slash-e/proto/gen/api/v1/README.md
2024-08-31 22:08:57 +08:00

33 KiB
Raw Blame History

Protocol Documentation

Table of Contents

Top

api/v1/common.proto

State

Name Number Description
STATE_UNSPECIFIED 0
ACTIVE 1
INACTIVE 2

Visibility

Name Number Description
VISIBILITY_UNSPECIFIED 0
WORKSPACE 1
PUBLIC 2

Top

api/v1/user_service.proto

CreateUserAccessTokenRequest

Field Type Label Description
id int32 id is the user id.
description string description is the description of the access token.
expires_at google.protobuf.Timestamp optional expires_at is the expiration time of the access token. If expires_at is not set, the access token will never expire.

CreateUserRequest

Field Type Label Description
user User

DeleteUserAccessTokenRequest

Field Type Label Description
id int32 id is the user id.
access_token string access_token is the access token to delete.

DeleteUserRequest

Field Type Label Description
id int32

GetUserRequest

Field Type Label Description
id int32

ListUserAccessTokensRequest

Field Type Label Description
id int32 id is the user id.

ListUserAccessTokensResponse

Field Type Label Description
access_tokens UserAccessToken repeated

ListUsersRequest

ListUsersResponse

Field Type Label Description
users User repeated

UpdateUserRequest

Field Type Label Description
user User
update_mask google.protobuf.FieldMask

User

Field Type Label Description
id int32
state State
created_time google.protobuf.Timestamp
updated_time google.protobuf.Timestamp
role Role
email string
nickname string
password string

UserAccessToken

Field Type Label Description
access_token string
description string
issued_at google.protobuf.Timestamp
expires_at google.protobuf.Timestamp

Role

Name Number Description
ROLE_UNSPECIFIED 0
ADMIN 1
USER 2

UserService

Method Name Request Type Response Type Description
ListUsers ListUsersRequest ListUsersResponse ListUsers returns a list of users.
GetUser GetUserRequest User GetUser returns a user by id.
CreateUser CreateUserRequest User CreateUser creates a new user.
UpdateUser UpdateUserRequest User
DeleteUser DeleteUserRequest .google.protobuf.Empty DeleteUser deletes a user by id.
ListUserAccessTokens ListUserAccessTokensRequest ListUserAccessTokensResponse ListUserAccessTokens returns a list of access tokens for a user.
CreateUserAccessToken CreateUserAccessTokenRequest UserAccessToken CreateUserAccessToken creates a new access token for a user.
DeleteUserAccessToken DeleteUserAccessTokenRequest .google.protobuf.Empty DeleteUserAccessToken deletes an access token for a user.

Top

api/v1/auth_service.proto

GetAuthStatusRequest

SignInRequest

Field Type Label Description
email string
password string

SignInWithSSORequest

Field Type Label Description
idp_id string The id of the SSO provider.
code string The code to sign in with.
redirect_uri string The redirect URI.

SignOutRequest

SignUpRequest

Field Type Label Description
email string
nickname string
password string

AuthService

Method Name Request Type Response Type Description
GetAuthStatus GetAuthStatusRequest User GetAuthStatus returns the current auth status of the user.
SignIn SignInRequest User SignIn signs in the user with the given username and password.
SignInWithSSO SignInWithSSORequest User SignInWithSSO signs in the user with the given SSO code.
SignUp SignUpRequest User SignUp signs up the user with the given username and password.
SignOut SignOutRequest .google.protobuf.Empty SignOut signs out the user.

Top

api/v1/collection_service.proto

Collection

Field Type Label Description
id int32
creator_id int32
created_time google.protobuf.Timestamp
updated_time google.protobuf.Timestamp
name string
title string
description string
shortcut_ids int32 repeated
visibility Visibility

CreateCollectionRequest

Field Type Label Description
collection Collection

DeleteCollectionRequest

Field Type Label Description
id int32

GetCollectionByNameRequest

Field Type Label Description
name string

GetCollectionRequest

Field Type Label Description
id int32

ListCollectionsRequest

ListCollectionsResponse

Field Type Label Description
collections Collection repeated

UpdateCollectionRequest

Field Type Label Description
collection Collection
update_mask google.protobuf.FieldMask

CollectionService

Method Name Request Type Response Type Description
ListCollections ListCollectionsRequest ListCollectionsResponse ListCollections returns a list of collections.
GetCollection GetCollectionRequest Collection GetCollection returns a collection by id.
GetCollectionByName GetCollectionByNameRequest Collection GetCollectionByName returns a collection by name.
CreateCollection CreateCollectionRequest Collection CreateCollection creates a collection.
UpdateCollection UpdateCollectionRequest Collection UpdateCollection updates a collection.
DeleteCollection DeleteCollectionRequest .google.protobuf.Empty DeleteCollection deletes a collection by id.

Top

api/v1/shortcut_service.proto

CreateShortcutRequest

Field Type Label Description
shortcut Shortcut

DeleteShortcutRequest

Field Type Label Description
id int32

GetShortcutAnalyticsRequest

Field Type Label Description
id int32

GetShortcutAnalyticsResponse

Field Type Label Description
references GetShortcutAnalyticsResponse.AnalyticsItem repeated
devices GetShortcutAnalyticsResponse.AnalyticsItem repeated
browsers GetShortcutAnalyticsResponse.AnalyticsItem repeated

GetShortcutAnalyticsResponse.AnalyticsItem

Field Type Label Description
name string
count int32

GetShortcutByNameRequest

Field Type Label Description
name string

