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)
| 3442 | // non-archived chat ID for each requested workspace. Workspaces with |
| 3443 | // no chats are omitted from the response. |
| 3444 | func (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. |
| 3462 | type PRInsightsResponse struct { |