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

Method OrganizationByName

codersdk/organizations.go:250–263  ·  view source on GitHub ↗
(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

248}
249
250func (c *Client) OrganizationByName(ctx context.Context, name string) (Organization, error) {
251 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/organizations/%s", name), nil)
252 if err != nil {
253 return Organization{}, xerrors.Errorf("execute request: %w", err)
254 }
255 defer res.Body.Close()
256
257 if res.StatusCode != http.StatusOK {
258 return Organization{}, ReadBodyAsError(res)
259 }
260
261 var organization Organization
262 return organization, json.NewDecoder(res.Body).Decode(&organization)
263}
264
265func (c *Client) Organizations(ctx context.Context) ([]Organization, error) {
266 res, err := c.Request(ctx, http.MethodGet, "/api/v2/organizations", nil)

Callers 10

OrganizationMethod · 0.95
deleteOrganizationMethod · 0.80
showOrganizationMethod · 0.80
SelectedMethod · 0.80
createOrganizationMethod · 0.80
resolveTemplateIDFunction · 0.80
setupFirstUserFunction · 0.80
setupMultiOrgFunction · 0.80
createTemplateInOrgFunction · 0.80
verifyQuotaUserFunction · 0.80

Calls 4

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

Tested by 1

verifyQuotaUserFunction · 0.64