| 681 | } |
| 682 | |
| 683 | func (c *Client) PostLogSource(ctx context.Context, req PostLogSourceRequest) (codersdk.WorkspaceAgentLogSource, error) { |
| 684 | res, err := c.SDK.Request(ctx, http.MethodPost, "/api/v2/workspaceagents/me/log-source", req) |
| 685 | if err != nil { |
| 686 | return codersdk.WorkspaceAgentLogSource{}, err |
| 687 | } |
| 688 | defer res.Body.Close() |
| 689 | if res.StatusCode != http.StatusCreated { |
| 690 | return codersdk.WorkspaceAgentLogSource{}, codersdk.ReadBodyAsError(res) |
| 691 | } |
| 692 | var logSource codersdk.WorkspaceAgentLogSource |
| 693 | return logSource, json.NewDecoder(res.Body).Decode(&logSource) |
| 694 | } |
| 695 | |
| 696 | type ExternalAuthResponse struct { |
| 697 | AccessToken string `json:"access_token"` |