refactor: add markdown service

This commit is contained in:
Steven
2024-04-29 08:00:37 +08:00
parent 4338234641
commit 155c5baf2c
46 changed files with 5479 additions and 2084 deletions

View File

@ -8,7 +8,7 @@ tags:
- name: AuthService
- name: IdentityProviderService
- name: InboxService
- name: LinkService
- name: MarkdownService
- name: ResourceService
- name: MemoService
- name: TagService
@ -219,15 +219,15 @@ paths:
type: string
tags:
- InboxService
/api/v1/linkMetadata:
/api/v1/markdown/link:metadata:
get:
summary: GetLinkMetadata returns metadata for a given link.
operationId: LinkService_GetLinkMetadata
operationId: MarkdownService_GetLinkMetadata
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1GetLinkMetadataResponse'
$ref: '#/definitions/v1LinkMetadata'
default:
description: An unexpected error response.
schema:
@ -238,7 +238,49 @@ paths:
required: false
type: string
tags:
- LinkService
- MarkdownService
/api/v1/markdown/parse:
post:
summary: Parses the given markdown content and returns a list of nodes.
operationId: MarkdownService_ParseMarkdown
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1ParseMarkdownResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/v1ParseMarkdownRequest'
tags:
- MarkdownService
/api/v1/markdown:restore:
post:
summary: Restores the given nodes to markdown content.
operationId: MarkdownService_RestoreMarkdown
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1RestoreMarkdownResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: body
in: body
required: true
schema:
$ref: '#/definitions/v1RestoreMarkdownRequest'
tags:
- MarkdownService
/api/v1/memos:
get:
summary: ListMemos lists memos with pagination and filter.
@ -994,6 +1036,12 @@ paths:
format: date-time
content:
type: string
nodes:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
readOnly: true
visibility:
$ref: '#/definitions/v1Visibility'
pinned:
@ -1729,6 +1777,13 @@ definitions:
properties:
reaction:
$ref: '#/definitions/v1Reaction'
TableNodeRow:
type: object
properties:
cells:
type: array
items:
type: string
UserRole:
type: string
enum:
@ -1987,6 +2042,13 @@ definitions:
payload:
$ref: '#/definitions/apiv1ActivityPayload'
description: The payload of the activity.
v1AutoLinkNode:
type: object
properties:
url:
type: string
isRawText:
type: boolean
v1BatchUpsertTagRequest:
type: object
properties:
@ -1995,6 +2057,43 @@ definitions:
items:
type: object
$ref: '#/definitions/v1UpsertTagRequest'
v1BlockquoteNode:
type: object
properties:
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1BoldItalicNode:
type: object
properties:
symbol:
type: string
content:
type: string
v1BoldNode:
type: object
properties:
symbol:
type: string
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1CodeBlockNode:
type: object
properties:
language:
type: string
content:
type: string
v1CodeNode:
type: object
properties:
content:
type: string
v1CreateMemoRequest:
type: object
properties:
@ -2009,6 +2108,18 @@ definitions:
type: string
url:
type: string
v1EmbeddedContentNode:
type: object
properties:
resourceName:
type: string
params:
type: string
v1EscapingCharacterNode:
type: object
properties:
symbol:
type: string
v1ExportMemosRequest:
type: object
properties:
@ -2021,11 +2132,6 @@ definitions:
content:
type: string
format: byte
v1GetLinkMetadataResponse:
type: object
properties:
linkMetadata:
$ref: '#/definitions/v1LinkMetadata'
v1GetTagSuggestionsResponse:
type: object
properties:
@ -2044,6 +2150,34 @@ definitions:
description: |-
stats is the stats of memo creating/updating activities.
key is the year-month-day string. e.g. "2020-01-01".
v1HeadingNode:
type: object
properties:
level:
type: integer
format: int32
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1HighlightNode:
type: object
properties:
content:
type: string
v1HorizontalRuleNode:
type: object
properties:
symbol:
type: string
v1ImageNode:
type: object
properties:
altText:
type: string
url:
type: string
v1Inbox:
type: object
properties:
@ -2082,6 +2216,15 @@ definitions:
- TYPE_MEMO_COMMENT
- TYPE_VERSION_UPDATE
default: TYPE_UNSPECIFIED
v1ItalicNode:
type: object
properties:
symbol:
type: string
content:
type: string
v1LineBreakNode:
type: object
v1LinkMetadata:
type: object
properties:
@ -2091,6 +2234,13 @@ definitions:
type: string
image:
type: string
v1LinkNode:
type: object
properties:
text:
type: string
url:
type: string
v1ListIdentityProvidersResponse:
type: object
properties:
@ -2200,6 +2350,16 @@ definitions:
items:
type: object
$ref: '#/definitions/apiv1WorkspaceSetting'
v1MathBlockNode:
type: object
properties:
content:
type: string
v1MathNode:
type: object
properties:
content:
type: string
v1Memo:
type: object
properties:
@ -2230,6 +2390,12 @@ definitions:
format: date-time
content:
type: string
nodes:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
readOnly: true
visibility:
$ref: '#/definitions/v1Visibility'
pinned:
@ -2278,6 +2444,137 @@ definitions:
- REFERENCE
- COMMENT
default: TYPE_UNSPECIFIED
v1Node:
type: object
properties:
type:
$ref: '#/definitions/v1NodeType'
lineBreakNode:
$ref: '#/definitions/v1LineBreakNode'
paragraphNode:
$ref: '#/definitions/v1ParagraphNode'
codeBlockNode:
$ref: '#/definitions/v1CodeBlockNode'
headingNode:
$ref: '#/definitions/v1HeadingNode'
horizontalRuleNode:
$ref: '#/definitions/v1HorizontalRuleNode'
blockquoteNode:
$ref: '#/definitions/v1BlockquoteNode'
orderedListNode:
$ref: '#/definitions/v1OrderedListNode'
unorderedListNode:
$ref: '#/definitions/v1UnorderedListNode'
taskListNode:
$ref: '#/definitions/v1TaskListNode'
mathBlockNode:
$ref: '#/definitions/v1MathBlockNode'
tableNode:
$ref: '#/definitions/v1TableNode'
embeddedContentNode:
$ref: '#/definitions/v1EmbeddedContentNode'
textNode:
$ref: '#/definitions/v1TextNode'
boldNode:
$ref: '#/definitions/v1BoldNode'
italicNode:
$ref: '#/definitions/v1ItalicNode'
boldItalicNode:
$ref: '#/definitions/v1BoldItalicNode'
codeNode:
$ref: '#/definitions/v1CodeNode'
imageNode:
$ref: '#/definitions/v1ImageNode'
linkNode:
$ref: '#/definitions/v1LinkNode'
autoLinkNode:
$ref: '#/definitions/v1AutoLinkNode'
tagNode:
$ref: '#/definitions/v1TagNode'
strikethroughNode:
$ref: '#/definitions/v1StrikethroughNode'
escapingCharacterNode:
$ref: '#/definitions/v1EscapingCharacterNode'
mathNode:
$ref: '#/definitions/v1MathNode'
highlightNode:
$ref: '#/definitions/v1HighlightNode'
subscriptNode:
$ref: '#/definitions/v1SubscriptNode'
superscriptNode:
$ref: '#/definitions/v1SuperscriptNode'
referencedContentNode:
$ref: '#/definitions/v1ReferencedContentNode'
spoilerNode:
$ref: '#/definitions/v1SpoilerNode'
v1NodeType:
type: string
enum:
- NODE_UNSPECIFIED
- LINE_BREAK
- PARAGRAPH
- CODE_BLOCK
- HEADING
- HORIZONTAL_RULE
- BLOCKQUOTE
- ORDERED_LIST
- UNORDERED_LIST
- TASK_LIST
- MATH_BLOCK
- TABLE
- EMBEDDED_CONTENT
- TEXT
- BOLD
- ITALIC
- BOLD_ITALIC
- CODE
- IMAGE
- LINK
- AUTO_LINK
- TAG
- STRIKETHROUGH
- ESCAPING_CHARACTER
- MATH
- HIGHLIGHT
- SUBSCRIPT
- SUPERSCRIPT
- REFERENCED_CONTENT
- SPOILER
default: NODE_UNSPECIFIED
v1OrderedListNode:
type: object
properties:
number:
type: string
indent:
type: integer
format: int32
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1ParagraphNode:
type: object
properties:
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1ParseMarkdownRequest:
type: object
properties:
markdown:
type: string
v1ParseMarkdownResponse:
type: object
properties:
nodes:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1Reaction:
type: object
properties:
@ -2310,6 +2607,13 @@ definitions:
- CLOWN_FACE
- QUESTION_MARK
default: TYPE_UNSPECIFIED
v1ReferencedContentNode:
type: object
properties:
resourceName:
type: string
params:
type: string
v1RenameTagRequest:
type: object
properties:
@ -2355,6 +2659,19 @@ definitions:
title: |-
The related memo.
Format: memos/{id}
v1RestoreMarkdownRequest:
type: object
properties:
nodes:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1RestoreMarkdownResponse:
type: object
properties:
markdown:
type: string
v1RowStatus:
type: string
enum:
@ -2386,6 +2703,42 @@ definitions:
items:
type: object
$ref: '#/definitions/v1User'
v1SpoilerNode:
type: object
properties:
content:
type: string
v1StrikethroughNode:
type: object
properties:
content:
type: string
v1SubscriptNode:
type: object
properties:
content:
type: string
v1SuperscriptNode:
type: object
properties:
content:
type: string
v1TableNode:
type: object
properties:
header:
type: array
items:
type: string
delimiter:
type: array
items:
type: string
rows:
type: array
items:
type: object
$ref: '#/definitions/TableNodeRow'
v1Tag:
type: object
properties:
@ -2396,6 +2749,44 @@ definitions:
title: |-
The creator of tags.
Format: users/{id}
v1TagNode:
type: object
properties:
content:
type: string
v1TaskListNode:
type: object
properties:
symbol:
type: string
indent:
type: integer
format: int32
complete:
type: boolean
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1TextNode:
type: object
properties:
content:
type: string
v1UnorderedListNode:
type: object
properties:
symbol:
type: string
indent:
type: integer
format: int32
children:
type: array
items:
type: object
$ref: '#/definitions/v1Node'
v1UpsertTagRequest:
type: object
properties: