Commit d71fd2f8 authored by Steven's avatar Steven

refactor: auth service

parent 9972a77d
...@@ -4,26 +4,40 @@ package memos.api.v1; ...@@ -4,26 +4,40 @@ package memos.api.v1;
import "api/v1/user_service.proto"; import "api/v1/user_service.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
option go_package = "gen/api/v1"; option go_package = "gen/api/v1";
service AuthService { service AuthService {
// GetAuthStatus returns the current auth status of the user. // GetAuthStatus returns the current authentication status of the user.
// This method is idempotent and safe, suitable for checking authentication state.
rpc GetAuthStatus(GetAuthStatusRequest) returns (User) { rpc GetAuthStatus(GetAuthStatusRequest) returns (User) {
option (google.api.http) = {post: "/api/v1/auth/status"}; option (google.api.http) = {get: "/api/v1/auth/status"};
} }
// SignIn signs in the user.
rpc SignIn(SignInRequest) returns (User) { // CreateSession authenticates a user and creates a new session.
option (google.api.http) = {post: "/api/v1/auth/signin"}; // Returns the authenticated user information upon successful authentication.
rpc CreateSession(CreateSessionRequest) returns (User) {
option (google.api.http) = {
post: "/api/v1/auth/sessions"
body: "*"
};
} }
// SignUp signs up the user with the given username and password.
rpc SignUp(SignUpRequest) returns (User) { // RegisterUser creates a new user account with username and password.
option (google.api.http) = {post: "/api/v1/auth/signup"}; // Returns the newly created user information upon successful registration.
rpc RegisterUser(RegisterUserRequest) returns (User) {
option (google.api.http) = {
post: "/api/v1/auth/users"
body: "*"
};
} }
// SignOut signs out the user.
rpc SignOut(SignOutRequest) returns (google.protobuf.Empty) { // DeleteSession terminates the current user session.
option (google.api.http) = {post: "/api/v1/auth/signout"}; // 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"};
} }
} }
...@@ -33,8 +47,9 @@ message GetAuthStatusResponse { ...@@ -33,8 +47,9 @@ message GetAuthStatusResponse {
User user = 1; User user = 1;
} }
message SignInRequest { message CreateSessionRequest {
// Provide one authentication method (username/password or SSO). // Provide one authentication method (username/password or SSO).
// Required field to specify the authentication method.
oneof method { oneof method {
// Username and password authentication method. // Username and password authentication method.
PasswordCredentials password_credentials = 1; PasswordCredentials password_credentials = 1;
...@@ -42,31 +57,44 @@ message SignInRequest { ...@@ -42,31 +57,44 @@ message SignInRequest {
// SSO provider authentication method. // SSO provider authentication method.
SSOCredentials sso_credentials = 2; SSOCredentials sso_credentials = 2;
} }
// Whether the session should never expire. // Whether the session should never expire.
bool never_expire = 3; // Optional field that defaults to false for security.
bool never_expire = 3 [(google.api.field_behavior) = OPTIONAL];
} }
message PasswordCredentials { message PasswordCredentials {
// The username to sign in with. // The username to sign in with.
string username = 1; // Required field for password-based authentication.
string username = 1 [(google.api.field_behavior) = REQUIRED];
// The password to sign in with. // The password to sign in with.
string password = 2; // Required field for password-based authentication.
string password = 2 [(google.api.field_behavior) = REQUIRED];
} }
message SSOCredentials { message SSOCredentials {
// The ID of the SSO provider. // The ID of the SSO provider.
int32 idp_id = 1; // Required field to identify the SSO provider.
// The code to sign in with. int32 idp_id = 1 [(google.api.field_behavior) = REQUIRED];
string code = 2;
// The redirect URI. // The authorization code from the SSO provider.
string redirect_uri = 3; // 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];
} }
message SignUpRequest { message RegisterUserRequest {
// The username to sign up with. // The username to sign up with.
string username = 1; // Required field that must be unique across the system.
string username = 1 [(google.api.field_behavior) = REQUIRED];
// The password to sign up with. // The password to sign up with.
string password = 2; // Required field that should meet security requirements.
string password = 2 [(google.api.field_behavior) = REQUIRED];
} }
message SignOutRequest {} message DeleteSessionRequest {}
...@@ -3,68 +3,88 @@ syntax = "proto3"; ...@@ -3,68 +3,88 @@ syntax = "proto3";
package memos.api.v1; package memos.api.v1;
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
option go_package = "gen/api/v1"; option go_package = "gen/api/v1";
service MarkdownService { service MarkdownService {
// ParseMarkdown parses the given markdown content and returns a list of nodes. // 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) { rpc ParseMarkdown(ParseMarkdownRequest) returns (ParseMarkdownResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/api/v1/markdown:parse" post: "/api/v1/markdown:parse"
body: "*" body: "*"
}; };
} }
// RestoreMarkdownNodes restores the given nodes to markdown content. // RestoreMarkdownNodes restores the given nodes to markdown content.
// This is the inverse operation of ParseMarkdown.
rpc RestoreMarkdownNodes(RestoreMarkdownNodesRequest) returns (RestoreMarkdownNodesResponse) { rpc RestoreMarkdownNodes(RestoreMarkdownNodesRequest) returns (RestoreMarkdownNodesResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/api/v1/markdown/node:restore" post: "/api/v1/markdown:restore"
body: "*" body: "*"
}; };
} }
// StringifyMarkdownNodes stringify the given nodes to plain text content. // StringifyMarkdownNodes stringify the given nodes to plain text content.
// This removes all markdown formatting and returns plain text.
rpc StringifyMarkdownNodes(StringifyMarkdownNodesRequest) returns (StringifyMarkdownNodesResponse) { rpc StringifyMarkdownNodes(StringifyMarkdownNodesRequest) returns (StringifyMarkdownNodesResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/api/v1/markdown/node:stringify" post: "/api/v1/markdown:stringify"
body: "*" body: "*"
}; };
} }
// GetLinkMetadata returns metadata for a given link. // GetLinkMetadata returns metadata for a given link.
// This is useful for generating link previews.
rpc GetLinkMetadata(GetLinkMetadataRequest) returns (LinkMetadata) { rpc GetLinkMetadata(GetLinkMetadataRequest) returns (LinkMetadata) {
option (google.api.http) = {get: "/api/v1/markdown/link:metadata"}; option (google.api.http) = {get: "/api/v1/markdown/links:getMetadata"};
} }
} }
message ParseMarkdownRequest { message ParseMarkdownRequest {
string markdown = 1; // The markdown content to parse.
string markdown = 1 [(google.api.field_behavior) = REQUIRED];
} }
message ParseMarkdownResponse { message ParseMarkdownResponse {
// The parsed markdown nodes.
repeated Node nodes = 1; repeated Node nodes = 1;
} }
message RestoreMarkdownNodesRequest { message RestoreMarkdownNodesRequest {
repeated Node nodes = 1; // The nodes to restore to markdown content.
repeated Node nodes = 1 [(google.api.field_behavior) = REQUIRED];
} }
message RestoreMarkdownNodesResponse { message RestoreMarkdownNodesResponse {
// The restored markdown content.
string markdown = 1; string markdown = 1;
} }
message StringifyMarkdownNodesRequest { message StringifyMarkdownNodesRequest {
repeated Node nodes = 1; // The nodes to stringify to plain text.
repeated Node nodes = 1 [(google.api.field_behavior) = REQUIRED];
} }
message StringifyMarkdownNodesResponse { message StringifyMarkdownNodesResponse {
// The plain text content.
string plain_text = 1; string plain_text = 1;
} }
message GetLinkMetadataRequest { message GetLinkMetadataRequest {
string link = 1; // The link URL to get metadata for.
string link = 1 [(google.api.field_behavior) = REQUIRED];
} }
message LinkMetadata { message LinkMetadata {
// The title of the linked page.
string title = 1; string title = 1;
// The description of the linked page.
string description = 2; string description = 2;
// The URL of the preview image for the linked page.
string image = 3; string image = 3;
} }
...@@ -218,7 +238,10 @@ message TableNode { ...@@ -218,7 +238,10 @@ message TableNode {
} }
message EmbeddedContentNode { message EmbeddedContentNode {
// The resource name of the embedded content.
string resource_name = 1; string resource_name = 1;
// Additional parameters for the embedded content.
string params = 2; string params = 2;
} }
...@@ -289,7 +312,10 @@ message SuperscriptNode { ...@@ -289,7 +312,10 @@ message SuperscriptNode {
} }
message ReferencedContentNode { message ReferencedContentNode {
// The resource name of the referenced content.
string resource_name = 1; string resource_name = 1;
// Additional parameters for the referenced content.
string params = 2; string params = 2;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -214,6 +214,7 @@ func (ListNode_Kind) EnumDescriptor() ([]byte, []int) { ...@@ -214,6 +214,7 @@ func (ListNode_Kind) EnumDescriptor() ([]byte, []int) {
type ParseMarkdownRequest struct { type ParseMarkdownRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The markdown content to parse.
Markdown string `protobuf:"bytes,1,opt,name=markdown,proto3" json:"markdown,omitempty"` Markdown string `protobuf:"bytes,1,opt,name=markdown,proto3" json:"markdown,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -258,6 +259,7 @@ func (x *ParseMarkdownRequest) GetMarkdown() string { ...@@ -258,6 +259,7 @@ func (x *ParseMarkdownRequest) GetMarkdown() string {
type ParseMarkdownResponse struct { type ParseMarkdownResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The parsed markdown nodes.
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -302,6 +304,7 @@ func (x *ParseMarkdownResponse) GetNodes() []*Node { ...@@ -302,6 +304,7 @@ func (x *ParseMarkdownResponse) GetNodes() []*Node {
type RestoreMarkdownNodesRequest struct { type RestoreMarkdownNodesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The nodes to restore to markdown content.
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -346,6 +349,7 @@ func (x *RestoreMarkdownNodesRequest) GetNodes() []*Node { ...@@ -346,6 +349,7 @@ func (x *RestoreMarkdownNodesRequest) GetNodes() []*Node {
type RestoreMarkdownNodesResponse struct { type RestoreMarkdownNodesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The restored markdown content.
Markdown string `protobuf:"bytes,1,opt,name=markdown,proto3" json:"markdown,omitempty"` Markdown string `protobuf:"bytes,1,opt,name=markdown,proto3" json:"markdown,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -390,6 +394,7 @@ func (x *RestoreMarkdownNodesResponse) GetMarkdown() string { ...@@ -390,6 +394,7 @@ func (x *RestoreMarkdownNodesResponse) GetMarkdown() string {
type StringifyMarkdownNodesRequest struct { type StringifyMarkdownNodesRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The nodes to stringify to plain text.
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"` Nodes []*Node `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -434,6 +439,7 @@ func (x *StringifyMarkdownNodesRequest) GetNodes() []*Node { ...@@ -434,6 +439,7 @@ func (x *StringifyMarkdownNodesRequest) GetNodes() []*Node {
type StringifyMarkdownNodesResponse struct { type StringifyMarkdownNodesResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The plain text content.
PlainText string `protobuf:"bytes,1,opt,name=plain_text,json=plainText,proto3" json:"plain_text,omitempty"` PlainText string `protobuf:"bytes,1,opt,name=plain_text,json=plainText,proto3" json:"plain_text,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -478,6 +484,7 @@ func (x *StringifyMarkdownNodesResponse) GetPlainText() string { ...@@ -478,6 +484,7 @@ func (x *StringifyMarkdownNodesResponse) GetPlainText() string {
type GetLinkMetadataRequest struct { type GetLinkMetadataRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The link URL to get metadata for.
Link string `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"` Link string `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -522,8 +529,11 @@ func (x *GetLinkMetadataRequest) GetLink() string { ...@@ -522,8 +529,11 @@ func (x *GetLinkMetadataRequest) GetLink() string {
type LinkMetadata struct { type LinkMetadata struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The title of the linked page.
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
// The description of the linked page.
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
// The URL of the preview image for the linked page.
Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"` Image string `protobuf:"bytes,3,opt,name=image,proto3" json:"image,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -1762,7 +1772,9 @@ func (x *TableNode) GetRows() []*TableNode_Row { ...@@ -1762,7 +1772,9 @@ func (x *TableNode) GetRows() []*TableNode_Row {
type EmbeddedContentNode struct { type EmbeddedContentNode struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The resource name of the embedded content.
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
// Additional parameters for the embedded content.
Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -2522,7 +2534,9 @@ func (x *SuperscriptNode) GetContent() string { ...@@ -2522,7 +2534,9 @@ func (x *SuperscriptNode) GetContent() string {
type ReferencedContentNode struct { type ReferencedContentNode struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The resource name of the referenced content.
ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"`
// Additional parameters for the referenced content.
Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` Params string `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -2716,22 +2730,22 @@ var File_api_v1_markdown_service_proto protoreflect.FileDescriptor ...@@ -2716,22 +2730,22 @@ var File_api_v1_markdown_service_proto protoreflect.FileDescriptor
const file_api_v1_markdown_service_proto_rawDesc = "" + const file_api_v1_markdown_service_proto_rawDesc = "" +
"\n" + "\n" +
"\x1dapi/v1/markdown_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\"2\n" + "\x1dapi/v1/markdown_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\"7\n" +
"\x14ParseMarkdownRequest\x12\x1a\n" + "\x14ParseMarkdownRequest\x12\x1f\n" +
"\bmarkdown\x18\x01 \x01(\tR\bmarkdown\"A\n" + "\bmarkdown\x18\x01 \x01(\tB\x03\xe0A\x02R\bmarkdown\"A\n" +
"\x15ParseMarkdownResponse\x12(\n" + "\x15ParseMarkdownResponse\x12(\n" +
"\x05nodes\x18\x01 \x03(\v2\x12.memos.api.v1.NodeR\x05nodes\"G\n" + "\x05nodes\x18\x01 \x03(\v2\x12.memos.api.v1.NodeR\x05nodes\"L\n" +
"\x1bRestoreMarkdownNodesRequest\x12(\n" + "\x1bRestoreMarkdownNodesRequest\x12-\n" +
"\x05nodes\x18\x01 \x03(\v2\x12.memos.api.v1.NodeR\x05nodes\":\n" + "\x05nodes\x18\x01 \x03(\v2\x12.memos.api.v1.NodeB\x03\xe0A\x02R\x05nodes\":\n" +
"\x1cRestoreMarkdownNodesResponse\x12\x1a\n" + "\x1cRestoreMarkdownNodesResponse\x12\x1a\n" +
"\bmarkdown\x18\x01 \x01(\tR\bmarkdown\"I\n" + "\bmarkdown\x18\x01 \x01(\tR\bmarkdown\"N\n" +
"\x1dStringifyMarkdownNodesRequest\x12(\n" + "\x1dStringifyMarkdownNodesRequest\x12-\n" +
"\x05nodes\x18\x01 \x03(\v2\x12.memos.api.v1.NodeR\x05nodes\"?\n" + "\x05nodes\x18\x01 \x03(\v2\x12.memos.api.v1.NodeB\x03\xe0A\x02R\x05nodes\"?\n" +
"\x1eStringifyMarkdownNodesResponse\x12\x1d\n" + "\x1eStringifyMarkdownNodesResponse\x12\x1d\n" +
"\n" + "\n" +
"plain_text\x18\x01 \x01(\tR\tplainText\",\n" + "plain_text\x18\x01 \x01(\tR\tplainText\"1\n" +
"\x16GetLinkMetadataRequest\x12\x12\n" + "\x16GetLinkMetadataRequest\x12\x17\n" +
"\x04link\x18\x01 \x01(\tR\x04link\"\\\n" + "\x04link\x18\x01 \x01(\tB\x03\xe0A\x02R\x04link\"\\\n" +
"\fLinkMetadata\x12\x14\n" + "\fLinkMetadata\x12\x14\n" +
"\x05title\x18\x01 \x01(\tR\x05title\x12 \n" + "\x05title\x18\x01 \x01(\tR\x05title\x12 \n" +
"\vdescription\x18\x02 \x01(\tR\vdescription\x12\x14\n" + "\vdescription\x18\x02 \x01(\tR\vdescription\x12\x14\n" +
...@@ -2907,12 +2921,12 @@ const file_api_v1_markdown_service_proto_rawDesc = "" + ...@@ -2907,12 +2921,12 @@ const file_api_v1_markdown_service_proto_rawDesc = "" +
"\vSUPERSCRIPT\x10A\x12\x16\n" + "\vSUPERSCRIPT\x10A\x12\x16\n" +
"\x12REFERENCED_CONTENT\x10B\x12\v\n" + "\x12REFERENCED_CONTENT\x10B\x12\v\n" +
"\aSPOILER\x10C\x12\x10\n" + "\aSPOILER\x10C\x12\x10\n" +
"\fHTML_ELEMENT\x10D2\xc7\x04\n" + "\fHTML_ELEMENT\x10D2\xc1\x04\n" +
"\x0fMarkdownService\x12{\n" + "\x0fMarkdownService\x12{\n" +
"\rParseMarkdown\x12\".memos.api.v1.ParseMarkdownRequest\x1a#.memos.api.v1.ParseMarkdownResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v1/markdown:parse\x12\x97\x01\n" + "\rParseMarkdown\x12\".memos.api.v1.ParseMarkdownRequest\x1a#.memos.api.v1.ParseMarkdownResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/api/v1/markdown:parse\x12\x92\x01\n" +
"\x14RestoreMarkdownNodes\x12).memos.api.v1.RestoreMarkdownNodesRequest\x1a*.memos.api.v1.RestoreMarkdownNodesResponse\"(\x82\xd3\xe4\x93\x02\":\x01*\"\x1d/api/v1/markdown/node:restore\x12\x9f\x01\n" + "\x14RestoreMarkdownNodes\x12).memos.api.v1.RestoreMarkdownNodesRequest\x1a*.memos.api.v1.RestoreMarkdownNodesResponse\"#\x82\xd3\xe4\x93\x02\x1d:\x01*\"\x18/api/v1/markdown:restore\x12\x9a\x01\n" +
"\x16StringifyMarkdownNodes\x12+.memos.api.v1.StringifyMarkdownNodesRequest\x1a,.memos.api.v1.StringifyMarkdownNodesResponse\"*\x82\xd3\xe4\x93\x02$:\x01*\"\x1f/api/v1/markdown/node:stringify\x12{\n" + "\x16StringifyMarkdownNodes\x12+.memos.api.v1.StringifyMarkdownNodesRequest\x1a,.memos.api.v1.StringifyMarkdownNodesResponse\"%\x82\xd3\xe4\x93\x02\x1f:\x01*\"\x1a/api/v1/markdown:stringify\x12\x7f\n" +
"\x0fGetLinkMetadata\x12$.memos.api.v1.GetLinkMetadataRequest\x1a\x1a.memos.api.v1.LinkMetadata\"&\x82\xd3\xe4\x93\x02 \x12\x1e/api/v1/markdown/link:metadataB\xac\x01\n" + "\x0fGetLinkMetadata\x12$.memos.api.v1.GetLinkMetadataRequest\x1a\x1a.memos.api.v1.LinkMetadata\"*\x82\xd3\xe4\x93\x02$\x12\"/api/v1/markdown/links:getMetadataB\xac\x01\n" +
"\x10com.memos.api.v1B\x14MarkdownServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3" "\x10com.memos.api.v1B\x14MarkdownServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
var ( var (
......
...@@ -172,7 +172,7 @@ func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.Serv ...@@ -172,7 +172,7 @@ func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.Serv
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MarkdownService/RestoreMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown/node:restore")) annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MarkdownService/RestoreMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown:restore"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -192,7 +192,7 @@ func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.Serv ...@@ -192,7 +192,7 @@ func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.Serv
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MarkdownService/StringifyMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown/node:stringify")) annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MarkdownService/StringifyMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown:stringify"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -212,7 +212,7 @@ func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.Serv ...@@ -212,7 +212,7 @@ func RegisterMarkdownServiceHandlerServer(ctx context.Context, mux *runtime.Serv
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MarkdownService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/markdown/link:metadata")) annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.MarkdownService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/markdown/links:getMetadata"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -287,7 +287,7 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv ...@@ -287,7 +287,7 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MarkdownService/RestoreMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown/node:restore")) annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MarkdownService/RestoreMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown:restore"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -304,7 +304,7 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv ...@@ -304,7 +304,7 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MarkdownService/StringifyMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown/node:stringify")) annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MarkdownService/StringifyMarkdownNodes", runtime.WithHTTPPathPattern("/api/v1/markdown:stringify"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -321,7 +321,7 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv ...@@ -321,7 +321,7 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MarkdownService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/markdown/link:metadata")) annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.MarkdownService/GetLinkMetadata", runtime.WithHTTPPathPattern("/api/v1/markdown/links:getMetadata"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -339,9 +339,9 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv ...@@ -339,9 +339,9 @@ func RegisterMarkdownServiceHandlerClient(ctx context.Context, mux *runtime.Serv
var ( var (
pattern_MarkdownService_ParseMarkdown_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "markdown"}, "parse")) pattern_MarkdownService_ParseMarkdown_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "markdown"}, "parse"))
pattern_MarkdownService_RestoreMarkdownNodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "markdown", "node"}, "restore")) pattern_MarkdownService_RestoreMarkdownNodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "markdown"}, "restore"))
pattern_MarkdownService_StringifyMarkdownNodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "markdown", "node"}, "stringify")) pattern_MarkdownService_StringifyMarkdownNodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "markdown"}, "stringify"))
pattern_MarkdownService_GetLinkMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "markdown", "link"}, "metadata")) pattern_MarkdownService_GetLinkMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "markdown", "links"}, "getMetadata"))
) )
var ( var (
......
...@@ -30,12 +30,16 @@ const ( ...@@ -30,12 +30,16 @@ const (
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MarkdownServiceClient interface { type MarkdownServiceClient interface {
// ParseMarkdown parses the given markdown content and returns a list of nodes. // ParseMarkdown parses the given markdown content and returns a list of nodes.
// This is a utility method that transforms markdown text into structured nodes.
ParseMarkdown(ctx context.Context, in *ParseMarkdownRequest, opts ...grpc.CallOption) (*ParseMarkdownResponse, error) ParseMarkdown(ctx context.Context, in *ParseMarkdownRequest, opts ...grpc.CallOption) (*ParseMarkdownResponse, error)
// RestoreMarkdownNodes restores the given nodes to markdown content. // RestoreMarkdownNodes restores the given nodes to markdown content.
// This is the inverse operation of ParseMarkdown.
RestoreMarkdownNodes(ctx context.Context, in *RestoreMarkdownNodesRequest, opts ...grpc.CallOption) (*RestoreMarkdownNodesResponse, error) RestoreMarkdownNodes(ctx context.Context, in *RestoreMarkdownNodesRequest, opts ...grpc.CallOption) (*RestoreMarkdownNodesResponse, error)
// StringifyMarkdownNodes stringify the given nodes to plain text content. // StringifyMarkdownNodes stringify the given nodes to plain text content.
// This removes all markdown formatting and returns plain text.
StringifyMarkdownNodes(ctx context.Context, in *StringifyMarkdownNodesRequest, opts ...grpc.CallOption) (*StringifyMarkdownNodesResponse, error) StringifyMarkdownNodes(ctx context.Context, in *StringifyMarkdownNodesRequest, opts ...grpc.CallOption) (*StringifyMarkdownNodesResponse, error)
// GetLinkMetadata returns metadata for a given link. // GetLinkMetadata returns metadata for a given link.
// This is useful for generating link previews.
GetLinkMetadata(ctx context.Context, in *GetLinkMetadataRequest, opts ...grpc.CallOption) (*LinkMetadata, error) GetLinkMetadata(ctx context.Context, in *GetLinkMetadataRequest, opts ...grpc.CallOption) (*LinkMetadata, error)
} }
...@@ -92,12 +96,16 @@ func (c *markdownServiceClient) GetLinkMetadata(ctx context.Context, in *GetLink ...@@ -92,12 +96,16 @@ func (c *markdownServiceClient) GetLinkMetadata(ctx context.Context, in *GetLink
// for forward compatibility. // for forward compatibility.
type MarkdownServiceServer interface { type MarkdownServiceServer interface {
// ParseMarkdown parses the given markdown content and returns a list of nodes. // ParseMarkdown parses the given markdown content and returns a list of nodes.
// This is a utility method that transforms markdown text into structured nodes.
ParseMarkdown(context.Context, *ParseMarkdownRequest) (*ParseMarkdownResponse, error) ParseMarkdown(context.Context, *ParseMarkdownRequest) (*ParseMarkdownResponse, error)
// RestoreMarkdownNodes restores the given nodes to markdown content. // RestoreMarkdownNodes restores the given nodes to markdown content.
// This is the inverse operation of ParseMarkdown.
RestoreMarkdownNodes(context.Context, *RestoreMarkdownNodesRequest) (*RestoreMarkdownNodesResponse, error) RestoreMarkdownNodes(context.Context, *RestoreMarkdownNodesRequest) (*RestoreMarkdownNodesResponse, error)
// StringifyMarkdownNodes stringify the given nodes to plain text content. // StringifyMarkdownNodes stringify the given nodes to plain text content.
// This removes all markdown formatting and returns plain text.
StringifyMarkdownNodes(context.Context, *StringifyMarkdownNodesRequest) (*StringifyMarkdownNodesResponse, error) StringifyMarkdownNodes(context.Context, *StringifyMarkdownNodesRequest) (*StringifyMarkdownNodesResponse, error)
// GetLinkMetadata returns metadata for a given link. // GetLinkMetadata returns metadata for a given link.
// This is useful for generating link previews.
GetLinkMetadata(context.Context, *GetLinkMetadataRequest) (*LinkMetadata, error) GetLinkMetadata(context.Context, *GetLinkMetadataRequest) (*LinkMetadata, error)
mustEmbedUnimplementedMarkdownServiceServer() mustEmbedUnimplementedMarkdownServiceServer()
} }
......
This diff is collapsed.
...@@ -6,10 +6,9 @@ var authenticationAllowlistMethods = map[string]bool{ ...@@ -6,10 +6,9 @@ var authenticationAllowlistMethods = map[string]bool{
"/memos.api.v1.IdentityProviderService/GetIdentityProvider": true, "/memos.api.v1.IdentityProviderService/GetIdentityProvider": true,
"/memos.api.v1.IdentityProviderService/ListIdentityProviders": true, "/memos.api.v1.IdentityProviderService/ListIdentityProviders": true,
"/memos.api.v1.AuthService/GetAuthStatus": true, "/memos.api.v1.AuthService/GetAuthStatus": true,
"/memos.api.v1.AuthService/SignIn": true, "/memos.api.v1.AuthService/CreateSession": true,
"/memos.api.v1.AuthService/SignInWithSSO": true, "/memos.api.v1.AuthService/RegisterUser": true,
"/memos.api.v1.AuthService/SignOut": true, "/memos.api.v1.AuthService/DeleteSession": true,
"/memos.api.v1.AuthService/SignUp": true,
"/memos.api.v1.UserService/GetUser": true, "/memos.api.v1.UserService/GetUser": true,
"/memos.api.v1.UserService/GetUserAvatar": true, "/memos.api.v1.UserService/GetUserAvatar": true,
"/memos.api.v1.UserService/GetUserStats": true, "/memos.api.v1.UserService/GetUserStats": true,
......
...@@ -44,7 +44,7 @@ func (s *APIV1Service) GetAuthStatus(ctx context.Context, _ *v1pb.GetAuthStatusR ...@@ -44,7 +44,7 @@ func (s *APIV1Service) GetAuthStatus(ctx context.Context, _ *v1pb.GetAuthStatusR
return convertUserFromStore(user), nil return convertUserFromStore(user), nil
} }
func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest) (*v1pb.User, error) { func (s *APIV1Service) CreateSession(ctx context.Context, request *v1pb.CreateSessionRequest) (*v1pb.User, error) {
var existingUser *store.User var existingUser *store.User
if passwordCredentials := request.GetPasswordCredentials(); passwordCredentials != nil { if passwordCredentials := request.GetPasswordCredentials(); passwordCredentials != nil {
user, err := s.Store.GetUser(ctx, &store.FindUser{ user, err := s.Store.GetUser(ctx, &store.FindUser{
...@@ -189,7 +189,7 @@ func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTim ...@@ -189,7 +189,7 @@ func (s *APIV1Service) doSignIn(ctx context.Context, user *store.User, expireTim
return nil return nil
} }
func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) (*v1pb.User, error) { func (s *APIV1Service) RegisterUser(ctx context.Context, request *v1pb.RegisterUserRequest) (*v1pb.User, error) {
workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx) workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get workspace general setting, error: %v", err) return nil, status.Errorf(codes.Internal, "failed to get workspace general setting, error: %v", err)
...@@ -237,7 +237,7 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) ...@@ -237,7 +237,7 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest)
return convertUserFromStore(user), nil return convertUserFromStore(user), nil
} }
func (s *APIV1Service) SignOut(ctx context.Context, _ *v1pb.SignOutRequest) (*emptypb.Empty, error) { func (s *APIV1Service) DeleteSession(ctx context.Context, _ *v1pb.DeleteSessionRequest) (*emptypb.Empty, error) {
accessToken, ok := ctx.Value(accessTokenContextKey).(string) accessToken, ok := ctx.Value(accessTokenContextKey).(string)
// Try to delete the access token from the store. // Try to delete the access token from the store.
if ok { if ok {
......
...@@ -45,7 +45,7 @@ const PasswordSignInForm = observer(() => { ...@@ -45,7 +45,7 @@ const PasswordSignInForm = observer(() => {
try { try {
actionBtnLoadingState.setLoading(); actionBtnLoadingState.setLoading();
await authServiceClient.signIn({ passwordCredentials: { username, password }, neverExpire: remember }); await authServiceClient.createSession({ passwordCredentials: { username, password }, neverExpire: remember });
await initialUserStore(); await initialUserStore();
navigateTo("/"); navigateTo("/");
} catch (error: any) { } catch (error: any) {
......
...@@ -19,7 +19,7 @@ const UserBanner = (props: Props) => { ...@@ -19,7 +19,7 @@ const UserBanner = (props: Props) => {
const currentUser = useCurrentUser(); const currentUser = useCurrentUser();
const handleSignOut = async () => { const handleSignOut = async () => {
await authServiceClient.signOut({}); await authServiceClient.deleteSession({});
window.location.href = Routes.AUTH; window.location.href = Routes.AUTH;
}; };
......
...@@ -46,7 +46,7 @@ const AuthCallback = observer(() => { ...@@ -46,7 +46,7 @@ const AuthCallback = observer(() => {
const redirectUri = absolutifyLink("/auth/callback"); const redirectUri = absolutifyLink("/auth/callback");
(async () => { (async () => {
try { try {
await authServiceClient.signIn({ await authServiceClient.createSession({
ssoCredentials: { ssoCredentials: {
idpId: identityProviderId, idpId: identityProviderId,
code, code,
......
...@@ -47,7 +47,7 @@ const SignUp = observer(() => { ...@@ -47,7 +47,7 @@ const SignUp = observer(() => {
try { try {
actionBtnLoadingState.setLoading(); actionBtnLoadingState.setLoading();
await authServiceClient.signUp({ username, password }); await authServiceClient.registerUser({ username, password });
await initialUserStore(); await initialUserStore();
navigateTo("/"); navigateTo("/");
} catch (error: any) { } catch (error: any) {
......
This diff is collapsed.
...@@ -225,36 +225,46 @@ export function nodeTypeToNumber(object: NodeType): number { ...@@ -225,36 +225,46 @@ export function nodeTypeToNumber(object: NodeType): number {
} }
export interface ParseMarkdownRequest { export interface ParseMarkdownRequest {
/** The markdown content to parse. */
markdown: string; markdown: string;
} }
export interface ParseMarkdownResponse { export interface ParseMarkdownResponse {
/** The parsed markdown nodes. */
nodes: Node[]; nodes: Node[];
} }
export interface RestoreMarkdownNodesRequest { export interface RestoreMarkdownNodesRequest {
/** The nodes to restore to markdown content. */
nodes: Node[]; nodes: Node[];
} }
export interface RestoreMarkdownNodesResponse { export interface RestoreMarkdownNodesResponse {
/** The restored markdown content. */
markdown: string; markdown: string;
} }
export interface StringifyMarkdownNodesRequest { export interface StringifyMarkdownNodesRequest {
/** The nodes to stringify to plain text. */
nodes: Node[]; nodes: Node[];
} }
export interface StringifyMarkdownNodesResponse { export interface StringifyMarkdownNodesResponse {
/** The plain text content. */
plainText: string; plainText: string;
} }
export interface GetLinkMetadataRequest { export interface GetLinkMetadataRequest {
/** The link URL to get metadata for. */
link: string; link: string;
} }
export interface LinkMetadata { export interface LinkMetadata {
/** The title of the linked page. */
title: string; title: string;
/** The description of the linked page. */
description: string; description: string;
/** The URL of the preview image for the linked page. */
image: string; image: string;
} }
...@@ -407,7 +417,9 @@ export interface TableNode_Row { ...@@ -407,7 +417,9 @@ export interface TableNode_Row {
} }
export interface EmbeddedContentNode { export interface EmbeddedContentNode {
/** The resource name of the embedded content. */
resourceName: string; resourceName: string;
/** Additional parameters for the embedded content. */
params: string; params: string;
} }
...@@ -478,7 +490,9 @@ export interface SuperscriptNode { ...@@ -478,7 +490,9 @@ export interface SuperscriptNode {
} }
export interface ReferencedContentNode { export interface ReferencedContentNode {
/** The resource name of the referenced content. */
resourceName: string; resourceName: string;
/** Additional parameters for the referenced content. */
params: string; params: string;
} }
...@@ -3202,7 +3216,10 @@ export const MarkdownServiceDefinition = { ...@@ -3202,7 +3216,10 @@ export const MarkdownServiceDefinition = {
name: "MarkdownService", name: "MarkdownService",
fullName: "memos.api.v1.MarkdownService", fullName: "memos.api.v1.MarkdownService",
methods: { methods: {
/** ParseMarkdown parses the given markdown content and returns a list of nodes. */ /**
* ParseMarkdown parses the given markdown content and returns a list of nodes.
* This is a utility method that transforms markdown text into structured nodes.
*/
parseMarkdown: { parseMarkdown: {
name: "ParseMarkdown", name: "ParseMarkdown",
requestType: ParseMarkdownRequest, requestType: ParseMarkdownRequest,
...@@ -3246,7 +3263,10 @@ export const MarkdownServiceDefinition = { ...@@ -3246,7 +3263,10 @@ export const MarkdownServiceDefinition = {
}, },
}, },
}, },
/** RestoreMarkdownNodes restores the given nodes to markdown content. */ /**
* RestoreMarkdownNodes restores the given nodes to markdown content.
* This is the inverse operation of ParseMarkdown.
*/
restoreMarkdownNodes: { restoreMarkdownNodes: {
name: "RestoreMarkdownNodes", name: "RestoreMarkdownNodes",
requestType: RestoreMarkdownNodesRequest, requestType: RestoreMarkdownNodesRequest,
...@@ -3257,12 +3277,12 @@ export const MarkdownServiceDefinition = { ...@@ -3257,12 +3277,12 @@ export const MarkdownServiceDefinition = {
_unknownFields: { _unknownFields: {
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
34, 29,
58, 58,
1, 1,
42, 42,
34, 34,
29, 24,
47, 47,
97, 97,
112, 112,
...@@ -3279,11 +3299,6 @@ export const MarkdownServiceDefinition = { ...@@ -3279,11 +3299,6 @@ export const MarkdownServiceDefinition = {
111, 111,
119, 119,
110, 110,
47,
110,
111,
100,
101,
58, 58,
114, 114,
101, 101,
...@@ -3297,7 +3312,10 @@ export const MarkdownServiceDefinition = { ...@@ -3297,7 +3312,10 @@ export const MarkdownServiceDefinition = {
}, },
}, },
}, },
/** StringifyMarkdownNodes stringify the given nodes to plain text content. */ /**
* StringifyMarkdownNodes stringify the given nodes to plain text content.
* This removes all markdown formatting and returns plain text.
*/
stringifyMarkdownNodes: { stringifyMarkdownNodes: {
name: "StringifyMarkdownNodes", name: "StringifyMarkdownNodes",
requestType: StringifyMarkdownNodesRequest, requestType: StringifyMarkdownNodesRequest,
...@@ -3308,12 +3326,12 @@ export const MarkdownServiceDefinition = { ...@@ -3308,12 +3326,12 @@ export const MarkdownServiceDefinition = {
_unknownFields: { _unknownFields: {
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
36, 31,
58, 58,
1, 1,
42, 42,
34, 34,
31, 26,
47, 47,
97, 97,
112, 112,
...@@ -3330,11 +3348,6 @@ export const MarkdownServiceDefinition = { ...@@ -3330,11 +3348,6 @@ export const MarkdownServiceDefinition = {
111, 111,
119, 119,
110, 110,
47,
110,
111,
100,
101,
58, 58,
115, 115,
116, 116,
...@@ -3350,7 +3363,10 @@ export const MarkdownServiceDefinition = { ...@@ -3350,7 +3363,10 @@ export const MarkdownServiceDefinition = {
}, },
}, },
}, },
/** GetLinkMetadata returns metadata for a given link. */ /**
* GetLinkMetadata returns metadata for a given link.
* This is useful for generating link previews.
*/
getLinkMetadata: { getLinkMetadata: {
name: "GetLinkMetadata", name: "GetLinkMetadata",
requestType: GetLinkMetadataRequest, requestType: GetLinkMetadataRequest,
...@@ -3361,9 +3377,9 @@ export const MarkdownServiceDefinition = { ...@@ -3361,9 +3377,9 @@ export const MarkdownServiceDefinition = {
_unknownFields: { _unknownFields: {
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
32, 36,
18, 18,
30, 34,
47, 47,
97, 97,
112, 112,
...@@ -3385,8 +3401,12 @@ export const MarkdownServiceDefinition = { ...@@ -3385,8 +3401,12 @@ export const MarkdownServiceDefinition = {
105, 105,
110, 110,
107, 107,
115,
58, 58,
109, 103,
101,
116,
77,
101, 101,
116, 116,
97, 97,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment