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

Method DeleteUserAIProviderKey

codersdk/chats.go:2182–2192  ·  view source on GitHub ↗

DeleteUserAIProviderKey deletes a user API key for an AI provider.

(ctx context.Context, user string, providerID uuid.UUID)

Source from the content-addressed store, hash-verified

2180
2181// DeleteUserAIProviderKey deletes a user API key for an AI provider.
2182func (c *ExperimentalClient) DeleteUserAIProviderKey(ctx context.Context, user string, providerID uuid.UUID) error {
2183 res, err := c.Request(ctx, http.MethodDelete, fmt.Sprintf("%s/%s", userAIProviderKeysPath(user), providerID), nil)
2184 if err != nil {
2185 return xerrors.Errorf("delete user AI provider key: %w", err)
2186 }
2187 defer res.Body.Close()
2188 if res.StatusCode != http.StatusNoContent {
2189 return ReadBodyAsError(res)
2190 }
2191 return nil
2192}
2193
2194func userAIProviderKeysPath(user string) string {
2195 return fmt.Sprintf("/api/experimental/users/%s/ai-provider-keys", url.PathEscape(user))

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