feat: implement shortcuts

This commit is contained in:
johnnyjoy
2025-02-02 17:11:52 +08:00
parent b9a0c56163
commit 14c72fa7df
9 changed files with 1740 additions and 216 deletions

View File

@@ -94,6 +94,32 @@ service UserService {
option (google.api.http) = {delete: "/api/v1/{name=users/*}/access_tokens/{access_token}"};
option (google.api.method_signature) = "name,access_token";
}
// ListShortcuts returns a list of shortcuts for a user.
rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
option (google.api.http) = {get: "/api/v1/{parent=users/*}/shortcuts"};
option (google.api.method_signature) = "parent";
}
// CreateShortcut creates a new shortcut for a user.
rpc CreateShortcut(CreateShortcutRequest) returns (Shortcut) {
option (google.api.http) = {
post: "/api/v1/{parent=users/*}/shortcuts"
body: "shortcut"
};
option (google.api.method_signature) = "parent,shortcut";
}
// UpdateShortcut updates a shortcut for a user.
rpc UpdateShortcut(UpdateShortcutRequest) returns (Shortcut) {
option (google.api.http) = {
patch: "/api/v1/{parent=users/*}/shortcuts/{shortcut.id}"
body: "shortcut"
};
option (google.api.method_signature) = "parent,shortcut,update_mask";
}
// DeleteShortcut deletes a shortcut for a user.
rpc DeleteShortcut(DeleteShortcutRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {delete: "/api/v1/{parent=users/*}/shortcuts/{id}"};
option (google.api.method_signature) = "parent,id";
}
}
message User {
@@ -254,3 +280,42 @@ message DeleteUserAccessTokenRequest {
// access_token is the access token to delete.
string access_token = 2;
}
message Shortcut {
string id = 1;
string title = 2;
string filter = 3;
}
message ListShortcutsRequest {
// The name of the user.
string parent = 1;
}
message ListShortcutsResponse {
repeated Shortcut shortcuts = 1;
}
message CreateShortcutRequest {
// The name of the user.
string parent = 1;
Shortcut shortcut = 2;
}
message UpdateShortcutRequest {
// The name of the user.
string parent = 1;
Shortcut shortcut = 2;
google.protobuf.FieldMask update_mask = 3;
}
message DeleteShortcutRequest {
// The name of the user.
string parent = 1;
// The id of the shortcut.
string id = 2;
}