init commit
This commit is contained in:
3
proto/api/v1/README.md
Normal file
3
proto/api/v1/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Memos API Design
|
||||
|
||||
This API design should follow the guidelines and best practices outlined in the [Google API Improvement Proposals (AIPs)](https://google.aip.dev/).
|
||||
127
proto/api/v1/activity_service.proto
Normal file
127
proto/api/v1/activity_service.proto
Normal file
@@ -0,0 +1,127 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service ActivityService {
|
||||
// ListActivities returns a list of activities.
|
||||
rpc ListActivities(ListActivitiesRequest) returns (ListActivitiesResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/activities"};
|
||||
}
|
||||
|
||||
// GetActivity returns the activity with the given id.
|
||||
rpc GetActivity(GetActivityRequest) returns (Activity) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=activities/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Activity {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Activity"
|
||||
pattern: "activities/{activity}"
|
||||
name_field: "name"
|
||||
singular: "activity"
|
||||
plural: "activities"
|
||||
};
|
||||
|
||||
// The name of the activity.
|
||||
// Format: activities/{id}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = OUTPUT_ONLY,
|
||||
(google.api.field_behavior) = IDENTIFIER
|
||||
];
|
||||
|
||||
// The name of the creator.
|
||||
// Format: users/{user}
|
||||
string creator = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The type of the activity.
|
||||
Type type = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The level of the activity.
|
||||
Level level = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// 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 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Activity types.
|
||||
enum Type {
|
||||
// Unspecified type.
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
// Memo comment activity.
|
||||
MEMO_COMMENT = 1;
|
||||
// Version update activity.
|
||||
VERSION_UPDATE = 2;
|
||||
}
|
||||
|
||||
// Activity levels.
|
||||
enum Level {
|
||||
// Unspecified level.
|
||||
LEVEL_UNSPECIFIED = 0;
|
||||
// Info level.
|
||||
INFO = 1;
|
||||
// Warn level.
|
||||
WARN = 2;
|
||||
// Error level.
|
||||
ERROR = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ActivityPayload {
|
||||
oneof payload {
|
||||
// Memo comment activity payload.
|
||||
ActivityMemoCommentPayload memo_comment = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ActivityMemoCommentPayload represents the payload of a memo comment activity.
|
||||
message ActivityMemoCommentPayload {
|
||||
// The memo name of comment.
|
||||
// Format: memos/{memo}
|
||||
string memo = 1;
|
||||
// The name of related memo.
|
||||
// Format: memos/{memo}
|
||||
string related_memo = 2;
|
||||
}
|
||||
|
||||
message ListActivitiesRequest {
|
||||
// The maximum number of activities to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 100 activities will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
int32 page_size = 1;
|
||||
|
||||
// A page token, received from a previous `ListActivities` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 2;
|
||||
}
|
||||
|
||||
message ListActivitiesResponse {
|
||||
// The activities.
|
||||
repeated Activity activities = 1;
|
||||
|
||||
// A token to retrieve the next page of results.
|
||||
// Pass this value in the page_token field in the subsequent call to `ListActivities`
|
||||
// method to retrieve the next page of results.
|
||||
string next_page_token = 2;
|
||||
}
|
||||
|
||||
message GetActivityRequest {
|
||||
// The name of the activity.
|
||||
// Format: activities/{id}, id is the system generated auto-incremented id.
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Activity"}
|
||||
];
|
||||
}
|
||||
171
proto/api/v1/attachment_service.proto
Normal file
171
proto/api/v1/attachment_service.proto
Normal file
@@ -0,0 +1,171 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/httpbody.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service AttachmentService {
|
||||
// CreateAttachment creates a new attachment.
|
||||
rpc CreateAttachment(CreateAttachmentRequest) returns (Attachment) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/attachments"
|
||||
body: "attachment"
|
||||
};
|
||||
option (google.api.method_signature) = "attachment";
|
||||
}
|
||||
// ListAttachments lists all attachments.
|
||||
rpc ListAttachments(ListAttachmentsRequest) returns (ListAttachmentsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/attachments"};
|
||||
}
|
||||
// GetAttachment returns a attachment by name.
|
||||
rpc GetAttachment(GetAttachmentRequest) returns (Attachment) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=attachments/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// GetAttachmentBinary returns a attachment binary by name.
|
||||
rpc GetAttachmentBinary(GetAttachmentBinaryRequest) returns (google.api.HttpBody) {
|
||||
option (google.api.http) = {get: "/file/{name=attachments/*}/{filename}"};
|
||||
option (google.api.method_signature) = "name,filename,thumbnail";
|
||||
}
|
||||
// UpdateAttachment updates a attachment.
|
||||
rpc UpdateAttachment(UpdateAttachmentRequest) returns (Attachment) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{attachment.name=attachments/*}"
|
||||
body: "attachment"
|
||||
};
|
||||
option (google.api.method_signature) = "attachment,update_mask";
|
||||
}
|
||||
// DeleteAttachment deletes a attachment by name.
|
||||
rpc DeleteAttachment(DeleteAttachmentRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=attachments/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Attachment {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Attachment"
|
||||
pattern: "attachments/{attachment}"
|
||||
singular: "attachment"
|
||||
plural: "attachments"
|
||||
};
|
||||
|
||||
// The name of the attachment.
|
||||
// Format: attachments/{attachment}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// Output only. The creation timestamp.
|
||||
google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The filename of the attachment.
|
||||
string filename = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Input only. The content of the attachment.
|
||||
bytes content = 4 [(google.api.field_behavior) = INPUT_ONLY];
|
||||
|
||||
// Optional. The external link of the attachment.
|
||||
string external_link = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// The MIME type of the attachment.
|
||||
string type = 6 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Output only. The size of the attachment in bytes.
|
||||
int64 size = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Optional. The related memo. Refer to `Memo.name`.
|
||||
// Format: memos/{memo}
|
||||
optional string memo = 8 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message CreateAttachmentRequest {
|
||||
// Required. The attachment to create.
|
||||
Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The attachment ID to use for this attachment.
|
||||
// If empty, a unique ID will be generated.
|
||||
string attachment_id = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListAttachmentsRequest {
|
||||
// Optional. The maximum number of attachments to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 50 attachments will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token, received from a previous `ListAttachments` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Filter to apply to the list results.
|
||||
// Example: "type=image/png" or "filename:*.jpg"
|
||||
// Supported operators: =, !=, <, <=, >, >=, :
|
||||
// Supported fields: filename, type, size, create_time, memo
|
||||
string filter = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The order to sort results by.
|
||||
// Example: "create_time desc" or "filename asc"
|
||||
string order_by = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListAttachmentsResponse {
|
||||
// The list of attachments.
|
||||
repeated Attachment attachments = 1;
|
||||
|
||||
// A token that 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;
|
||||
|
||||
// The total count of attachments (may be approximate).
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message GetAttachmentRequest {
|
||||
// Required. The attachment name of the attachment to retrieve.
|
||||
// Format: attachments/{attachment}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Attachment"}
|
||||
];
|
||||
}
|
||||
|
||||
message GetAttachmentBinaryRequest {
|
||||
// Required. The attachment name of the attachment.
|
||||
// Format: attachments/{attachment}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Attachment"}
|
||||
];
|
||||
|
||||
// The filename of the attachment. Mainly used for downloading.
|
||||
string filename = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. A flag indicating if the thumbnail version of the attachment should be returned.
|
||||
bool thumbnail = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateAttachmentRequest {
|
||||
// Required. The attachment which replaces the attachment on the server.
|
||||
Attachment attachment = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message DeleteAttachmentRequest {
|
||||
// Required. The attachment name of the attachment to delete.
|
||||
// Format: attachments/{attachment}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Attachment"}
|
||||
];
|
||||
}
|
||||
93
proto/api/v1/auth_service.proto
Normal file
93
proto/api/v1/auth_service.proto
Normal file
@@ -0,0 +1,93 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/user_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service AuthService {
|
||||
// GetCurrentSession returns the current active session information.
|
||||
// This method is idempotent and safe, suitable for checking current session state.
|
||||
rpc GetCurrentSession(GetCurrentSessionRequest) returns (GetCurrentSessionResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/auth/sessions/current"};
|
||||
}
|
||||
|
||||
// CreateSession authenticates a user and creates a new session.
|
||||
// Returns the authenticated user information upon successful authentication.
|
||||
rpc CreateSession(CreateSessionRequest) returns (CreateSessionResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/auth/sessions"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteSession terminates the current user session.
|
||||
// This is an idempotent operation that invalidates the user's authentication.
|
||||
rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/auth/sessions/current"};
|
||||
}
|
||||
}
|
||||
|
||||
message GetCurrentSessionRequest {}
|
||||
|
||||
message GetCurrentSessionResponse {
|
||||
User user = 1;
|
||||
|
||||
// Last time the session was accessed.
|
||||
// Used for sliding expiration calculation (last_accessed_time + 2 weeks).
|
||||
google.protobuf.Timestamp last_accessed_at = 2;
|
||||
}
|
||||
|
||||
message CreateSessionRequest {
|
||||
// Nested message for password-based authentication credentials.
|
||||
message PasswordCredentials {
|
||||
// The username to sign in with.
|
||||
// Required field for password-based authentication.
|
||||
string username = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The password to sign in with.
|
||||
// Required field for password-based authentication.
|
||||
string password = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
// Nested message for SSO authentication credentials.
|
||||
message SSOCredentials {
|
||||
// The ID of the SSO provider.
|
||||
// Required field to identify the SSO provider.
|
||||
int32 idp_id = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The authorization code from the SSO provider.
|
||||
// Required field for completing the SSO flow.
|
||||
string code = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The redirect URI used in the SSO flow.
|
||||
// Required field for security validation.
|
||||
string redirect_uri = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
// Provide one authentication method (username/password or SSO).
|
||||
// Required field to specify the authentication method.
|
||||
oneof credentials {
|
||||
// Username and password authentication method.
|
||||
PasswordCredentials password_credentials = 1;
|
||||
|
||||
// SSO provider authentication method.
|
||||
SSOCredentials sso_credentials = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CreateSessionResponse {
|
||||
// The authenticated user information.
|
||||
User user = 1;
|
||||
|
||||
// Last time the session was accessed.
|
||||
// Used for sliding expiration calculation (last_accessed_time + 2 weeks).
|
||||
google.protobuf.Timestamp last_accessed_at = 2;
|
||||
}
|
||||
|
||||
message DeleteSessionRequest {}
|
||||
23
proto/api/v1/common.proto
Normal file
23
proto/api/v1/common.proto
Normal file
@@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
enum State {
|
||||
STATE_UNSPECIFIED = 0;
|
||||
NORMAL = 1;
|
||||
ARCHIVED = 2;
|
||||
}
|
||||
|
||||
// Used internally for obfuscating the page token.
|
||||
message PageToken {
|
||||
int32 limit = 1;
|
||||
int32 offset = 2;
|
||||
}
|
||||
|
||||
enum Direction {
|
||||
DIRECTION_UNSPECIFIED = 0;
|
||||
ASC = 1;
|
||||
DESC = 2;
|
||||
}
|
||||
147
proto/api/v1/idp_service.proto
Normal file
147
proto/api/v1/idp_service.proto
Normal file
@@ -0,0 +1,147 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.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"
|
||||
};
|
||||
option (google.api.method_signature) = "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 {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/IdentityProvider"
|
||||
pattern: "identityProviders/{idp}"
|
||||
name_field: "name"
|
||||
singular: "identityProvider"
|
||||
plural: "identityProviders"
|
||||
};
|
||||
|
||||
// The resource name of the identity provider.
|
||||
// Format: identityProviders/{idp}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// Required. The type of the identity provider.
|
||||
Type type = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The display title of the identity provider.
|
||||
string title = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. Filter applied to user identifiers.
|
||||
string identifier_filter = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Required. Configuration for the identity provider.
|
||||
IdentityProviderConfig config = 5 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
// OAuth2 identity provider.
|
||||
OAUTH2 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message IdentityProviderConfig {
|
||||
oneof config {
|
||||
OAuth2Config oauth2_config = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message FieldMapping {
|
||||
string identifier = 1;
|
||||
string display_name = 2;
|
||||
string email = 3;
|
||||
string avatar_url = 4;
|
||||
}
|
||||
|
||||
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 {
|
||||
// The list of identity providers.
|
||||
repeated IdentityProvider identity_providers = 1;
|
||||
}
|
||||
|
||||
message GetIdentityProviderRequest {
|
||||
// Required. The resource name of the identity provider to get.
|
||||
// Format: identityProviders/{idp}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/IdentityProvider"}
|
||||
];
|
||||
}
|
||||
|
||||
message CreateIdentityProviderRequest {
|
||||
// Required. The identity provider to create.
|
||||
IdentityProvider identity_provider = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The ID to use for the identity provider, which will become the final component of the resource name.
|
||||
// If not provided, the system will generate one.
|
||||
string identity_provider_id = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateIdentityProviderRequest {
|
||||
// Required. The identity provider to update.
|
||||
IdentityProvider identity_provider = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The update mask applies to the resource. Only the top level fields of
|
||||
// IdentityProvider are supported.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message DeleteIdentityProviderRequest {
|
||||
// Required. The resource name of the identity provider to delete.
|
||||
// Format: identityProviders/{idp}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/IdentityProvider"}
|
||||
];
|
||||
}
|
||||
149
proto/api/v1/inbox_service.proto
Normal file
149
proto/api/v1/inbox_service.proto
Normal file
@@ -0,0 +1,149 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.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/{parent=users/*}/inboxes"};
|
||||
option (google.api.method_signature) = "parent";
|
||||
}
|
||||
// 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 {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Inbox"
|
||||
pattern: "inboxes/{inbox}"
|
||||
name_field: "name"
|
||||
singular: "inbox"
|
||||
plural: "inboxes"
|
||||
};
|
||||
|
||||
// The resource name of the inbox.
|
||||
// Format: inboxes/{inbox}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The sender of the inbox notification.
|
||||
// Format: users/{user}
|
||||
string sender = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The receiver of the inbox notification.
|
||||
// Format: users/{user}
|
||||
string receiver = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The status of the inbox notification.
|
||||
Status status = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Output only. The creation timestamp.
|
||||
google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The type of the inbox notification.
|
||||
Type type = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Optional. The activity ID associated with this inbox notification.
|
||||
optional int32 activity_id = 7 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Status enumeration for inbox notifications.
|
||||
enum Status {
|
||||
// Unspecified status.
|
||||
STATUS_UNSPECIFIED = 0;
|
||||
// The notification is unread.
|
||||
UNREAD = 1;
|
||||
// The notification is archived.
|
||||
ARCHIVED = 2;
|
||||
}
|
||||
|
||||
// Type enumeration for inbox notifications.
|
||||
enum Type {
|
||||
// Unspecified type.
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
// Memo comment notification.
|
||||
MEMO_COMMENT = 1;
|
||||
// Version update notification.
|
||||
VERSION_UPDATE = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ListInboxesRequest {
|
||||
// Required. The parent resource whose inboxes will be listed.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of inboxes to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 50 inboxes will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token, received from a previous `ListInboxes` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Filter to apply to the list results.
|
||||
// Example: "status=UNREAD" or "type=MEMO_COMMENT"
|
||||
// Supported operators: =, !=
|
||||
// Supported fields: status, type, sender, create_time
|
||||
string filter = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The order to sort results by.
|
||||
// Example: "create_time desc" or "status asc"
|
||||
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListInboxesResponse {
|
||||
// The list of inboxes.
|
||||
repeated Inbox inboxes = 1;
|
||||
|
||||
// A token that 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;
|
||||
|
||||
// The total count of inboxes (may be approximate).
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message UpdateInboxRequest {
|
||||
// Required. The inbox to update.
|
||||
Inbox inbox = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. If set to true, allows updating missing fields.
|
||||
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteInboxRequest {
|
||||
// Required. The resource name of the inbox to delete.
|
||||
// Format: inboxes/{inbox}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Inbox"}
|
||||
];
|
||||
}
|
||||
329
proto/api/v1/markdown_service.proto
Normal file
329
proto/api/v1/markdown_service.proto
Normal file
@@ -0,0 +1,329 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service MarkdownService {
|
||||
// ParseMarkdown parses the given markdown content and returns a list of nodes.
|
||||
// This is a utility method that transforms markdown text into structured nodes.
|
||||
rpc ParseMarkdown(ParseMarkdownRequest) returns (ParseMarkdownResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/markdown:parse"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// RestoreMarkdownNodes restores the given nodes to markdown content.
|
||||
// This is the inverse operation of ParseMarkdown.
|
||||
rpc RestoreMarkdownNodes(RestoreMarkdownNodesRequest) returns (RestoreMarkdownNodesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/markdown:restore"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// StringifyMarkdownNodes stringify the given nodes to plain text content.
|
||||
// This removes all markdown formatting and returns plain text.
|
||||
rpc StringifyMarkdownNodes(StringifyMarkdownNodesRequest) returns (StringifyMarkdownNodesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/markdown:stringify"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// GetLinkMetadata returns metadata for a given link.
|
||||
// This is useful for generating link previews.
|
||||
rpc GetLinkMetadata(GetLinkMetadataRequest) returns (LinkMetadata) {
|
||||
option (google.api.http) = {get: "/api/v1/markdown/links:getMetadata"};
|
||||
}
|
||||
}
|
||||
|
||||
message ParseMarkdownRequest {
|
||||
// The markdown content to parse.
|
||||
string markdown = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message ParseMarkdownResponse {
|
||||
// The parsed markdown nodes.
|
||||
repeated Node nodes = 1;
|
||||
}
|
||||
|
||||
message RestoreMarkdownNodesRequest {
|
||||
// The nodes to restore to markdown content.
|
||||
repeated Node nodes = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message RestoreMarkdownNodesResponse {
|
||||
// The restored markdown content.
|
||||
string markdown = 1;
|
||||
}
|
||||
|
||||
message StringifyMarkdownNodesRequest {
|
||||
// The nodes to stringify to plain text.
|
||||
repeated Node nodes = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message StringifyMarkdownNodesResponse {
|
||||
// The plain text content.
|
||||
string plain_text = 1;
|
||||
}
|
||||
|
||||
message GetLinkMetadataRequest {
|
||||
// The link URL to get metadata for.
|
||||
string link = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message LinkMetadata {
|
||||
// The title of the linked page.
|
||||
string title = 1;
|
||||
|
||||
// The description of the linked page.
|
||||
string description = 2;
|
||||
|
||||
// The URL of the preview image for the linked page.
|
||||
string image = 3;
|
||||
}
|
||||
|
||||
enum NodeType {
|
||||
NODE_UNSPECIFIED = 0;
|
||||
|
||||
// Block nodes.
|
||||
LINE_BREAK = 1;
|
||||
PARAGRAPH = 2;
|
||||
CODE_BLOCK = 3;
|
||||
HEADING = 4;
|
||||
HORIZONTAL_RULE = 5;
|
||||
BLOCKQUOTE = 6;
|
||||
LIST = 7;
|
||||
ORDERED_LIST_ITEM = 8;
|
||||
UNORDERED_LIST_ITEM = 9;
|
||||
TASK_LIST_ITEM = 10;
|
||||
MATH_BLOCK = 11;
|
||||
TABLE = 12;
|
||||
EMBEDDED_CONTENT = 13;
|
||||
|
||||
// Inline nodes.
|
||||
TEXT = 51;
|
||||
BOLD = 52;
|
||||
ITALIC = 53;
|
||||
BOLD_ITALIC = 54;
|
||||
CODE = 55;
|
||||
IMAGE = 56;
|
||||
LINK = 57;
|
||||
AUTO_LINK = 58;
|
||||
TAG = 59;
|
||||
STRIKETHROUGH = 60;
|
||||
ESCAPING_CHARACTER = 61;
|
||||
MATH = 62;
|
||||
HIGHLIGHT = 63;
|
||||
SUBSCRIPT = 64;
|
||||
SUPERSCRIPT = 65;
|
||||
REFERENCED_CONTENT = 66;
|
||||
SPOILER = 67;
|
||||
HTML_ELEMENT = 68;
|
||||
}
|
||||
|
||||
message Node {
|
||||
NodeType type = 1;
|
||||
|
||||
oneof node {
|
||||
// Block nodes.
|
||||
LineBreakNode line_break_node = 11;
|
||||
ParagraphNode paragraph_node = 12;
|
||||
CodeBlockNode code_block_node = 13;
|
||||
HeadingNode heading_node = 14;
|
||||
HorizontalRuleNode horizontal_rule_node = 15;
|
||||
BlockquoteNode blockquote_node = 16;
|
||||
ListNode list_node = 17;
|
||||
OrderedListItemNode ordered_list_item_node = 18;
|
||||
UnorderedListItemNode unordered_list_item_node = 19;
|
||||
TaskListItemNode task_list_item_node = 20;
|
||||
MathBlockNode math_block_node = 21;
|
||||
TableNode table_node = 22;
|
||||
EmbeddedContentNode embedded_content_node = 23;
|
||||
|
||||
// Inline nodes.
|
||||
TextNode text_node = 51;
|
||||
BoldNode bold_node = 52;
|
||||
ItalicNode italic_node = 53;
|
||||
BoldItalicNode bold_italic_node = 54;
|
||||
CodeNode code_node = 55;
|
||||
ImageNode image_node = 56;
|
||||
LinkNode link_node = 57;
|
||||
AutoLinkNode auto_link_node = 58;
|
||||
TagNode tag_node = 59;
|
||||
StrikethroughNode strikethrough_node = 60;
|
||||
EscapingCharacterNode escaping_character_node = 61;
|
||||
MathNode math_node = 62;
|
||||
HighlightNode highlight_node = 63;
|
||||
SubscriptNode subscript_node = 64;
|
||||
SuperscriptNode superscript_node = 65;
|
||||
ReferencedContentNode referenced_content_node = 66;
|
||||
SpoilerNode spoiler_node = 67;
|
||||
HTMLElementNode html_element_node = 68;
|
||||
}
|
||||
}
|
||||
|
||||
message LineBreakNode {}
|
||||
|
||||
message ParagraphNode {
|
||||
repeated Node children = 1;
|
||||
}
|
||||
|
||||
message CodeBlockNode {
|
||||
string language = 1;
|
||||
string content = 2;
|
||||
}
|
||||
|
||||
message HeadingNode {
|
||||
int32 level = 1;
|
||||
repeated Node children = 2;
|
||||
}
|
||||
|
||||
message HorizontalRuleNode {
|
||||
string symbol = 1;
|
||||
}
|
||||
|
||||
message BlockquoteNode {
|
||||
repeated Node children = 1;
|
||||
}
|
||||
|
||||
message ListNode {
|
||||
enum Kind {
|
||||
KIND_UNSPECIFIED = 0;
|
||||
ORDERED = 1;
|
||||
UNORDERED = 2;
|
||||
DESCRIPTION = 3;
|
||||
}
|
||||
Kind kind = 1;
|
||||
int32 indent = 2;
|
||||
repeated Node children = 3;
|
||||
}
|
||||
|
||||
message OrderedListItemNode {
|
||||
string number = 1;
|
||||
int32 indent = 2;
|
||||
repeated Node children = 3;
|
||||
}
|
||||
|
||||
message UnorderedListItemNode {
|
||||
string symbol = 1;
|
||||
int32 indent = 2;
|
||||
repeated Node children = 3;
|
||||
}
|
||||
|
||||
message TaskListItemNode {
|
||||
string symbol = 1;
|
||||
int32 indent = 2;
|
||||
bool complete = 3;
|
||||
repeated Node children = 4;
|
||||
}
|
||||
|
||||
message MathBlockNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message TableNode {
|
||||
repeated Node header = 1;
|
||||
repeated string delimiter = 2;
|
||||
|
||||
message Row {
|
||||
repeated Node cells = 1;
|
||||
}
|
||||
repeated Row rows = 3;
|
||||
}
|
||||
|
||||
message EmbeddedContentNode {
|
||||
// The resource name of the embedded content.
|
||||
string resource_name = 1;
|
||||
|
||||
// Additional parameters for the embedded content.
|
||||
string params = 2;
|
||||
}
|
||||
|
||||
message TextNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message BoldNode {
|
||||
string symbol = 1;
|
||||
repeated Node children = 2;
|
||||
}
|
||||
|
||||
message ItalicNode {
|
||||
string symbol = 1;
|
||||
repeated Node children = 2;
|
||||
}
|
||||
|
||||
message BoldItalicNode {
|
||||
string symbol = 1;
|
||||
string content = 2;
|
||||
}
|
||||
|
||||
message CodeNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message ImageNode {
|
||||
string alt_text = 1;
|
||||
string url = 2;
|
||||
}
|
||||
|
||||
message LinkNode {
|
||||
repeated Node content = 1;
|
||||
string url = 2;
|
||||
}
|
||||
|
||||
message AutoLinkNode {
|
||||
string url = 1;
|
||||
bool is_raw_text = 2;
|
||||
}
|
||||
|
||||
message TagNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message StrikethroughNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message EscapingCharacterNode {
|
||||
string symbol = 1;
|
||||
}
|
||||
|
||||
message MathNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message HighlightNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message SubscriptNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message SuperscriptNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message ReferencedContentNode {
|
||||
// The resource name of the referenced content.
|
||||
string resource_name = 1;
|
||||
|
||||
// Additional parameters for the referenced content.
|
||||
string params = 2;
|
||||
}
|
||||
|
||||
message SpoilerNode {
|
||||
string content = 1;
|
||||
}
|
||||
|
||||
message HTMLElementNode {
|
||||
string tag_name = 1;
|
||||
map<string, string> attributes = 2;
|
||||
}
|
||||
714
proto/api/v1/memo_service.proto
Normal file
714
proto/api/v1/memo_service.proto
Normal file
@@ -0,0 +1,714 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/attachment_service.proto";
|
||||
import "api/v1/common.proto";
|
||||
import "api/v1/markdown_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.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: "memo"
|
||||
};
|
||||
option (google.api.method_signature) = "memo";
|
||||
}
|
||||
// ListMemos lists memos with pagination and filter.
|
||||
rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/v1/memos"
|
||||
additional_bindings: {get: "/api/v1/{parent=users/*}/memos"}
|
||||
};
|
||||
option (google.api.method_signature) = "";
|
||||
option (google.api.method_signature) = "parent";
|
||||
}
|
||||
// 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";
|
||||
}
|
||||
// RenameMemoTag renames a tag for a memo.
|
||||
rpc RenameMemoTag(RenameMemoTagRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{parent=memos/*}/tags:rename"
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "parent,old_tag,new_tag";
|
||||
}
|
||||
// DeleteMemoTag deletes a tag for a memo.
|
||||
rpc DeleteMemoTag(DeleteMemoTagRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{parent=memos/*}/tags/{tag}"};
|
||||
option (google.api.method_signature) = "parent,tag";
|
||||
}
|
||||
// SetMemoAttachments sets attachments for a memo.
|
||||
rpc SetMemoAttachments(SetMemoAttachmentsRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{name=memos/*}/attachments"
|
||||
body: "*"
|
||||
};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// ListMemoAttachments lists attachments for a memo.
|
||||
rpc ListMemoAttachments(ListMemoAttachmentsRequest) returns (ListMemoAttachmentsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=memos/*}/attachments"};
|
||||
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,comment";
|
||||
}
|
||||
// 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";
|
||||
}
|
||||
// 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/{name=reactions/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
// ExportMemos exports memos for the current user
|
||||
rpc ExportMemos(ExportMemosRequest) returns (ExportMemosResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/memos:export"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// ImportMemos imports memos from provided data
|
||||
rpc ImportMemos(ImportMemosRequest) returns (ImportMemosResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/memos:import"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
enum Visibility {
|
||||
VISIBILITY_UNSPECIFIED = 0;
|
||||
PRIVATE = 1;
|
||||
PROTECTED = 2;
|
||||
PUBLIC = 3;
|
||||
}
|
||||
|
||||
message Reaction {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Reaction"
|
||||
pattern: "reactions/{reaction}"
|
||||
name_field: "name"
|
||||
singular: "reaction"
|
||||
plural: "reactions"
|
||||
};
|
||||
|
||||
// The resource name of the reaction.
|
||||
// Format: reactions/{reaction}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = OUTPUT_ONLY,
|
||||
(google.api.field_behavior) = IDENTIFIER
|
||||
];
|
||||
|
||||
// The resource name of the creator.
|
||||
// Format: users/{user}
|
||||
string creator = 2 [
|
||||
(google.api.field_behavior) = OUTPUT_ONLY,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// The resource name of the content.
|
||||
// For memo reactions, this should be the memo's resource name.
|
||||
// Format: memos/{memo}
|
||||
string content_id = 3 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The type of reaction (e.g., "👍", "❤️", "😄").
|
||||
string reaction_type = 4 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Output only. The creation timestamp.
|
||||
google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
|
||||
message Memo {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Memo"
|
||||
pattern: "memos/{memo}"
|
||||
name_field: "name"
|
||||
singular: "memo"
|
||||
plural: "memos"
|
||||
};
|
||||
|
||||
// The resource name of the memo.
|
||||
// Format: memos/{memo}, memo is the user defined id or uuid.
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The state of the memo.
|
||||
State state = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The name of the creator.
|
||||
// Format: users/{user}
|
||||
string creator = 3 [
|
||||
(google.api.field_behavior) = OUTPUT_ONLY,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Output only. The creation timestamp.
|
||||
google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Output only. The last update timestamp.
|
||||
google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The display timestamp of the memo.
|
||||
google.protobuf.Timestamp display_time = 6 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Required. The content of the memo in Markdown format.
|
||||
string content = 7 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Output only. The parsed nodes from the content.
|
||||
repeated Node nodes = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The visibility of the memo.
|
||||
Visibility visibility = 9 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Output only. The tags extracted from the content.
|
||||
repeated string tags = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Whether the memo is pinned.
|
||||
bool pinned = 11 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The attachments of the memo.
|
||||
repeated Attachment attachments = 12 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The relations of the memo.
|
||||
repeated MemoRelation relations = 13 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Output only. The reactions to the memo.
|
||||
repeated Reaction reactions = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Output only. The computed properties of the memo.
|
||||
Property property = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Output only. The name of the parent memo.
|
||||
// Format: memos/{memo}
|
||||
optional string parent = 16 [
|
||||
(google.api.field_behavior) = OUTPUT_ONLY,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Output only. The snippet of the memo content. Plain text only.
|
||||
string snippet = 17 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Optional. The location of the memo.
|
||||
optional Location location = 18 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Computed properties of a memo.
|
||||
message Property {
|
||||
bool has_link = 1;
|
||||
bool has_task_list = 2;
|
||||
bool has_code = 3;
|
||||
bool has_incomplete_tasks = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message Location {
|
||||
// A placeholder text for the location.
|
||||
string placeholder = 1 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// The latitude of the location.
|
||||
double latitude = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// The longitude of the location.
|
||||
double longitude = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message CreateMemoRequest {
|
||||
// Required. The memo to create.
|
||||
Memo memo = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The memo ID to use for this memo.
|
||||
// If empty, a unique ID will be generated.
|
||||
string memo_id = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. If set, validate the request but don't actually create the memo.
|
||||
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. An idempotency token.
|
||||
string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListMemosRequest {
|
||||
// Optional. The parent is the owner of the memos.
|
||||
// If not specified or `users/-`, it will list all memos.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = OPTIONAL,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of memos to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 50 memos will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token, received from a previous `ListMemos` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The state of the memos to list.
|
||||
// Default to `NORMAL`. Set to `ARCHIVED` to list archived memos.
|
||||
State state = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The order to sort results by.
|
||||
// Default to "display_time desc".
|
||||
// Example: "display_time desc" or "create_time asc"
|
||||
string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Filter to apply to the list results.
|
||||
// Filter is a CEL expression to filter memos.
|
||||
// Refer to `Shortcut.filter`.
|
||||
string filter = 6 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. If true, show deleted memos in the response.
|
||||
bool show_deleted = 7 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// [Deprecated] Old filter contains some specific conditions to filter memos.
|
||||
// Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']"
|
||||
string old_filter = 8;
|
||||
}
|
||||
|
||||
message ListMemosResponse {
|
||||
// The list of memos.
|
||||
repeated Memo memos = 1;
|
||||
|
||||
// A token that 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;
|
||||
|
||||
// The total count of memos (may be approximate).
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message GetMemoRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Optional. The fields to return in the response.
|
||||
// If not specified, all fields are returned.
|
||||
google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateMemoRequest {
|
||||
// Required. The memo to update.
|
||||
// The `name` field is required.
|
||||
Memo memo = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. If set to true, allows updating sensitive fields.
|
||||
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteMemoRequest {
|
||||
// Required. The resource name of the memo to delete.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Optional. If set to true, the memo will be deleted even if it has associated data.
|
||||
bool force = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message RenameMemoTagRequest {
|
||||
// Required. The parent, who owns the tags.
|
||||
// Format: memos/{memo}. Use "memos/-" to rename all tags.
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The old tag name to rename.
|
||||
string old_tag = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The new tag name.
|
||||
string new_tag = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message DeleteMemoTagRequest {
|
||||
// Required. The parent, who owns the tags.
|
||||
// Format: memos/{memo}. Use "memos/-" to delete all tags.
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The tag name to delete.
|
||||
string tag = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. Whether to delete related memos.
|
||||
bool delete_related_memos = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message SetMemoAttachmentsRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The attachments to set for the memo.
|
||||
repeated Attachment attachments = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message ListMemoAttachmentsRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of attachments to return.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListMemoAttachmentsResponse {
|
||||
// The list of attachments.
|
||||
repeated Attachment attachments = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of attachments.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message MemoRelation {
|
||||
// The memo in the relation.
|
||||
Memo memo = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The related memo.
|
||||
Memo related_memo = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The type of the relation.
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
REFERENCE = 1;
|
||||
COMMENT = 2;
|
||||
}
|
||||
Type type = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Memo reference in relations.
|
||||
message Memo {
|
||||
// The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Output only. The snippet of the memo content. Plain text only.
|
||||
string snippet = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
}
|
||||
|
||||
message SetMemoRelationsRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The relations to set for the memo.
|
||||
repeated MemoRelation relations = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message ListMemoRelationsRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of relations to return.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListMemoRelationsResponse {
|
||||
// The list of relations.
|
||||
repeated MemoRelation relations = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of relations.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message CreateMemoCommentRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The comment to create.
|
||||
Memo comment = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The comment ID to use.
|
||||
string comment_id = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListMemoCommentsRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of comments to return.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The order to sort results by.
|
||||
string order_by = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListMemoCommentsResponse {
|
||||
// The list of comment memos.
|
||||
repeated Memo memos = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of comments.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message ListMemoReactionsRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of reactions to return.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListMemoReactionsResponse {
|
||||
// The list of reactions.
|
||||
repeated Reaction reactions = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of reactions.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message UpsertMemoReactionRequest {
|
||||
// Required. The resource name of the memo.
|
||||
// Format: memos/{memo}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Memo"}
|
||||
];
|
||||
|
||||
// Required. The reaction to upsert.
|
||||
Reaction reaction = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message DeleteMemoReactionRequest {
|
||||
// Required. The resource name of the reaction to delete.
|
||||
// Format: reactions/{reaction}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Reaction"}
|
||||
];
|
||||
}
|
||||
|
||||
// Export/Import Messages
|
||||
|
||||
message ExportMemosRequest {
|
||||
// Optional. Format for the export (currently only "json" is supported)
|
||||
string format = 1 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Filter to apply to memos for export
|
||||
// Uses the same filter format as ListMemosRequest
|
||||
string filter = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to exclude archived memos from export
|
||||
// Default: false (include archived memos)
|
||||
bool exclude_archived = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to include attachments in the export
|
||||
// Default: true
|
||||
bool include_attachments = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to include memo relations in the export
|
||||
// Default: true
|
||||
bool include_relations = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ExportMemosResponse {
|
||||
// The exported data as bytes
|
||||
bytes data = 1;
|
||||
|
||||
// The format of the exported data
|
||||
string format = 2;
|
||||
|
||||
// Suggested filename for the export
|
||||
string filename = 3;
|
||||
|
||||
// Number of memos exported
|
||||
int32 memo_count = 4;
|
||||
|
||||
// Size of the export data in bytes
|
||||
int64 size_bytes = 5;
|
||||
}
|
||||
|
||||
message ImportMemosRequest {
|
||||
// Required. The data to import (JSON format)
|
||||
bytes data = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. Format of the import data (currently only "json" is supported)
|
||||
string format = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to overwrite existing memos with the same UID
|
||||
// Default: false (skip existing memos)
|
||||
bool overwrite_existing = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to validate only (dry run mode)
|
||||
// If true, the import will be validated but no data will be created
|
||||
bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to preserve original timestamps
|
||||
// Default: true
|
||||
bool preserve_timestamps = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to skip importing attachments
|
||||
// Default: false (import attachments if present)
|
||||
bool skip_attachments = 6 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Whether to skip importing memo relations
|
||||
// Default: false (import relations if present)
|
||||
bool skip_relations = 7 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ImportMemosResponse {
|
||||
// Number of memos successfully imported
|
||||
int32 imported_count = 1;
|
||||
|
||||
// Number of memos skipped (due to errors or existing UIDs)
|
||||
int32 skipped_count = 2;
|
||||
|
||||
// Number of memos that failed validation (in validate_only mode)
|
||||
int32 validation_errors = 3;
|
||||
|
||||
// List of error messages for failed imports
|
||||
repeated string errors = 4;
|
||||
|
||||
// List of warning messages for potential issues
|
||||
repeated string warnings = 5;
|
||||
|
||||
// Summary of the import operation
|
||||
ImportSummary summary = 6;
|
||||
}
|
||||
|
||||
message ImportSummary {
|
||||
// Total number of memos in the import data
|
||||
int32 total_memos = 1;
|
||||
|
||||
// Number of new memos created
|
||||
int32 created_count = 2;
|
||||
|
||||
// Number of existing memos updated
|
||||
int32 updated_count = 3;
|
||||
|
||||
// Number of attachments imported
|
||||
int32 attachments_imported = 4;
|
||||
|
||||
// Number of relations imported
|
||||
int32 relations_imported = 5;
|
||||
|
||||
// Import duration in milliseconds
|
||||
int64 duration_ms = 6;
|
||||
}
|
||||
124
proto/api/v1/shortcut_service.proto
Normal file
124
proto/api/v1/shortcut_service.proto
Normal file
@@ -0,0 +1,124 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service ShortcutService {
|
||||
// ListShortcuts returns a list of shortcuts for a user.
|
||||
rpc ListShortcuts(ListShortcutsRequest) returns (ListShortcutsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{parent=users/*}/shortcuts"};
|
||||
option (google.api.method_signature) = "parent";
|
||||
}
|
||||
|
||||
// GetShortcut gets a shortcut by name.
|
||||
rpc GetShortcut(GetShortcutRequest) returns (Shortcut) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*/shortcuts/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// CreateShortcut creates a new shortcut for a user.
|
||||
rpc CreateShortcut(CreateShortcutRequest) returns (Shortcut) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{parent=users/*}/shortcuts"
|
||||
body: "shortcut"
|
||||
};
|
||||
option (google.api.method_signature) = "parent,shortcut";
|
||||
}
|
||||
|
||||
// UpdateShortcut updates a shortcut for a user.
|
||||
rpc UpdateShortcut(UpdateShortcutRequest) returns (Shortcut) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{shortcut.name=users/*/shortcuts/*}"
|
||||
body: "shortcut"
|
||||
};
|
||||
option (google.api.method_signature) = "shortcut,update_mask";
|
||||
}
|
||||
|
||||
// DeleteShortcut deletes a shortcut for a user.
|
||||
rpc DeleteShortcut(DeleteShortcutRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=users/*/shortcuts/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Shortcut {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Shortcut"
|
||||
pattern: "users/{user}/shortcuts/{shortcut}"
|
||||
singular: "shortcut"
|
||||
plural: "shortcuts"
|
||||
};
|
||||
|
||||
// The resource name of the shortcut.
|
||||
// Format: users/{user}/shortcuts/{shortcut}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The title of the shortcut.
|
||||
string title = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The filter expression for the shortcut.
|
||||
string filter = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListShortcutsRequest {
|
||||
// Required. The parent resource where shortcuts are listed.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {child_type: "memos.api.v1/Shortcut"}
|
||||
];
|
||||
}
|
||||
|
||||
message ListShortcutsResponse {
|
||||
// The list of shortcuts.
|
||||
repeated Shortcut shortcuts = 1;
|
||||
}
|
||||
|
||||
message GetShortcutRequest {
|
||||
// Required. The resource name of the shortcut to retrieve.
|
||||
// Format: users/{user}/shortcuts/{shortcut}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Shortcut"}
|
||||
];
|
||||
}
|
||||
|
||||
message CreateShortcutRequest {
|
||||
// Required. The parent resource where this shortcut will be created.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {child_type: "memos.api.v1/Shortcut"}
|
||||
];
|
||||
|
||||
// Required. The shortcut to create.
|
||||
Shortcut shortcut = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. If set, validate the request, but do not actually create the shortcut.
|
||||
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateShortcutRequest {
|
||||
// Required. The shortcut resource which replaces the resource on the server.
|
||||
Shortcut shortcut = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteShortcutRequest {
|
||||
// Required. The resource name of the shortcut to delete.
|
||||
// Format: users/{user}/shortcuts/{shortcut}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Shortcut"}
|
||||
];
|
||||
}
|
||||
554
proto/api/v1/user_service.proto
Normal file
554
proto/api/v1/user_service.proto
Normal file
@@ -0,0 +1,554 @@
|
||||
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/api/httpbody.proto";
|
||||
import "google/api/resource.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"};
|
||||
}
|
||||
|
||||
// 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";
|
||||
}
|
||||
|
||||
// SearchUsers searches for users based on query.
|
||||
rpc SearchUsers(SearchUsersRequest) returns (SearchUsersResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users:search"};
|
||||
option (google.api.method_signature) = "query";
|
||||
}
|
||||
|
||||
// GetUserAvatar gets the avatar of a user.
|
||||
rpc GetUserAvatar(GetUserAvatarRequest) returns (google.api.HttpBody) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*}/avatar"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// ListAllUserStats returns statistics for all users.
|
||||
rpc ListAllUserStats(ListAllUserStatsRequest) returns (ListAllUserStatsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/users:stats"};
|
||||
}
|
||||
|
||||
// GetUserStats returns statistics for a specific user.
|
||||
rpc GetUserStats(GetUserStatsRequest) returns (UserStats) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*}:getStats"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// GetUserSetting returns the user setting.
|
||||
rpc GetUserSetting(GetUserSettingRequest) returns (UserSetting) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*}:getSetting"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// UpdateUserSetting updates the user setting.
|
||||
rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UserSetting) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{setting.name=users/*}:updateSetting"
|
||||
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/{parent=users/*}/accessTokens"};
|
||||
option (google.api.method_signature) = "parent";
|
||||
}
|
||||
|
||||
// CreateUserAccessToken creates a new access token for a user.
|
||||
rpc CreateUserAccessToken(CreateUserAccessTokenRequest) returns (UserAccessToken) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{parent=users/*}/accessTokens"
|
||||
body: "access_token"
|
||||
};
|
||||
option (google.api.method_signature) = "parent,access_token";
|
||||
}
|
||||
|
||||
// DeleteUserAccessToken deletes an access token.
|
||||
rpc DeleteUserAccessToken(DeleteUserAccessTokenRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=users/*/accessTokens/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// ListUserSessions returns a list of active sessions for a user.
|
||||
rpc ListUserSessions(ListUserSessionsRequest) returns (ListUserSessionsResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{parent=users/*}/sessions"};
|
||||
option (google.api.method_signature) = "parent";
|
||||
}
|
||||
|
||||
// RevokeUserSession revokes a specific session for a user.
|
||||
rpc RevokeUserSession(RevokeUserSessionRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=users/*/sessions/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message User {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/User"
|
||||
pattern: "users/{user}"
|
||||
name_field: "name"
|
||||
singular: "user"
|
||||
plural: "users"
|
||||
};
|
||||
|
||||
// The resource name of the user.
|
||||
// Format: users/{user}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The role of the user.
|
||||
Role role = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The unique username for login.
|
||||
string username = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The email address of the user.
|
||||
string email = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The display name of the user.
|
||||
string display_name = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The avatar URL of the user.
|
||||
string avatar_url = 6 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The description of the user.
|
||||
string description = 7 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Input only. The password for the user.
|
||||
string password = 8 [(google.api.field_behavior) = INPUT_ONLY];
|
||||
|
||||
// The state of the user.
|
||||
State state = 9 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Output only. The creation timestamp.
|
||||
google.protobuf.Timestamp create_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Output only. The last update timestamp.
|
||||
google.protobuf.Timestamp update_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// User role enumeration.
|
||||
enum Role {
|
||||
// Unspecified role.
|
||||
ROLE_UNSPECIFIED = 0;
|
||||
// Host role with full system access.
|
||||
HOST = 1;
|
||||
// Admin role with administrative privileges.
|
||||
ADMIN = 2;
|
||||
// Regular user role.
|
||||
USER = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ListUsersRequest {
|
||||
// Optional. The maximum number of users to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 50 users will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token, received from a previous `ListUsers` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Filter to apply to the list results.
|
||||
// Example: "state=ACTIVE" or "role=USER" or "email:@example.com"
|
||||
// Supported operators: =, !=, <, <=, >, >=, :
|
||||
// Supported fields: username, email, role, state, create_time, update_time
|
||||
string filter = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The order to sort results by.
|
||||
// Example: "create_time desc" or "username asc"
|
||||
string order_by = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. If true, show deleted users in the response.
|
||||
bool show_deleted = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListUsersResponse {
|
||||
// The list of users.
|
||||
repeated User users = 1;
|
||||
|
||||
// A token that 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;
|
||||
|
||||
// The total count of users (may be approximate).
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message GetUserRequest {
|
||||
// Required. The resource name of the user.
|
||||
// Format: users/{user}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Optional. The fields to return in the response.
|
||||
// If not specified, all fields are returned.
|
||||
google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message CreateUserRequest {
|
||||
// Required. The user to create.
|
||||
User user = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.field_behavior) = INPUT_ONLY
|
||||
];
|
||||
|
||||
// Optional. The user ID to use for this user.
|
||||
// If empty, a unique ID will be generated.
|
||||
// Must match the pattern [a-z0-9-]+
|
||||
string user_id = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. If set, validate the request but don't actually create the user.
|
||||
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. An idempotency token that can be used to ensure that multiple
|
||||
// requests to create a user have the same result.
|
||||
string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateUserRequest {
|
||||
// Required. The user to update.
|
||||
User user = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. If set to true, allows updating sensitive fields.
|
||||
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteUserRequest {
|
||||
// Required. The resource name of the user to delete.
|
||||
// Format: users/{user}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Optional. If set to true, the user will be deleted even if they have associated data.
|
||||
bool force = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message SearchUsersRequest {
|
||||
// Required. The search query.
|
||||
string query = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The maximum number of users to return.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message SearchUsersResponse {
|
||||
// The list of users matching the search query.
|
||||
repeated User users = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of matching users.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message GetUserAvatarRequest {
|
||||
// Required. The resource name of the user.
|
||||
// Format: users/{user}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
}
|
||||
|
||||
// User statistics messages
|
||||
message UserStats {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/UserStats"
|
||||
pattern: "users/{user}"
|
||||
singular: "userStats"
|
||||
plural: "userStats"
|
||||
};
|
||||
|
||||
// The resource name of the user whose stats these are.
|
||||
// Format: users/{user}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The timestamps when the memos were displayed.
|
||||
repeated google.protobuf.Timestamp memo_display_timestamps = 2;
|
||||
|
||||
// The stats of memo types.
|
||||
MemoTypeStats memo_type_stats = 3;
|
||||
|
||||
// The count of tags.
|
||||
map<string, int32> tag_count = 4;
|
||||
|
||||
// The pinned memos of the user.
|
||||
repeated string pinned_memos = 5;
|
||||
|
||||
// Total memo count.
|
||||
int32 total_memo_count = 6;
|
||||
|
||||
// Memo type statistics.
|
||||
message MemoTypeStats {
|
||||
int32 link_count = 1;
|
||||
int32 code_count = 2;
|
||||
int32 todo_count = 3;
|
||||
int32 undo_count = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message GetUserStatsRequest {
|
||||
// Required. The resource name of the user.
|
||||
// Format: users/{user}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
}
|
||||
|
||||
// User settings message
|
||||
message UserSetting {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/UserSetting"
|
||||
pattern: "users/{user}"
|
||||
singular: "userSetting"
|
||||
plural: "userSettings"
|
||||
};
|
||||
|
||||
// The resource name of the user whose setting this is.
|
||||
// Format: users/{user}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The preferred locale of the user.
|
||||
string locale = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// The preferred appearance of the user.
|
||||
string appearance = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// The default visibility of the memo.
|
||||
string memo_visibility = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// The preferred theme of the user.
|
||||
// This references a CSS file in the web/public/themes/ directory.
|
||||
// If not set, the default theme will be used.
|
||||
string theme = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message GetUserSettingRequest {
|
||||
// Required. The resource name of the user.
|
||||
// Format: users/{user}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
}
|
||||
|
||||
message UpdateUserSettingRequest {
|
||||
// Required. The user setting to update.
|
||||
UserSetting setting = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Required. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
// User access token message
|
||||
message UserAccessToken {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/UserAccessToken"
|
||||
pattern: "users/{user}/accessTokens/{access_token}"
|
||||
singular: "userAccessToken"
|
||||
plural: "userAccessTokens"
|
||||
};
|
||||
|
||||
// The resource name of the access token.
|
||||
// Format: users/{user}/accessTokens/{access_token}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// Output only. The access token value.
|
||||
string access_token = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The description of the access token.
|
||||
string description = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Output only. The issued timestamp.
|
||||
google.protobuf.Timestamp issued_at = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Optional. The expiration timestamp.
|
||||
google.protobuf.Timestamp expires_at = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListUserAccessTokensRequest {
|
||||
// Required. The parent resource whose access tokens will be listed.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Optional. The maximum number of access tokens to return.
|
||||
int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListUserAccessTokensResponse {
|
||||
// The list of access tokens.
|
||||
repeated UserAccessToken access_tokens = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of access tokens.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message CreateUserAccessTokenRequest {
|
||||
// Required. The parent resource where this access token will be created.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
// Required. The access token to create.
|
||||
UserAccessToken access_token = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The access token ID to use.
|
||||
string access_token_id = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteUserAccessTokenRequest {
|
||||
// Required. The resource name of the access token to delete.
|
||||
// Format: users/{user}/accessTokens/{access_token}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/UserAccessToken"}
|
||||
];
|
||||
}
|
||||
|
||||
message UserSession {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/UserSession"
|
||||
pattern: "users/{user}/sessions/{session}"
|
||||
name_field: "name"
|
||||
};
|
||||
|
||||
// The resource name of the session.
|
||||
// Format: users/{user}/sessions/{session}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The session ID.
|
||||
string session_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The timestamp when the session was created.
|
||||
google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// The timestamp when the session was last accessed.
|
||||
// Used for sliding expiration calculation (last_accessed_time + 2 weeks).
|
||||
google.protobuf.Timestamp last_accessed_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Client information associated with this session.
|
||||
ClientInfo client_info = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
message ClientInfo {
|
||||
// User agent string of the client.
|
||||
string user_agent = 1;
|
||||
|
||||
// IP address of the client.
|
||||
string ip_address = 2;
|
||||
|
||||
// Optional. Device type (e.g., "mobile", "desktop", "tablet").
|
||||
string device_type = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Operating system (e.g., "iOS 17.0", "Windows 11").
|
||||
string os = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Browser name and version (e.g., "Chrome 119.0").
|
||||
string browser = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
}
|
||||
|
||||
message ListUserSessionsRequest {
|
||||
// Required. The resource name of the parent.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
}
|
||||
|
||||
message ListUserSessionsResponse {
|
||||
// The list of user sessions.
|
||||
repeated UserSession sessions = 1;
|
||||
}
|
||||
|
||||
message RevokeUserSessionRequest {
|
||||
// Required. The resource name of the session to revoke.
|
||||
// Format: users/{user}/sessions/{session}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/UserSession"}
|
||||
];
|
||||
}
|
||||
|
||||
message ListAllUserStatsRequest {
|
||||
// Optional. The maximum number of user stats to return.
|
||||
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token for pagination.
|
||||
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListAllUserStatsResponse {
|
||||
// The list of user statistics.
|
||||
repeated UserStats user_stats = 1;
|
||||
|
||||
// A token for the next page of results.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of user statistics.
|
||||
int32 total_size = 3;
|
||||
}
|
||||
124
proto/api/v1/webhook_service.proto
Normal file
124
proto/api/v1/webhook_service.proto
Normal file
@@ -0,0 +1,124 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WebhookService {
|
||||
// ListWebhooks returns a list of webhooks for a user.
|
||||
rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/{parent=users/*}/webhooks"};
|
||||
option (google.api.method_signature) = "parent";
|
||||
}
|
||||
|
||||
// GetWebhook gets a webhook by name.
|
||||
rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=users/*/webhooks/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// CreateWebhook creates a new webhook for a user.
|
||||
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/{parent=users/*}/webhooks"
|
||||
body: "webhook"
|
||||
};
|
||||
option (google.api.method_signature) = "parent,webhook";
|
||||
}
|
||||
|
||||
// UpdateWebhook updates a webhook for a user.
|
||||
rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{webhook.name=users/*/webhooks/*}"
|
||||
body: "webhook"
|
||||
};
|
||||
option (google.api.method_signature) = "webhook,update_mask";
|
||||
}
|
||||
|
||||
// DeleteWebhook deletes a webhook for a user.
|
||||
rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/{name=users/*/webhooks/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Webhook {
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Webhook"
|
||||
pattern: "users/{user}/webhooks/{webhook}"
|
||||
singular: "webhook"
|
||||
plural: "webhooks"
|
||||
};
|
||||
|
||||
// The resource name of the webhook.
|
||||
// Format: users/{user}/webhooks/{webhook}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
// The display name of the webhook.
|
||||
string display_name = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The target URL for the webhook.
|
||||
string url = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
}
|
||||
|
||||
message ListWebhooksRequest {
|
||||
// Required. The parent resource where webhooks are listed.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {child_type: "memos.api.v1/Webhook"}
|
||||
];
|
||||
}
|
||||
|
||||
message ListWebhooksResponse {
|
||||
// The list of webhooks.
|
||||
repeated Webhook webhooks = 1;
|
||||
}
|
||||
|
||||
message GetWebhookRequest {
|
||||
// Required. The resource name of the webhook to retrieve.
|
||||
// Format: users/{user}/webhooks/{webhook}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Webhook"}
|
||||
];
|
||||
}
|
||||
|
||||
message CreateWebhookRequest {
|
||||
// Required. The parent resource where this webhook will be created.
|
||||
// Format: users/{user}
|
||||
string parent = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {child_type: "memos.api.v1/Webhook"}
|
||||
];
|
||||
|
||||
// Required. The webhook to create.
|
||||
Webhook webhook = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. If set, validate the request, but do not actually create the webhook.
|
||||
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateWebhookRequest {
|
||||
// Required. The webhook resource which replaces the resource on the server.
|
||||
Webhook webhook = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteWebhookRequest {
|
||||
// Required. The resource name of the webhook to delete.
|
||||
// Format: users/{user}/webhooks/{webhook}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Webhook"}
|
||||
];
|
||||
}
|
||||
177
proto/api/v1/workspace_service.proto
Normal file
177
proto/api/v1/workspace_service.proto
Normal file
@@ -0,0 +1,177 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
|
||||
option go_package = "gen/api/v1";
|
||||
|
||||
service WorkspaceService {
|
||||
// Gets the workspace profile.
|
||||
rpc GetWorkspaceProfile(GetWorkspaceProfileRequest) returns (WorkspaceProfile) {
|
||||
option (google.api.http) = {get: "/api/v1/workspace/profile"};
|
||||
}
|
||||
|
||||
// Gets a workspace setting.
|
||||
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=workspace/settings/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// Updates a workspace setting.
|
||||
rpc UpdateWorkspaceSetting(UpdateWorkspaceSettingRequest) returns (WorkspaceSetting) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/{setting.name=workspace/settings/*}"
|
||||
body: "setting"
|
||||
};
|
||||
option (google.api.method_signature) = "setting,update_mask";
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace profile message containing basic workspace information.
|
||||
message WorkspaceProfile {
|
||||
// The name of instance owner.
|
||||
// Format: users/{user}
|
||||
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;
|
||||
|
||||
// Instance URL is the URL of the instance.
|
||||
string instance_url = 6;
|
||||
}
|
||||
|
||||
// Request for workspace profile.
|
||||
message GetWorkspaceProfileRequest {}
|
||||
|
||||
// A workspace setting resource.
|
||||
message WorkspaceSetting {
|
||||
option (google.api.resource) = {
|
||||
type: "api.memos.dev/WorkspaceSetting"
|
||||
pattern: "workspace/settings/{setting}"
|
||||
singular: "workspaceSetting"
|
||||
plural: "workspaceSettings"
|
||||
};
|
||||
|
||||
// The name of the workspace setting.
|
||||
// Format: workspace/settings/{setting}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
oneof value {
|
||||
WorkspaceGeneralSetting general_setting = 2;
|
||||
WorkspaceStorageSetting storage_setting = 3;
|
||||
WorkspaceMemoRelatedSetting memo_related_setting = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message WorkspaceGeneralSetting {
|
||||
// theme is the name of the selected theme.
|
||||
// This references a CSS file in the web/public/themes/ directory.
|
||||
string theme = 1;
|
||||
// disallow_user_registration disallows user registration.
|
||||
bool disallow_user_registration = 2;
|
||||
// disallow_password_auth disallows password authentication.
|
||||
bool disallow_password_auth = 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;
|
||||
// week_start_day_offset is the week start day offset from Sunday.
|
||||
// 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
|
||||
// Default is Sunday.
|
||||
int32 week_start_day_offset = 7;
|
||||
|
||||
// disallow_change_username disallows changing username.
|
||||
bool disallow_change_username = 8;
|
||||
// disallow_change_nickname disallows changing nickname.
|
||||
bool disallow_change_nickname = 9;
|
||||
}
|
||||
|
||||
message WorkspaceCustomProfile {
|
||||
string title = 1;
|
||||
string description = 2;
|
||||
string logo_url = 3;
|
||||
string locale = 4;
|
||||
string appearance = 5;
|
||||
}
|
||||
|
||||
message WorkspaceStorageSetting {
|
||||
enum StorageType {
|
||||
STORAGE_TYPE_UNSPECIFIED = 0;
|
||||
// DATABASE is the database storage type.
|
||||
DATABASE = 1;
|
||||
// LOCAL is the local storage type.
|
||||
LOCAL = 2;
|
||||
// S3 is the S3 storage type.
|
||||
S3 = 3;
|
||||
}
|
||||
// storage_type is the storage type.
|
||||
StorageType storage_type = 1;
|
||||
// The template of file path.
|
||||
// e.g. assets/{timestamp}_{filename}
|
||||
string filepath_template = 2;
|
||||
// The max upload size in megabytes.
|
||||
int64 upload_size_limit_mb = 3;
|
||||
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
|
||||
message S3Config {
|
||||
string access_key_id = 1;
|
||||
string access_key_secret = 2;
|
||||
string endpoint = 3;
|
||||
string region = 4;
|
||||
string bucket = 5;
|
||||
bool use_path_style = 6;
|
||||
}
|
||||
// The S3 config.
|
||||
S3Config s3_config = 4;
|
||||
}
|
||||
|
||||
message WorkspaceMemoRelatedSetting {
|
||||
// disallow_public_visibility disallows set memo as public visibility.
|
||||
bool disallow_public_visibility = 1;
|
||||
// display_with_update_time orders and displays memo with update time.
|
||||
bool display_with_update_time = 2;
|
||||
// content_length_limit is the limit of content length. Unit is byte.
|
||||
int32 content_length_limit = 3;
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
bool enable_double_click_edit = 4;
|
||||
// enable_link_preview enables links preview.
|
||||
bool enable_link_preview = 5;
|
||||
// enable_comment enables comment.
|
||||
bool enable_comment = 6;
|
||||
// reactions is the list of reactions.
|
||||
repeated string reactions = 7;
|
||||
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
|
||||
bool disable_markdown_shortcuts = 8;
|
||||
// enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW).
|
||||
bool enable_blur_nsfw_content = 9;
|
||||
// nsfw_tags is the list of tags that mark content as NSFW for blurring.
|
||||
repeated string nsfw_tags = 10;
|
||||
}
|
||||
|
||||
// Request message for GetWorkspaceSetting method.
|
||||
message GetWorkspaceSettingRequest {
|
||||
// The resource name of the workspace setting.
|
||||
// Format: workspace/settings/{setting}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "api.memos.dev/WorkspaceSetting"}
|
||||
];
|
||||
}
|
||||
|
||||
// Request message for UpdateWorkspaceSetting method.
|
||||
message UpdateWorkspaceSettingRequest {
|
||||
// The workspace setting resource which replaces the resource on the server.
|
||||
WorkspaceSetting setting = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
Reference in New Issue
Block a user