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

Method ListUserAIProviderKeyConfigs

codersdk/chats.go:2154–2165  ·  view source on GitHub ↗

ListUserAIProviderKeyConfigs returns user-scoped AI provider key configs.

(ctx context.Context, user string)

Source from the content-addressed store, hash-verified

2152
2153// ListUserAIProviderKeyConfigs returns user-scoped AI provider key configs.
2154func (c *ExperimentalClient) ListUserAIProviderKeyConfigs(ctx context.Context, user string) ([]UserAIProviderKeyConfig, error) {
2155 res, err := c.Request(ctx, http.MethodGet, userAIProviderKeysPath(user), nil)
2156 if err != nil {
2157 return nil, xerrors.Errorf("list user AI provider key configs: %w", err)
2158 }
2159 defer res.Body.Close()
2160 if res.StatusCode != http.StatusOK {
2161 return nil, ReadBodyAsError(res)
2162 }
2163 var configs []UserAIProviderKeyConfig
2164 return configs, json.NewDecoder(res.Body).Decode(&configs)
2165}
2166
2167// UpsertUserAIProviderKey creates or replaces a user API key for an AI provider.
2168func (c *ExperimentalClient) UpsertUserAIProviderKey(ctx context.Context, user string, providerID uuid.UUID, req CreateUserAIProviderKeyRequest) (UserAIProviderKeyConfig, error) {

Callers 1

TestUserAIProviderKeysFunction · 0.95

Calls 5

ReadBodyAsErrorFunction · 0.85
userAIProviderKeysPathFunction · 0.70
CloseMethod · 0.65
RequestMethod · 0.45
ErrorfMethod · 0.45

Tested by 1

TestUserAIProviderKeysFunction · 0.76