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

Method CreateChat

codersdk/chats.go:2806–2817  ·  view source on GitHub ↗

CreateChat creates a new chat.

(ctx context.Context, req CreateChatRequest)

Source from the content-addressed store, hash-verified

2804
2805// CreateChat creates a new chat.
2806func (c *ExperimentalClient) CreateChat(ctx context.Context, req CreateChatRequest) (Chat, error) {
2807 res, err := c.Request(ctx, http.MethodPost, "/api/experimental/chats", req)
2808 if err != nil {
2809 return Chat{}, err
2810 }
2811 if res.StatusCode != http.StatusCreated {
2812 return Chat{}, readBodyAsChatUsageLimitError(res)
2813 }
2814 defer res.Body.Close()
2815 var chat Chat
2816 return chat, json.NewDecoder(res.Body).Decode(&chat)
2817}
2818
2819// StreamChatOptions are optional parameters for StreamChat.
2820type StreamChatOptions struct {

Callers 15

TestPostChatsFunction · 0.95
TestPostChats_ClientTypeFunction · 0.95
TestWatchChatsFunction · 0.95
TestPatchChatFunction · 0.95
TestRegenerateChatTitleFunction · 0.95
TestProposeChatTitleFunction · 0.95
TestGetChatDiffStatusFunction · 0.95
TestGetChatDiffContentsFunction · 0.95
TestChatSystemPromptFunction · 0.95
TestChatWithMCPServerIDsFunction · 0.95

Calls 3

CloseMethod · 0.65
RequestMethod · 0.45

Tested by 15

TestPostChatsFunction · 0.76
TestPostChats_ClientTypeFunction · 0.76
TestWatchChatsFunction · 0.76
TestPatchChatFunction · 0.76
TestRegenerateChatTitleFunction · 0.76
TestProposeChatTitleFunction · 0.76
TestGetChatDiffStatusFunction · 0.76
TestGetChatDiffContentsFunction · 0.76
TestChatSystemPromptFunction · 0.76
TestChatWithMCPServerIDsFunction · 0.76