Skip to content

Commit

Permalink
Add GetParams for /organizations/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Sep 19, 2024
1 parent ff233cb commit 86fdaa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion organization/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,20 @@ func (c *Client) Create(ctx context.Context, params *CreateParams) (*clerk.Organ
return organization, err
}

type GetParams struct {
clerk.APIParams
IncludeMembersCount *bool `json:"include_members_count,omitempty"`
}

// Get retrieves details for an organization.
// The organization can be fetched by either the ID or its slug.
func (c *Client) Get(ctx context.Context, idOrSlug string) (*clerk.Organization, error) {
func (c *Client) Get(ctx context.Context, idOrSlug string, params *GetParams) (*clerk.Organization, error) {
path, err := clerk.JoinPath(path, idOrSlug)
if err != nil {
return nil, err
}
req := clerk.NewAPIRequest(http.MethodGet, path)
req.SetParams(params)
organization := &clerk.Organization{}
err = c.Backend.Call(ctx, req, organization)
return organization, err
Expand Down
2 changes: 1 addition & 1 deletion organization/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestOrganizationClientGet(t *testing.T) {
},
}
client := NewClient(config)
organization, err := client.Get(context.Background(), id)
organization, err := client.Get(context.Background(), id, &GetParams{})
require.NoError(t, err)
require.Equal(t, id, organization.ID)
require.Equal(t, name, organization.Name)
Expand Down

0 comments on commit 86fdaa9

Please sign in to comment.