mirror of
https://github.com/aykhans/slash-e.git
synced 2025-06-14 20:07:50 +00:00
refactor: update api version
This commit is contained in:
52
proto/api/v1/auth_service.proto
Normal file
52
proto/api/v1/auth_service.proto
Normal file
@ -0,0 +1,52 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/user_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service AuthService {
|
||||
rpc GetAuthStatus(GetAuthStatusRequest) returns (GetAuthStatusResponse) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/status"};
|
||||
}
|
||||
rpc SignIn(SignInRequest) returns (SignInResponse) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signin"};
|
||||
}
|
||||
rpc SignUp(SignUpRequest) returns (SignUpResponse) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signup"};
|
||||
}
|
||||
rpc SignOut(SignOutRequest) returns (SignOutResponse) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signout"};
|
||||
}
|
||||
}
|
||||
|
||||
message GetAuthStatusRequest {}
|
||||
|
||||
message GetAuthStatusResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message SignInRequest {
|
||||
string email = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message SignInResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message SignUpRequest {
|
||||
string email = 1;
|
||||
string nickname = 2;
|
||||
string password = 3;
|
||||
}
|
||||
|
||||
message SignUpResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message SignOutRequest {}
|
||||
|
||||
message SignOutResponse {}
|
111
proto/api/v1/collection_service.proto
Normal file
111
proto/api/v1/collection_service.proto
Normal file
@ -0,0 +1,111 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service CollectionService {
|
||||
// ListCollections returns a list of collections.
|
||||
rpc ListCollections(ListCollectionsRequest) returns (ListCollectionsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/collections"};
|
||||
}
|
||||
// GetCollection returns a collection by id.
|
||||
rpc GetCollection(GetCollectionRequest) returns (GetCollectionResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/collections/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// GetCollectionByName returns a collection by name.
|
||||
rpc GetCollectionByName(GetCollectionByNameRequest) returns (GetCollectionByNameResponse) {}
|
||||
// CreateCollection creates a collection.
|
||||
rpc CreateCollection(CreateCollectionRequest) returns (CreateCollectionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/collections"
|
||||
body: "collection"
|
||||
};
|
||||
}
|
||||
// UpdateCollection updates a collection.
|
||||
rpc UpdateCollection(UpdateCollectionRequest) returns (UpdateCollectionResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/collections/{collection.id}"
|
||||
body: "collection"
|
||||
};
|
||||
option (google.api.method_signature) = "collection,update_mask";
|
||||
}
|
||||
// DeleteCollection deletes a collection by id.
|
||||
rpc DeleteCollection(DeleteCollectionRequest) returns (DeleteCollectionResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/collections/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Collection {
|
||||
int32 id = 1;
|
||||
|
||||
int32 creator_id = 2;
|
||||
|
||||
google.protobuf.Timestamp created_time = 3;
|
||||
|
||||
google.protobuf.Timestamp updated_time = 4;
|
||||
|
||||
string name = 6;
|
||||
|
||||
string title = 7;
|
||||
|
||||
string description = 8;
|
||||
|
||||
repeated int32 shortcut_ids = 9;
|
||||
|
||||
Visibility visibility = 10;
|
||||
}
|
||||
|
||||
message ListCollectionsRequest {}
|
||||
|
||||
message ListCollectionsResponse {
|
||||
repeated Collection collections = 1;
|
||||
}
|
||||
|
||||
message GetCollectionRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetCollectionResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message GetCollectionByNameRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message GetCollectionByNameResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message CreateCollectionRequest {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message CreateCollectionResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message UpdateCollectionRequest {
|
||||
Collection collection = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateCollectionResponse {
|
||||
Collection collection = 1;
|
||||
}
|
||||
|
||||
message DeleteCollectionRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message DeleteCollectionResponse {}
|
23
proto/api/v1/common.proto
Normal file
23
proto/api/v1/common.proto
Normal file
@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
enum RowStatus {
|
||||
ROW_STATUS_UNSPECIFIED = 0;
|
||||
|
||||
NORMAL = 1;
|
||||
|
||||
ARCHIVED = 2;
|
||||
}
|
||||
|
||||
enum Visibility {
|
||||
VISIBILITY_UNSPECIFIED = 0;
|
||||
|
||||
PRIVATE = 1;
|
||||
|
||||
WORKSPACE = 2;
|
||||
|
||||
PUBLIC = 3;
|
||||
}
|
103
proto/api/v1/memo_service.proto
Normal file
103
proto/api/v1/memo_service.proto
Normal file
@ -0,0 +1,103 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service MemoService {
|
||||
// ListMemos returns a list of memos.
|
||||
rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/memos"};
|
||||
}
|
||||
// GetMemo returns a memo by id.
|
||||
rpc GetMemo(GetMemoRequest) returns (GetMemoResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/memos/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// CreateMemo creates a memo.
|
||||
rpc CreateMemo(CreateMemoRequest) returns (CreateMemoResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/memos"
|
||||
body: "memo"
|
||||
};
|
||||
}
|
||||
// UpdateMemo updates a memo.
|
||||
rpc UpdateMemo(UpdateMemoRequest) returns (UpdateMemoResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/memos/{memo.id}"
|
||||
body: "memo"
|
||||
};
|
||||
option (google.api.method_signature) = "memo,update_mask";
|
||||
}
|
||||
// DeleteMemo deletes a memo by id.
|
||||
rpc DeleteMemo(DeleteMemoRequest) returns (DeleteMemoResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/memos/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Memo {
|
||||
int32 id = 1;
|
||||
|
||||
int32 creator_id = 2;
|
||||
|
||||
google.protobuf.Timestamp created_time = 3;
|
||||
|
||||
google.protobuf.Timestamp updated_time = 4;
|
||||
|
||||
RowStatus row_status = 5;
|
||||
|
||||
string name = 6;
|
||||
|
||||
string title = 7;
|
||||
|
||||
string content = 8;
|
||||
|
||||
repeated string tags = 9;
|
||||
|
||||
Visibility visibility = 10;
|
||||
}
|
||||
|
||||
message ListMemosRequest {}
|
||||
|
||||
message ListMemosResponse {
|
||||
repeated Memo memos = 1;
|
||||
}
|
||||
|
||||
message GetMemoRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetMemoResponse {
|
||||
Memo memo = 1;
|
||||
}
|
||||
|
||||
message CreateMemoRequest {
|
||||
Memo memo = 1;
|
||||
}
|
||||
|
||||
message CreateMemoResponse {
|
||||
Memo memo = 1;
|
||||
}
|
||||
|
||||
message UpdateMemoRequest {
|
||||
Memo memo = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateMemoResponse {
|
||||
Memo memo = 1;
|
||||
}
|
||||
|
||||
message DeleteMemoRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message DeleteMemoResponse {}
|
148
proto/api/v1/shortcut_service.proto
Normal file
148
proto/api/v1/shortcut_service.proto
Normal file
@ -0,0 +1,148 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service ShortcutService {
|
||||
// ListShortcuts returns a list of shortcuts.
|
||||
rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/shortcuts"};
|
||||
}
|
||||
// GetShortcut returns a shortcut by id.
|
||||
rpc GetShortcut(GetShortcutRequest) returns (GetShortcutResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/shortcuts/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// GetShortcutByName returns a shortcut by name.
|
||||
rpc GetShortcutByName(GetShortcutByNameRequest) returns (GetShortcutByNameResponse) {}
|
||||
// CreateShortcut creates a shortcut.
|
||||
rpc CreateShortcut(CreateShortcutRequest) returns (CreateShortcutResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/shortcuts"
|
||||
body: "shortcut"
|
||||
};
|
||||
}
|
||||
// UpdateShortcut updates a shortcut.
|
||||
rpc UpdateShortcut(UpdateShortcutRequest) returns (UpdateShortcutResponse) {
|
||||
option (google.api.http) = {
|
||||
put: "/api/v1/shortcuts/{shortcut.id}"
|
||||
body: "shortcut"
|
||||
};
|
||||
option (google.api.method_signature) = "shortcut,update_mask";
|
||||
}
|
||||
// DeleteShortcut deletes a shortcut by name.
|
||||
rpc DeleteShortcut(DeleteShortcutRequest) returns (DeleteShortcutResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/shortcuts/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// GetShortcutAnalytics returns the analytics for a shortcut.
|
||||
rpc GetShortcutAnalytics(GetShortcutAnalyticsRequest) returns (GetShortcutAnalyticsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/shortcuts/{id}/analytics"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Shortcut {
|
||||
int32 id = 1;
|
||||
|
||||
int32 creator_id = 2;
|
||||
|
||||
google.protobuf.Timestamp created_time = 3;
|
||||
|
||||
google.protobuf.Timestamp updated_time = 4;
|
||||
|
||||
RowStatus row_status = 5;
|
||||
|
||||
string name = 6;
|
||||
|
||||
string link = 7;
|
||||
|
||||
string title = 8;
|
||||
|
||||
repeated string tags = 9;
|
||||
|
||||
string description = 10;
|
||||
|
||||
Visibility visibility = 11;
|
||||
|
||||
int32 view_count = 12;
|
||||
|
||||
OpenGraphMetadata og_metadata = 13;
|
||||
}
|
||||
|
||||
message OpenGraphMetadata {
|
||||
string title = 1;
|
||||
|
||||
string description = 2;
|
||||
|
||||
string image = 3;
|
||||
}
|
||||
|
||||
message ListShortcutsRequest {}
|
||||
|
||||
message ListShortcutsResponse {
|
||||
repeated Shortcut shortcuts = 1;
|
||||
}
|
||||
|
||||
message GetShortcutRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetShortcutResponse {
|
||||
Shortcut shortcut = 1;
|
||||
}
|
||||
|
||||
message GetShortcutByNameRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message GetShortcutByNameResponse {
|
||||
Shortcut shortcut = 1;
|
||||
}
|
||||
|
||||
message CreateShortcutRequest {
|
||||
Shortcut shortcut = 1;
|
||||
}
|
||||
|
||||
message CreateShortcutResponse {
|
||||
Shortcut shortcut = 1;
|
||||
}
|
||||
|
||||
message UpdateShortcutRequest {
|
||||
Shortcut shortcut = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateShortcutResponse {
|
||||
Shortcut shortcut = 1;
|
||||
}
|
||||
|
||||
message DeleteShortcutRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message DeleteShortcutResponse {}
|
||||
|
||||
message GetShortcutAnalyticsRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetShortcutAnalyticsResponse {
|
||||
message AnalyticsItem {
|
||||
string name = 1;
|
||||
int32 count = 2;
|
||||
}
|
||||
repeated AnalyticsItem references = 1;
|
||||
|
||||
repeated AnalyticsItem devices = 2;
|
||||
|
||||
repeated AnalyticsItem browsers = 3;
|
||||
}
|
51
proto/api/v1/subscription_service.proto
Normal file
51
proto/api/v1/subscription_service.proto
Normal file
@ -0,0 +1,51 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service SubscriptionService {
|
||||
rpc GetSubscription(GetSubscriptionRequest) returns (GetSubscriptionResponse) {
|
||||
option (google.api.http) = {get: "/v1/subscription"};
|
||||
}
|
||||
rpc UpdateSubscription(UpdateSubscriptionRequest) returns (UpdateSubscriptionResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v1/subscription"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message Subscription {
|
||||
PlanType plan = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
google.protobuf.Timestamp started_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
google.protobuf.Timestamp expires_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
|
||||
enum PlanType {
|
||||
PLAN_TYPE_UNSPECIFIED = 0;
|
||||
|
||||
FREE = 1;
|
||||
|
||||
PRO = 2;
|
||||
}
|
||||
|
||||
message GetSubscriptionRequest {}
|
||||
|
||||
message GetSubscriptionResponse {
|
||||
Subscription subscription = 1;
|
||||
}
|
||||
|
||||
message UpdateSubscriptionRequest {
|
||||
string license_key = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message UpdateSubscriptionResponse {
|
||||
Subscription subscription = 1;
|
||||
}
|
163
proto/api/v1/user_service.proto
Normal file
163
proto/api/v1/user_service.proto
Normal file
@ -0,0 +1,163 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service UserService {
|
||||
// ListUsers returns a list of users.
|
||||
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users"};
|
||||
}
|
||||
// GetUser returns a user by id.
|
||||
rpc GetUser(GetUserRequest) returns (GetUserResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// CreateUser creates a new user.
|
||||
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/users"
|
||||
body: "user"
|
||||
};
|
||||
}
|
||||
rpc UpdateUser(UpdateUserRequest) returns (UpdateUserResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/users/{user.id}"
|
||||
body: "user"
|
||||
};
|
||||
option (google.api.method_signature) = "user,update_mask";
|
||||
}
|
||||
// DeleteUser deletes a user by id.
|
||||
rpc DeleteUser(DeleteUserRequest) returns (DeleteUserResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/users/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// ListUserAccessTokens returns a list of access tokens for a user.
|
||||
rpc ListUserAccessTokens(ListUserAccessTokensRequest) returns (ListUserAccessTokensResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users/{id}/access_tokens"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// CreateUserAccessToken creates a new access token for a user.
|
||||
rpc CreateUserAccessToken(CreateUserAccessTokenRequest) returns (CreateUserAccessTokenResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/users/{id}/access_tokens"
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// DeleteUserAccessToken deletes an access token for a user.
|
||||
rpc DeleteUserAccessToken(DeleteUserAccessTokenRequest) returns (DeleteUserAccessTokenResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/users/{id}/access_tokens/{access_token}"};
|
||||
option (google.api.method_signature) = "id,access_token";
|
||||
}
|
||||
}
|
||||
|
||||
message User {
|
||||
int32 id = 1;
|
||||
|
||||
RowStatus row_status = 2;
|
||||
|
||||
google.protobuf.Timestamp created_time = 3;
|
||||
|
||||
google.protobuf.Timestamp updated_time = 4;
|
||||
|
||||
Role role = 6;
|
||||
|
||||
string email = 7;
|
||||
|
||||
string nickname = 8;
|
||||
|
||||
string password = 9;
|
||||
}
|
||||
|
||||
enum Role {
|
||||
ROLE_UNSPECIFIED = 0;
|
||||
|
||||
ADMIN = 1;
|
||||
|
||||
USER = 2;
|
||||
}
|
||||
|
||||
message ListUsersRequest {}
|
||||
|
||||
message ListUsersResponse {
|
||||
repeated User users = 1;
|
||||
}
|
||||
|
||||
message GetUserRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetUserResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message CreateUserRequest {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message CreateUserResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message UpdateUserRequest {
|
||||
User user = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateUserResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message DeleteUserRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message DeleteUserResponse {}
|
||||
|
||||
message ListUserAccessTokensRequest {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message ListUserAccessTokensResponse {
|
||||
repeated UserAccessToken access_tokens = 1;
|
||||
}
|
||||
|
||||
message CreateUserAccessTokenRequest {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
// description is the description of the access token.
|
||||
string description = 2;
|
||||
// expires_at is the expiration time of the access token.
|
||||
// If expires_at is not set, the access token will never expire.
|
||||
optional google.protobuf.Timestamp expires_at = 3;
|
||||
}
|
||||
|
||||
message CreateUserAccessTokenResponse {
|
||||
UserAccessToken access_token = 1;
|
||||
}
|
||||
|
||||
message DeleteUserAccessTokenRequest {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
// access_token is the access token to delete.
|
||||
string access_token = 2;
|
||||
}
|
||||
|
||||
message DeleteUserAccessTokenResponse {}
|
||||
|
||||
message UserAccessToken {
|
||||
string access_token = 1;
|
||||
string description = 2;
|
||||
google.protobuf.Timestamp issued_at = 3;
|
||||
google.protobuf.Timestamp expires_at = 4;
|
||||
}
|
71
proto/api/v1/user_setting_service.proto
Normal file
71
proto/api/v1/user_setting_service.proto
Normal file
@ -0,0 +1,71 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service UserSettingService {
|
||||
// GetUserSetting returns the user setting.
|
||||
rpc GetUserSetting(GetUserSettingRequest) returns (GetUserSettingResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users/{id}/settings"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// UpdateUserSetting updates the user setting.
|
||||
rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UpdateUserSettingResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/users/{id}/settings"
|
||||
body: "user_setting"
|
||||
};
|
||||
option (google.api.method_signature) = "user_setting,update_mask";
|
||||
}
|
||||
}
|
||||
|
||||
message UserSetting {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
|
||||
enum Locale {
|
||||
LOCALE_UNSPECIFIED = 0;
|
||||
LOCALE_EN = 1;
|
||||
LOCALE_ZH = 2;
|
||||
}
|
||||
// locale is the user locale.
|
||||
Locale locale = 2;
|
||||
|
||||
enum ColorTheme {
|
||||
COLOR_THEME_UNSPECIFIED = 0;
|
||||
COLOR_THEME_SYSTEM = 1;
|
||||
COLOR_THEME_LIGHT = 2;
|
||||
COLOR_THEME_DARK = 3;
|
||||
}
|
||||
// color_theme is the user color theme.
|
||||
ColorTheme color_theme = 3;
|
||||
}
|
||||
|
||||
message GetUserSettingRequest {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetUserSettingResponse {
|
||||
UserSetting user_setting = 1;
|
||||
}
|
||||
|
||||
message UpdateUserSettingRequest {
|
||||
// id is the user id.
|
||||
int32 id = 1;
|
||||
|
||||
// user_setting is the user setting to update.
|
||||
UserSetting user_setting = 2;
|
||||
|
||||
// update_mask is the field mask to update.
|
||||
google.protobuf.FieldMask update_mask = 3;
|
||||
}
|
||||
|
||||
message UpdateUserSettingResponse {
|
||||
UserSetting user_setting = 1;
|
||||
}
|
92
proto/api/v1/workspace_service.proto
Normal file
92
proto/api/v1/workspace_service.proto
Normal file
@ -0,0 +1,92 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package slash.api.v1;
|
||||
|
||||
import "api/v1/subscription_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WorkspaceService {
|
||||
rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (GetWorkspaceProfileResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/profile"};
|
||||
}
|
||||
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (GetWorkspaceSettingResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/setting"};
|
||||
}
|
||||
rpc UpdateWorkspaceSetting(UpdateWorkspaceSettingRequest) returns (UpdateWorkspaceSettingResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/workspace/setting"
|
||||
body: "setting"
|
||||
};
|
||||
option (google.api.method_signature) = "setting,update_mask";
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceProfile {
|
||||
// Current workspace mode: dev, prod.
|
||||
string mode = 1;
|
||||
// Current workspace version.
|
||||
string version = 2;
|
||||
// The workspace plan.
|
||||
PlanType plan = 3;
|
||||
// Whether to enable other users to sign up.
|
||||
bool enable_signup = 4;
|
||||
// The custom style.
|
||||
string custom_style = 5;
|
||||
// The custom script.
|
||||
string custom_script = 6;
|
||||
}
|
||||
|
||||
message WorkspaceSetting {
|
||||
string license_key = 1;
|
||||
// Whether to enable other users to sign up.
|
||||
bool enable_signup = 2;
|
||||
// The instance URL.
|
||||
string instance_url = 3;
|
||||
// The custom style.
|
||||
string custom_style = 4;
|
||||
// The custom script.
|
||||
string custom_script = 5;
|
||||
// The auto backup setting.
|
||||
AutoBackupWorkspaceSetting auto_backup = 6;
|
||||
}
|
||||
|
||||
message AutoBackupWorkspaceSetting {
|
||||
// Whether auto backup is enabled.
|
||||
bool enabled = 1;
|
||||
// The cron expression for auto backup.
|
||||
// For example, "0 0 0 * * *" means backup at 00:00:00 every day.
|
||||
// See https://en.wikipedia.org/wiki/Cron for more details.
|
||||
string cron_expression = 2;
|
||||
// The maximum number of backups to keep.
|
||||
int32 max_keep = 3;
|
||||
}
|
||||
|
||||
message GetWorkspaceProfileRequest {}
|
||||
|
||||
message GetWorkspaceProfileResponse {
|
||||
// The workspace profile.
|
||||
WorkspaceProfile profile = 1;
|
||||
}
|
||||
|
||||
message GetWorkspaceSettingRequest {}
|
||||
|
||||
message GetWorkspaceSettingResponse {
|
||||
// The user setting.
|
||||
WorkspaceSetting setting = 1;
|
||||
}
|
||||
|
||||
message UpdateWorkspaceSettingRequest {
|
||||
// The user setting.
|
||||
WorkspaceSetting setting = 1;
|
||||
// The update mask.
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateWorkspaceSettingResponse {
|
||||
// The user setting.
|
||||
WorkspaceSetting setting = 1;
|
||||
}
|
Reference in New Issue
Block a user