Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!feat: redesign api #174

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-for-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
70 changes: 70 additions & 0 deletions proto/librarian/porter/v1/gebura.proto
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
24 changes: 24 additions & 0 deletions proto/librarian/porter/v1/tiphereth.proto
Original file line number Diff line number Diff line change
@@ -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;
}
138 changes: 138 additions & 0 deletions proto/librarian/sephirah/v1/angela/angela_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
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(GetServerInformationRequest) returns (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);

// `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`
// 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 GetServerInformationRequest {
optional bool with_status_report = 1;
}
message GetServerInformationResponse {
sephirah.ServerInformation server_information = 1;
}

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;
}
50 changes: 50 additions & 0 deletions proto/librarian/sephirah/v1/angela/binah.proto
Original file line number Diff line number Diff line change
@@ -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;
}
Loading
Loading