chore: add shortcut space routes

This commit is contained in:
Steven
2023-12-17 23:27:01 +08:00
parent 43cda4e2fb
commit fb7fc2443f
21 changed files with 647 additions and 493 deletions

View File

@ -15,11 +15,13 @@ service ShortcutService {
rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
option (google.api.http) = {get: "/api/v2/shortcuts"};
}
// GetShortcut returns a shortcut by id.
// GetShortcut returns a shortcut by name.
rpc GetShortcut(GetShortcutRequest) returns (GetShortcutResponse) {
option (google.api.http) = {get: "/api/v2/shortcuts/{id}"};
option (google.api.method_signature) = "id";
option (google.api.http) = {get: "/api/v2/shortcuts/{name}"};
option (google.api.method_signature) = "name";
}
// GetShortcutById returns a shortcut by id.
rpc GetShortcutById(GetShortcutByIdRequest) returns (GetShortcutByIdResponse) {}
// CreateShortcut creates a shortcut.
rpc CreateShortcut(CreateShortcutRequest) returns (CreateShortcutResponse) {
option (google.api.http) = {
@ -30,20 +32,20 @@ service ShortcutService {
// UpdateShortcut updates a shortcut.
rpc UpdateShortcut(UpdateShortcutRequest) returns (UpdateShortcutResponse) {
option (google.api.http) = {
put: "/api/v2/shortcuts/{shortcut.id}"
put: "/api/v2/shortcuts/{shortcut.name}"
body: "shortcut"
};
option (google.api.method_signature) = "shortcut,update_mask";
}
// DeleteShortcut deletes a shortcut by id.
// DeleteShortcut deletes a shortcut by name.
rpc DeleteShortcut(DeleteShortcutRequest) returns (DeleteShortcutResponse) {
option (google.api.http) = {delete: "/api/v2/shortcuts/{id}"};
option (google.api.method_signature) = "id";
option (google.api.http) = {delete: "/api/v2/shortcuts/{name}"};
option (google.api.method_signature) = "name";
}
// GetShortcutAnalytics returns the analytics for a shortcut.
rpc GetShortcutAnalytics(GetShortcutAnalyticsRequest) returns (GetShortcutAnalyticsResponse) {
option (google.api.http) = {get: "/api/v2/shortcuts/{id}/analytics"};
option (google.api.method_signature) = "id";
option (google.api.http) = {get: "/api/v2/shortcuts/{name}/analytics"};
option (google.api.method_signature) = "name";
}
}
@ -90,13 +92,21 @@ message ListShortcutsResponse {
}
message GetShortcutRequest {
int32 id = 1;
string name = 1;
}
message GetShortcutResponse {
Shortcut shortcut = 1;
}
message GetShortcutByIdRequest {
int32 id = 1;
}
message GetShortcutByIdResponse {
Shortcut shortcut = 1;
}
message CreateShortcutRequest {
Shortcut shortcut = 1;
}
@ -116,13 +126,13 @@ message UpdateShortcutResponse {
}
message DeleteShortcutRequest {
int32 id = 1;
string name = 1;
}
message DeleteShortcutResponse {}
message GetShortcutAnalyticsRequest {
int32 id = 1;
string name = 1;
}
message GetShortcutAnalyticsResponse {