Skip to content

Commit

Permalink
api: Fix bookmarks creation endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansmares committed Apr 29, 2024
1 parent 43a0e72 commit c480c24
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 121 deletions.
2 changes: 1 addition & 1 deletion api/ttn/lorawan/v3/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11175,7 +11175,7 @@ API keys of users.

| Method Name | Method | Pattern | Body |
| ----------- | ------ | ------- | ---- |
| `Create` | `POST` | `/api/v3/users/bookmarks` | `*` |
| `Create` | `POST` | `/api/v3/users/{user_ids.user_id}/bookmarks` | `*` |
| `List` | `GET` | `/api/v3/users/{user_ids.user_id}/bookmarks` | |
| `Delete` | `DELETE` | `/api/v3/users/{user_ids.user_id}/bookmarks/applications/{entity_ids.application_ids.application_id}` | |
| `Delete` | `DELETE` | `/api/v3/users/{user_ids.user_id}/bookmarks/clients/{entity_ids.client_ids.client_id}` | |
Expand Down
99 changes: 55 additions & 44 deletions api/ttn/lorawan/v3/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12704,39 +12704,6 @@
]
}
},
"/users/bookmarks": {
"post": {
"summary": "Create a bookmark for the given user.",
"operationId": "UserBookmarkRegistry_Create",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v3UserBookmark"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v3CreateUserBookmarkRequest"
}
}
],
"tags": [
"UserBookmarkRegistry"
]
}
},
"/users/{collaborator.user_ids.user_id}/applications": {
"get": {
"summary": "List applications where the given user or organization is a direct collaborator.\nIf no user or organization is given, this returns the applications the caller\nhas access to.\nSimilar to Get, this selects the fields given by the field mask.\nMore or less fields may be returned, depending on the rights of the caller.",
Expand Down Expand Up @@ -13960,6 +13927,44 @@
"tags": [
"UserBookmarkRegistry"
]
},
"post": {
"summary": "Create a bookmark for the given user.",
"operationId": "UserBookmarkRegistry_Create",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v3UserBookmark"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "user_ids.user_id",
"description": "This ID shares namespace with organization IDs.",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v3UserBookmarkRegistryCreateBody"
}
}
],
"tags": [
"UserBookmarkRegistry"
]
}
},
"/users/{user_ids.user_id}/bookmarks/applications/{entity_ids.application_ids.application_id}": {
Expand Down Expand Up @@ -21013,17 +21018,6 @@
}
}
},
"v3CreateUserBookmarkRequest": {
"type": "object",
"properties": {
"user_ids": {
"$ref": "#/definitions/v3UserIdentifiers"
},
"entity_ids": {
"$ref": "#/definitions/v3EntityIdentifiers"
}
}
},
"v3CreateUserRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -27274,6 +27268,23 @@
}
}
},
"v3UserBookmarkRegistryCreateBody": {
"type": "object",
"properties": {
"user_ids": {
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "Secondary identifier, which can only be used in specific requests."
}
}
},
"entity_ids": {
"$ref": "#/definitions/v3EntityIdentifiers"
}
}
},
"v3UserBookmarks": {
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion api/ttn/lorawan/v3/user_services.proto
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ service UserBookmarkRegistry {
// Create a bookmark for the given user.
rpc Create(CreateUserBookmarkRequest) returns (UserBookmark) {
option (google.api.http) = {
post: "/users/bookmarks"
post: "/users/{user_ids.user_id}/bookmarks"
body: "*"
};
}
Expand Down
140 changes: 71 additions & 69 deletions pkg/ttnpb/user_services.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c480c24

Please sign in to comment.