PostOrganizationMember adds a user to an organization
(ctx context.Context, organizationID uuid.UUID, user string)
| 709 | |
| 710 | // PostOrganizationMember adds a user to an organization |
| 711 | func (c *Client) PostOrganizationMember(ctx context.Context, organizationID uuid.UUID, user string) (OrganizationMember, error) { |
| 712 | res, err := c.Request(ctx, http.MethodPost, fmt.Sprintf("/api/v2/organizations/%s/members/%s", organizationID, user), nil) |
| 713 | if err != nil { |
| 714 | return OrganizationMember{}, err |
| 715 | } |
| 716 | defer res.Body.Close() |
| 717 | if res.StatusCode != http.StatusOK { |
| 718 | return OrganizationMember{}, ReadBodyAsError(res) |
| 719 | } |
| 720 | var member OrganizationMember |
| 721 | return member, json.NewDecoder(res.Body).Decode(&member) |
| 722 | } |
| 723 | |
| 724 | // DeleteOrganizationMember removes a user from an organization |
| 725 | func (c *Client) DeleteOrganizationMember(ctx context.Context, organizationID uuid.UUID, user string) error { |