mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: api version
This commit is contained in:
56
proto/api/v1/activity_service.proto
Normal file
56
proto/api/v1/activity_service.proto
Normal file
@@ -0,0 +1,56 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service ActivityService {
|
||||
// GetActivity returns the activity with the given id.
|
||||
rpc GetActivity(GetActivityRequest) returns (Activity) {
|
||||
option (google.api.http) = {get: "/api/v1/activities/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Activity {
|
||||
// The system-generated unique identifier for the activity.
|
||||
int32 id = 1;
|
||||
// The system-generated unique identifier for the user who created the activity.
|
||||
int32 creator_id = 2;
|
||||
// The type of the activity.
|
||||
string type = 3;
|
||||
// The level of the activity.
|
||||
string level = 4;
|
||||
// The create time of the activity.
|
||||
google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
// The payload of the activity.
|
||||
ActivityPayload payload = 6;
|
||||
}
|
||||
|
||||
// ActivityMemoCommentPayload represents the payload of a memo comment activity.
|
||||
message ActivityMemoCommentPayload {
|
||||
// The memo id of comment.
|
||||
int32 memo_id = 1;
|
||||
// The memo id of related memo.
|
||||
int32 related_memo_id = 2;
|
||||
}
|
||||
|
||||
message ActivityVersionUpdatePayload {
|
||||
// The updated version of memos.
|
||||
string version = 1;
|
||||
}
|
||||
|
||||
message ActivityPayload {
|
||||
ActivityMemoCommentPayload memo_comment = 1;
|
||||
ActivityVersionUpdatePayload version_update = 2;
|
||||
}
|
||||
|
||||
message GetActivityRequest {
|
||||
// The system-generated unique identifier for the activity.
|
||||
int32 id = 1;
|
||||
}
|
65
proto/api/v1/auth_service.proto
Normal file
65
proto/api/v1/auth_service.proto
Normal file
@@ -0,0 +1,65 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/user_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service AuthService {
|
||||
// GetAuthStatus returns the current auth status of the user.
|
||||
rpc GetAuthStatus(GetAuthStatusRequest) returns (User) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/status"};
|
||||
}
|
||||
// SignIn signs in the user with the given username and password.
|
||||
rpc SignIn(SignInRequest) returns (User) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signin"};
|
||||
}
|
||||
// SignInWithSSO signs in the user with the given SSO code.
|
||||
rpc SignInWithSSO(SignInWithSSORequest) returns (User) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signin/sso"};
|
||||
}
|
||||
// SignUp signs up the user with the given username and password.
|
||||
rpc SignUp(SignUpRequest) returns (User) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signup"};
|
||||
}
|
||||
// SignOut signs out the user.
|
||||
rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {post: "/api/v1/auth/signout"};
|
||||
}
|
||||
}
|
||||
|
||||
message GetAuthStatusRequest {}
|
||||
|
||||
message GetAuthStatusResponse {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message SignInRequest {
|
||||
// The username to sign in with.
|
||||
string username = 1;
|
||||
// The password to sign in with.
|
||||
string password = 2;
|
||||
// Whether the session should never expire.
|
||||
bool never_expire = 3;
|
||||
}
|
||||
|
||||
message SignInWithSSORequest {
|
||||
// The ID of the SSO provider.
|
||||
int32 idp_id = 1;
|
||||
// The code to sign in with.
|
||||
string code = 2;
|
||||
// The redirect URI.
|
||||
string redirect_uri = 3;
|
||||
}
|
||||
|
||||
message SignUpRequest {
|
||||
// The username to sign up with.
|
||||
string username = 1;
|
||||
// The password to sign up with.
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
message SignOutRequest {}
|
17
proto/api/v1/common.proto
Normal file
17
proto/api/v1/common.proto
Normal file
@@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
enum RowStatus {
|
||||
ROW_STATUS_UNSPECIFIED = 0;
|
||||
ACTIVE = 1;
|
||||
ARCHIVED = 2;
|
||||
}
|
||||
|
||||
// Used internally for obfuscating the page token.
|
||||
message PageToken {
|
||||
int32 limit = 1;
|
||||
int32 offset = 2;
|
||||
}
|
114
proto/api/v1/idp_service.proto
Normal file
114
proto/api/v1/idp_service.proto
Normal file
@@ -0,0 +1,114 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service IdentityProviderService {
|
||||
// ListIdentityProviders lists identity providers.
|
||||
rpc ListIdentityProviders(ListIdentityProvidersRequest) returns (ListIdentityProvidersResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/identityProviders"};
|
||||
}
|
||||
// GetIdentityProvider gets an identity provider.
|
||||
rpc GetIdentityProvider(GetIdentityProviderRequest) returns (IdentityProvider) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=identityProviders/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// CreateIdentityProvider creates an identity provider.
|
||||
rpc CreateIdentityProvider(CreateIdentityProviderRequest) returns (IdentityProvider) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/identityProviders",
|
||||
body: "identity_provider"
|
||||
};
|
||||
}
|
||||
// UpdateIdentityProvider updates an identity provider.
|
||||
rpc UpdateIdentityProvider(UpdateIdentityProviderRequest) returns (IdentityProvider) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{identity_provider.name=identityProviders/*}"
|
||||
body: "identity_provider"
|
||||
};
|
||||
option (google.api.method_signature) = "identity_provider,update_mask";
|
||||
}
|
||||
// DeleteIdentityProvider deletes an identity provider.
|
||||
rpc DeleteIdentityProvider(DeleteIdentityProviderRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=identityProviders/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message IdentityProvider {
|
||||
// The name of the identityProvider.
|
||||
// Format: identityProviders/{id}
|
||||
string name = 1;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
OAUTH2 = 1;
|
||||
}
|
||||
Type type = 2;
|
||||
|
||||
string title = 3;
|
||||
|
||||
string identifier_filter = 4;
|
||||
|
||||
IdentityProviderConfig config = 5;
|
||||
}
|
||||
|
||||
message IdentityProviderConfig {
|
||||
oneof config {
|
||||
OAuth2Config oauth2_config = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message FieldMapping {
|
||||
string identifier = 1;
|
||||
string display_name = 2;
|
||||
string email = 3;
|
||||
}
|
||||
|
||||
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 ListIdentityProvidersRequest {}
|
||||
|
||||
message ListIdentityProvidersResponse {
|
||||
repeated IdentityProvider identity_providers = 1;
|
||||
}
|
||||
|
||||
message GetIdentityProviderRequest {
|
||||
// The name of the identityProvider to get.
|
||||
// Format: identityProviders/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message CreateIdentityProviderRequest {
|
||||
// The identityProvider to create.
|
||||
IdentityProvider identity_provider = 1;
|
||||
}
|
||||
|
||||
message UpdateIdentityProviderRequest {
|
||||
// The identityProvider to update.
|
||||
IdentityProvider identity_provider = 1;
|
||||
|
||||
// The update mask applies to the resource. Only the top level fields of
|
||||
// IdentityProvider are supported.
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message DeleteIdentityProviderRequest {
|
||||
// The name of the identityProvider to delete.
|
||||
// Format: identityProviders/{id}
|
||||
string name = 1;
|
||||
}
|
80
proto/api/v1/inbox_service.proto
Normal file
80
proto/api/v1/inbox_service.proto
Normal file
@@ -0,0 +1,80 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service InboxService {
|
||||
// ListInboxes lists inboxes for a user.
|
||||
rpc ListInboxes(ListInboxesRequest) returns (ListInboxesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/inboxes"};
|
||||
}
|
||||
// UpdateInbox updates an inbox.
|
||||
rpc UpdateInbox(UpdateInboxRequest) returns (Inbox) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{inbox.name=inboxes/*}"
|
||||
body: "inbox"
|
||||
};
|
||||
option (google.api.method_signature) = "inbox,update_mask";
|
||||
}
|
||||
// DeleteInbox deletes an inbox.
|
||||
rpc DeleteInbox(DeleteInboxRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=inboxes/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Inbox {
|
||||
// The name of the inbox.
|
||||
// Format: inboxes/{id}
|
||||
string name = 1;
|
||||
// Format: users/{id}
|
||||
string sender = 2;
|
||||
// Format: users/{id}
|
||||
string receiver = 3;
|
||||
|
||||
enum Status {
|
||||
STATUS_UNSPECIFIED = 0;
|
||||
UNREAD = 1;
|
||||
ARCHIVED = 2;
|
||||
}
|
||||
Status status = 4;
|
||||
|
||||
google.protobuf.Timestamp create_time = 5;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
TYPE_MEMO_COMMENT = 1;
|
||||
TYPE_VERSION_UPDATE = 2;
|
||||
}
|
||||
Type type = 6;
|
||||
|
||||
optional int32 activity_id = 7;
|
||||
}
|
||||
|
||||
message ListInboxesRequest {
|
||||
// Format: users/{id}
|
||||
string user = 1;
|
||||
}
|
||||
|
||||
message ListInboxesResponse {
|
||||
repeated Inbox inboxes = 1;
|
||||
}
|
||||
|
||||
message UpdateInboxRequest {
|
||||
Inbox inbox = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message DeleteInboxRequest {
|
||||
// The name of the inbox to delete.
|
||||
// Format: inboxes/{id}
|
||||
string name = 1;
|
||||
}
|
28
proto/api/v1/link_service.proto
Normal file
28
proto/api/v1/link_service.proto
Normal file
@@ -0,0 +1,28 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service LinkService {
|
||||
// GetLinkMetadata returns metadata for a given link.
|
||||
rpc GetLinkMetadata(GetLinkMetadataRequest) returns (GetLinkMetadataResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/linkMetadata"};
|
||||
}
|
||||
}
|
||||
|
||||
message GetLinkMetadataRequest {
|
||||
string link = 1;
|
||||
}
|
||||
|
||||
message GetLinkMetadataResponse {
|
||||
LinkMetadata link_metadata = 1;
|
||||
}
|
||||
|
||||
message LinkMetadata {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string image = 3;
|
||||
}
|
22
proto/api/v1/memo_relation_service.proto
Normal file
22
proto/api/v1/memo_relation_service.proto
Normal file
@@ -0,0 +1,22 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
message MemoRelation {
|
||||
// The name of memo.
|
||||
// Format: "memos/{uid}"
|
||||
string memo = 1;
|
||||
|
||||
// The name of related memo.
|
||||
// Format: "memos/{uid}"
|
||||
string related_memo = 2;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
REFERENCE = 1;
|
||||
COMMENT = 2;
|
||||
}
|
||||
Type type = 3;
|
||||
}
|
324
proto/api/v1/memo_service.proto
Normal file
324
proto/api/v1/memo_service.proto
Normal file
@@ -0,0 +1,324 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "api/v1/memo_relation_service.proto";
|
||||
import "api/v1/reaction_service.proto";
|
||||
import "api/v1/resource_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service MemoService {
|
||||
// CreateMemo creates a memo.
|
||||
rpc CreateMemo(CreateMemoRequest) returns (Memo) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/memos"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// ListMemos lists memos with pagination and filter.
|
||||
rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/memos"};
|
||||
}
|
||||
// SearchMemos searches memos.
|
||||
rpc SearchMemos(SearchMemosRequest) returns (SearchMemosResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/memos:search"};
|
||||
}
|
||||
// GetMemo gets a memo.
|
||||
rpc GetMemo(GetMemoRequest) returns (Memo) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// UpdateMemo updates a memo.
|
||||
rpc UpdateMemo(UpdateMemoRequest) returns (Memo) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{memo.name=memos/*}"
|
||||
body: "memo"
|
||||
};
|
||||
option (google.api.method_signature) = "memo,update_mask";
|
||||
}
|
||||
// DeleteMemo deletes a memo.
|
||||
rpc DeleteMemo(DeleteMemoRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=memos/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// ExportMemos exports memos.
|
||||
rpc ExportMemos(ExportMemosRequest) returns (ExportMemosResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/memos:export",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// SetMemoResources sets resources for a memo.
|
||||
rpc SetMemoResources(SetMemoResourcesRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{name=memos/*}/resources"
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// ListMemoResources lists resources for a memo.
|
||||
rpc ListMemoResources(ListMemoResourcesRequest) returns (ListMemoResourcesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}/resources"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// SetMemoRelations sets relations for a memo.
|
||||
rpc SetMemoRelations(SetMemoRelationsRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{name=memos/*}/relations"
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// ListMemoRelations lists relations for a memo.
|
||||
rpc ListMemoRelations(ListMemoRelationsRequest) returns (ListMemoRelationsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}/relations"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// CreateMemoComment creates a comment for a memo.
|
||||
rpc CreateMemoComment(CreateMemoCommentRequest) returns (Memo) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{name=memos/*}/comments",
|
||||
body: "comment"
|
||||
};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// ListMemoComments lists comments for a memo.
|
||||
rpc ListMemoComments(ListMemoCommentsRequest) returns (ListMemoCommentsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}/comments"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// GetUserMemosStats gets stats of memos for a user.
|
||||
rpc GetUserMemosStats(GetUserMemosStatsRequest) returns (GetUserMemosStatsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/memos/stats"};
|
||||
option (google.api.method_signature) = "username";
|
||||
}
|
||||
// ListMemoReactions lists reactions for a memo.
|
||||
rpc ListMemoReactions(ListMemoReactionsRequest) returns (ListMemoReactionsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}/reactions"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// UpsertMemoReaction upserts a reaction for a memo.
|
||||
rpc UpsertMemoReaction(UpsertMemoReactionRequest) returns (Reaction) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{name=memos/*}/reactions",
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// DeleteMemoReaction deletes a reaction for a memo.
|
||||
rpc DeleteMemoReaction(DeleteMemoReactionRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/reactions/{reaction_id}"};
|
||||
option (google.api.method_signature) = "reaction_id";
|
||||
}
|
||||
}
|
||||
|
||||
enum Visibility {
|
||||
VISIBILITY_UNSPECIFIED = 0;
|
||||
PRIVATE = 1;
|
||||
PROTECTED = 2;
|
||||
PUBLIC = 3;
|
||||
}
|
||||
|
||||
message Memo {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
// id is the system generated id.
|
||||
string name = 1;
|
||||
|
||||
// The user defined id of the memo.
|
||||
string uid = 2;
|
||||
|
||||
RowStatus row_status = 3;
|
||||
|
||||
// The name of the creator.
|
||||
// Format: users/{id}
|
||||
string creator = 4;
|
||||
|
||||
google.protobuf.Timestamp create_time = 5;
|
||||
|
||||
google.protobuf.Timestamp update_time = 6;
|
||||
|
||||
google.protobuf.Timestamp display_time = 78;
|
||||
|
||||
string content = 8;
|
||||
|
||||
Visibility visibility = 9;
|
||||
|
||||
bool pinned = 10;
|
||||
|
||||
optional int32 parent_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated Resource resources = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated MemoRelation relations = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated Reaction reactions = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
|
||||
message CreateMemoRequest {
|
||||
string content = 1;
|
||||
|
||||
Visibility visibility = 2;
|
||||
}
|
||||
|
||||
message ListMemosRequest {
|
||||
// The maximum number of memos to return.
|
||||
int32 page_size = 1;
|
||||
|
||||
// A page token, received from a previous `ListMemos` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 2;
|
||||
|
||||
// Filter is used to filter memos returned in the list.
|
||||
// Format: "creator == users/{uid} && visibilities == ['PUBLIC', 'PROTECTED']"
|
||||
string filter = 3;
|
||||
}
|
||||
|
||||
message ListMemosResponse {
|
||||
repeated Memo memos = 1;
|
||||
|
||||
// A token, which can be sent as `page_token` to retrieve the next page.
|
||||
// If this field is omitted, there are no subsequent pages.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
message SearchMemosRequest {
|
||||
// Filter is used to filter memos returned.
|
||||
// Format: "creator == users/{uid} && visibilities == ['PUBLIC', 'PROTECTED']"
|
||||
string filter = 1;
|
||||
}
|
||||
|
||||
message SearchMemosResponse {
|
||||
repeated Memo memos = 1;
|
||||
}
|
||||
|
||||
message GetMemoRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message UpdateMemoRequest {
|
||||
Memo memo = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message DeleteMemoRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ExportMemosRequest {
|
||||
// Same as ListMemosRequest.filter
|
||||
string filter = 1;
|
||||
}
|
||||
|
||||
message ExportMemosResponse {
|
||||
bytes content = 1;
|
||||
}
|
||||
|
||||
message SetMemoResourcesRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
|
||||
repeated Resource resources = 2;
|
||||
}
|
||||
|
||||
message ListMemoResourcesRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListMemoResourcesResponse {
|
||||
repeated Resource resources = 1;
|
||||
}
|
||||
|
||||
message SetMemoRelationsRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
|
||||
repeated MemoRelation relations = 2;
|
||||
}
|
||||
|
||||
message ListMemoRelationsRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListMemoRelationsResponse {
|
||||
repeated MemoRelation relations = 1;
|
||||
}
|
||||
|
||||
message CreateMemoCommentRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
|
||||
CreateMemoRequest comment = 2;
|
||||
}
|
||||
|
||||
message ListMemoCommentsRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListMemoCommentsResponse {
|
||||
repeated Memo memos = 1;
|
||||
}
|
||||
|
||||
message GetUserMemosStatsRequest {
|
||||
// name is the name of the user to get stats for.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
|
||||
// timezone location
|
||||
// Format: uses tz identifier
|
||||
// https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
string timezone = 2;
|
||||
|
||||
// Same as ListMemosRequest.filter
|
||||
string filter = 3;
|
||||
}
|
||||
|
||||
message GetUserMemosStatsResponse {
|
||||
// stats is the stats of memo creating/updating activities.
|
||||
// key is the year-month-day string. e.g. "2020-01-01".
|
||||
map<string, int32> stats = 1;
|
||||
}
|
||||
|
||||
message ListMemoReactionsRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListMemoReactionsResponse {
|
||||
repeated Reaction reactions = 1;
|
||||
}
|
||||
|
||||
message UpsertMemoReactionRequest {
|
||||
// The name of the memo.
|
||||
// Format: memos/{id}
|
||||
string name = 1;
|
||||
|
||||
Reaction reaction = 2;
|
||||
}
|
||||
|
||||
message DeleteMemoReactionRequest {
|
||||
int32 reaction_id = 1;
|
||||
}
|
32
proto/api/v1/reaction_service.proto
Normal file
32
proto/api/v1/reaction_service.proto
Normal file
@@ -0,0 +1,32 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
message Reaction {
|
||||
int32 id = 1;
|
||||
|
||||
// The name of the creator.
|
||||
// Format: users/{id}
|
||||
string creator = 2;
|
||||
|
||||
string content_id = 3;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
THUMBS_UP = 1;
|
||||
THUMBS_DOWN = 2;
|
||||
HEART = 3;
|
||||
FIRE = 4;
|
||||
CLAPPING_HANDS = 5;
|
||||
LAUGH = 6;
|
||||
OK_HAND = 7;
|
||||
ROCKET = 8;
|
||||
EYES = 9;
|
||||
THINKING_FACE = 10;
|
||||
CLOWN_FACE = 11;
|
||||
QUESTION_MARK = 12;
|
||||
}
|
||||
Type reaction_type = 4;
|
||||
}
|
112
proto/api/v1/resource_service.proto
Normal file
112
proto/api/v1/resource_service.proto
Normal file
@@ -0,0 +1,112 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service ResourceService {
|
||||
// CreateResource creates a new resource.
|
||||
rpc CreateResource(CreateResourceRequest) returns (Resource) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/resources",
|
||||
body: "resource"
|
||||
};
|
||||
}
|
||||
// ListResources lists all resources.
|
||||
rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/resources"};
|
||||
}
|
||||
// SearchResources searches memos.
|
||||
rpc SearchResources(SearchResourcesRequest) returns (SearchResourcesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/resources:search"};
|
||||
}
|
||||
// GetResource returns a resource by name.
|
||||
rpc GetResource(GetResourceRequest) returns (Resource) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=resources/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// UpdateResource updates a resource.
|
||||
rpc UpdateResource(UpdateResourceRequest) returns (Resource) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{resource.name=resources/*}",
|
||||
body: "resource"
|
||||
};
|
||||
option (google.api.method_signature) = "resource,update_mask";
|
||||
}
|
||||
// DeleteResource deletes a resource by name.
|
||||
rpc DeleteResource(DeleteResourceRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=resources/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Resource {
|
||||
// The name of the resource.
|
||||
// Format: resources/{id}
|
||||
// id is the system generated unique identifier.
|
||||
string name = 1;
|
||||
|
||||
// The user defined id of the resource.
|
||||
string uid = 2;
|
||||
|
||||
google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
string filename = 4;
|
||||
|
||||
bytes content = 5 [(google.api.field_behavior) = INPUT_ONLY];
|
||||
|
||||
string external_link = 6;
|
||||
|
||||
string type = 7;
|
||||
|
||||
int64 size = 8;
|
||||
|
||||
// The related memo.
|
||||
// Format: memos/{id}
|
||||
optional string memo = 9;
|
||||
}
|
||||
|
||||
message CreateResourceRequest {
|
||||
Resource resource = 1;
|
||||
}
|
||||
|
||||
message ListResourcesRequest {}
|
||||
|
||||
message ListResourcesResponse {
|
||||
repeated Resource resources = 1;
|
||||
}
|
||||
|
||||
message SearchResourcesRequest {
|
||||
string filter = 1;
|
||||
}
|
||||
|
||||
message SearchResourcesResponse {
|
||||
repeated Resource resources = 1;
|
||||
}
|
||||
|
||||
message GetResourceRequest {
|
||||
// The name of the resource.
|
||||
// Format: resources/{id}
|
||||
// id is the system generated unique identifier.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message UpdateResourceRequest {
|
||||
Resource resource = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message DeleteResourceRequest {
|
||||
// The name of the resource.
|
||||
// Format: resources/{id}
|
||||
// id is the system generated unique identifier.
|
||||
string name = 1;
|
||||
}
|
109
proto/api/v1/storage_service.proto
Normal file
109
proto/api/v1/storage_service.proto
Normal file
@@ -0,0 +1,109 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.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 StorageService {
|
||||
// CreateStorage creates a new storage.
|
||||
rpc CreateStorage(CreateStorageRequest) returns (CreateStorageResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/storages"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// GetStorage returns a storage by id.
|
||||
rpc GetStorage(GetStorageRequest) returns (GetStorageResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/storages/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// ListStorages returns a list of storages.
|
||||
rpc ListStorages(ListStoragesRequest) returns (ListStoragesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/storages"};
|
||||
}
|
||||
// UpdateStorage updates a storage.
|
||||
rpc UpdateStorage(UpdateStorageRequest) returns (UpdateStorageResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/storages/{storage.id}"
|
||||
body: "storage"
|
||||
};
|
||||
option (google.api.method_signature) = "storage,update_mask";
|
||||
}
|
||||
// DeleteStorage deletes a storage by id.
|
||||
rpc DeleteStorage(DeleteStorageRequest) returns (DeleteStorageResponse) {
|
||||
option (google.api.http) = {delete: "/api/v1/storages/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Storage {
|
||||
int32 id = 1;
|
||||
string title = 2;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
S3 = 1;
|
||||
}
|
||||
Type type = 3;
|
||||
StorageConfig config = 4;
|
||||
}
|
||||
|
||||
message StorageConfig {
|
||||
oneof config {
|
||||
S3Config s3_config = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message S3Config {
|
||||
string end_point = 1;
|
||||
string path = 2;
|
||||
string region = 3;
|
||||
string access_key = 4;
|
||||
string secret_key = 5;
|
||||
string bucket = 6;
|
||||
string url_prefix = 7;
|
||||
string url_suffix = 8;
|
||||
bool pre_sign = 9;
|
||||
}
|
||||
|
||||
message CreateStorageRequest {
|
||||
Storage storage = 1;
|
||||
}
|
||||
|
||||
message CreateStorageResponse {
|
||||
Storage storage = 1;
|
||||
}
|
||||
|
||||
message GetStorageRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message GetStorageResponse {
|
||||
Storage storage = 1;
|
||||
}
|
||||
|
||||
message ListStoragesRequest {}
|
||||
|
||||
message ListStoragesResponse {
|
||||
repeated Storage storages = 1;
|
||||
}
|
||||
|
||||
message UpdateStorageRequest {
|
||||
Storage storage = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UpdateStorageResponse {
|
||||
Storage storage = 1;
|
||||
}
|
||||
|
||||
message DeleteStorageRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message DeleteStorageResponse {}
|
88
proto/api/v1/tag_service.proto
Normal file
88
proto/api/v1/tag_service.proto
Normal file
@@ -0,0 +1,88 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service TagService {
|
||||
// UpsertTag upserts a tag.
|
||||
rpc UpsertTag(UpsertTagRequest) returns (Tag) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/tags",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// BatchUpsertTag upserts multiple tags.
|
||||
rpc BatchUpsertTag(BatchUpsertTagRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/tags:batchUpsert",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// ListTags lists tags.
|
||||
rpc ListTags(ListTagsRequest) returns (ListTagsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/tags"};
|
||||
}
|
||||
// RenameTag renames a tag.
|
||||
// All related memos will be updated.
|
||||
rpc RenameTag(RenameTagRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/tags:rename",
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// DeleteTag deletes a tag.
|
||||
rpc DeleteTag(DeleteTagRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/tags"};
|
||||
}
|
||||
// GetTagSuggestions gets tag suggestions from the user's memos.
|
||||
rpc GetTagSuggestions(GetTagSuggestionsRequest) returns (GetTagSuggestionsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/tags/suggestion"};
|
||||
}
|
||||
}
|
||||
|
||||
message Tag {
|
||||
string name = 1;
|
||||
// The creator of tags.
|
||||
// Format: users/{id}
|
||||
string creator = 2;
|
||||
}
|
||||
|
||||
message UpsertTagRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message BatchUpsertTagRequest {
|
||||
repeated UpsertTagRequest requests = 1;
|
||||
}
|
||||
|
||||
message ListTagsRequest {}
|
||||
|
||||
message ListTagsResponse {
|
||||
repeated Tag tags = 1;
|
||||
}
|
||||
|
||||
message RenameTagRequest {
|
||||
// The creator of tags.
|
||||
// Format: users/{id}
|
||||
string user = 1;
|
||||
string old_name = 2;
|
||||
string new_name = 3;
|
||||
}
|
||||
|
||||
message DeleteTagRequest {
|
||||
Tag tag = 1;
|
||||
}
|
||||
|
||||
message GetTagSuggestionsRequest {
|
||||
// The creator of tags.
|
||||
// Format: users/{id}
|
||||
string user = 1;
|
||||
}
|
||||
|
||||
message GetTagSuggestionsResponse {
|
||||
repeated string tags = 1;
|
||||
}
|
213
proto/api/v1/user_service.proto
Normal file
213
proto/api/v1/user_service.proto
Normal file
@@ -0,0 +1,213 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/empty.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"};
|
||||
}
|
||||
// SearchUsers searches users by filter.
|
||||
rpc SearchUsers(SearchUsersRequest) returns (SearchUsersResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users:search"};
|
||||
}
|
||||
// GetUser gets a user by name.
|
||||
rpc GetUser(GetUserRequest) returns (User) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// CreateUser creates a new user.
|
||||
rpc CreateUser(CreateUserRequest) returns (User) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/users"
|
||||
body: "user"
|
||||
};
|
||||
option (google.api.method_signature) = "user";
|
||||
}
|
||||
// UpdateUser updates a user.
|
||||
rpc UpdateUser(UpdateUserRequest) returns (User) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{user.name=users/*}"
|
||||
body: "user"
|
||||
};
|
||||
option (google.api.method_signature) = "user,update_mask";
|
||||
}
|
||||
// DeleteUser deletes a user.
|
||||
rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=users/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// GetUserSetting gets the setting of a user.
|
||||
rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*}/setting"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// UpdateUserSetting updates the setting of a user.
|
||||
rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UserSetting) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{setting.name=users/*/setting}"
|
||||
body: "setting"
|
||||
};
|
||||
option (google.api.method_signature) = "setting,update_mask";
|
||||
}
|
||||
// ListUserAccessTokens returns a list of access tokens for a user.
|
||||
rpc ListUserAccessTokens(ListUserAccessTokensRequest) returns (ListUserAccessTokensResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*}/access_tokens"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// CreateUserAccessToken creates a new access token for a user.
|
||||
rpc CreateUserAccessToken(CreateUserAccessTokenRequest) returns (UserAccessToken) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{name=users/*}/access_tokens"
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// DeleteUserAccessToken deletes an access token for a user.
|
||||
rpc DeleteUserAccessToken(DeleteUserAccessTokenRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=users/*}/access_tokens/{access_token}"};
|
||||
option (google.api.method_signature) = "name,access_token";
|
||||
}
|
||||
}
|
||||
|
||||
message User {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
|
||||
// The system generated uid of the user.
|
||||
int32 id = 2;
|
||||
|
||||
enum Role {
|
||||
ROLE_UNSPECIFIED = 0;
|
||||
HOST = 1;
|
||||
ADMIN = 2;
|
||||
USER = 3;
|
||||
}
|
||||
Role role = 3;
|
||||
|
||||
string username = 4;
|
||||
|
||||
string email = 5;
|
||||
|
||||
string nickname = 6;
|
||||
|
||||
string avatar_url = 7;
|
||||
|
||||
string description = 8;
|
||||
|
||||
string password = 9 [(google.api.field_behavior) = INPUT_ONLY];
|
||||
|
||||
RowStatus row_status = 10;
|
||||
|
||||
google.protobuf.Timestamp create_time = 11;
|
||||
|
||||
google.protobuf.Timestamp update_time = 12;
|
||||
}
|
||||
|
||||
message ListUsersRequest {}
|
||||
|
||||
message ListUsersResponse {
|
||||
repeated User users = 1;
|
||||
}
|
||||
|
||||
message SearchUsersRequest {
|
||||
// Filter is used to filter users returned in the list.
|
||||
// Format: "username == frank"
|
||||
string filter = 1;
|
||||
}
|
||||
|
||||
message SearchUsersResponse {
|
||||
repeated User users = 1;
|
||||
}
|
||||
|
||||
message GetUserRequest {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message CreateUserRequest {
|
||||
User user = 1;
|
||||
}
|
||||
|
||||
message UpdateUserRequest {
|
||||
User user = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message DeleteUserRequest {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message UserSetting {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
// The preferred locale of the user.
|
||||
string locale = 2;
|
||||
// The preferred appearance of the user.
|
||||
string appearance = 3;
|
||||
// The default visibility of the memo.
|
||||
string memo_visibility = 4;
|
||||
}
|
||||
|
||||
message GetUserSettingRequest {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message UpdateUserSettingRequest {
|
||||
UserSetting setting = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message UserAccessToken {
|
||||
string access_token = 1;
|
||||
string description = 2;
|
||||
google.protobuf.Timestamp issued_at = 3;
|
||||
google.protobuf.Timestamp expires_at = 4;
|
||||
}
|
||||
|
||||
message ListUserAccessTokensRequest {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message ListUserAccessTokensResponse {
|
||||
repeated UserAccessToken access_tokens = 1;
|
||||
}
|
||||
|
||||
message CreateUserAccessTokenRequest {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
|
||||
string description = 2;
|
||||
|
||||
optional google.protobuf.Timestamp expires_at = 3;
|
||||
}
|
||||
|
||||
message DeleteUserAccessTokenRequest {
|
||||
// The name of the user.
|
||||
// Format: users/{id}
|
||||
string name = 1;
|
||||
// access_token is the access token to delete.
|
||||
string access_token = 2;
|
||||
}
|
88
proto/api/v1/webhook_service.proto
Normal file
88
proto/api/v1/webhook_service.proto
Normal file
@@ -0,0 +1,88 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WebhookService {
|
||||
// CreateWebhook creates a new webhook.
|
||||
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/webhooks"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// GetWebhook returns a webhook by id.
|
||||
rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {get: "/api/v1/webhooks/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// ListWebhooks returns a list of webhooks.
|
||||
rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/webhooks"};
|
||||
}
|
||||
// UpdateWebhook updates a webhook.
|
||||
rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/webhooks/{webhook.id}"
|
||||
body: "webhook"
|
||||
};
|
||||
option (google.api.method_signature) = "webhook,update_mask";
|
||||
}
|
||||
// DeleteWebhook deletes a webhook by id.
|
||||
rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/webhooks/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
}
|
||||
|
||||
message Webhook {
|
||||
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 url = 7;
|
||||
}
|
||||
|
||||
message CreateWebhookRequest {
|
||||
string name = 1;
|
||||
|
||||
string url = 2;
|
||||
}
|
||||
|
||||
message GetWebhookRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message ListWebhooksRequest {
|
||||
int32 creator_id = 1;
|
||||
}
|
||||
|
||||
message ListWebhooksResponse {
|
||||
repeated Webhook webhooks = 1;
|
||||
}
|
||||
|
||||
message UpdateWebhookRequest {
|
||||
Webhook webhook = 1;
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
}
|
||||
|
||||
message DeleteWebhookRequest {
|
||||
int32 id = 1;
|
||||
}
|
26
proto/api/v1/workspace_service.proto
Normal file
26
proto/api/v1/workspace_service.proto
Normal file
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WorkspaceService {
|
||||
// GetWorkspaceProfile returns the workspace profile.
|
||||
rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/profile"};
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceProfile {
|
||||
// The name of instance owner.
|
||||
// Format: "users/{id}"
|
||||
string owner = 1;
|
||||
// version is the current version of instance
|
||||
string version = 2;
|
||||
// mode is the instance mode (e.g. "prod", "dev" or "demo").
|
||||
string mode = 3;
|
||||
}
|
||||
|
||||
message GetWorkspaceProfileRequest {}
|
109
proto/api/v1/workspace_setting_service.proto
Normal file
109
proto/api/v1/workspace_setting_service.proto
Normal file
@@ -0,0 +1,109 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WorkspaceSettingService {
|
||||
// ListWorkspaceSetting returns the list of settings.
|
||||
rpc ListWorkspaceSettings(ListWorkspaceSettingsRequest) returns (ListWorkspaceSettingsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/settings"};
|
||||
}
|
||||
// GetWorkspaceSetting returns the setting by name.
|
||||
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// SetWorkspaceSetting updates the setting.
|
||||
rpc SetWorkspaceSetting(SetWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/workspace/{setting.name=settings/*}",
|
||||
body: "setting"
|
||||
};
|
||||
option (google.api.method_signature) = "setting";
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceSetting {
|
||||
// name is the name of the setting.
|
||||
// Format: settings/{setting}
|
||||
string name = 1;
|
||||
oneof value {
|
||||
WorkspaceGeneralSetting general_setting = 2;
|
||||
WorkspaceStorageSetting storage_setting = 3;
|
||||
WorkspaceMemoRelatedSetting memo_related_setting = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceGeneralSetting {
|
||||
// instance_url is the instance URL.
|
||||
string instance_url = 1;
|
||||
// disallow_signup is the flag to disallow signup.
|
||||
bool disallow_signup = 2;
|
||||
// disallow_password_login is the flag to disallow password login.
|
||||
bool disallow_password_login = 3;
|
||||
// additional_script is the additional script.
|
||||
string additional_script = 4;
|
||||
// additional_style is the additional style.
|
||||
string additional_style = 5;
|
||||
// custom_profile is the custom profile.
|
||||
WorkspaceCustomProfile custom_profile = 6;
|
||||
}
|
||||
|
||||
message WorkspaceCustomProfile {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string logo_url = 3;
|
||||
string locale = 4;
|
||||
string appearance = 5;
|
||||
}
|
||||
|
||||
message WorkspaceStorageSetting {
|
||||
// storage_type is the storage type.
|
||||
StorageType storage_type = 1;
|
||||
// The id of actived external storage.
|
||||
optional int32 actived_external_storage_id = 2;
|
||||
// The template of local storage path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
string local_storage_path_template = 3;
|
||||
// The max upload size in megabytes.
|
||||
int64 upload_size_limit_mb = 4;
|
||||
|
||||
enum StorageType {
|
||||
STORAGE_TYPE_UNSPECIFIED = 0;
|
||||
// STORAGE_TYPE_DATABASE is the database storage type.
|
||||
STORAGE_TYPE_DATABASE = 1;
|
||||
// STORAGE_TYPE_LOCAL is the local storage type.
|
||||
STORAGE_TYPE_LOCAL = 2;
|
||||
// STORAGE_TYPE_EXTERNAL is the external storage type.
|
||||
STORAGE_TYPE_EXTERNAL = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceMemoRelatedSetting {
|
||||
// disallow_public_share disallows set memo as public visible.
|
||||
bool disallow_public_visible = 1;
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
bool display_with_update_time = 2;
|
||||
}
|
||||
|
||||
message ListWorkspaceSettingsRequest {}
|
||||
|
||||
message ListWorkspaceSettingsResponse {
|
||||
repeated WorkspaceSetting settings = 1;
|
||||
}
|
||||
|
||||
message GetWorkspaceSettingRequest {
|
||||
// The resource name of the workspace setting.
|
||||
// Format: settings/{setting}
|
||||
string name = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message SetWorkspaceSettingRequest {
|
||||
// setting is the setting to update.
|
||||
WorkspaceSetting setting = 1;
|
||||
}
|
Reference in New Issue
Block a user