ListUserAIProviderKeyConfigs returns user-scoped AI provider key configs.
(ctx context.Context, user string)
| 2152 | |
| 2153 | // ListUserAIProviderKeyConfigs returns user-scoped AI provider key configs. |
| 2154 | func (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. |
| 2168 | func (c *ExperimentalClient) UpsertUserAIProviderKey(ctx context.Context, user string, providerID uuid.UUID, req CreateUserAIProviderKeyRequest) (UserAIProviderKeyConfig, error) { |