feat: add create shortcut api

This commit is contained in:
Steven
2023-08-09 23:31:52 +08:00
parent e936aaced1
commit 1194099667
19 changed files with 864 additions and 62 deletions

View File

@ -9,6 +9,7 @@ import "google/api/client.proto";
option go_package = "gen/api/v2";
service ShortcutService {
// ListShortcuts returns a list of shortcuts.
rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
option (google.api.http) = {get: "/api/v2/shortcuts"};
}
@ -17,6 +18,13 @@ service ShortcutService {
option (google.api.http) = {get: "/api/v2/shortcuts/{name}"};
option (google.api.method_signature) = "name";
}
// CreateShortcut creates a shortcut.
rpc CreateShortcut(CreateShortcutRequest) returns (CreateShortcutResponse) {
option (google.api.http) = {
post: "/api/v2/shortcuts"
body: "shortcut"
};
}
}
message Shortcut {
@ -76,3 +84,11 @@ message GetShortcutRequest {
message GetShortcutResponse {
Shortcut shortcut = 1;
}
message CreateShortcutRequest {
Shortcut shortcut = 1;
}
message CreateShortcutResponse {
Shortcut shortcut = 1;
}

View File

@ -15,6 +15,7 @@ service UserService {
option (google.api.http) = {get: "/api/v2/users/{id}"};
option (google.api.method_signature) = "id";
}
// CreateUser creates a new user.
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
option (google.api.http) = {
post: "/api/v2/users"