chore: update link service

This commit is contained in:
Steven
2024-03-13 20:25:27 +08:00
parent 0abe20df72
commit 5d740c3813
5 changed files with 167 additions and 110 deletions

View File

@@ -172,12 +172,16 @@ paths:
type: integer
format: int32
- name: pageToken
description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page."
description: |-
A page token, received from a previous `ListMemos` call.
Provide this to retrieve the subsequent page.
in: query
required: false
type: string
- name: filter
description: "Filter is used to filter memos returned in the list.\r\nFormat: \"creator == users/{username} && visibilities == ['PUBLIC', 'PROTECTED']\""
description: |-
Filter is used to filter memos returned in the list.
Format: "creator == users/{username} && visibilities == ['PUBLIC', 'PROTECTED']"
in: query
required: false
type: string
@@ -238,12 +242,17 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "name is the name of the user to get stats for.\r\nFormat: users/{username}"
description: |-
name is the name of the user to get stats for.
Format: users/{username}
in: query
required: false
type: string
- name: timezone
description: "timezone location\r\nFormat: uses tz identifier\r\nhttps://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
description: |-
timezone location
Format: uses tz identifier
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
in: query
required: false
type: string
@@ -575,7 +584,9 @@ paths:
$ref: '#/definitions/apiv2RowStatus'
creator:
type: string
title: "The name of the creator.\r\nFormat: users/{username}"
title: |-
The name of the creator.
Format: users/{username}
creatorId:
type: integer
format: int32
@@ -652,7 +663,7 @@ paths:
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: url
- name: link
in: query
required: false
type: string
@@ -827,7 +838,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: user
description: "The creator of tags.\r\nFormat: users/{username}"
description: |-
The creator of tags.
Format: users/{username}
in: query
required: false
type: string
@@ -851,7 +864,9 @@ paths:
required: false
type: string
- name: tag.creator
description: "The creator of tags.\r\nFormat: users/{username}"
description: |-
The creator of tags.
Format: users/{username}
in: query
required: false
type: string
@@ -891,7 +906,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: user
description: "The creator of tags.\r\nFormat: users/{username}"
description: |-
The creator of tags.
Format: users/{username}
in: query
required: false
type: string
@@ -914,7 +931,9 @@ paths:
- TagService
/api/v2/tags:rename:
patch:
summary: "RenameTag renames a tag.\r\nAll related memos will be updated."
summary: |-
RenameTag renames a tag.
All related memos will be updated.
operationId: TagService_RenameTag
responses:
"200":
@@ -927,7 +946,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: user
description: "The creator of tags.\r\nFormat: users/{username}"
description: |-
The creator of tags.
Format: users/{username}
in: query
required: false
type: string
@@ -1130,7 +1151,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The resource name of the workspace setting.\r\nFormat: settings/{setting}"
description: |-
The resource name of the workspace setting.
Format: settings/{setting}
in: path
required: true
type: string
@@ -1152,7 +1175,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: setting.name
description: "name is the name of the setting.\r\nFormat: settings/{setting}"
description: |-
name is the name of the setting.
Format: settings/{setting}
in: path
required: true
type: string
@@ -1185,7 +1210,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: inbox.name
description: "The name of the inbox.\r\nFormat: inboxes/{uid}"
description: |-
The name of the inbox.
Format: inboxes/{uid}
in: path
required: true
type: string
@@ -1229,7 +1256,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name_1
description: "The name of the inbox to delete.\r\nFormat: inboxes/{uid}"
description: |-
The name of the inbox to delete.
Format: inboxes/{uid}
in: path
required: true
type: string
@@ -1251,7 +1280,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1272,7 +1303,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1294,7 +1327,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1315,7 +1350,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1342,7 +1379,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1369,7 +1408,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1391,7 +1432,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: setting.name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1431,7 +1474,9 @@ paths:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: user.name
description: "The name of the user.\r\nFormat: users/{username}"
description: |-
The name of the user.
Format: users/{username}
in: path
required: true
type: string
@@ -1583,7 +1628,9 @@ definitions:
properties:
name:
type: string
title: "The name of the user.\r\nFormat: users/{username}"
title: |-
The name of the user.
Format: users/{username}
locale:
type: string
description: The preferred locale of the user.
@@ -1640,7 +1687,9 @@ definitions:
properties:
name:
type: string
title: "name is the name of the setting.\r\nFormat: settings/{setting}"
title: |-
name is the name of the setting.
Format: settings/{setting}
generalSetting:
$ref: '#/definitions/apiv2WorkspaceGeneralSetting'
description: general_setting is the general setting of workspace.
@@ -1763,7 +1812,7 @@ definitions:
type: object
properties:
metadata:
$ref: '#/definitions/v2Metadata'
$ref: '#/definitions/v2LinkMetadata'
v2GetMemoByNameResponse:
type: object
properties:
@@ -1799,7 +1848,9 @@ definitions:
additionalProperties:
type: integer
format: int32
description: "stats is the stats of memo creating/updating activities.\r\nkey is the year-month-day string. e.g. \"2020-01-01\"."
description: |-
stats is the stats of memo creating/updating activities.
key is the year-month-day string. e.g. "2020-01-01".
v2GetUserResponse:
type: object
properties:
@@ -1830,7 +1881,9 @@ definitions:
properties:
name:
type: string
title: "The name of the inbox.\r\nFormat: inboxes/{uid}"
title: |-
The name of the inbox.
Format: inboxes/{uid}
sender:
type: string
title: 'Format: users/{username}'
@@ -1861,6 +1914,15 @@ definitions:
- TYPE_MEMO_COMMENT
- TYPE_VERSION_UPDATE
default: TYPE_UNSPECIFIED
v2LinkMetadata:
type: object
properties:
title:
type: string
description:
type: string
image:
type: string
v2ListInboxesResponse:
type: object
properties:
@@ -1911,7 +1973,9 @@ definitions:
$ref: '#/definitions/v2Memo'
nextPageToken:
type: string
description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages."
description: |-
A token, which can be sent as `page_token` to retrieve the next page.
If this field is omitted, there are no subsequent pages.
v2ListResourcesResponse:
type: object
properties:
@@ -1966,7 +2030,9 @@ definitions:
$ref: '#/definitions/apiv2RowStatus'
creator:
type: string
title: "The name of the creator.\r\nFormat: users/{username}"
title: |-
The name of the creator.
Format: users/{username}
creatorId:
type: integer
format: int32
@@ -2025,16 +2091,6 @@ definitions:
- REFERENCE
- COMMENT
default: TYPE_UNSPECIFIED
v2Metadata:
type: object
properties:
title:
type: string
description:
type: string
image:
type: string
title: Metadata message
v2RenameTagResponse:
type: object
properties:
@@ -2098,7 +2154,9 @@ definitions:
type: string
creator:
type: string
title: "The creator of tags.\r\nFormat: users/{username}"
title: |-
The creator of tags.
Format: users/{username}
v2UpdateInboxResponse:
type: object
properties:
@@ -2149,7 +2207,9 @@ definitions:
properties:
name:
type: string
title: "The name of the user.\r\nFormat: users/{username}"
title: |-
The name of the user.
Format: users/{username}
id:
type: integer
format: int32

View File

@@ -7,16 +7,14 @@ import (
apiv2pb "github.com/usememos/memos/proto/gen/api/v2"
)
func (*APIV2Service) GetMetadata(_ context.Context, request *apiv2pb.GetLinkMetadataRequest) (*apiv2pb.GetLinkMetadataResponse, error) {
urlStr := request.Url
htmlMeta, err := getter.GetHTMLMeta(urlStr)
func (*APIV2Service) GetLinkMetadata(_ context.Context, request *apiv2pb.GetLinkMetadataRequest) (*apiv2pb.GetLinkMetadataResponse, error) {
htmlMeta, err := getter.GetHTMLMeta(request.Link)
if err != nil {
return nil, err
}
return &apiv2pb.GetLinkMetadataResponse{
Metadata: &apiv2pb.Metadata{
Metadata: &apiv2pb.LinkMetadata{
Title: htmlMeta.Title,
Description: htmlMeta.Description,
Image: htmlMeta.Image,