slash-e/proto/api/v1/workspace_service.proto
2024-08-12 23:41:56 +08:00

120 lines
2.8 KiB
Protocol Buffer

syntax = "proto3";
package slash.api.v1;
import "api/v1/common.proto";
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 owner name.
// Format: "users/{id}"
string owner = 6;
// The workspace branding.
bytes branding = 7;
// The workspace available features.
repeated string features = 8;
}
message WorkspaceSetting {
// The workspace custome branding.
bytes branding = 1;
// The custom style.
string custom_style = 2;
// The default visibility of shortcuts and collections.
Visibility default_visibility = 3;
// The identity providers.
repeated IdentityProvider identity_providers = 4;
}
message IdentityProvider {
// The unique identifier of the identity provider.
string id = 1;
string title = 2;
enum Type {
TYPE_UNSPECIFIED = 0;
OAUTH2 = 1;
}
Type type = 3;
IdentityProviderConfig config = 4;
}
message IdentityProviderConfig {
oneof config {
OAuth2Config oauth2 = 1;
}
message FieldMapping {
string identifier = 1;
string display_name = 2;
}
message OAuth2Config {
string client_id = 1;
string client_secret = 2;
string auth_url = 3;
string token_url = 4;
string user_info_url = 5;
repeated string scopes = 6;
FieldMapping field_mapping = 7;
}
}
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;
}