MCPcopy Index your code
hub / github.com/coder/coder / Organizations

Method Organizations

codersdk/organizations.go:265–278  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

263}
264
265func (c *Client) Organizations(ctx context.Context) ([]Organization, error) {
266 res, err := c.Request(ctx, http.MethodGet, "/api/v2/organizations", nil)
267 if err != nil {
268 return []Organization{}, xerrors.Errorf("execute request: %w", err)
269 }
270 defer res.Body.Close()
271
272 if res.StatusCode != http.StatusOK {
273 return []Organization{}, ReadBodyAsError(res)
274 }
275
276 var organizations []Organization
277 return organizations, json.NewDecoder(res.Body).Decode(&organizations)
278}
279
280func (c *Client) Organization(ctx context.Context, id uuid.UUID) (Organization, error) {
281 // OrganizationByName uses the exact same endpoint. It accepts a name or uuid.

Callers 2

listOrganizationsMethod · 0.80
TestMultiOrgFetchFunction · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
ErrorfMethod · 0.45

Tested by 1

TestMultiOrgFetchFunction · 0.64