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

Method CreateChatProvider

codersdk/chats.go:2111–2123  ·  view source on GitHub ↗

CreateChatProvider creates an admin-managed chat provider config.

(ctx context.Context, req CreateChatProviderConfigRequest)

Source from the content-addressed store, hash-verified

2109
2110// CreateChatProvider creates an admin-managed chat provider config.
2111func (c *ExperimentalClient) CreateChatProvider(ctx context.Context, req CreateChatProviderConfigRequest) (ChatProviderConfig, error) {
2112 res, err := c.Request(ctx, http.MethodPost, "/api/experimental/chats/providers", req)
2113 if err != nil {
2114 return ChatProviderConfig{}, err
2115 }
2116 defer res.Body.Close()
2117 if res.StatusCode != http.StatusCreated {
2118 return ChatProviderConfig{}, ReadBodyAsError(res)
2119 }
2120
2121 var provider ChatProviderConfig
2122 return provider, json.NewDecoder(res.Body).Decode(&provider)
2123}
2124
2125// UpdateChatProvider updates an admin-managed chat provider config.
2126func (c *ExperimentalClient) UpdateChatProvider(ctx context.Context, providerID uuid.UUID, req UpdateChatProviderConfigRequest) (ChatProviderConfig, error) {

Callers 6

TestCreateChatProviderFunction · 0.95
TestListChatProvidersFunction · 0.80
TestUpdateChatProviderFunction · 0.80
ensureScaletestProviderFunction · 0.80

Calls 3

ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
RequestMethod · 0.45

Tested by 5

TestCreateChatProviderFunction · 0.76
TestListChatProvidersFunction · 0.64
TestUpdateChatProviderFunction · 0.64