CreateOrganization creates an organization and adds the user making the request as an owner.
(ctx context.Context, req CreateOrganizationRequest)
| 285 | |
| 286 | // CreateOrganization creates an organization and adds the user making the request as an owner. |
| 287 | func (c *Client) CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (Organization, error) { |
| 288 | res, err := c.Request(ctx, http.MethodPost, "/api/v2/organizations", req) |
| 289 | if err != nil { |
| 290 | return Organization{}, err |
| 291 | } |
| 292 | defer res.Body.Close() |
| 293 | |
| 294 | if res.StatusCode != http.StatusCreated { |
| 295 | return Organization{}, ReadBodyAsError(res) |
| 296 | } |
| 297 | |
| 298 | var org Organization |
| 299 | return org, json.NewDecoder(res.Body).Decode(&org) |
| 300 | } |
| 301 | |
| 302 | // UpdateOrganization will update information about the corresponding organization, based on |
| 303 | // the UUID/name provided as `orgID`. |