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

Method WorkspaceSharingSettings

codersdk/workspacesharing.go:48–60  ·  view source on GitHub ↗

WorkspaceSharingSettings retrieves the workspace sharing settings for an organization.

(ctx context.Context, orgID string)

Source from the content-addressed store, hash-verified

46
47// WorkspaceSharingSettings retrieves the workspace sharing settings for an organization.
48func (c *Client) WorkspaceSharingSettings(ctx context.Context, orgID string) (WorkspaceSharingSettings, error) {
49 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/organizations/%s/settings/workspace-sharing", orgID), nil)
50 if err != nil {
51 return WorkspaceSharingSettings{}, err
52 }
53 defer res.Body.Close()
54
55 if res.StatusCode != http.StatusOK {
56 return WorkspaceSharingSettings{}, ReadBodyAsError(res)
57 }
58 var resp WorkspaceSharingSettings
59 return resp, json.NewDecoder(res.Body).Decode(&resp)
60}
61
62// PatchWorkspaceSharingSettings modifies the workspace sharing settings for an organization.
63func (c *Client) PatchWorkspaceSharingSettings(ctx context.Context, orgID string, req UpdateWorkspaceSharingSettingsRequest) (WorkspaceSharingSettings, error) {

Callers 2

organizationSettingsMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 1