From ffe150f03c5e20511f1c54358ce5db1c346183f4 Mon Sep 17 00:00:00 2001 From: cq-bot Date: Mon, 23 Oct 2023 12:59:53 +0000 Subject: [PATCH] fix: Generate CloudQuery Go API Client from `spec.json` --- client.gen.go | 8 ++++++++ models.gen.go | 3 +++ spec.json | 11 ++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/client.gen.go b/client.gen.go index 726b20b..9be7269 100644 --- a/client.gen.go +++ b/client.gen.go @@ -6046,6 +6046,7 @@ type ListTeamAPIKeysResponse struct { Metadata ListMetadata `json:"metadata"` } JSON401 *RequiresAuthentication + JSON404 *NotFound JSON500 *InternalError } @@ -9359,6 +9360,13 @@ func ParseListTeamAPIKeysResponse(rsp *http.Response) (*ListTeamAPIKeysResponse, } response.JSON401 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError if err := json.Unmarshal(bodyBytes, &dest); err != nil { diff --git a/models.gen.go b/models.gen.go index ebc7e51..e7a5706 100644 --- a/models.gen.go +++ b/models.gen.go @@ -135,6 +135,9 @@ type APIKey struct { CreatedAt *time.Time `json:"created_at,omitempty"` CreatedBy *Email `json:"created_by,omitempty"` + // Expired Whether the API key has expired or not + Expired bool `json:"expired"` + // ExpiresAt Timestamp at which API key will stop working ExpiresAt time.Time `json:"expires_at"` diff --git a/spec.json b/spec.json index bb3074c..ffc88c5 100644 --- a/spec.json +++ b/spec.json @@ -3223,6 +3223,9 @@ "401": { "$ref": "#/components/responses/RequiresAuthentication" }, + "404": { + "$ref": "#/components/responses/NotFound" + }, "500": { "$ref": "#/components/responses/InternalError" } @@ -4786,7 +4789,8 @@ "required": [ "name", "scope", - "expires_at" + "expires_at", + "expired" ], "properties": { "name": { @@ -4812,6 +4816,11 @@ "format": "date-time", "example": "2017-07-14T16:53:42Z" }, + "expired": { + "type": "boolean", + "description": "Whether the API key has expired or not", + "example": false + }, "scope": { "$ref": "#/components/schemas/APIKeyScope" }