| 117 | } |
| 118 | |
| 119 | func (c *Client) RoleIDPSyncSettings(ctx context.Context, orgID string) (RoleSyncSettings, error) { |
| 120 | res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/organizations/%s/settings/idpsync/roles", orgID), nil) |
| 121 | if err != nil { |
| 122 | return RoleSyncSettings{}, xerrors.Errorf("make request: %w", err) |
| 123 | } |
| 124 | defer res.Body.Close() |
| 125 | |
| 126 | if res.StatusCode != http.StatusOK { |
| 127 | return RoleSyncSettings{}, ReadBodyAsError(res) |
| 128 | } |
| 129 | var resp RoleSyncSettings |
| 130 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 131 | } |
| 132 | |
| 133 | func (c *Client) PatchRoleIDPSyncSettings(ctx context.Context, orgID string, req RoleSyncSettings) (RoleSyncSettings, error) { |
| 134 | res, err := c.Request(ctx, http.MethodPatch, fmt.Sprintf("/api/v2/organizations/%s/settings/idpsync/roles", orgID), req) |