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

Method GetChatsByWorkspace

codersdk/chats.go:3444–3459  ·  view source on GitHub ↗

GetChatsByWorkspace returns a mapping of workspace ID to the latest non-archived chat ID for each requested workspace. Workspaces with no chats are omitted from the response.

(ctx context.Context, workspaceIDs []uuid.UUID)

Source from the content-addressed store, hash-verified

3442// non-archived chat ID for each requested workspace. Workspaces with
3443// no chats are omitted from the response.
3444func (c *ExperimentalClient) GetChatsByWorkspace(ctx context.Context, workspaceIDs []uuid.UUID) (map[uuid.UUID]uuid.UUID, error) {
3445 ids := make([]string, 0, len(workspaceIDs))
3446 for _, id := range workspaceIDs {
3447 ids = append(ids, id.String())
3448 }
3449 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/experimental/chats/by-workspace?workspace_ids=%s", strings.Join(ids, ",")), nil)
3450 if err != nil {
3451 return nil, err
3452 }
3453 defer res.Body.Close()
3454 if res.StatusCode != http.StatusOK {
3455 return nil, ReadBodyAsError(res)
3456 }
3457 var result map[uuid.UUID]uuid.UUID
3458 return result, json.NewDecoder(res.Body).Decode(&result)
3459}
3460
3461// PRInsightsResponse is the response from the PR insights endpoint.
3462type PRInsightsResponse struct {

Callers 1

TestGetChatsByWorkspaceFunction · 0.80

Calls 4

ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45
RequestMethod · 0.45

Tested by 1

TestGetChatsByWorkspaceFunction · 0.64