From 33de587b82c478fe0a1863c2d315f0609d0ffc72 Mon Sep 17 00:00:00 2001 From: MuZhou233 Date: Wed, 5 Mar 2025 23:29:41 +0800 Subject: [PATCH 1/3] tmp --- proto/librarian/sephirah/v1/angela.proto | 57 +++++++++++++ proto/librarian/sephirah/v1/base.proto | 49 +++++++++++ proto/librarian/sephirah/v1/binah.proto | 2 - proto/librarian/sephirah/v1/gebura.proto | 31 ------- proto/librarian/sephirah/v1/sentinel.proto | 51 ++++++++++++ proto/librarian/sephirah/v1/sephirah.proto | 92 ++------------------- proto/librarian/sephirah/v1/tiphereth.proto | 5 ++ 7 files changed, 168 insertions(+), 119 deletions(-) create mode 100644 proto/librarian/sephirah/v1/angela.proto create mode 100644 proto/librarian/sephirah/v1/sentinel.proto diff --git a/proto/librarian/sephirah/v1/angela.proto b/proto/librarian/sephirah/v1/angela.proto new file mode 100644 index 00000000..6a88f4f7 --- /dev/null +++ b/proto/librarian/sephirah/v1/angela.proto @@ -0,0 +1,57 @@ +syntax = "proto3"; + +package librarian.sephirah.v1; + +import "google/protobuf/timestamp.proto"; +import "librarian/sephirah/v1/binah.proto"; +import "librarian/sephirah/v1/chesed.proto"; +import "librarian/sephirah/v1/gebura.proto"; +import "librarian/sephirah/v1/hokma.proto"; +import "librarian/sephirah/v1/netzach.proto"; +import "librarian/sephirah/v1/tiphereth.proto"; +import "librarian/sephirah/v1/yesod.proto"; +import "librarian/v1/wellknown.proto"; +import "librarian/sephirah/v1/base.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +/* + * Angela provides the admin control interface + */ +service LibrarianAngelaService { + // Allow anonymous call, use accessToken to get complete information + rpc GetServerInformation(GetServerInformationRequest) returns (GetServerInformationResponse); + // `Tiphereth` Login via password and get two token + rpc GetToken(GetTokenRequest) returns (GetTokenResponse); + // `Tiphereth` Use valid refresh_token and get two new token, a refresh_token can only be used once + rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); + + // `Tiphereth` + rpc CreateUser(CreateUserRequest) returns (CreateUserResponse); + // `Tiphereth` + rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse); + // `Tiphereth` + rpc ListUsers(ListUsersRequest) returns (ListUsersResponse); + + // `Tiphereth` + rpc ListPorters(ListPortersRequest) returns (ListPortersResponse); + // `Tiphereth` + rpc UpdatePorterStatus(UpdatePorterStatusRequest) returns (UpdatePorterStatusResponse); + // `Tiphereth` + rpc ListPorterGroups(ListPorterGroupsRequest) returns (ListPorterGroupsResponse); + + // `Binah` + rpc SetFileCapacity(SetFileCapacityRequest) returns (SetFileCapacityResponse); + + // `Gebura` + rpc CreateAppInfo(CreateAppInfoRequest) returns (CreateAppInfoResponse); + // `Gebura` + rpc UpdateAppInfo(UpdateAppInfoRequest) returns (UpdateAppInfoResponse); + // `Gebura` Used to manage app info + rpc ListAppInfos(ListAppInfosRequest) returns (ListAppInfosResponse); + // `Gebura` Merge two app infos + rpc MergeAppInfos(MergeAppInfosRequest) returns (MergeAppInfosResponse); + // `Gebura` Pick one app info out from merged + rpc PickAppInfo(PickAppInfoRequest) returns (PickAppInfoResponse); +} \ No newline at end of file diff --git a/proto/librarian/sephirah/v1/base.proto b/proto/librarian/sephirah/v1/base.proto index 1c05ba6e..1dd8de0b 100644 --- a/proto/librarian/sephirah/v1/base.proto +++ b/proto/librarian/sephirah/v1/base.proto @@ -4,10 +4,59 @@ package librarian.sephirah.v1; import "google/protobuf/timestamp.proto"; import "librarian/v1/common.proto"; +import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; +message GetServerInformationRequest { + optional bool with_status_report = 1; +} +message GetServerInformationResponse { + // For manual inspection only, the client may display but should not parse the response. + ServerBinarySummary server_binary_summary = 1; + // For manual inspection only, the client may display but should not parse the response. + ServerProtocolSummary protocol_summary = 2; + // The time that server received the request, + // note that there is a transmission delay between server and client. + google.protobuf.Timestamp current_time = 3; + // Valid when accessToken is provided. + optional librarian.v1.FeatureSummary feature_summary = 4; + // For showing to user, customizable by server owner. + ServerInstanceSummary server_instance_summary = 5; + // Plain text status report for manual inspection. + // Content is specific to server implementation. + optional string status_report = 6; +} + +message ServerBinarySummary { + // Server source code address. + // *Should* be a valid http address. + string source_code_address = 1; + // Binary build version. + // The content *should* be a semantic version string similar to the one generated by `git describe`, + // but rely on the actual implementation of the server. + string build_version = 2; + // Binary build date. + // The content *should* be a date format that is human-readable. + string build_date = 3; +} + +message ServerProtocolSummary { + // Protocol version used by server. + // The content *must* be a semantic version string generated by `git describe`, + // and if the server is built for production, it *must* be a valid version tag. + string version = 1; +} + +message ServerInstanceSummary { + string name = 1; + string description = 2; + string website_url = 3; + string logo_url = 4; + string background_url = 5; +} + message FileMetadata { librarian.v1.InternalID id = 1; string name = 2; diff --git a/proto/librarian/sephirah/v1/binah.proto b/proto/librarian/sephirah/v1/binah.proto index e4c17065..37b5cfee 100644 --- a/proto/librarian/sephirah/v1/binah.proto +++ b/proto/librarian/sephirah/v1/binah.proto @@ -17,8 +17,6 @@ message SetFileCapacityRequest { message SetFileCapacityResponse {} message GetFileCapacityRequest { - // Only admin can get the file capacity of other users - optional librarian.v1.InternalID user_id = 1; FileType file_type = 2; } diff --git a/proto/librarian/sephirah/v1/gebura.proto b/proto/librarian/sephirah/v1/gebura.proto index de45095c..939b999b 100644 --- a/proto/librarian/sephirah/v1/gebura.proto +++ b/proto/librarian/sephirah/v1/gebura.proto @@ -157,37 +157,6 @@ message ListAppsResponse { repeated App apps = 2; } -message ReportSentinelInformationRequest { - repeated string hostnames = 1; - ServerScheme scheme = 2; - // valid when need_token is true - string get_token_url_path = 3; - string download_file_url_path = 4; - repeated SentinelLibrary libraries = 5; - message SentinelLibrary { - int64 id = 1; - string download_base_path = 2; - } - enum ServerScheme { - SERVER_SCHEME_UNSPECIFIED = 0; - SERVER_SCHEME_HTTP = 1; - SERVER_SCHEME_HTTPS = 2; - } -} - -message ReportSentinelInformationResponse {} - -message ReportAppBinariesRequest { - repeated SentinelAppBinary sentinel_app_binaries = 1; - message SentinelAppBinary { - AppBinary app_binary = 1; - int64 sentinel_library_id = 2; - string sentinel_generated_id = 3; - } -} - -message ReportAppBinariesResponse {} - message AssignAppRequest { // `internal` must be true librarian.v1.InternalID app_info_id = 1; diff --git a/proto/librarian/sephirah/v1/sentinel.proto b/proto/librarian/sephirah/v1/sentinel.proto new file mode 100644 index 00000000..1394101b --- /dev/null +++ b/proto/librarian/sephirah/v1/sentinel.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; + +package librarian.sephirah.v1; + +import "librarian/sephirah/v1/gebura.proto"; +import "librarian/sephirah/v1/tiphereth.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +service LibrarianSentinelService { + // `Tiphereth` Use valid refresh_token and get two new token, a refresh_token can only be used once + rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); + + // `Gebura` `Sentinel` + rpc ReportSentinelInformation(ReportSentinelInformationRequest) returns (ReportSentinelInformationResponse); + // `Gebura` `Sentinel` + // Full update, changes are handled by librarian + rpc ReportAppBinaries(ReportAppBinariesRequest) returns (ReportAppBinariesResponse); +} + +message ReportSentinelInformationRequest { + repeated string hostnames = 1; + ServerScheme scheme = 2; + // valid when need_token is true + string get_token_url_path = 3; + string download_file_url_path = 4; + repeated SentinelLibrary libraries = 5; + message SentinelLibrary { + int64 id = 1; + string download_base_path = 2; + } + enum ServerScheme { + SERVER_SCHEME_UNSPECIFIED = 0; + SERVER_SCHEME_HTTP = 1; + SERVER_SCHEME_HTTPS = 2; + } +} + +message ReportSentinelInformationResponse {} + +message ReportAppBinariesRequest { + repeated SentinelAppBinary sentinel_app_binaries = 1; + message SentinelAppBinary { + AppBinary app_binary = 1; + int64 sentinel_library_id = 2; + string sentinel_generated_id = 3; + } +} + +message ReportAppBinariesResponse {} \ No newline at end of file diff --git a/proto/librarian/sephirah/v1/sephirah.proto b/proto/librarian/sephirah/v1/sephirah.proto index b4d8727b..51b78ebe 100644 --- a/proto/librarian/sephirah/v1/sephirah.proto +++ b/proto/librarian/sephirah/v1/sephirah.proto @@ -10,7 +10,7 @@ import "librarian/sephirah/v1/hokma.proto"; import "librarian/sephirah/v1/netzach.proto"; import "librarian/sephirah/v1/tiphereth.proto"; import "librarian/sephirah/v1/yesod.proto"; -import "librarian/v1/wellknown.proto"; +import "librarian/sephirah/v1/base.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; @@ -36,12 +36,14 @@ service LibrarianSephirahService { rpc ListenServerEvent(ListenServerEventRequest) returns (stream ListenServerEventResponse); // `Tiphereth` `Normal` Login via password and get two token rpc GetToken(GetTokenRequest) returns (GetTokenResponse); - // `Tiphereth` `Normal` `Sentinel` `Porter` Use valid refresh_token and get two new token, a refresh_token can only be used once + // `Tiphereth` `Normal` `Porter` Use valid refresh_token and get two new token, a refresh_token can only be used once rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); // `Tiphereth` `Porter` Obtain access_token of a specific user after user authorization. // This token can be used to perform actions on behalf of the user. rpc AcquireUserToken(AcquireUserTokenRequest) returns (AcquireUserTokenResponse); + // `Tiphereth` + rpc GetUser(GetUserRequest) returns (GetUserResponse); // `Tiphereth` Self register as a new normal user rpc RegisterUser(RegisterUserRequest) returns (RegisterUserResponse); // `Tiphereth` `Normal` Client should register device after the first login @@ -57,30 +59,14 @@ service LibrarianSephirahService { // NOTE2: Delete session will not affect device registration. rpc DeleteUserSession(DeleteUserSessionRequest) returns (DeleteUserSessionResponse); - // `Tiphereth` `Admin` `Normal limited` - rpc CreateUser(CreateUserRequest) returns (CreateUserResponse); - // `Tiphereth` `Admin` `Normal limited` - rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse); - // `Tiphereth` `Admin` `Normal limited` - rpc GetUser(GetUserRequest) returns (GetUserResponse); - // `Tiphereth` `Admin` `Normal limited` - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse); - // `Tiphereth` `Normal` Bind third-party account to current user. - // Create (account)<-[Equal]->(current user) rpc LinkAccount(LinkAccountRequest) returns (LinkAccountResponse); // `Tiphereth` `Normal` Unbind third-party account from current user. - // Delete (account)<-[Equal]->(current user) rpc UnLinkAccount(UnLinkAccountRequest) returns (UnLinkAccountResponse); // `Tiphereth` `Normal` List third-party account binded to current user. - // Match ()<-[Equal]->(current user) rpc ListLinkAccounts(ListLinkAccountsRequest) returns (ListLinkAccountsResponse); - // `Tiphereth` `Admin` - rpc ListPorters(ListPortersRequest) returns (ListPortersResponse); - // `Tiphereth` `Admin` - rpc UpdatePorterStatus(UpdatePorterStatusRequest) returns (UpdatePorterStatusResponse); - // `Tiphereth` `Admin` `Normal limited` + // `Tiphereth` `Normal limited` rpc ListPorterGroups(ListPorterGroupsRequest) returns (ListPorterGroupsResponse); // `Tiphereth` `Normal` rpc CreatePorterContext(CreatePorterContextRequest) returns (CreatePorterContextResponse); @@ -89,9 +75,7 @@ service LibrarianSephirahService { // `Tiphereth` `Normal` Set porter context. rpc UpdatePorterContext(UpdatePorterContextRequest) returns (UpdatePorterContextResponse); - // `Binah` `Admin` - rpc SetFileCapacity(SetFileCapacityRequest) returns (SetFileCapacityResponse); - // `Binah` `Admin` `Normal limited` + // `Binah` `Normal` rpc GetFileCapacity(GetFileCapacityRequest) returns (GetFileCapacityResponse); // `Binah` `upload_token` rpc UploadFile(stream UploadFileRequest) returns (stream UploadFileResponse); @@ -128,17 +112,6 @@ service LibrarianSephirahService { // `Chesed` `Normal` rpc DownloadImage(DownloadImageRequest) returns (DownloadImageResponse); - // `Gebura` `Admin` - rpc CreateAppInfo(CreateAppInfoRequest) returns (CreateAppInfoResponse); - // `Gebura` `Admin` - rpc UpdateAppInfo(UpdateAppInfoRequest) returns (UpdateAppInfoResponse); - // `Gebura` `Admin` Used to manage app info - rpc ListAppInfos(ListAppInfosRequest) returns (ListAppInfosResponse); - // `Gebura` `Admin` Merge two app infos - rpc MergeAppInfos(MergeAppInfosRequest) returns (MergeAppInfosResponse); - // `Gebura` `Admin` Pick one app info out from merged - rpc PickAppInfo(PickAppInfoRequest) returns (PickAppInfoResponse); - // `Gebura` `Normal` Asynchronous update app infos. // Request on INTERNAL app info applies to all bound external app infos. // Create an INTERNAL app info when requested external app info does not exist @@ -178,11 +151,6 @@ service LibrarianSephirahService { // `Gebura` `Normal` rpc UnAssignApp(UnAssignAppRequest) returns (UnAssignAppResponse); - // `Gebura` `Sentinel` - rpc ReportSentinelInformation(ReportSentinelInformationRequest) returns (ReportSentinelInformationResponse); - // `Gebura` `Sentinel` - // Full update, changes are handled by librarian - rpc ReportAppBinaries(ReportAppBinariesRequest) returns (ReportAppBinariesResponse); // `Gebura` `Normal` rpc DownloadAppBinary(DownloadAppBinaryRequest) returns (DownloadAppBinaryResponse); @@ -314,54 +282,6 @@ service LibrarianSephirahService { rpc ListTags(ListTagsRequest) returns (ListTagsResponse); } -message GetServerInformationRequest { - optional bool with_status_report = 1; -} -message GetServerInformationResponse { - // For manual inspection only, the client may display but should not parse the response. - ServerBinarySummary server_binary_summary = 1; - // For manual inspection only, the client may display but should not parse the response. - ServerProtocolSummary protocol_summary = 2; - // The time that server received the request, - // note that there is a transmission delay between server and client. - google.protobuf.Timestamp current_time = 3; - // Valid when accessToken is provided. - optional librarian.v1.FeatureSummary feature_summary = 4; - // For showing to user, customizable by server owner. - ServerInstanceSummary server_instance_summary = 5; - // Plain text status report for manual inspection. - // Content is specific to server implementation. - optional string status_report = 6; -} - -message ServerBinarySummary { - // Server source code address. - // *Should* be a valid http address. - string source_code_address = 1; - // Binary build version. - // The content *should* be a semantic version string similar to the one generated by `git describe`, - // but rely on the actual implementation of the server. - string build_version = 2; - // Binary build date. - // The content *should* be a date format that is human-readable. - string build_date = 3; -} - -message ServerProtocolSummary { - // Protocol version used by server. - // The content *must* be a semantic version string generated by `git describe`, - // and if the server is built for production, it *must* be a valid version tag. - string version = 1; -} - -message ServerInstanceSummary { - string name = 1; - string description = 2; - string website_url = 3; - string logo_url = 4; - string background_url = 5; -} - message ListenServerEventRequest {} message ListenServerEventResponse { diff --git a/proto/librarian/sephirah/v1/tiphereth.proto b/proto/librarian/sephirah/v1/tiphereth.proto index 02452108..1f8fcfd4 100644 --- a/proto/librarian/sephirah/v1/tiphereth.proto +++ b/proto/librarian/sephirah/v1/tiphereth.proto @@ -188,6 +188,11 @@ message UpdatePorterContextRequest { } message UpdatePorterContextResponse {} +message DeletePorterContextRequest { + librarian.v1.InternalID context_id = 1; +} +message DeletePorterContextResponse {} + message User { librarian.v1.InternalID id = 1; string username = 2; From acaa527e297de3269cb3e5a2633749fb2806069d Mon Sep 17 00:00:00 2001 From: MuZhou233 Date: Sat, 8 Mar 2025 19:05:19 +0800 Subject: [PATCH 2/3] tmp --- buf.yaml | 5 +- proto/librarian/porter/v1/gebura.proto | 70 +++ .../v1/{porter.proto => porter_service.proto} | 44 +- proto/librarian/porter/v1/tiphereth.proto | 24 + proto/librarian/sephirah/v1/angela.proto | 57 --- .../sephirah/v1/angela/angela_service.proto | 120 +++++ .../librarian/sephirah/v1/angela/binah.proto | 50 ++ .../librarian/sephirah/v1/angela/gebura.proto | 97 ++++ .../sephirah/v1/angela/tiphereth.proto | 75 +++ proto/librarian/sephirah/v1/gebura.proto | 469 ------------------ proto/librarian/sephirah/v1/hokma.proto | 45 -- proto/librarian/sephirah/v1/sentinel.proto | 51 -- .../v1/sentinel/sentinel_service.proto | 64 +++ .../sephirah/v1/{ => sephirah}/base.proto | 18 +- .../sephirah/v1/{ => sephirah}/binah.proto | 29 +- .../sephirah/v1/{ => sephirah}/chesed.proto | 9 +- .../sephirah/v1/sephirah/gebura.proto | 429 ++++++++++++++++ .../sephirah/v1/{ => sephirah}/netzach.proto | 2 +- .../sephirah_service.proto} | 118 ++--- .../v1/{ => sephirah}/tiphereth.proto | 65 +-- .../sephirah/v1/{ => sephirah}/yesod.proto | 20 +- proto/librarian/v1/common.proto | 133 +---- proto/librarian/v1/wellknown.proto | 53 +- 23 files changed, 1077 insertions(+), 970 deletions(-) create mode 100644 proto/librarian/porter/v1/gebura.proto rename proto/librarian/porter/v1/{porter.proto => porter_service.proto} (84%) create mode 100644 proto/librarian/porter/v1/tiphereth.proto delete mode 100644 proto/librarian/sephirah/v1/angela.proto create mode 100644 proto/librarian/sephirah/v1/angela/angela_service.proto create mode 100644 proto/librarian/sephirah/v1/angela/binah.proto create mode 100644 proto/librarian/sephirah/v1/angela/gebura.proto create mode 100644 proto/librarian/sephirah/v1/angela/tiphereth.proto delete mode 100644 proto/librarian/sephirah/v1/gebura.proto delete mode 100644 proto/librarian/sephirah/v1/hokma.proto delete mode 100644 proto/librarian/sephirah/v1/sentinel.proto create mode 100644 proto/librarian/sephirah/v1/sentinel/sentinel_service.proto rename proto/librarian/sephirah/v1/{ => sephirah}/base.proto (84%) rename proto/librarian/sephirah/v1/{ => sephirah}/binah.proto (76%) rename proto/librarian/sephirah/v1/{ => sephirah}/chesed.proto (86%) create mode 100644 proto/librarian/sephirah/v1/sephirah/gebura.proto rename proto/librarian/sephirah/v1/{ => sephirah}/netzach.proto (99%) rename proto/librarian/sephirah/v1/{sephirah.proto => sephirah/sephirah_service.proto} (71%) rename proto/librarian/sephirah/v1/{ => sephirah}/tiphereth.proto (86%) rename proto/librarian/sephirah/v1/{ => sephirah}/yesod.proto (92%) diff --git a/buf.yaml b/buf.yaml index 817fae27..ee0363d3 100644 --- a/buf.yaml +++ b/buf.yaml @@ -5,10 +5,9 @@ deps: - buf.build/bufbuild/protovalidate lint: use: - - DEFAULT + - STANDARD except: - - FIELD_NOT_REQUIRED - - PACKAGE_NO_IMPORT_CYCLE + - PACKAGE_VERSION_SUFFIX ignore_only: PACKAGE_VERSION_SUFFIX: - proto/errors/errors.proto diff --git a/proto/librarian/porter/v1/gebura.proto b/proto/librarian/porter/v1/gebura.proto new file mode 100644 index 00000000..dfbd5782 --- /dev/null +++ b/proto/librarian/porter/v1/gebura.proto @@ -0,0 +1,70 @@ +syntax = "proto3"; + +package librarian.porter.v1; + +option csharp_namespace = "TuiHub.Protos.Librarian.Porter.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/porter/v1;v1"; + +message SearchAppInfoRequest { + string name_like = 1; +} + +message SearchAppInfoResponse { + repeated AppInfo app_infos = 1; +} + +message GetAppInfoRequest { + // WellKnownAppInfoSource + string source = 1; + string source_app_id = 2; +} +message GetAppInfoResponse { + AppInfo app_info = 1; +} + +message ParseRawAppInfoRequest { + // WellKnownAppInfoSource + string source = 1; + string source_app_id = 2; + string raw_data_json = 3; +} + +message ParseRawAppInfoResponse { + AppInfo app_info = 1; +} + +message AppInfo { + // WellKnownAppInfoSource + string source = 1; + string source_app_id = 2; + optional string source_url = 3; + + // original data in json format + string raw_data_json = 4; + optional AppInfoDetails details = 5; + + string name = 6; + AppType type = 7; + string short_description = 8; + string icon_image_url = 9; + // must be horizontal, usually 16:9 + string background_image_url = 10; + // must be vertical, usually 3:4 + string cover_image_url = 11; + repeated string tags = 12; + repeated string alt_names = 13; +} + +message AppInfoDetails { + string description = 1; + string release_date = 2; + string developer = 3; + string publisher = 4; + string version = 5; + repeated string image_urls = 6; +} + +enum AppType { + APP_TYPE_UNSPECIFIED = 0; + APP_TYPE_GAME = 1; +} diff --git a/proto/librarian/porter/v1/porter.proto b/proto/librarian/porter/v1/porter_service.proto similarity index 84% rename from proto/librarian/porter/v1/porter.proto rename to proto/librarian/porter/v1/porter_service.proto index c2b8a2ed..5fc9325d 100644 --- a/proto/librarian/porter/v1/porter.proto +++ b/proto/librarian/porter/v1/porter_service.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package librarian.porter.v1; +import "librarian/porter/v1/gebura.proto"; +import "librarian/porter/v1/tiphereth.proto"; import "librarian/v1/common.proto"; import "librarian/v1/wellknown.proto"; @@ -17,14 +19,14 @@ service LibrarianPorterService { rpc DisableContext(DisableContextRequest) returns (DisableContextResponse); // `Tiphereth` - rpc PullAccount(PullAccountRequest) returns (PullAccountResponse); + rpc GetAccount(GetAccountRequest) returns (GetAccountResponse); - // `Gebura` - rpc PullAppInfo(PullAppInfoRequest) returns (PullAppInfoResponse); - // `Gebura` - rpc PullAccountAppInfoRelation(PullAccountAppInfoRelationRequest) returns (PullAccountAppInfoRelationResponse); // `Gebura` rpc SearchAppInfo(SearchAppInfoRequest) returns (SearchAppInfoResponse); + // `Gebura` Get app info from source. + rpc GetAppInfo(GetAppInfoRequest) returns (GetAppInfoResponse); + // `Gebura` Parse app info from json. + rpc ParseRawAppInfo(ParseRawAppInfoRequest) returns (ParseRawAppInfoResponse); // `Yesod` rpc PullFeed(PullFeedRequest) returns (PullFeedResponse); @@ -106,38 +108,6 @@ message DisableContextRequest { } message DisableContextResponse {} -message PullAccountRequest { - librarian.v1.AccountID account_id = 1; -} -message PullAccountResponse { - librarian.v1.Account account = 1; -} - -message PullAppInfoRequest { - librarian.v1.AppInfoID app_info_id = 1; -} - -message PullAppInfoResponse { - librarian.v1.AppInfo app_info = 1; -} - -message PullAccountAppInfoRelationRequest { - librarian.v1.AccountAppRelationType relation_type = 1; - librarian.v1.AccountID account_id = 2; -} - -message PullAccountAppInfoRelationResponse { - repeated librarian.v1.AppInfo app_infos = 1; -} - -message SearchAppInfoRequest { - string name = 1; -} - -message SearchAppInfoResponse { - repeated librarian.v1.AppInfo app_infos = 1; -} - message PullFeedRequest { // `PorterFeatureSummary.feed_sources` librarian.v1.FeatureRequest source = 1; diff --git a/proto/librarian/porter/v1/tiphereth.proto b/proto/librarian/porter/v1/tiphereth.proto new file mode 100644 index 00000000..8e148c4c --- /dev/null +++ b/proto/librarian/porter/v1/tiphereth.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package librarian.porter.v1; + +option csharp_namespace = "TuiHub.Protos.Librarian.Porter.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/porter/v1;v1"; + +message GetAccountRequest { + // WellKnownAccountPlatform + string platform = 1; + string platform_account_id = 2; +} +message GetAccountResponse { + Account account = 1; +} + +message Account { + // WellKnownPlatform + string platform = 1; + string platform_account_id = 2; + string name = 3; + string profile_url = 4; + string avatar_url = 5; +} diff --git a/proto/librarian/sephirah/v1/angela.proto b/proto/librarian/sephirah/v1/angela.proto deleted file mode 100644 index 6a88f4f7..00000000 --- a/proto/librarian/sephirah/v1/angela.proto +++ /dev/null @@ -1,57 +0,0 @@ -syntax = "proto3"; - -package librarian.sephirah.v1; - -import "google/protobuf/timestamp.proto"; -import "librarian/sephirah/v1/binah.proto"; -import "librarian/sephirah/v1/chesed.proto"; -import "librarian/sephirah/v1/gebura.proto"; -import "librarian/sephirah/v1/hokma.proto"; -import "librarian/sephirah/v1/netzach.proto"; -import "librarian/sephirah/v1/tiphereth.proto"; -import "librarian/sephirah/v1/yesod.proto"; -import "librarian/v1/wellknown.proto"; -import "librarian/sephirah/v1/base.proto"; - -option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; -option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; - -/* - * Angela provides the admin control interface - */ -service LibrarianAngelaService { - // Allow anonymous call, use accessToken to get complete information - rpc GetServerInformation(GetServerInformationRequest) returns (GetServerInformationResponse); - // `Tiphereth` Login via password and get two token - rpc GetToken(GetTokenRequest) returns (GetTokenResponse); - // `Tiphereth` Use valid refresh_token and get two new token, a refresh_token can only be used once - rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); - - // `Tiphereth` - rpc CreateUser(CreateUserRequest) returns (CreateUserResponse); - // `Tiphereth` - rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse); - // `Tiphereth` - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse); - - // `Tiphereth` - rpc ListPorters(ListPortersRequest) returns (ListPortersResponse); - // `Tiphereth` - rpc UpdatePorterStatus(UpdatePorterStatusRequest) returns (UpdatePorterStatusResponse); - // `Tiphereth` - rpc ListPorterGroups(ListPorterGroupsRequest) returns (ListPorterGroupsResponse); - - // `Binah` - rpc SetFileCapacity(SetFileCapacityRequest) returns (SetFileCapacityResponse); - - // `Gebura` - rpc CreateAppInfo(CreateAppInfoRequest) returns (CreateAppInfoResponse); - // `Gebura` - rpc UpdateAppInfo(UpdateAppInfoRequest) returns (UpdateAppInfoResponse); - // `Gebura` Used to manage app info - rpc ListAppInfos(ListAppInfosRequest) returns (ListAppInfosResponse); - // `Gebura` Merge two app infos - rpc MergeAppInfos(MergeAppInfosRequest) returns (MergeAppInfosResponse); - // `Gebura` Pick one app info out from merged - rpc PickAppInfo(PickAppInfoRequest) returns (PickAppInfoResponse); -} \ No newline at end of file diff --git a/proto/librarian/sephirah/v1/angela/angela_service.proto b/proto/librarian/sephirah/v1/angela/angela_service.proto new file mode 100644 index 00000000..154c205d --- /dev/null +++ b/proto/librarian/sephirah/v1/angela/angela_service.proto @@ -0,0 +1,120 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.angela; + +import "librarian/sephirah/v1/angela/binah.proto"; +import "librarian/sephirah/v1/angela/gebura.proto"; +import "librarian/sephirah/v1/angela/tiphereth.proto"; +import "librarian/sephirah/v1/sephirah/base.proto"; +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +/* + * Angela provides the admin control interface + */ +service LibrarianAngelaService { + // Allow anonymous call, use accessToken to get complete information + rpc GetServerInformation(sephirah.GetServerInformationRequest) returns (sephirah.GetServerInformationResponse); + + rpc GetServerConfig(GetServerConfigRequest) returns (GetServerConfigResponse); + rpc UpdateServerConfig(UpdateServerConfigRequest) returns (UpdateServerConfigResponse); + + // `Tiphereth` Login via password and get two token + rpc GetToken(GetTokenRequest) returns (GetTokenResponse); + // `Tiphereth` Use valid refresh_token and get two new token, a refresh_token can only be used once + rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); + + // `Tiphereth` + rpc CreateUser(CreateUserRequest) returns (CreateUserResponse); + // `Tiphereth` + rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse); + // `Tiphereth` + rpc ListUsers(ListUsersRequest) returns (ListUsersResponse); + + // `Tiphereth` + rpc ListPorters(ListPortersRequest) returns (ListPortersResponse); + // `Tiphereth` + rpc UpdatePorterStatus(UpdatePorterStatusRequest) returns (UpdatePorterStatusResponse); + // `Tiphereth` Delete porter, only when porter is disabled + rpc DeletePorter(DeletePorterRequest) returns (DeletePorterResponse); + + // `Binah` + rpc ListStorageCapacityUsage(ListStorageCapacityUsageRequest) returns (ListStorageCapacityUsageResponse); + // `Binah` `upload_token` + // Maximum 256M + // Server must send response at least once a minute to keepalive. + // Client should ignore in_process response and wait for success or error response. + rpc SimpleUploadFile(stream SimpleUploadFileRequest) returns (stream SimpleUploadFileResponse); + // `Binah` `download_token` + // Server will not check the receiving state + rpc SimpleDownloadFile(SimpleDownloadFileRequest) returns (stream SimpleDownloadFileResponse); + // `Binah` `upload_token` + // Upload file through http url + rpc PresignedUploadFile(PresignedUploadFileRequest) returns (PresignedUploadFileResponse); + // `Binah` `upload_token` + // Report file transfer status. Mainly used to trigger server post-process immediately + rpc PresignedUploadFileStatus(PresignedUploadFileStatusRequest) returns (PresignedUploadFileStatusResponse); + // `Binah` `download_token` + // Download file through http url + rpc PresignedDownloadFile(PresignedDownloadFileRequest) returns (PresignedDownloadFileResponse); + + // `Gebura` + rpc SearchAppInfos(SearchAppInfosRequest) returns (SearchAppInfosResponse); + // `Gebura` + rpc CreateStoreApp(CreateStoreAppRequest) returns (CreateStoreAppResponse); + // `Gebura` + rpc UpdateStoreApp(UpdateStoreAppRequest) returns (UpdateStoreAppResponse); + // `Gebura` + rpc ListStoreApps(ListStoreAppsRequest) returns (ListStoreAppsResponse); + + // `Gebura` + rpc ListStoreAppBinaries(ListStoreAppBinariesRequest) returns (ListStoreAppBinariesResponse); + // `Gebura` + rpc UpdateStoreAppBinary(UpdateStoreAppBinaryRequest) returns (UpdateStoreAppBinaryResponse); + // `Gebura` + rpc ListStoreAppBinaryFiles(ListStoreAppBinaryFilesRequest) returns (ListStoreAppBinaryFilesResponse); + + // `Gebura` + rpc CreateStoreAppSaveFile(CreateStoreAppSaveFileRequest) returns (CreateStoreAppSaveFileResponse); + // `Gebura` + rpc UpdateStoreAppSaveFile(UpdateStoreAppSaveFileRequest) returns (UpdateStoreAppSaveFileResponse); + // `Gebura` + rpc UploadStoreAppSaveFile(UploadStoreAppSaveFileRequest) returns (UploadStoreAppSaveFileResponse); + // `Gebura` + rpc ListStoreAppSaveFiles(ListStoreAppSaveFilesRequest) returns (ListStoreAppSaveFilesResponse); + // `Gebura` + rpc DeleteStoreAppSaveFile(DeleteStoreAppSaveFileRequest) returns (DeleteStoreAppSaveFileResponse); +} + +message GetServerConfigRequest {} +message GetServerConfigResponse { + repeated ServerConfigSection sections = 1; +} + +message UpdateServerConfigRequest { + repeated ServerConfigItem items = 1; +} +message UpdateServerConfigResponse {} + +message ServerConfigSection { + string id = 1; + librarian.v1.I18NString name = 2; + librarian.v1.I18NString description = 3; + repeated ServerConfigItem items = 4; +} + +message ServerConfigItem { + // id must be unique in sections + string id = 1; + librarian.v1.I18NString name = 2; + librarian.v1.I18NString description = 3; + string default_value = 4; + string current_value = 5; +} + +message ServerConfigItemUpdate { + string id = 1; + string value = 2; +} diff --git a/proto/librarian/sephirah/v1/angela/binah.proto b/proto/librarian/sephirah/v1/angela/binah.proto new file mode 100644 index 00000000..a4f6660b --- /dev/null +++ b/proto/librarian/sephirah/v1/angela/binah.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.angela; + +import "librarian/sephirah/v1/sephirah/binah.proto"; +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +message ListStorageCapacityUsageRequest { + librarian.v1.PagingRequest paging = 1; +} +message ListStorageCapacityUsageResponse { + message Item { + librarian.v1.InternalID user_id = 1; + sephirah.StorageCapacityUsage storage_capacity_usage = 2; + } + librarian.v1.PagingResponse paging = 1; + repeated Item items = 2; +} + +message SimpleUploadFileRequest { + bytes data = 1; +} + +message SimpleUploadFileResponse { + sephirah.FileTransferStatus status = 1; +} +message SimpleDownloadFileRequest {} +message SimpleDownloadFileResponse { + bytes data = 1; +} + +message PresignedUploadFileRequest {} +message PresignedUploadFileResponse { + string upload_url = 1; +} + +message PresignedUploadFileStatusRequest { + sephirah.FileTransferStatus status = 1; +} + +message PresignedUploadFileStatusResponse {} + +message PresignedDownloadFileRequest {} +message PresignedDownloadFileResponse { + // Should follow AWS S3 API + string download_url = 1; +} diff --git a/proto/librarian/sephirah/v1/angela/gebura.proto b/proto/librarian/sephirah/v1/angela/gebura.proto new file mode 100644 index 00000000..358a35a1 --- /dev/null +++ b/proto/librarian/sephirah/v1/angela/gebura.proto @@ -0,0 +1,97 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.angela; + +import "librarian/sephirah/v1/sephirah/gebura.proto"; +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +message SearchAppInfosRequest { + librarian.v1.PagingRequest paging = 1; + string name_like = 2; + repeated string source_filter = 3; +} +message SearchAppInfosResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.AppInfo app_infos = 2; +} + +message CreateStoreAppRequest { + sephirah.StoreApp store_app = 1; +} +message CreateStoreAppResponse { + librarian.v1.InternalID id = 1; +} + +message UpdateStoreAppRequest { + sephirah.StoreApp app_info = 1; +} + +message UpdateStoreAppResponse {} + +message ListStoreAppsRequest { + librarian.v1.PagingRequest paging = 1; + repeated string source_filter = 3; + repeated sephirah.AppType type_filter = 4; + repeated librarian.v1.InternalID id_filter = 5; +} + +message ListStoreAppsResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.StoreApp app_infos = 2; +} + +message ListStoreAppBinariesRequest { + librarian.v1.PagingRequest paging = 1; + repeated librarian.v1.InternalID app_id_filter = 2; + repeated librarian.v1.InternalID id_filter = 3; +} +message ListStoreAppBinariesResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.StoreAppBinary binaries = 2; +} +message UpdateStoreAppBinaryRequest { + sephirah.StoreAppBinary binary = 1; +} +message UpdateStoreAppBinaryResponse {} + +message ListStoreAppBinaryFilesRequest { + librarian.v1.PagingRequest paging = 1; + librarian.v1.InternalID app_binary_id = 3; + repeated librarian.v1.InternalID id_filter = 4; +} +message ListStoreAppBinaryFilesResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.StoreAppBinaryFile files = 2; +} + +message CreateStoreAppSaveFileRequest { + sephirah.StoreAppSaveFile save_file = 1; +} +message CreateStoreAppSaveFileResponse { + librarian.v1.InternalID id = 1; +} +message UpdateStoreAppSaveFileRequest { + sephirah.StoreAppSaveFile save_file = 1; +} +message UpdateStoreAppSaveFileResponse {} +message UploadStoreAppSaveFileRequest { + librarian.v1.InternalID id = 1; + librarian.v1.FileMetadata file_metadata = 2; +} +message UploadStoreAppSaveFileResponse {} +message ListStoreAppSaveFilesRequest { + librarian.v1.PagingRequest paging = 1; + librarian.v1.InternalID app_id = 2; + repeated librarian.v1.InternalID id_filter = 3; +} +message ListStoreAppSaveFilesResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.StoreAppSaveFile save_files = 2; +} +message DeleteStoreAppSaveFileRequest { + librarian.v1.InternalID id = 1; +} +message DeleteStoreAppSaveFileResponse {} diff --git a/proto/librarian/sephirah/v1/angela/tiphereth.proto b/proto/librarian/sephirah/v1/angela/tiphereth.proto new file mode 100644 index 00000000..4b97622c --- /dev/null +++ b/proto/librarian/sephirah/v1/angela/tiphereth.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.angela; + +import "librarian/sephirah/v1/sephirah/tiphereth.proto"; +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +message GetTokenRequest { + string username = 1; + string password = 2; + // Always ignore this if client don't impl device info feature. + // Otherwise, re-login after registered device with this and every time after + optional librarian.v1.InternalID device_id = 3; +} + +message GetTokenResponse { + string access_token = 1; + string refresh_token = 2; +} + +message RefreshTokenRequest { + // Always ignore this if client don't impl device info feature. + // Be used to add device info after registered device. + // Only first device_id will be used. + optional librarian.v1.InternalID device_id = 3; +} + +message RefreshTokenResponse { + string access_token = 1; + string refresh_token = 2; +} + +message CreateUserRequest { + sephirah.User user = 1; +} +message CreateUserResponse { + librarian.v1.InternalID id = 1; +} + +message ListUsersRequest { + librarian.v1.PagingRequest paging = 1; + repeated sephirah.UserType type_filter = 2; + repeated sephirah.UserStatus status_filter = 3; +} +message ListUsersResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.User users = 2; +} + +message UpdateUserRequest { + sephirah.User user = 1; +} +message UpdateUserResponse {} + +message ListPortersRequest { + librarian.v1.PagingRequest paging = 1; +} +message ListPortersResponse { + librarian.v1.PagingResponse paging = 1; + repeated sephirah.Porter porters = 2; +} + +message UpdatePorterStatusRequest { + librarian.v1.InternalID porter_id = 1; + sephirah.UserStatus status = 2; +} +message UpdatePorterStatusResponse {} + +message DeletePorterRequest { + librarian.v1.InternalID porter_id = 1; +} +message DeletePorterResponse {} diff --git a/proto/librarian/sephirah/v1/gebura.proto b/proto/librarian/sephirah/v1/gebura.proto deleted file mode 100644 index 939b999b..00000000 --- a/proto/librarian/sephirah/v1/gebura.proto +++ /dev/null @@ -1,469 +0,0 @@ -syntax = "proto3"; - -package librarian.sephirah.v1; - -import "google/protobuf/duration.proto"; -import "librarian/sephirah/v1/base.proto"; -import "librarian/v1/common.proto"; - -option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; -option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; - -message CreateAppInfoRequest { - // `id` can be anything, `internal` must be true - librarian.v1.AppInfo app_info = 1; -} -message CreateAppInfoResponse { - librarian.v1.InternalID id = 1; -} - -message UpdateAppInfoRequest { - // `internal` must be true - librarian.v1.AppInfo app_info = 1; -} - -message UpdateAppInfoResponse {} - -message ListAppInfosRequest { - librarian.v1.PagingRequest paging = 1; - bool exclude_internal = 2; - repeated string source_filter = 3; - repeated librarian.v1.AppType type_filter = 4; - repeated librarian.v1.InternalID id_filter = 5; - bool contain_details = 6; -} - -message ListAppInfosResponse { - librarian.v1.PagingResponse paging = 1; - repeated librarian.v1.AppInfo app_infos = 2; -} - -message SyncAppInfosRequest { - repeated librarian.v1.AppInfoID app_info_ids = 1; - // if false, server will return immediately. - // if true, server will return data after sync finished. - optional bool wait_data = 2; -} - -message SyncAppInfosResponse { - repeated librarian.v1.AppInfo app_infos = 1; -} - -message MergeAppInfosRequest { - // `internal` must be true - librarian.v1.AppInfo base = 1; - // Must be internal app. - // The InternalID will be dropped after merge. - // Other apps bind to this app will rebind to base. - librarian.v1.InternalID merged = 2; -} - -message MergeAppInfosResponse {} - -message PickAppInfoRequest { - // `internal` must be false - librarian.v1.InternalID picked = 1; -} - -message PickAppInfoResponse {} - -message SyncAccountAppInfosRequest { - librarian.v1.AccountID account_id = 1; -} - -message SyncAccountAppInfosResponse {} - -message SearchAppInfosRequest { - librarian.v1.PagingRequest paging = 1; - string query = 2; -} -message SearchAppInfosResponse { - librarian.v1.PagingResponse paging = 1; - // without details - repeated librarian.v1.AppInfoMixed app_infos = 2; -} - -message SearchNewAppInfosRequest { - librarian.v1.PagingRequest paging = 1; - string name = 2; - repeated string source_filter = 3; -} -message SearchNewAppInfosResponse { - librarian.v1.PagingResponse paging = 1; - repeated librarian.v1.AppInfo app_infos = 2; -} - -message GetAppInfoRequest { - librarian.v1.InternalID app_info_id = 1; -} - -message GetAppInfoResponse { - librarian.v1.AppInfo app_info = 1; -} - -message GetBoundAppInfosRequest { - librarian.v1.InternalID app_info_id = 1; -} - -message GetBoundAppInfosResponse { - repeated librarian.v1.AppInfo app_infos = 1; -} - -message PurchaseAppInfoRequest { - // When `internal` is true, `source_app_id` must be valid InternalID. - // When `internal` is false, Server should create that app and return no matter the source is supported. - librarian.v1.AppInfoID app_info_id = 1; -} - -message PurchaseAppInfoResponse { - // When purchase external app, return the auto created internal app id. - librarian.v1.InternalID id = 1; -} - -message GetPurchasedAppInfosRequest { - optional string source = 1; -} -message GetPurchasedAppInfosResponse { - // without details - repeated librarian.v1.AppInfoMixed app_infos = 1; -} - -message CreateAppRequest { - App app = 1; -} - -message CreateAppResponse { - librarian.v1.InternalID id = 1; -} - -message UpdateAppRequest { - App app = 1; -} - -message UpdateAppResponse {} - -message ListAppsRequest { - librarian.v1.PagingRequest paging = 1; - // List owned apps by default. - // Used to get other's **public** apps. - repeated librarian.v1.InternalID owner_id_filter = 2; - repeated librarian.v1.InternalID id_filter = 3; - repeated librarian.v1.InternalID assigned_app_info_id_filter = 4; - repeated librarian.v1.InternalID device_id_filter = 5; -} - -message ListAppsResponse { - librarian.v1.PagingResponse paging = 1; - repeated App apps = 2; -} - -message AssignAppRequest { - // `internal` must be true - librarian.v1.InternalID app_info_id = 1; - librarian.v1.InternalID app_id = 2; -} - -message AssignAppResponse {} - -message UnAssignAppRequest { - librarian.v1.InternalID app_id = 1; -} - -message UnAssignAppResponse {} - -message DownloadAppBinaryRequest { - librarian.v1.InternalID id = 1; -} - -message DownloadAppBinaryResponse { - AppBinary app_binary = 1; - // base url to be path-joined when need_token is false - string download_url = 2; - // valid when need_token is true - optional string token = 3; -} - -message AddAppRunTimeRequest { - librarian.v1.InternalID app_id = 1; - librarian.v1.InternalID device_id = 2; - librarian.v1.TimeRange time_range = 3; -} - -message AddAppRunTimeResponse {} - -message SumAppRunTimeRequest { - repeated librarian.v1.InternalID app_id_filter = 1; - repeated librarian.v1.InternalID device_id_filter = 2; - librarian.v1.TimeAggregation time_aggregation = 3; -} - -message SumAppRunTimeResponse { - message Group { - librarian.v1.TimeRange time_range = 1; - google.protobuf.Duration duration = 2; - } - repeated Group run_time_groups = 1; -} - -message UploadAppSaveFileRequest { - FileMetadata file_metadata = 1; - librarian.v1.InternalID app_id = 2; -} - -message UploadAppSaveFileResponse { - string upload_token = 1; -} - -message DownloadAppSaveFileRequest { - librarian.v1.InternalID id = 1; -} - -message DownloadAppSaveFileResponse { - string download_token = 2; -} - -message ListAppSaveFilesRequest { - librarian.v1.InternalID app_id = 1; -} - -message ListAppSaveFilesResponse { - message Result { - librarian.v1.InternalID id = 1; - FileMetadata file = 2; - bool pinned = 3; - } - repeated Result results = 1; -} - -message RemoveAppSaveFileRequest { - librarian.v1.InternalID id = 1; -} - -message RemoveAppSaveFileResponse {} - -message PinAppSaveFileRequest { - librarian.v1.InternalID id = 1; -} - -message PinAppSaveFileResponse {} - -message UnpinAppSaveFileRequest { - librarian.v1.InternalID id = 1; -} - -message UnpinAppSaveFileResponse {} - -message SetAppSaveFileCapacityRequest { - oneof entity { - bool user = 1; - librarian.v1.InternalID app_id = 2; - } - // negative value means use default - int64 count = 4; - // negative value means use default - int64 size_bytes = 5; - // unspecified means use default - // strategies of smaller scopes have higher priority when multiple scopes reach limit - AppSaveFileCapacityStrategy strategy = 6; -} - -message SetAppSaveFileCapacityResponse {} - -message SetAppSaveFileCapacityDefaultRequest { - oneof entity { - bool app = 1; - } - // negative value means no limit - int64 count = 4; - // negative value means no limit - int64 size_bytes = 5; - AppSaveFileCapacityStrategy strategy = 6; -} - -message SetAppSaveFileCapacityDefaultResponse {} - -enum AppSaveFileCapacityStrategy { - APP_SAVE_FILE_CAPACITY_STRATEGY_UNSPECIFIED = 0; - APP_SAVE_FILE_CAPACITY_STRATEGY_FAIL = 1; - APP_SAVE_FILE_CAPACITY_STRATEGY_DELETE_OLDEST = 2; - APP_SAVE_FILE_CAPACITY_STRATEGY_DELETE_OLDEST_UNTIL_SATISFIED = 3; -} - -message GetAppSaveFileCapacityRequest { - oneof entity { - bool user = 1; - librarian.v1.InternalID app_id = 2; - } -} - -message GetAppSaveFileCapacityResponse { - int64 count = 1; - int64 size_bytes = 2; - AppSaveFileCapacityStrategy strategy = 3; -} - -message GetAppSaveFileCapacityDefaultRequest { - oneof entity { - bool app = 1; - } -} - -message GetAppSaveFileCapacityDefaultResponse { - int64 count = 1; - int64 size_bytes = 2; - AppSaveFileCapacityStrategy strategy = 3; -} - -message CreateSharedAppSaveRequest { - SharedAppSave shared_app_save = 1; -} - -message CreateSharedAppSaveResponse { - librarian.v1.InternalID id = 1; -} - -message UpdateSharedAppSaveRequest { - SharedAppSave shared_app_save = 1; -} - -message UpdateSharedAppSaveResponse {} - -message ListSharedAppSavesRequest { - librarian.v1.PagingRequest paging = 1; - repeated librarian.v1.InternalID id_filter = 2; - repeated librarian.v1.InternalID app_info_id_filter = 3; -} - -message ListSharedAppSavesResponse { - librarian.v1.PagingResponse paging = 1; - repeated SharedAppSave shared_app_saves = 2; -} - -message RemoveSharedAppSaveRequest { - librarian.v1.InternalID id = 1; -} - -message RemoveSharedAppSaveResponse {} - -message CreateSharedAppSaveFileRequest { - // `Normal` will always create non-public SharedAppSaveFile - SharedAppSaveFile shared_app_save_file = 1; -} - -message CreateSharedAppSaveFileResponse { - librarian.v1.InternalID id = 1; -} - -message UpdateSharedAppSaveFileRequest { - // `Normal` can't set public field - SharedAppSaveFile shared_app_save_file = 1; -} - -message UpdateSharedAppSaveFileResponse {} - -message ListSharedAppSaveFilesRequest { - librarian.v1.PagingRequest paging = 1; - repeated librarian.v1.InternalID id_filter = 2; - repeated librarian.v1.InternalID shared_app_save_id_filter = 3; - repeated librarian.v1.InternalID user_id_filter = 4; -} - -message ListSharedAppSaveFilesResponse { - librarian.v1.PagingResponse paging = 1; - repeated SharedAppSaveFile shared_app_save_files = 2; -} - -message RemoveSharedAppSaveFileRequest { - // `Normal` can only remove owned SharedAppSaveFile - librarian.v1.InternalID id = 1; -} - -message RemoveSharedAppSaveFileResponse {} - -message ListAppCategoriesRequest {} - -message ListAppCategoriesResponse { - repeated AppCategory app_categories = 1; -} - -message CreateAppCategoryRequest { - AppCategory app_category = 1; -} - -message CreateAppCategoryResponse { - librarian.v1.InternalID id = 1; -} - -message UpdateAppCategoryRequest { - AppCategory app_category = 1; -} - -message UpdateAppCategoryResponse {} - -message RemoveAppCategoryRequest { - librarian.v1.InternalID id = 1; -} - -message RemoveAppCategoryResponse {} - -message App { - librarian.v1.InternalID id = 1; - string name = 2; - string description = 3; - // Only used in response - // Available when assigned to an app - optional librarian.v1.InternalID assigned_app_info_id = 4; - optional librarian.v1.InternalID device_id = 5; - - // false by default - bool public = 10; -} - -message AppBinary { - librarian.v1.InternalID id = 1; - string name = 2; - int64 size_bytes = 3; - bool need_token = 4; - repeated AppBinaryFile files = 10; -} - -message AppBinaryFile { - string name = 1; - int64 size_bytes = 2; - bytes sha256 = 3; - // should be path-joined to download_url when need_token is false - string server_file_path = 4; - repeated AppBinaryFileChunk chunks = 5; -} - -message AppBinaryFileChunk { - int64 offset_bytes = 1; - int64 size_bytes = 2; - bytes sha256 = 3; -} - -message AppCategory { - librarian.v1.InternalID id = 1; - string name = 2; - // Full update - repeated librarian.v1.InternalID app_ids = 3; - // Full update - repeated librarian.v1.InternalID app_info_ids = 4; -} - -message SharedAppSave { - librarian.v1.InternalID id = 1; - string name = 2; - string description = 3; - librarian.v1.InternalID app_info_id = 4; -} - -message SharedAppSaveFile { - librarian.v1.InternalID id = 1; - string name = 2; - string description = 3; - bool public = 4; - librarian.v1.InternalID shared_app_save_id = 5; - librarian.v1.InternalID file_metadata_id = 6; - optional librarian.v1.InternalID user_id = 7; -} diff --git a/proto/librarian/sephirah/v1/hokma.proto b/proto/librarian/sephirah/v1/hokma.proto deleted file mode 100644 index fef8b0ff..00000000 --- a/proto/librarian/sephirah/v1/hokma.proto +++ /dev/null @@ -1,45 +0,0 @@ -syntax = "proto3"; - -package librarian.sephirah.v1; - -import "librarian/v1/common.proto"; - -option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; -option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; - -message CreateTagRequest { - Tag tag = 1; -} - -message CreateTagResponse { - librarian.v1.InternalID id = 1; -} - -message UpdateTagRequest { - Tag tag = 1; -} - -message UpdateTagResponse {} - -message ListTagsRequest { - librarian.v1.PagingRequest paging = 1; - repeated librarian.v1.InternalID id_filter = 2; - // If not set, default to current user - repeated librarian.v1.InternalID creator_id_filter = 3; -} - -message ListTagsResponse { - librarian.v1.PagingResponse paging = 1; - repeated Tag tags = 2; -} - -message Tag { - librarian.v1.InternalID id = 1; - // name is unique to each creator. - // name cannot be changed - string name = 2; - string description = 3; - librarian.v1.InternalID creator_id = 4; - // false by default - bool public = 5; -} diff --git a/proto/librarian/sephirah/v1/sentinel.proto b/proto/librarian/sephirah/v1/sentinel.proto deleted file mode 100644 index 1394101b..00000000 --- a/proto/librarian/sephirah/v1/sentinel.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; - -package librarian.sephirah.v1; - -import "librarian/sephirah/v1/gebura.proto"; -import "librarian/sephirah/v1/tiphereth.proto"; - -option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; -option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; - -service LibrarianSentinelService { - // `Tiphereth` Use valid refresh_token and get two new token, a refresh_token can only be used once - rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); - - // `Gebura` `Sentinel` - rpc ReportSentinelInformation(ReportSentinelInformationRequest) returns (ReportSentinelInformationResponse); - // `Gebura` `Sentinel` - // Full update, changes are handled by librarian - rpc ReportAppBinaries(ReportAppBinariesRequest) returns (ReportAppBinariesResponse); -} - -message ReportSentinelInformationRequest { - repeated string hostnames = 1; - ServerScheme scheme = 2; - // valid when need_token is true - string get_token_url_path = 3; - string download_file_url_path = 4; - repeated SentinelLibrary libraries = 5; - message SentinelLibrary { - int64 id = 1; - string download_base_path = 2; - } - enum ServerScheme { - SERVER_SCHEME_UNSPECIFIED = 0; - SERVER_SCHEME_HTTP = 1; - SERVER_SCHEME_HTTPS = 2; - } -} - -message ReportSentinelInformationResponse {} - -message ReportAppBinariesRequest { - repeated SentinelAppBinary sentinel_app_binaries = 1; - message SentinelAppBinary { - AppBinary app_binary = 1; - int64 sentinel_library_id = 2; - string sentinel_generated_id = 3; - } -} - -message ReportAppBinariesResponse {} \ No newline at end of file diff --git a/proto/librarian/sephirah/v1/sentinel/sentinel_service.proto b/proto/librarian/sephirah/v1/sentinel/sentinel_service.proto new file mode 100644 index 00000000..89d759e9 --- /dev/null +++ b/proto/librarian/sephirah/v1/sentinel/sentinel_service.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.sentinel; + +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1.Sentinel"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1/sentinel;v1"; + +service LibrarianSentinelService { + // `Tiphereth` Use valid refresh_token and get two new token, a refresh_token can only be used once + rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); + + // `Gebura` `Sentinel` + rpc ReportSentinelInformation(ReportSentinelInformationRequest) returns (ReportSentinelInformationResponse); + // `Gebura` `Sentinel` + // Full update, changes are handled by librarian + rpc ReportAppBinaries(ReportAppBinariesRequest) returns (ReportAppBinariesResponse); +} + +message RefreshTokenRequest {} +message RefreshTokenResponse { + string access_token = 1; + string refresh_token = 2; +} + +message ReportSentinelInformationRequest { + string hostname = 1; + repeated string hostname_alternatives = 2; + // valid when need_token is true + string get_token_url_path = 3; + string download_file_base_path = 4; + repeated SentinelLibrary libraries = 5; +} +message ReportSentinelInformationResponse {} + +message ReportAppBinariesRequest { + repeated SentinelLibraryAppBinary app_binaries = 1; +} +message ReportAppBinariesResponse {} + +message SentinelLibrary { + int64 id = 1; + string download_base_path = 2; +} + +message SentinelLibraryAppBinary { + int64 sentinel_library_id = 1; + string sentinel_generated_id = 2; + int64 size_bytes = 3; + bool need_token = 4; + repeated SentinelLibraryAppBinaryFile files = 5; + + string name = 10; + string version = 11; + string developer = 12; + string publisher = 13; +} + +message SentinelLibraryAppBinaryFile { + librarian.v1.FileMetadata file_metadata = 1; + // should be path-joined to download_url when need_token is false + string server_file_path = 4; +} diff --git a/proto/librarian/sephirah/v1/base.proto b/proto/librarian/sephirah/v1/sephirah/base.proto similarity index 84% rename from proto/librarian/sephirah/v1/base.proto rename to proto/librarian/sephirah/v1/sephirah/base.proto index 1dd8de0b..88e04ef6 100644 --- a/proto/librarian/sephirah/v1/base.proto +++ b/proto/librarian/sephirah/v1/sephirah/base.proto @@ -1,9 +1,8 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; import "google/protobuf/timestamp.proto"; -import "librarian/v1/common.proto"; import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; @@ -56,18 +55,3 @@ message ServerInstanceSummary { string logo_url = 4; string background_url = 5; } - -message FileMetadata { - librarian.v1.InternalID id = 1; - string name = 2; - int64 size_bytes = 3; - FileType type = 4; - bytes sha256 = 5; - google.protobuf.Timestamp create_time = 6; -} - -enum FileType { - FILE_TYPE_UNSPECIFIED = 0; - FILE_TYPE_GEBURA_SAVE = 1; - FILE_TYPE_CHESED_IMAGE = 2; -} diff --git a/proto/librarian/sephirah/v1/binah.proto b/proto/librarian/sephirah/v1/sephirah/binah.proto similarity index 76% rename from proto/librarian/sephirah/v1/binah.proto rename to proto/librarian/sephirah/v1/sephirah/binah.proto index 37b5cfee..08540d35 100644 --- a/proto/librarian/sephirah/v1/binah.proto +++ b/proto/librarian/sephirah/v1/sephirah/binah.proto @@ -1,28 +1,29 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; -import "librarian/sephirah/v1/base.proto"; -import "librarian/v1/common.proto"; +import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; -message SetFileCapacityRequest { - librarian.v1.InternalID user_id = 1; - FileType file_type = 2; - int64 size_bytes = 3; -} +message GetStorageCapacityUsageRequest {} -message SetFileCapacityResponse {} +message GetStorageCapacityUsageResponse { + StorageCapacityUsage storage_capacity_usage = 1; +} -message GetFileCapacityRequest { - FileType file_type = 2; +message StorageCapacityUsage { + int64 total_limit_size_bytes = 1; + int64 total_used_size_bytes = 2; + // details are optional and depends on server implementation + repeated StorageCapacityUsageDetail details = 3; } -message GetFileCapacityResponse { - int64 limit_size_bytes = 1; - int64 used_size_bytes = 2; +message StorageCapacityUsageDetail { + librarian.v1.FileType type = 1; + int64 limit_size_bytes = 2; + int64 used_size_bytes = 3; } message UploadFileRequest { diff --git a/proto/librarian/sephirah/v1/chesed.proto b/proto/librarian/sephirah/v1/sephirah/chesed.proto similarity index 86% rename from proto/librarian/sephirah/v1/chesed.proto rename to proto/librarian/sephirah/v1/sephirah/chesed.proto index 0fed78dc..25a5ac99 100644 --- a/proto/librarian/sephirah/v1/chesed.proto +++ b/proto/librarian/sephirah/v1/sephirah/chesed.proto @@ -1,15 +1,14 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; -import "librarian/sephirah/v1/base.proto"; -import "librarian/v1/common.proto"; +import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; message UploadImageRequest { - FileMetadata file_metadata = 1; + librarian.v1.FileMetadata file_metadata = 1; string name = 2; string description = 3; } @@ -51,7 +50,7 @@ message GetImageRequest { } message GetImageResponse { - FileMetadata file_metadata = 1; + librarian.v1.FileMetadata file_metadata = 1; string name = 2; string description = 3; } diff --git a/proto/librarian/sephirah/v1/sephirah/gebura.proto b/proto/librarian/sephirah/v1/sephirah/gebura.proto new file mode 100644 index 00000000..a8990bc4 --- /dev/null +++ b/proto/librarian/sephirah/v1/sephirah/gebura.proto @@ -0,0 +1,429 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.sephirah; + +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; + +message SearchStoreAppsRequest { + librarian.v1.PagingRequest paging = 1; + string name_like = 2; +} +message SearchStoreAppsResponse { + librarian.v1.PagingResponse paging = 1; + repeated StoreAppDigest app_infos = 2; +} + +message GetStoreAppSummaryRequest { + librarian.v1.InternalID store_app_id = 1; + // default 0 means do not response binaries + int64 app_binary_limit = 2; + // default 0 means do not response save files + int64 app_save_file_limit = 3; + // default 0 means do not response acquired users + int64 acquired_user_limit = 4; +} + +message GetStoreAppSummaryResponse { + StoreAppSummary store_app = 1; +} + +message AcquireStoreAppRequest { + librarian.v1.InternalID store_app_id = 1; +} + +message AcquireStoreAppResponse { + // When acquired, server will create a new App with the same info and set the creator_device_id to the user's device id + librarian.v1.InternalID app_id = 1; +} + +message ListStoreAppBinariesRequest { + librarian.v1.PagingRequest paging = 1; + librarian.v1.InternalID app_id = 2; +} + +message ListStoreAppBinariesResponse { + librarian.v1.PagingResponse paging = 1; + repeated StoreAppBinary binaries = 2; +} + +message ListStoreAppBinaryFilesRequest { + librarian.v1.PagingRequest paging = 1; + librarian.v1.InternalID app_binary_id = 2; +} + +message ListStoreAppBinaryFilesResponse { + librarian.v1.PagingResponse paging = 1; + repeated StoreAppBinaryFile binary_files = 2; +} + +message DownloadStoreAppBinaryRequest { + librarian.v1.InternalID id = 1; +} + +message DownloadStoreAppBinaryResponse { + string download_base_url = 1; + // valid when need_token is true + optional string token = 2; + repeated string download_base_url_alternatives = 3; +} + +message ListStoreAppSaveFilesRequest { + librarian.v1.PagingRequest paging = 1; + librarian.v1.InternalID app_id = 2; +} + +message ListStoreAppSaveFilesResponse { + librarian.v1.PagingResponse paging = 1; + repeated StoreAppSaveFile save_files = 2; +} + +message DownloadStoreAppSaveFileRequest { + librarian.v1.InternalID id = 1; +} +message DownloadStoreAppSaveFileResponse { + string download_token = 1; +} + +message SearchAppInfosRequest { + librarian.v1.PagingRequest paging = 1; + string name_like = 2; + repeated string source_filter = 3; +} +message SearchAppInfosResponse { + librarian.v1.PagingResponse paging = 1; + repeated AppInfo app_infos = 2; +} + +message CreateAppRequest { + App app = 1; +} + +message CreateAppResponse { + librarian.v1.InternalID id = 1; +} + +message UpdateAppRequest { + App app = 1; +} + +message UpdateAppResponse {} + +message ListAppsRequest { + librarian.v1.PagingRequest paging = 1; + // List owned apps by default. + // Used to get other's **public** apps. + repeated librarian.v1.InternalID owner_id_filter = 2; + repeated librarian.v1.InternalID id_filter = 3; + repeated librarian.v1.InternalID device_id_filter = 5; +} + +message ListAppsResponse { + librarian.v1.PagingResponse paging = 1; + repeated App apps = 2; +} + +message BatchCreateAppRunTimeRequest { + repeated AppRunTime app_run_times = 1; +} + +message BatchCreateAppRunTimeResponse {} + +message SumAppRunTimeRequest { + repeated librarian.v1.InternalID app_id_filter = 1; + repeated librarian.v1.InternalID device_id_filter = 2; + repeated librarian.v1.TimeRange time_ranges_filter = 3; +} + +message SumAppRunTimeResponse { + message Group { + librarian.v1.TimeRange time_range = 1; + google.protobuf.Duration run_time_sum = 2; + } + repeated Group run_time_groups = 1; +} + +message ListAppRunTimesRequest { + librarian.v1.PagingRequest paging = 1; + repeated librarian.v1.InternalID app_id_filter = 2; + repeated librarian.v1.InternalID device_id_filter = 3; + librarian.v1.TimeRange time_range_cross = 4; +} + +message ListAppRunTimesResponse { + librarian.v1.PagingResponse paging = 1; + repeated AppRunTime app_run_times = 2; +} + +message DeleteAppRunTimeRequest { + librarian.v1.InternalID id = 1; +} + +message DeleteAppRunTimeResponse {} + +message AppRunTime { + librarian.v1.InternalID id = 1; + librarian.v1.InternalID app_id = 2; + librarian.v1.InternalID device_id = 3; + librarian.v1.TimeRange run_time = 4; +} + +message UploadAppSaveFileRequest { + librarian.v1.FileMetadata file_metadata = 1; + librarian.v1.InternalID app_id = 2; +} + +message UploadAppSaveFileResponse { + string upload_token = 1; +} + +message DownloadAppSaveFileRequest { + librarian.v1.InternalID id = 1; +} + +message DownloadAppSaveFileResponse { + string download_token = 2; +} + +message ListAppSaveFilesRequest { + librarian.v1.InternalID app_id = 1; +} + +message ListAppSaveFilesResponse { + message Result { + librarian.v1.InternalID id = 1; + librarian.v1.FileMetadata file = 2; + bool pinned = 3; + } + repeated Result results = 1; +} + +message DeleteAppSaveFileRequest { + librarian.v1.InternalID id = 1; +} + +message DeleteAppSaveFileResponse {} + +message PinAppSaveFileRequest { + librarian.v1.InternalID id = 1; +} + +message PinAppSaveFileResponse {} + +message UnpinAppSaveFileRequest { + librarian.v1.InternalID id = 1; +} + +message UnpinAppSaveFileResponse {} + +message GetAppSaveFileCapacityRequest { + librarian.v1.InternalID app_id = 1; +} + +message GetAppSaveFileCapacityResponse { + uint64 count = 1; + uint64 count_max = 2; + uint64 size_bytes = 3; + uint64 size_bytes_max = 4; + AppSaveFileCapacityStrategy strategy = 5; +} + +message SetAppSaveFileCapacityRequest { + librarian.v1.InternalID app_id = 1; + int64 count = 2; + int64 size_bytes = 3; + AppSaveFileCapacityStrategy strategy = 4; + // apply to all apps + bool apply_to_all = 5; +} + +message SetAppSaveFileCapacityResponse {} + +enum AppSaveFileCapacityStrategy { + APP_SAVE_FILE_CAPACITY_STRATEGY_UNSPECIFIED = 0; + // fail to save new file when reach limit + APP_SAVE_FILE_CAPACITY_STRATEGY_FAIL = 1; + // delete the oldest file and save new file + // check if delete the oldest file can't satisfy the limit, do not delete and fail to save new file + APP_SAVE_FILE_CAPACITY_STRATEGY_DELETE_OLDEST_OR_FAIL = 2; + // delete files until the limit is satisfied + // check if delete all files can't satisfy the limit, do not delete and fail to save new file + APP_SAVE_FILE_CAPACITY_STRATEGY_DELETE_UNTIL_SATISFIED = 3; +} + +message ListAppCategoriesRequest {} + +message ListAppCategoriesResponse { + repeated AppCategory app_categories = 1; +} + +message CreateAppCategoryRequest { + AppCategory app_category = 1; +} + +message CreateAppCategoryResponse { + librarian.v1.InternalID id = 1; +} + +message UpdateAppCategoryRequest { + AppCategory app_category = 1; +} + +message UpdateAppCategoryResponse {} + +message DeleteAppCategoryRequest { + librarian.v1.InternalID id = 1; +} + +message DeleteAppCategoryResponse {} + +message AppInfo { + // WellKnownAppInfoSource + string source = 1; + string source_app_id = 2; + optional string source_url = 3; + + string name = 10; + AppType type = 11; + string description = 12; + string icon_image_url = 13; + librarian.v1.InternalID icon_image_id = 14; + // must be horizontal, usually 16:9 + string background_image_url = 15; + librarian.v1.InternalID background_image_id = 16; + // must be vertical, usually 3:4 + string cover_image_url = 17; + librarian.v1.InternalID cover_image_id = 18; + repeated string tags = 19; + repeated string alt_names = 20; + string developer = 21; + string publisher = 22; +} + +message StoreAppSummary { + StoreApp store_app = 1; + int64 app_binary_count = 2; + repeated StoreAppBinary binaries = 3; + int64 app_save_file_count = 4; + repeated StoreAppSaveFile save_files = 5; + int64 acquired_count = 6; + repeated librarian.v1.InternalID acquired_user_ids = 7; +} + +message StoreApp { + librarian.v1.InternalID id = 1; + + // map of WellKnownAppInfoSource to source_app_id + map bound_app_source = 5; + // false by default, public store app makes it visible in store + bool public = 6; + + string name = 20; + AppType type = 21; + string description = 22; + // must be horizontal, usually 16:9 + librarian.v1.InternalID icon_image_id = 23; + librarian.v1.InternalID background_image_id = 24; + // must be vertical, usually 3:4 + librarian.v1.InternalID cover_image_id = 25; + repeated string tags = 26; + repeated string alt_names = 27; + string developer = 28; + string publisher = 29; +} + +message StoreAppDigest { + librarian.v1.InternalID id = 1; + + string name = 20; + AppType type = 21; + string short_description = 22; + // must be vertical, usually 3:4 + librarian.v1.InternalID cover_image_id = 25; + repeated string tags = 26; +} + +message StoreAppBinary { + librarian.v1.InternalID id = 1; + bool public = 2; + int64 size_bytes = 3; + + string name = 10; + string description = 11; + string version = 12; +} + +message StoreAppBinaryFile { + librarian.v1.InternalID id = 1; + librarian.v1.FileMetadata file = 2; + string download_path = 3; +} + +message StoreAppSaveFile { + librarian.v1.InternalID id = 1; + string name = 2; + string description = 3; + bool public = 4; + optional librarian.v1.FileMetadata file = 5; +} + +message App { + librarian.v1.InternalID id = 1; + + // version number is used to check if the app is updated + // set by server and always increase when updated + uint64 version_number = 2; + google.protobuf.Timestamp version_update_time = 3; + // set by server and can't be updated + librarian.v1.InternalID creator_device_id = 4; + // map of WellKnownAppInfoSource to source_app_id + map bound_app_source = 5; + // false by default, public app makes it visible to others + bool public = 6; + // set by server and can't be updated + // when created by user, leave it empty + // when created by store, set it to the store app id + optional librarian.v1.InternalID bound_store_app = 7; + // only valid when bound_store_app is set, default is false + // if not stop, the app is managed by the store and can't be updated by user + // if stop, user can get full control of the app, but the bound relationship can't be removed + optional bool stop_store_managing = 8; + + string name = 20; + AppType type = 21; + string description = 22; + string icon_image_url = 23; + // must be horizontal, usually 16:9 + librarian.v1.InternalID icon_image_id = 24; + string background_image_url = 25; + librarian.v1.InternalID background_image_id = 26; + // must be vertical, usually 3:4 + string cover_image_url = 27; + librarian.v1.InternalID cover_image_id = 28; + repeated string tags = 29; + repeated string alt_names = 30; + string developer = 31; + string publisher = 32; +} + +enum AppType { + APP_TYPE_UNSPECIFIED = 0; + APP_TYPE_GAME = 1; +} + +message AppCategory { + librarian.v1.InternalID id = 1; + + // version number is used to check if the app is updated + // set by server and always increase when updated + uint64 version_number = 2; + google.protobuf.Timestamp version_update_time = 3; + + string name = 10; + // Full update + repeated librarian.v1.InternalID app_ids = 11; +} diff --git a/proto/librarian/sephirah/v1/netzach.proto b/proto/librarian/sephirah/v1/sephirah/netzach.proto similarity index 99% rename from proto/librarian/sephirah/v1/netzach.proto rename to proto/librarian/sephirah/v1/sephirah/netzach.proto index 26f88e88..efe93d0b 100644 --- a/proto/librarian/sephirah/v1/netzach.proto +++ b/proto/librarian/sephirah/v1/sephirah/netzach.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; import "google/protobuf/timestamp.proto"; import "librarian/v1/common.proto"; diff --git a/proto/librarian/sephirah/v1/sephirah.proto b/proto/librarian/sephirah/v1/sephirah/sephirah_service.proto similarity index 71% rename from proto/librarian/sephirah/v1/sephirah.proto rename to proto/librarian/sephirah/v1/sephirah/sephirah_service.proto index 51b78ebe..f6e8ff15 100644 --- a/proto/librarian/sephirah/v1/sephirah.proto +++ b/proto/librarian/sephirah/v1/sephirah/sephirah_service.proto @@ -1,16 +1,15 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; import "google/protobuf/timestamp.proto"; -import "librarian/sephirah/v1/binah.proto"; -import "librarian/sephirah/v1/chesed.proto"; -import "librarian/sephirah/v1/gebura.proto"; -import "librarian/sephirah/v1/hokma.proto"; -import "librarian/sephirah/v1/netzach.proto"; -import "librarian/sephirah/v1/tiphereth.proto"; -import "librarian/sephirah/v1/yesod.proto"; -import "librarian/sephirah/v1/base.proto"; +import "librarian/sephirah/v1/sephirah/base.proto"; +import "librarian/sephirah/v1/sephirah/binah.proto"; +import "librarian/sephirah/v1/sephirah/chesed.proto"; +import "librarian/sephirah/v1/sephirah/gebura.proto"; +import "librarian/sephirah/v1/sephirah/netzach.proto"; +import "librarian/sephirah/v1/sephirah/tiphereth.proto"; +import "librarian/sephirah/v1/sephirah/yesod.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; @@ -34,6 +33,7 @@ service LibrarianSephirahService { // Server can close the stream at any time, client should reconnect if needed **with backoff**. // Only used to improve real-time experience, no guarantee of delivery. rpc ListenServerEvent(ListenServerEventRequest) returns (stream ListenServerEventResponse); + // `Tiphereth` `Normal` Login via password and get two token rpc GetToken(GetTokenRequest) returns (GetTokenResponse); // `Tiphereth` `Normal` `Porter` Use valid refresh_token and get two new token, a refresh_token can only be used once @@ -46,6 +46,8 @@ service LibrarianSephirahService { rpc GetUser(GetUserRequest) returns (GetUserResponse); // `Tiphereth` Self register as a new normal user rpc RegisterUser(RegisterUserRequest) returns (RegisterUserResponse); + // `Tiphereth` `Normal` Update self user info + rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse); // `Tiphereth` `Normal` Client should register device after the first login // and store the device_id locally. // The server could add extra limits to non-registered device @@ -66,8 +68,8 @@ service LibrarianSephirahService { // `Tiphereth` `Normal` List third-party account binded to current user. rpc ListLinkAccounts(ListLinkAccountsRequest) returns (ListLinkAccountsResponse); - // `Tiphereth` `Normal limited` - rpc ListPorterGroups(ListPorterGroupsRequest) returns (ListPorterGroupsResponse); + // `Tiphereth` `Normal` + rpc ListPorterDigests(ListPorterDigestsRequest) returns (ListPorterDigestsResponse); // `Tiphereth` `Normal` rpc CreatePorterContext(CreatePorterContextRequest) returns (CreatePorterContextResponse); // `Tiphereth` `Normal` @@ -76,7 +78,7 @@ service LibrarianSephirahService { rpc UpdatePorterContext(UpdatePorterContextRequest) returns (UpdatePorterContextResponse); // `Binah` `Normal` - rpc GetFileCapacity(GetFileCapacityRequest) returns (GetFileCapacityResponse); + rpc GetStorageCapacityUsage(GetStorageCapacityUsageRequest) returns (GetStorageCapacityUsageResponse); // `Binah` `upload_token` rpc UploadFile(stream UploadFileRequest) returns (stream UploadFileResponse); // `Binah` `download_token` @@ -112,52 +114,42 @@ service LibrarianSephirahService { // `Chesed` `Normal` rpc DownloadImage(DownloadImageRequest) returns (DownloadImageResponse); - // `Gebura` `Normal` Asynchronous update app infos. - // Request on INTERNAL app info applies to all bound external app infos. - // Create an INTERNAL app info when requested external app info does not exist - // Server should implement a sync rate limit to prevent abuse, - // when rate limit reached, return without real sync. - rpc SyncAppInfos(SyncAppInfosRequest) returns (SyncAppInfosResponse); - // `Gebura` `Normal` Asynchronously update app infos associated with an account. - // Create an INTERNAL app info when associated external app info does not exist. - // Server should implement a sync rate limit to prevent abuse, - // when rate limit reached, return without real sync. - rpc SyncAccountAppInfos(SyncAccountAppInfosRequest) returns (SyncAccountAppInfosResponse); - // `Gebura` `Normal` Search app infos that already exist in server - rpc SearchAppInfos(SearchAppInfosRequest) returns (SearchAppInfosResponse); - // `Gebura` `Normal` Search new app infos from external - rpc SearchNewAppInfos(SearchNewAppInfosRequest) returns (SearchNewAppInfosResponse); - // `Gebura` `Normal` Flattened app info, data priority is 1.INTERNAL, 2.STEAM. - // e.g. `id` will always from INTERNAL, `description` may from STEAM if it is empty in INTERNAL - rpc GetAppInfo(GetAppInfoRequest) returns (GetAppInfoResponse); - // `Gebura` `Normal` Original bound apps info of required app - rpc GetBoundAppInfos(GetBoundAppInfosRequest) returns (GetBoundAppInfosResponse); // `Gebura` `Normal` - rpc PurchaseAppInfo(PurchaseAppInfoRequest) returns (PurchaseAppInfoResponse); + rpc SearchStoreApps(SearchStoreAppsRequest) returns (SearchStoreAppsResponse); + // `Gebura` `Normal` + rpc GetStoreAppSummary(GetStoreAppSummaryRequest) returns (GetStoreAppSummaryResponse); // `Gebura` `Normal` - // Default get user purchased apps - // Use `source` to get purchase info from bound account - // only support steam - rpc GetPurchasedAppInfos(GetPurchasedAppInfosRequest) returns (GetPurchasedAppInfosResponse); + rpc AcquireStoreApp(AcquireStoreAppRequest) returns (AcquireStoreAppResponse); // `Gebura` `Normal` - rpc CreateApp(CreateAppRequest) returns (CreateAppResponse); + rpc ListStoreAppBinaries(ListStoreAppBinariesRequest) returns (ListStoreAppBinariesResponse); // `Gebura` `Normal` - rpc UpdateApp(UpdateAppRequest) returns (UpdateAppResponse); + rpc ListStoreAppBinaryFiles(ListStoreAppBinaryFilesRequest) returns (ListStoreAppBinaryFilesResponse); // `Gebura` `Normal` - rpc ListApps(ListAppsRequest) returns (ListAppsResponse); + rpc DownloadStoreAppBinary(DownloadStoreAppBinaryRequest) returns (DownloadStoreAppBinaryResponse); + // `Gebura` `Normal` - rpc AssignApp(AssignAppRequest) returns (AssignAppResponse); + rpc ListStoreAppSaveFiles(ListStoreAppSaveFilesRequest) returns (ListStoreAppSaveFilesResponse); // `Gebura` `Normal` - rpc UnAssignApp(UnAssignAppRequest) returns (UnAssignAppResponse); + rpc DownloadStoreAppSaveFile(DownloadStoreAppSaveFileRequest) returns (DownloadStoreAppSaveFileResponse); + // `Gebura` `Normal` Search app infos + rpc SearchAppInfos(SearchAppInfosRequest) returns (SearchAppInfosResponse); + // `Gebura` `Normal` + rpc CreateApp(CreateAppRequest) returns (CreateAppResponse); + // `Gebura` `Normal` + rpc UpdateApp(UpdateAppRequest) returns (UpdateAppResponse); // `Gebura` `Normal` - rpc DownloadAppBinary(DownloadAppBinaryRequest) returns (DownloadAppBinaryResponse); + rpc ListApps(ListAppsRequest) returns (ListAppsResponse); // `Gebura` `Normal` - rpc AddAppRunTime(AddAppRunTimeRequest) returns (AddAppRunTimeResponse); - // `Gebura` `Normal` Only support AGGREGATION_TYPE_OVERALL + rpc BatchCreateAppRunTime(BatchCreateAppRunTimeRequest) returns (BatchCreateAppRunTimeResponse); + // `Gebura` `Normal` rpc SumAppRunTime(SumAppRunTimeRequest) returns (SumAppRunTimeResponse); + // `Gebura` `Normal` + rpc ListAppRunTimes(ListAppRunTimesRequest) returns (ListAppRunTimesResponse); + // `Gebura` `Normal` + rpc DeleteAppRunTime(DeleteAppRunTimeRequest) returns (DeleteAppRunTimeResponse); // `Gebura` `Normal` rpc UploadAppSaveFile(UploadAppSaveFileRequest) returns (UploadAppSaveFileResponse); @@ -166,36 +158,15 @@ service LibrarianSephirahService { // `Gebura` `Normal` rpc ListAppSaveFiles(ListAppSaveFilesRequest) returns (ListAppSaveFilesResponse); // `Gebura` `Normal` - rpc RemoveAppSaveFile(RemoveAppSaveFileRequest) returns (RemoveAppSaveFileResponse); + rpc DeleteAppSaveFile(DeleteAppSaveFileRequest) returns (DeleteAppSaveFileResponse); // `Gebura` `Normal` rpc PinAppSaveFile(PinAppSaveFileRequest) returns (PinAppSaveFileResponse); // `Gebura` `Normal` rpc UnpinAppSaveFile(UnpinAppSaveFileRequest) returns (UnpinAppSaveFileResponse); // `Gebura` `Normal` - rpc SetAppSaveFileCapacity(SetAppSaveFileCapacityRequest) returns (SetAppSaveFileCapacityResponse); - // `Gebura` `Normal` rpc GetAppSaveFileCapacity(GetAppSaveFileCapacityRequest) returns (GetAppSaveFileCapacityResponse); // `Gebura` `Normal` - rpc SetAppSaveFileCapacityDefault(SetAppSaveFileCapacityDefaultRequest) returns (SetAppSaveFileCapacityDefaultResponse); - // `Gebura` `Normal` - rpc GetAppSaveFileCapacityDefault(GetAppSaveFileCapacityDefaultRequest) returns (GetAppSaveFileCapacityDefaultResponse); - - // `Gebura` `Admin` - rpc CreateSharedAppSave(CreateSharedAppSaveRequest) returns (CreateSharedAppSaveResponse); - // `Gebura` `Admin` - rpc UpdateSharedAppSave(UpdateSharedAppSaveRequest) returns (UpdateSharedAppSaveResponse); - // `Gebura` `Normal` - rpc ListSharedAppSaves(ListSharedAppSavesRequest) returns (ListSharedAppSavesResponse); - // `Gebura` `Admin` - rpc RemoveSharedAppSave(RemoveSharedAppSaveRequest) returns (RemoveSharedAppSaveResponse); - // `Gebura` `Admin` `Normal limited` - rpc CreateSharedAppSaveFile(CreateSharedAppSaveFileRequest) returns (CreateSharedAppSaveFileResponse); - // `Gebura` `Admin` `Normal limited` - rpc UpdateSharedAppSaveFile(UpdateSharedAppSaveFileRequest) returns (UpdateSharedAppSaveFileResponse); - // `Gebura` `Normal` - rpc ListSharedAppSaveFiles(ListSharedAppSaveFilesRequest) returns (ListSharedAppSaveFilesResponse); - // `Gebura` `Admin` `Normal limited` - rpc RemoveSharedAppSaveFile(RemoveSharedAppSaveFileRequest) returns (RemoveSharedAppSaveFileResponse); + rpc SetAppSaveFileCapacity(SetAppSaveFileCapacityRequest) returns (SetAppSaveFileCapacityResponse); // `Gebura` `Normal` rpc ListAppCategories(ListAppCategoriesRequest) returns (ListAppCategoriesResponse); @@ -204,7 +175,7 @@ service LibrarianSephirahService { // `Gebura` `Normal` rpc UpdateAppCategory(UpdateAppCategoryRequest) returns (UpdateAppCategoryResponse); // `Gebura` `Normal` - rpc RemoveAppCategory(RemoveAppCategoryRequest) returns (RemoveAppCategoryResponse); + rpc DeleteAppCategory(DeleteAppCategoryRequest) returns (DeleteAppCategoryResponse); // `Netzach` `Normal` rpc CreateNotifyTarget(CreateNotifyTargetRequest) returns (CreateNotifyTargetResponse); @@ -248,8 +219,6 @@ service LibrarianSephirahService { // `Yesod` `Normal` rpc ListFeedItems(ListFeedItemsRequest) returns (ListFeedItemsResponse); // `Yesod` `Normal` - rpc GroupFeedItems(GroupFeedItemsRequest) returns (GroupFeedItemsResponse); - // `Yesod` `Normal` rpc GetFeedItem(GetFeedItemRequest) returns (GetFeedItemResponse); // `Yesod` `Normal` rpc GetBatchFeedItems(GetBatchFeedItemsRequest) returns (GetBatchFeedItemsResponse); @@ -273,13 +242,6 @@ service LibrarianSephirahService { rpc PUpsertFeed(PUpsertFeedRequest) returns (PUpsertFeedResponse); // `Yesod` `Porter` rpc PGetFeed(PGetFeedRequest) returns (PGetFeedResponse); - - // `Hokma` `Normal` - rpc CreateTag(CreateTagRequest) returns (CreateTagResponse); - // `Hokma` `Normal` - rpc UpdateTag(UpdateTagRequest) returns (UpdateTagResponse); - // `Hokma` `Normal` - rpc ListTags(ListTagsRequest) returns (ListTagsResponse); } message ListenServerEventRequest {} diff --git a/proto/librarian/sephirah/v1/tiphereth.proto b/proto/librarian/sephirah/v1/sephirah/tiphereth.proto similarity index 86% rename from proto/librarian/sephirah/v1/tiphereth.proto rename to proto/librarian/sephirah/v1/sephirah/tiphereth.proto index 1f8fcfd4..58c1c845 100644 --- a/proto/librarian/sephirah/v1/tiphereth.proto +++ b/proto/librarian/sephirah/v1/sephirah/tiphereth.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; import "google/protobuf/timestamp.proto"; import "librarian/v1/common.proto"; @@ -89,16 +89,9 @@ message DeleteUserSessionRequest { } message DeleteUserSessionResponse {} -message CreateUserRequest { - User user = 1; -} -message CreateUserResponse { - librarian.v1.InternalID id = 1; -} - message UpdateUserRequest { User user = 1; - // Original password. Required if new password is not empty string + // Original password. Required if new password is not empty optional string password = 2; } message UpdateUserResponse {} @@ -112,25 +105,18 @@ message GetUserResponse { User user = 1; } -message ListUsersRequest { - librarian.v1.PagingRequest paging = 1; - repeated UserType type_filter = 2; - repeated UserStatus status_filter = 3; -} -message ListUsersResponse { - librarian.v1.PagingResponse paging = 1; - // self will not contained in the list - repeated User users = 2; -} - message LinkAccountRequest { - librarian.v1.AccountID account_id = 1; + // WellKnownAccountPlatform + string platform = 1; + string platform_account_id = 2; } message LinkAccountResponse { librarian.v1.InternalID account_id = 1; } message UnLinkAccountRequest { - librarian.v1.AccountID account_id = 1; + // WellKnownAccountPlatform + string platform = 1; + string platform_account_id = 2; } message UnLinkAccountResponse {} @@ -139,31 +125,17 @@ message ListLinkAccountsRequest { optional librarian.v1.InternalID user_id = 1; } message ListLinkAccountsResponse { - repeated librarian.v1.Account accounts = 1; + repeated Account accounts = 1; } -message ListPortersRequest { - librarian.v1.PagingRequest paging = 1; -} -message ListPortersResponse { - librarian.v1.PagingResponse paging = 1; - repeated Porter porters = 2; -} - -message UpdatePorterStatusRequest { - librarian.v1.InternalID porter_id = 1; - UserStatus status = 2; -} -message UpdatePorterStatusResponse {} - -message ListPorterGroupsRequest { +message ListPorterDigestsRequest { librarian.v1.PagingRequest paging = 1; // Normal user can only list active porters repeated UserStatus status_filter = 2; } -message ListPorterGroupsResponse { +message ListPorterDigestsResponse { librarian.v1.PagingResponse paging = 1; - repeated PorterGroup porter_groups = 2; + repeated PorterDigest porter_groups = 2; } message CreatePorterContextRequest { @@ -193,6 +165,17 @@ message DeletePorterContextRequest { } message DeletePorterContextResponse {} +message Account { + librarian.v1.InternalID id = 1; + // WellKnownPlatform + string platform = 2; + string platform_account_id = 3; + string name = 4; + string profile_url = 5; + string avatar_url = 6; + google.protobuf.Timestamp latest_update_time = 7; +} + message User { librarian.v1.InternalID id = 1; string username = 2; @@ -305,7 +288,7 @@ enum PorterContextHandleStatus { PORTER_CONTEXT_HANDLE_STATUS_BLOCKED = 4; } -message PorterGroup { +message PorterDigest { librarian.v1.PorterBinarySummary binary_summary = 1; string global_name = 2; repeated string regions = 3; diff --git a/proto/librarian/sephirah/v1/yesod.proto b/proto/librarian/sephirah/v1/sephirah/yesod.proto similarity index 92% rename from proto/librarian/sephirah/v1/yesod.proto rename to proto/librarian/sephirah/v1/sephirah/yesod.proto index 50b420de..4acbec30 100644 --- a/proto/librarian/sephirah/v1/yesod.proto +++ b/proto/librarian/sephirah/v1/sephirah/yesod.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package librarian.sephirah.v1; +package librarian.sephirah.v1.sephirah; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -85,24 +85,6 @@ message ListFeedItemsResponse { repeated FeedItemDigest items = 2; } -message GroupFeedItemsRequest { - librarian.v1.TimeAggregation publish_time_aggregation = 1; - repeated librarian.v1.InternalID feed_id_filter = 2; - repeated string author_filter = 3; - repeated string publish_platform_filter = 4; - repeated string category_filter = 5; - // NULL means no limit - optional int64 group_size = 7; -} - -message GroupFeedItemsResponse { - message FeedItemsGroup { - librarian.v1.TimeRange time_range = 1; - repeated FeedItemDigest items = 2; - } - repeated FeedItemsGroup groups = 1; -} - message GetFeedItemRequest { librarian.v1.InternalID id = 1; } diff --git a/proto/librarian/v1/common.proto b/proto/librarian/v1/common.proto index 73af3cba..25292e2f 100644 --- a/proto/librarian/v1/common.proto +++ b/proto/librarian/v1/common.proto @@ -2,143 +2,12 @@ syntax = "proto3"; package librarian.v1; -import "buf/validate/validate.proto"; -import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/v1;v1"; -message PagingRequest { - // start from 1, not 0 - int64 page_num = 1 [(buf.validate.field).int64.gt = 0]; - int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; -} - -message PagingResponse { - int64 total_size = 1 [(buf.validate.field).int64.gte = 0]; -} - -// half-open e.g. -// { -// start_time: "2023.01.01 00:00", -// duration: "1d" -// } -// means the whole day of 2023.1.1; -// or [2023.01.01 00:00 , 2023.01.02 00:00) -message TimeRange { - google.protobuf.Timestamp start_time = 1; - google.protobuf.Duration duration = 2 [(buf.validate.field).duration.gte = {seconds: 0}]; -} - -// Should be used in request messages -message TimeAggregation { - enum AggregationType { - AGGREGATION_TYPE_UNSPECIFIED = 0; - AGGREGATION_TYPE_OVERALL = 1; - AGGREGATION_TYPE_YEAR = 2; - AGGREGATION_TYPE_MONTH = 3; - AGGREGATION_TYPE_DAY = 4; - } - AggregationType aggregation_type = 1; - // The `TimeRange` should be adjusted on the server side to align with the nearest boundary when aggregating. - // e.g. the request TimeRange is 2023.2.13 9:26 ~ 2023.3.14 17:21. - // For aggregating by year, rounded to 2023.1.1 00:00 ~ 2024.1.1 00:00. - // For aggregating by month, rounded to 2023.2.1 00:00 ~ 2023.4.1 00:00. - // For aggregating by day, rounded to 2023.2.13 00:00 ~ 2023.3.15 00:00. - TimeRange time_range = 2; -} - -// A globally unique identifier generated by `Searcher` -message InternalID { - int64 id = 1; -} - -message Account { - InternalID id = 1; - // WellKnownPlatform - string platform = 2; - string platform_account_id = 3; - string name = 4; - string profile_url = 5; - string avatar_url = 6; - google.protobuf.Timestamp latest_update_time = 7; -} - -message AccountID { - // WellKnownAccountPlatform - string platform = 1; - string platform_account_id = 2; -} - -enum AccountAppRelationType { - ACCOUNT_APP_RELATION_TYPE_UNSPECIFIED = 0; - ACCOUNT_APP_RELATION_TYPE_OWN = 1; -} - -message AppInfo { - InternalID id = 1; - // ignore `source` and `source_app_id` when `internal` is true - bool internal = 2; - // WellKnownAppInfoSource - string source = 3; - string source_app_id = 4; - optional string source_url = 5; - - optional AppInfoDetails details = 6; - - string name = 7; - AppType type = 8; - string short_description = 9; - string icon_image_url = 10; - // must be horizontal, usually 16:9 - string background_image_url = 11; - // must be vertical, usually 3:4 - string cover_image_url = 12; - repeated string tags = 13; - repeated string alt_names = 14; -} - -// Mixed info of bound apps -message AppInfoMixed { - // internal app id - InternalID id = 1; - - optional AppInfoDetails details = 6; - - string name = 7; - AppType type = 8; - string short_description = 9; - string icon_image_url = 10; - // must be horizontal, usually 16:9 - string background_image_url = 11; - // must be vertical, usually 3:4 - string cover_image_url = 12; - repeated string tags = 13; - repeated string alt_names = 14; -} - -message AppInfoID { - bool internal = 1; - // WellKnownAppInfoSource - string source = 2; - string source_app_id = 3; -} - -message AppInfoDetails { - string description = 1; - string release_date = 2; - string developer = 3; - string publisher = 4; - string version = 5; - repeated string image_urls = 6; -} - -enum AppType { - APP_TYPE_UNSPECIFIED = 0; - APP_TYPE_GAME = 1; -} - message Feed { InternalID id = 1; // `standard field` diff --git a/proto/librarian/v1/wellknown.proto b/proto/librarian/v1/wellknown.proto index a58c5223..0141237c 100644 --- a/proto/librarian/v1/wellknown.proto +++ b/proto/librarian/v1/wellknown.proto @@ -2,8 +2,10 @@ syntax = "proto3"; package librarian.v1; +import "buf/validate/validate.proto"; import "google/protobuf/descriptor.proto"; -import "librarian/v1/common.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/v1;v1"; @@ -12,6 +14,55 @@ extend google.protobuf.EnumValueOptions { string to_string = 1000; } +message PagingRequest { + // start from 1, not 0 + int64 page_num = 1 [(buf.validate.field).int64.gt = 0]; + int64 page_size = 2 [(buf.validate.field).int64.gt = 0]; +} + +message PagingResponse { + int64 total_size = 1 [(buf.validate.field).int64.gte = 0]; +} + +// half-open e.g. +// { +// start_time: "2023.01.01 00:00", +// duration: "1d" +// } +// means the whole day of 2023.1.1; +// or [2023.01.01 00:00 , 2023.01.02 00:00) +message TimeRange { + google.protobuf.Timestamp start_time = 1; + google.protobuf.Duration duration = 2 [(buf.validate.field).duration.gte = {seconds: 0}]; +} + +// A globally unique identifier +message InternalID { + int64 id = 1; +} + +message I18NString { + // The key of the string. MUST only contain a-zA-Z0-9_.- + string key = 1; + // The default value of the string. + string value = 2; +} + +message FileMetadata { + librarian.v1.InternalID id = 1; + string name = 2; + int64 size_bytes = 3; + FileType type = 4; + bytes sha256 = 5; + google.protobuf.Timestamp create_time = 6; +} + +enum FileType { + FILE_TYPE_UNSPECIFIED = 0; + FILE_TYPE_GEBURA_SAVE = 1; + FILE_TYPE_CHESED_IMAGE = 2; +} + // FeatureFlag is used to identify features. // It will also be sent to clients for UI display. message FeatureFlag { From 114d2fb890c8799b888db6dbd049c9f4d0e95f48 Mon Sep 17 00:00:00 2001 From: MuZhou233 Date: Sat, 8 Mar 2025 19:34:27 +0800 Subject: [PATCH 3/3] complete --- .github/workflows/build.yml | 2 +- .github/workflows/check-for-pr.yml | 2 +- .../sephirah/v1/angela/angela_service.proto | 20 ++++++- .../sephirah/v1/angela/tiphereth.proto | 49 ++++++++++++++++ .../sephirah/v1/porter/porter_service.proto | 56 +++++++++++++++++++ .../librarian/sephirah/v1/sephirah/base.proto | 5 +- .../sephirah/v1/sephirah/netzach.proto | 20 ------- .../v1/sephirah/sephirah_service.proto | 20 +++---- .../sephirah/v1/sephirah/tiphereth.proto | 8 --- .../sephirah/v1/sephirah/yesod.proto | 15 ----- 10 files changed, 135 insertions(+), 62 deletions(-) create mode 100644 proto/librarian/sephirah/v1/porter/porter_service.proto diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0c9330e..88d90903 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: run: make install-plugins - name: Setup bufbuild - uses: bufbuild/buf-setup-action@v1.48.0 + uses: bufbuild/buf-setup-action@v1.50.0 - name: Build run: make generate diff --git a/.github/workflows/check-for-pr.yml b/.github/workflows/check-for-pr.yml index 0f3b33f3..dad87df7 100644 --- a/.github/workflows/check-for-pr.yml +++ b/.github/workflows/check-for-pr.yml @@ -37,7 +37,7 @@ jobs: uses: arduino/setup-protoc@v2 - name: Setup bufbuild - uses: bufbuild/buf-setup-action@v1.48.0 + uses: bufbuild/buf-setup-action@v1.50.0 - name: Check run: make check \ No newline at end of file diff --git a/proto/librarian/sephirah/v1/angela/angela_service.proto b/proto/librarian/sephirah/v1/angela/angela_service.proto index 154c205d..4f47fcaf 100644 --- a/proto/librarian/sephirah/v1/angela/angela_service.proto +++ b/proto/librarian/sephirah/v1/angela/angela_service.proto @@ -16,7 +16,7 @@ option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; */ service LibrarianAngelaService { // Allow anonymous call, use accessToken to get complete information - rpc GetServerInformation(sephirah.GetServerInformationRequest) returns (sephirah.GetServerInformationResponse); + rpc GetServerInformation(GetServerInformationRequest) returns (GetServerInformationResponse); rpc GetServerConfig(GetServerConfigRequest) returns (GetServerConfigResponse); rpc UpdateServerConfig(UpdateServerConfigRequest) returns (UpdateServerConfigResponse); @@ -40,6 +40,17 @@ service LibrarianAngelaService { // `Tiphereth` Delete porter, only when porter is disabled rpc DeletePorter(DeletePorterRequest) returns (DeletePorterResponse); + // `Tiphereth` + rpc CreateSentinel(CreateSentinelRequest) returns (CreateSentinelResponse); + // `Tiphereth` + rpc GetSentinelToken(GetSentinelTokenRequest) returns (GetSentinelTokenResponse); + // `Tiphereth` + rpc UpdateSentinel(UpdateSentinelRequest) returns (UpdateSentinelResponse); + // `Tiphereth` + rpc ListSentinels(ListSentinelsRequest) returns (ListSentinelsResponse); + // `Tiphereth` + rpc DeleteSentinel(DeleteSentinelRequest) returns (DeleteSentinelResponse); + // `Binah` rpc ListStorageCapacityUsage(ListStorageCapacityUsageRequest) returns (ListStorageCapacityUsageResponse); // `Binah` `upload_token` @@ -88,6 +99,13 @@ service LibrarianAngelaService { rpc DeleteStoreAppSaveFile(DeleteStoreAppSaveFileRequest) returns (DeleteStoreAppSaveFileResponse); } +message GetServerInformationRequest { + optional bool with_status_report = 1; +} +message GetServerInformationResponse { + sephirah.ServerInformation server_information = 1; +} + message GetServerConfigRequest {} message GetServerConfigResponse { repeated ServerConfigSection sections = 1; diff --git a/proto/librarian/sephirah/v1/angela/tiphereth.proto b/proto/librarian/sephirah/v1/angela/tiphereth.proto index 4b97622c..38a1118a 100644 --- a/proto/librarian/sephirah/v1/angela/tiphereth.proto +++ b/proto/librarian/sephirah/v1/angela/tiphereth.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package librarian.sephirah.v1.angela; +import "google/protobuf/timestamp.proto"; import "librarian/sephirah/v1/sephirah/tiphereth.proto"; import "librarian/v1/wellknown.proto"; @@ -73,3 +74,51 @@ message DeletePorterRequest { librarian.v1.InternalID porter_id = 1; } message DeletePorterResponse {} + +message CreateSentinelRequest { + Sentinel sentinel = 1; +} +message CreateSentinelResponse { + librarian.v1.InternalID id = 1; +} + +message ListSentinelsRequest { + librarian.v1.PagingRequest paging = 1; +} +message ListSentinelsResponse { + librarian.v1.PagingResponse paging = 1; + repeated Sentinel sentinels = 2; +} + +message GetSentinelTokenRequest { + librarian.v1.InternalID sentinel_id = 1; + google.protobuf.Timestamp expiration_time = 2; +} +message GetSentinelTokenResponse { + string refresh_token = 1; +} + +message UpdateSentinelRequest { + Sentinel sentinel = 1; +} +message UpdateSentinelResponse {} + +message DeleteSentinelRequest { + librarian.v1.InternalID sentinel_id = 1; +} +message DeleteSentinelResponse {} + +message Sentinel { + librarian.v1.InternalID id = 1; + string name = 2; + string description = 3; + librarian.v1.InternalID create_user_id = 4; + repeated string allowed_ips = 5; + SentinelStatus status = 6; +} + +enum SentinelStatus { + SENTINEL_STATUS_UNSPECIFIED = 0; + SENTINEL_STATUS_ACTIVE = 1; + SENTINEL_STATUS_BLOCKED = 2; +} diff --git a/proto/librarian/sephirah/v1/porter/porter_service.proto b/proto/librarian/sephirah/v1/porter/porter_service.proto new file mode 100644 index 00000000..897ad228 --- /dev/null +++ b/proto/librarian/sephirah/v1/porter/porter_service.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; + +package librarian.sephirah.v1.porter; + +import "librarian/v1/common.proto"; +import "librarian/v1/wellknown.proto"; + +option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1.Porter"; +option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1/porter;v1"; + +service LibrarianSephirahPorterService { + // `Tiphereth` `Porter` Obtain access_token of a specific user after user authorization. + // This token can be used to perform actions on behalf of the user. + rpc AcquireUserToken(AcquireUserTokenRequest) returns (AcquireUserTokenResponse); + + // `Netzach` `Porter` + rpc GetNotifyTargetItems(GetNotifyTargetItemsRequest) returns (GetNotifyTargetItemsResponse); + + // `Yesod` `Porter` + rpc UpsertFeed(UpsertFeedRequest) returns (UpsertFeedResponse); + // `Yesod` `Porter` + rpc GetFeed(GetFeedRequest) returns (GetFeedResponse); +} + +message AcquireUserTokenRequest { + librarian.v1.InternalID user_id = 1; +} + +message AcquireUserTokenResponse { + string access_token = 1; +} + +message GetNotifyTargetItemsRequest { + librarian.v1.InternalID id = 1; + librarian.v1.PagingRequest paging = 2; +} +message GetNotifyTargetItemsResponse { + librarian.v1.PagingResponse paging = 1; + librarian.v1.FeatureRequest destination = 2; + repeated librarian.v1.FeedItem items = 3; +} + +message UpsertFeedRequest { + librarian.v1.InternalID id = 1; + librarian.v1.Feed data = 2; +} + +message UpsertFeedResponse {} + +message GetFeedRequest { + librarian.v1.InternalID id = 1; +} + +message GetFeedResponse { + librarian.v1.Feed data = 1; +} diff --git a/proto/librarian/sephirah/v1/sephirah/base.proto b/proto/librarian/sephirah/v1/sephirah/base.proto index 88e04ef6..f32ace0c 100644 --- a/proto/librarian/sephirah/v1/sephirah/base.proto +++ b/proto/librarian/sephirah/v1/sephirah/base.proto @@ -8,10 +8,7 @@ import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; option go_package = "github.com/tuihub/protos/pkg/librarian/sephirah/v1;v1"; -message GetServerInformationRequest { - optional bool with_status_report = 1; -} -message GetServerInformationResponse { +message ServerInformation { // For manual inspection only, the client may display but should not parse the response. ServerBinarySummary server_binary_summary = 1; // For manual inspection only, the client may display but should not parse the response. diff --git a/proto/librarian/sephirah/v1/sephirah/netzach.proto b/proto/librarian/sephirah/v1/sephirah/netzach.proto index efe93d0b..8a635e3b 100644 --- a/proto/librarian/sephirah/v1/sephirah/netzach.proto +++ b/proto/librarian/sephirah/v1/sephirah/netzach.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package librarian.sephirah.v1.sephirah; import "google/protobuf/timestamp.proto"; -import "librarian/v1/common.proto"; import "librarian/v1/wellknown.proto"; option csharp_namespace = "TuiHub.Protos.Librarian.Sephirah.V1"; @@ -53,16 +52,6 @@ message ListNotifyFlowsResponse { repeated NotifyFlow flows = 2; } -message PorterGetNotifyTargetItemsRequest { - librarian.v1.InternalID id = 1; - librarian.v1.PagingRequest paging = 2; -} -message PorterGetNotifyTargetItemsResponse { - librarian.v1.PagingResponse paging = 1; - librarian.v1.FeatureRequest destination = 2; - repeated librarian.v1.FeedItem items = 3; -} - message NotifyTarget { librarian.v1.InternalID id = 1; string name = 2; @@ -112,7 +101,6 @@ enum NotifyFlowStatus { message ListSystemNotificationsRequest { librarian.v1.PagingRequest paging = 1; - repeated SystemNotificationType type_filter = 2; repeated SystemNotificationLevel level_filter = 3; repeated SystemNotificationStatus status_filter = 4; } @@ -131,7 +119,6 @@ message UpdateSystemNotificationResponse {} message SystemNotification { librarian.v1.InternalID id = 1; - SystemNotificationType type = 2; SystemNotificationLevel level = 3; SystemNotificationStatus status = 4; string title = 5; @@ -149,13 +136,6 @@ enum SystemNotificationLevel { SYSTEM_NOTIFICATION_LEVEL_INFO = 4; } -enum SystemNotificationType { - SYSTEM_NOTIFICATION_TYPE_UNSPECIFIED = 0; - // Limited to admin user - SYSTEM_NOTIFICATION_TYPE_SYSTEM = 1; - SYSTEM_NOTIFICATION_TYPE_USER = 2; -} - enum SystemNotificationStatus { SYSTEM_NOTIFICATION_STATUS_UNSPECIFIED = 0; SYSTEM_NOTIFICATION_STATUS_UNREAD = 1; diff --git a/proto/librarian/sephirah/v1/sephirah/sephirah_service.proto b/proto/librarian/sephirah/v1/sephirah/sephirah_service.proto index f6e8ff15..c16d7de6 100644 --- a/proto/librarian/sephirah/v1/sephirah/sephirah_service.proto +++ b/proto/librarian/sephirah/v1/sephirah/sephirah_service.proto @@ -36,11 +36,8 @@ service LibrarianSephirahService { // `Tiphereth` `Normal` Login via password and get two token rpc GetToken(GetTokenRequest) returns (GetTokenResponse); - // `Tiphereth` `Normal` `Porter` Use valid refresh_token and get two new token, a refresh_token can only be used once + // `Tiphereth` `Normal` Use valid refresh_token and get two new token, a refresh_token can only be used once rpc RefreshToken(RefreshTokenRequest) returns (RefreshTokenResponse); - // `Tiphereth` `Porter` Obtain access_token of a specific user after user authorization. - // This token can be used to perform actions on behalf of the user. - rpc AcquireUserToken(AcquireUserTokenRequest) returns (AcquireUserTokenResponse); // `Tiphereth` rpc GetUser(GetUserRequest) returns (GetUserResponse); @@ -190,10 +187,7 @@ service LibrarianSephirahService { // `Netzach` `Normal` rpc ListNotifyFlows(ListNotifyFlowsRequest) returns (ListNotifyFlowsResponse); - // `Netzach` `Porter` - rpc PorterGetNotifyTargetItems(PorterGetNotifyTargetItemsRequest) returns (PorterGetNotifyTargetItemsResponse); - - // `Netzach` `Admin` `Normal limited` + // `Netzach` `Normal` rpc ListSystemNotifications(ListSystemNotificationsRequest) returns (ListSystemNotificationsResponse); // `Netzach` `Normal` rpc UpdateSystemNotification(UpdateSystemNotificationRequest) returns (UpdateSystemNotificationResponse); @@ -237,11 +231,13 @@ service LibrarianSephirahService { rpc RemoveFeedItemFromCollection(RemoveFeedItemFromCollectionRequest) returns (RemoveFeedItemFromCollectionResponse); // `Yesod` `Normal` rpc ListFeedItemsInCollection(ListFeedItemsInCollectionRequest) returns (ListFeedItemsInCollectionResponse); +} - // `Yesod` `Porter` - rpc PUpsertFeed(PUpsertFeedRequest) returns (PUpsertFeedResponse); - // `Yesod` `Porter` - rpc PGetFeed(PGetFeedRequest) returns (PGetFeedResponse); +message GetServerInformationRequest { + optional bool with_status_report = 1; +} +message GetServerInformationResponse { + ServerInformation server_information = 1; } message ListenServerEventRequest {} diff --git a/proto/librarian/sephirah/v1/sephirah/tiphereth.proto b/proto/librarian/sephirah/v1/sephirah/tiphereth.proto index 58c1c845..903544df 100644 --- a/proto/librarian/sephirah/v1/sephirah/tiphereth.proto +++ b/proto/librarian/sephirah/v1/sephirah/tiphereth.proto @@ -34,14 +34,6 @@ message RefreshTokenResponse { string refresh_token = 2; } -message AcquireUserTokenRequest { - librarian.v1.InternalID user_id = 1; -} - -message AcquireUserTokenResponse { - string access_token = 1; -} - message RegisterUserRequest { string username = 1; string password = 2; diff --git a/proto/librarian/sephirah/v1/sephirah/yesod.proto b/proto/librarian/sephirah/v1/sephirah/yesod.proto index 4acbec30..2945b3da 100644 --- a/proto/librarian/sephirah/v1/sephirah/yesod.proto +++ b/proto/librarian/sephirah/v1/sephirah/yesod.proto @@ -106,21 +106,6 @@ message ReadFeedItemRequest { } message ReadFeedItemResponse {} -message PUpsertFeedRequest { - librarian.v1.InternalID id = 1; - librarian.v1.Feed data = 2; -} - -message PUpsertFeedResponse {} - -message PGetFeedRequest { - librarian.v1.InternalID id = 1; -} - -message PGetFeedResponse { - librarian.v1.Feed data = 1; -} - message CreateFeedItemCollectionRequest { FeedItemCollection collection = 1; }