GetShortcutRequest

Field Type Label Description
id int32

ListShortcutsRequest

ListShortcutsResponse

Field Type Label Description
shortcuts Shortcut repeated

Shortcut

Field Type Label Description
id int32
creator_id int32
created_time google.protobuf.Timestamp
updated_time google.protobuf.Timestamp
name string
link string
title string
tags string repeated
description string
visibility Visibility
view_count int32
og_metadata Shortcut.OpenGraphMetadata

Shortcut.OpenGraphMetadata

Field Type Label Description
title string
description string
image string

UpdateShortcutRequest

Field Type Label Description
shortcut Shortcut
update_mask google.protobuf.FieldMask

ShortcutService

Method Name Request Type Response Type Description
ListShortcuts ListShortcutsRequest ListShortcutsResponse ListShortcuts returns a list of shortcuts.
GetShortcut GetShortcutRequest Shortcut GetShortcut returns a shortcut by id.
GetShortcutByName GetShortcutByNameRequest Shortcut GetShortcutByName returns a shortcut by name.
CreateShortcut CreateShortcutRequest Shortcut CreateShortcut creates a shortcut.
UpdateShortcut UpdateShortcutRequest Shortcut UpdateShortcut updates a shortcut.
DeleteShortcut DeleteShortcutRequest .google.protobuf.Empty DeleteShortcut deletes a shortcut by name.
GetShortcutAnalytics GetShortcutAnalyticsRequest GetShortcutAnalyticsResponse GetShortcutAnalytics returns the analytics for a shortcut.

Top

api/v1/subscription_service.proto

DeleteSubscriptionRequest

GetSubscriptionRequest

Subscription

Field Type Label Description
plan PlanType
started_time google.protobuf.Timestamp
expires_time google.protobuf.Timestamp
features string repeated
seats int32
shortcuts_limit int32
collections_limit int32

UpdateSubscriptionRequest

Field Type Label Description
license_key string

PlanType

Name Number Description
PLAN_TYPE_UNSPECIFIED 0
FREE 1
PRO 2
ENTERPRISE 3

SubscriptionService

Method Name Request Type Response Type Description
GetSubscription GetSubscriptionRequest Subscription GetSubscription gets the current subscription of Slash instance.
UpdateSubscription UpdateSubscriptionRequest Subscription UpdateSubscription updates the subscription.
DeleteSubscription DeleteSubscriptionRequest Subscription DeleteSubscription deletes the subscription.

Top

api/v1/user_setting_service.proto

GetUserSettingRequest

Field Type Label Description
id int32 id is the user id.

UpdateUserSettingRequest

Field Type Label Description
id int32 id is the user id.
user_setting UserSetting user_setting is the user setting to update.
update_mask google.protobuf.FieldMask update_mask is the field mask to update.

UserSetting

Field Type Label Description
user_id int32
general UserSetting.GeneralSetting
access_tokens UserSetting.AccessTokensSetting

UserSetting.AccessTokensSetting

Field Type Label Description
access_tokens UserSetting.AccessTokensSetting.AccessToken repeated Nested repeated field

UserSetting.AccessTokensSetting.AccessToken

Field Type Label Description
access_token string The access token is a JWT token, including expiration time, issuer, etc.
description string A description for the access token.

UserSetting.GeneralSetting

Field Type Label Description
locale string
color_theme string

UserSettingService

Method Name Request Type Response Type Description
GetUserSetting GetUserSettingRequest UserSetting GetUserSetting returns the user setting.
UpdateUserSetting UpdateUserSettingRequest UserSetting UpdateUserSetting updates the user setting.

Top

api/v1/workspace_service.proto

GetWorkspaceProfileRequest

GetWorkspaceSettingRequest

IdentityProvider

Field Type Label Description
id string The unique identifier of the identity provider.
title string
type IdentityProvider.Type
config IdentityProviderConfig

IdentityProviderConfig

Field Type Label Description
oauth2 IdentityProviderConfig.OAuth2Config

IdentityProviderConfig.FieldMapping

Field Type Label Description
identifier string
display_name string

IdentityProviderConfig.OAuth2Config

Field Type Label Description
client_id string
client_secret string
auth_url string
token_url string
user_info_url string
scopes string repeated
field_mapping IdentityProviderConfig.FieldMapping

UpdateWorkspaceSettingRequest

Field Type Label Description
setting WorkspaceSetting The user setting.
update_mask google.protobuf.FieldMask The update mask.

WorkspaceProfile

Field Type Label Description
mode string Current workspace mode: dev, prod.
version string Current workspace version.
owner string The owner name. Format: "users/{id}"
subscription Subscription The workspace subscription.
custom_style string The custom style.
branding bytes The workspace branding.

WorkspaceSetting

Field Type Label Description
instance_url string The url of instance.
branding bytes The workspace custome branding.
custom_style string The custom style.
default_visibility Visibility The default visibility of shortcuts and collections.
identity_providers IdentityProvider repeated The identity providers.
disallow_user_registration bool Whether to disallow user registration by email&password.
disallow_password_auth bool Whether to disallow password authentication.

IdentityProvider.Type

Name Number Description
TYPE_UNSPECIFIED 0
OAUTH2 1

WorkspaceService

Method Name Request Type Response Type Description
GetWorkspaceProfile GetWorkspaceProfileRequest WorkspaceProfile
GetWorkspaceSetting GetWorkspaceSettingRequest WorkspaceSetting
UpdateWorkspaceSetting UpdateWorkspaceSettingRequest WorkspaceSetting

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)