Skip to content

Commit

Permalink
feat: auto-updated SDK (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Oct 26, 2024
1 parent bda0f3c commit edad27a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mockhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
40 changes: 35 additions & 5 deletions openAPIDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,23 @@
"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"
},
{
"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"
}
Expand Down Expand Up @@ -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",
Expand All @@ -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": [
Expand Down
15 changes: 12 additions & 3 deletions sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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
Expand Down

0 comments on commit edad27a

Please sign in to comment.