Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
5d740c38
Commit
5d740c38
authored
Mar 13, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update link service
parent
0abe20df
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
167 additions
and
110 deletions
+167
-110
link_service.proto
proto/api/v2/link_service.proto
+3
-4
README.md
proto/gen/api/v2/README.md
+6
-6
link_service.pb.go
proto/gen/api/v2/link_service.pb.go
+53
-53
apidocs.swagger.yaml
server/route/api/v2/apidocs.swagger.yaml
+102
-42
link_service.go
server/route/api/v2/link_service.go
+3
-5
No files found.
proto/api/v2/link_service.proto
View file @
5d740c38
...
...
@@ -12,17 +12,16 @@ service LinkService {
}
}
// Metadata message
message
Metadata
{
message
LinkMetadata
{
string
title
=
1
;
string
description
=
2
;
string
image
=
3
;
}
message
GetLinkMetadataRequest
{
string
url
=
1
;
string
link
=
1
;
}
message
GetLinkMetadataResponse
{
Metadata
metadata
=
1
;
Link
Metadata
metadata
=
1
;
}
proto/gen/api/v2/README.md
View file @
5d740c38
...
...
@@ -78,7 +78,7 @@
-
[
api/v2/link_service.proto
](
#api_v2_link_service-proto
)
-
[
GetLinkMetadataRequest
](
#memos-api-v2-GetLinkMetadataRequest
)
-
[
GetLinkMetadataResponse
](
#memos-api-v2-GetLinkMetadataResponse
)
-
[
Metadata
](
#memos-api-v2-
Metadata
)
-
[
LinkMetadata
](
#memos-api-v2-Link
Metadata
)
-
[
LinkService
](
#memos-api-v2-LinkService
)
...
...
@@ -1119,7 +1119,7 @@ Used internally for obfuscating the page token.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
|
url
|
[
string
](
#string
)
| | |
|
link
|
[
string
](
#string
)
| | |
...
...
@@ -1134,17 +1134,17 @@ Used internally for obfuscating the page token.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| metadata |
[
Metadata
](
#memos-api-v2-Metadata
)
| | |
| metadata |
[
LinkMetadata
](
#memos-api-v2-LinkMetadata
)
| | |
<a
name=
"memos-api-v2-LinkMetadata"
></a>
<a
name=
"memos-api-v2-Metadata"
></a>
### LinkMetadata
### Metadata
Metadata message
| Field | Type | Label | Description |
...
...
proto/gen/api/v2/link_service.pb.go
View file @
5d740c38
This diff is collapsed.
Click to expand it.
server/route/api/v2/apidocs.swagger.yaml
View file @
5d740c38
This diff is collapsed.
Click to expand it.
server/route/api/v2/link_service.go
View file @
5d740c38
...
...
@@ -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
.
Link
Metadata
{
Title
:
htmlMeta
.
Title
,
Description
:
htmlMeta
.
Description
,
Image
:
htmlMeta
.
Image
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment