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

Method GetChatFile

codersdk/chats.go:3297–3311  ·  view source on GitHub ↗

GetChatFile retrieves a previously uploaded chat file by ID.

(ctx context.Context, fileID uuid.UUID)

Source from the content-addressed store, hash-verified

3295
3296// GetChatFile retrieves a previously uploaded chat file by ID.
3297func (c *ExperimentalClient) GetChatFile(ctx context.Context, fileID uuid.UUID) ([]byte, string, error) {
3298 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/experimental/chats/files/%s", fileID), nil)
3299 if err != nil {
3300 return nil, "", err
3301 }
3302 defer res.Body.Close()
3303 if res.StatusCode != http.StatusOK {
3304 return nil, "", ReadBodyAsError(res)
3305 }
3306 data, err := io.ReadAll(res.Body)
3307 if err != nil {
3308 return nil, "", err
3309 }
3310 return data, res.Header.Get("Content-Type"), nil
3311}
3312
3313// GetChatUsageLimitConfig returns the deployment-wide chat usage limit config.
3314func (c *ExperimentalClient) GetChatUsageLimitConfig(ctx context.Context) (ChatUsageLimitConfigResponse, error) {

Callers 3

TestGetChatFileFunction · 0.95
TestPostChatFileFunction · 0.80

Calls 5

ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
GetMethod · 0.65
RequestMethod · 0.45
ReadAllMethod · 0.45

Tested by 3

TestGetChatFileFunction · 0.76
TestPostChatFileFunction · 0.64