diff --git a/mockhttp.go b/mockhttp.go index 86a3dc8..dd8d964 100644 --- a/mockhttp.go +++ b/mockhttp.go @@ -11,7 +11,7 @@ import ( var endpointResponseExamples = map[string]map[string]mockResponse{ "/api_keys": { "GET": mockResponse{ - Content: `[{"created_at":"2022-11-15T20:13:35Z","created_by":"629982cc-de05-43db-ae16-28f2399c4910","id":165432,"last_used_at":"2022-11-15T20:22:51Z","last_used_from_addr":"192.0.2.255","name":"mykey_1"},{"created_at":"2022-11-15T20:12:36Z","created_by":"629982cc-de05-43db-ae16-28f2399c4910","id":165433,"last_used_at":"2022-11-15T20:15:04Z","last_used_from_addr":"192.0.2.255","name":"mykey_2"}]`, + Content: `[{"created_at":"2022-11-15T20:13:35Z","created_by":{"id":"629982cc-de05-43db-ae16-28f2399c4910","image":"http://link.to.image","name":"John Smith"},"id":165432,"last_used_at":"2022-11-15T20:22:51Z","last_used_from_addr":"192.0.2.255","name":"mykey_1"},{"created_at":"2022-11-15T20:12:36Z","created_by":{"id":"629982cc-de05-43db-ae16-28f2399c4910","image":"http://link.to.image","name":"John Smith"},"id":165433,"last_used_at":"2022-11-15T20:15:04Z","last_used_from_addr":"192.0.2.255","name":"mykey_2"}]`, Code: 200, }, "POST": mockResponse{ diff --git a/openAPIDefinition.json b/openAPIDefinition.json index 7fb2c5b..9b0daef 100644 --- a/openAPIDefinition.json +++ b/openAPIDefinition.json @@ -85,7 +85,11 @@ "id": 165432, "name": "mykey_1", "created_at": "2022-11-15T20:13:35Z", - "created_by": "629982cc-de05-43db-ae16-28f2399c4910", + "created_by": { + "id": "629982cc-de05-43db-ae16-28f2399c4910", + "name": "John Smith", + "image": "http://link.to.image" + }, "last_used_at": "2022-11-15T20:22:51Z", "last_used_from_addr": "192.0.2.255" }, @@ -93,7 +97,11 @@ "id": 165433, "name": "mykey_2", "created_at": "2022-11-15T20:12:36Z", - "created_by": "629982cc-de05-43db-ae16-28f2399c4910", + "created_by": { + "id": "629982cc-de05-43db-ae16-28f2399c4910", + "name": "John Smith", + "image": "http://link.to.image" + }, "last_used_at": "2022-11-15T20:15:04Z", "last_used_from_addr": "192.0.2.255" } @@ -3956,9 +3964,7 @@ "format": "date-time" }, "created_by": { - "description": "ID of the user who created this API key", - "type": "string", - "format": "uuid" + "$ref": "#/components/schemas/ApiKeyCreatorData" }, "last_used_at": { "description": "A timestamp indicating when the API was last used", @@ -3972,6 +3978,30 @@ } } }, + "ApiKeyCreatorData": { + "description": "The user data of the user that created this API key.", + "type": "object", + "required": [ + "id", + "name", + "image" + ], + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "ID of the user who created this API key" + }, + "name": { + "type": "string", + "description": "The name of the user." + }, + "image": { + "type": "string", + "description": "The URL to the user's avatar image." + } + } + }, "Operation": { "type": "object", "required": [ diff --git a/sdk.go b/sdk.go index 51a8dde..4ec5762 100644 --- a/sdk.go +++ b/sdk.go @@ -929,6 +929,16 @@ type ApiKeyCreateResponse struct { Name string `json:"name"` } +// ApiKeyCreatorData The user data of the user that created this API key. +type ApiKeyCreatorData struct { + // ID of the user who created this API key + ID string `json:"id"` + // Image The URL to the user's avatar image. + Image string `json:"image"` + // Name The name of the user. + Name string `json:"name"` +} + type ApiKeyRevokeResponse struct { // CreatedAt A timestamp indicating when the API key was created CreatedAt time.Time `json:"created_at"` @@ -948,9 +958,8 @@ type ApiKeyRevokeResponse struct { type ApiKeysListResponseItem struct { // CreatedAt A timestamp indicating when the API key was created - CreatedAt time.Time `json:"created_at"` - // CreatedBy ID of the user who created this API key - CreatedBy string `json:"created_by"` + CreatedAt time.Time `json:"created_at"` + CreatedBy ApiKeyCreatorData `json:"created_by"` // ID The API key ID ID int64 `json:"id"` // LastUsedAt A timestamp indicating when the API was last used