Commit 5d740c38 authored by Steven's avatar Steven

chore: update link service

parent 0abe20df
......@@ -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;
LinkMetadata metadata = 1;
}
......@@ -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-LinkMetadata)
- [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 |
......
This diff is collapsed.
This diff is collapsed.
......@@ -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,
......
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