| 532 | } |
| 533 | |
| 534 | func (c *Client) CryptoKeys(ctx context.Context, feature codersdk.CryptoKeyFeature) (CryptoKeysResponse, error) { |
| 535 | res, err := c.Request(ctx, http.MethodGet, |
| 536 | "/api/v2/workspaceproxies/me/crypto-keys", nil, |
| 537 | codersdk.WithQueryParam("feature", string(feature)), |
| 538 | ) |
| 539 | if err != nil { |
| 540 | return CryptoKeysResponse{}, xerrors.Errorf("make request: %w", err) |
| 541 | } |
| 542 | defer res.Body.Close() |
| 543 | |
| 544 | if res.StatusCode != http.StatusOK { |
| 545 | return CryptoKeysResponse{}, codersdk.ReadBodyAsError(res) |
| 546 | } |
| 547 | var resp CryptoKeysResponse |
| 548 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 549 | } |