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

Method GetTokenConfig

codersdk/apikey.go:194–205  ·  view source on GitHub ↗

GetTokenConfig returns deployment options related to token management

(ctx context.Context, userID string)

Source from the content-addressed store, hash-verified

192
193// GetTokenConfig returns deployment options related to token management
194func (c *Client) GetTokenConfig(ctx context.Context, userID string) (TokenConfig, error) {
195 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/users/%s/keys/tokens/tokenconfig", userID), nil)
196 if err != nil {
197 return TokenConfig{}, err
198 }
199 defer res.Body.Close()
200 if res.StatusCode > http.StatusOK {
201 return TokenConfig{}, ReadBodyAsError(res)
202 }
203 tokenConfig := TokenConfig{}
204 return tokenConfig, json.NewDecoder(res.Body).Decode(&tokenConfig)
205}

Callers 1

createTokenMethod · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected