mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: implement reaction service
This commit is contained in:
@ -324,6 +324,69 @@ CreateMemoComment creates a comment for a memo.
|
||||
| 200 | A successful response. | [v2CreateMemoCommentResponse](#v2creatememocommentresponse) |
|
||||
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
|
||||
|
||||
### /api/v2/memos/{id}/reactions
|
||||
|
||||
#### GET
|
||||
##### Summary
|
||||
|
||||
ListMemoReactions lists reactions for a memo.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Located in | Description | Required | Schema |
|
||||
| ---- | ---------- | ----------- | -------- | ------ |
|
||||
| id | path | | Yes | integer |
|
||||
|
||||
##### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | A successful response. | [v2ListMemoReactionsResponse](#v2listmemoreactionsresponse) |
|
||||
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
|
||||
|
||||
#### POST
|
||||
##### Summary
|
||||
|
||||
UpsertMemoReaction upserts a reaction for a memo.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Located in | Description | Required | Schema |
|
||||
| ---- | ---------- | ----------- | -------- | ------ |
|
||||
| id | path | | Yes | integer |
|
||||
| reaction.id | query | | No | integer |
|
||||
| reaction.creator | query | | No | string |
|
||||
| reaction.contentId | query | | No | string |
|
||||
| reaction.reactionType | query | | No | string |
|
||||
|
||||
##### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | A successful response. | [v2UpsertMemoReactionResponse](#v2upsertmemoreactionresponse) |
|
||||
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
|
||||
|
||||
### /api/v2/memos/{id}/reactions/{reactionId}
|
||||
|
||||
#### DELETE
|
||||
##### Summary
|
||||
|
||||
DeleteMemoReaction deletes a reaction for a memo.
|
||||
|
||||
##### Parameters
|
||||
|
||||
| Name | Located in | Description | Required | Schema |
|
||||
| ---- | ---------- | ----------- | -------- | ------ |
|
||||
| id | path | | Yes | integer |
|
||||
| reactionId | path | | Yes | integer |
|
||||
|
||||
##### Responses
|
||||
|
||||
| Code | Description | Schema |
|
||||
| ---- | ----------- | ------ |
|
||||
| 200 | A successful response. | [v2DeleteMemoReactionResponse](#v2deletememoreactionresponse) |
|
||||
| default | An unexpected error response. | [googlerpcStatus](#googlerpcstatus) |
|
||||
|
||||
### /api/v2/memos/{id}/relations
|
||||
|
||||
#### GET
|
||||
@ -414,7 +477,7 @@ UpdateMemo updates a memo.
|
||||
| Name | Located in | Description | Required | Schema |
|
||||
| ---- | ---------- | ----------- | -------- | ------ |
|
||||
| memo.id | path | id is the system generated unique identifier. | Yes | integer |
|
||||
| memo | body | | Yes | { **"name"**: string, **"rowStatus"**: [apiv2RowStatus](#apiv2rowstatus), **"creator"**: string, **"creatorId"**: integer, **"createTime"**: dateTime, **"updateTime"**: dateTime, **"displayTime"**: dateTime, **"content"**: string, **"visibility"**: [v2Visibility](#v2visibility), **"pinned"**: boolean, **"parentId"**: integer, **"resources"**: [ [v2Resource](#v2resource) ], **"relations"**: [ [v2MemoRelation](#v2memorelation) ] } |
|
||||
| memo | body | | Yes | { **"name"**: string, **"rowStatus"**: [apiv2RowStatus](#apiv2rowstatus), **"creator"**: string, **"creatorId"**: integer, **"createTime"**: dateTime, **"updateTime"**: dateTime, **"displayTime"**: dateTime, **"content"**: string, **"visibility"**: [v2Visibility](#v2visibility), **"pinned"**: boolean, **"parentId"**: integer, **"resources"**: [ [v2Resource](#v2resource) ], **"relations"**: [ [v2MemoRelation](#v2memorelation) ], **"reactions"**: [ [apiv2Reaction](#apiv2reaction) ] } |
|
||||
|
||||
##### Responses
|
||||
|
||||
@ -1078,6 +1141,21 @@ GetActivity returns the activity with the given id.
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| version | string | | No |
|
||||
|
||||
#### apiv2Reaction
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| id | integer | | No |
|
||||
| creator | string | | No |
|
||||
| contentId | string | | No |
|
||||
| reactionType | [apiv2ReactionType](#apiv2reactiontype) | | No |
|
||||
|
||||
#### apiv2ReactionType
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| apiv2ReactionType | string | | |
|
||||
|
||||
#### apiv2RowStatus
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -1194,6 +1272,12 @@ GetActivity returns the activity with the given id.
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| v2DeleteInboxResponse | object | | |
|
||||
|
||||
#### v2DeleteMemoReactionResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| v2DeleteMemoReactionResponse | object | | |
|
||||
|
||||
#### v2DeleteMemoResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -1344,6 +1428,12 @@ GetActivity returns the activity with the given id.
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| memos | [ [v2Memo](#v2memo) ] | | No |
|
||||
|
||||
#### v2ListMemoReactionsResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| reactions | [ [apiv2Reaction](#apiv2reaction) ] | | No |
|
||||
|
||||
#### v2ListMemoRelationsResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -1411,6 +1501,7 @@ GetActivity returns the activity with the given id.
|
||||
| parentId | integer | | No |
|
||||
| resources | [ [v2Resource](#v2resource) ] | | No |
|
||||
| relations | [ [v2MemoRelation](#v2memorelation) ] | | No |
|
||||
| reactions | [ [apiv2Reaction](#apiv2reaction) ] | | No |
|
||||
|
||||
#### v2MemoRelation
|
||||
|
||||
@ -1530,6 +1621,12 @@ GetActivity returns the activity with the given id.
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| workspaceProfile | [v2WorkspaceProfile](#v2workspaceprofile) | | No |
|
||||
|
||||
#### v2UpsertMemoReactionResponse
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
| ---- | ---- | ----------- | -------- |
|
||||
| reaction | [apiv2Reaction](#apiv2reaction) | | No |
|
||||
|
||||
#### v2UpsertTagRequest
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -358,6 +358,99 @@ paths:
|
||||
default: VISIBILITY_UNSPECIFIED
|
||||
tags:
|
||||
- MemoService
|
||||
/api/v2/memos/{id}/reactions:
|
||||
get:
|
||||
summary: ListMemoReactions lists reactions for a memo.
|
||||
operationId: MemoService_ListMemoReactions
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v2ListMemoReactionsResponse'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
tags:
|
||||
- MemoService
|
||||
post:
|
||||
summary: UpsertMemoReaction upserts a reaction for a memo.
|
||||
operationId: MemoService_UpsertMemoReaction
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v2UpsertMemoReactionResponse'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
- name: reaction.id
|
||||
in: query
|
||||
required: false
|
||||
type: integer
|
||||
format: int32
|
||||
- name: reaction.creator
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
- name: reaction.contentId
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
- name: reaction.reactionType
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
enum:
|
||||
- TYPE_UNSPECIFIED
|
||||
- EYES
|
||||
- HEART
|
||||
- LAUGH
|
||||
- ROCKET
|
||||
- THUMBS_DOWN
|
||||
- THUMBS_UP
|
||||
default: TYPE_UNSPECIFIED
|
||||
tags:
|
||||
- MemoService
|
||||
/api/v2/memos/{id}/reactions/{reactionId}:
|
||||
delete:
|
||||
summary: DeleteMemoReaction deletes a reaction for a memo.
|
||||
operationId: MemoService_DeleteMemoReaction
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v2DeleteMemoReactionResponse'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
- name: reactionId
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
tags:
|
||||
- MemoService
|
||||
/api/v2/memos/{id}/relations:
|
||||
get:
|
||||
summary: ListMemoRelations lists relations for a memo.
|
||||
@ -520,6 +613,12 @@ paths:
|
||||
type: object
|
||||
$ref: '#/definitions/v2MemoRelation'
|
||||
readOnly: true
|
||||
reactions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/apiv2Reaction'
|
||||
readOnly: true
|
||||
tags:
|
||||
- MemoService
|
||||
/api/v2/memos:export:
|
||||
@ -1426,6 +1525,29 @@ definitions:
|
||||
properties:
|
||||
version:
|
||||
type: string
|
||||
apiv2Reaction:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
creator:
|
||||
type: string
|
||||
contentId:
|
||||
type: string
|
||||
reactionType:
|
||||
$ref: '#/definitions/apiv2ReactionType'
|
||||
apiv2ReactionType:
|
||||
type: string
|
||||
enum:
|
||||
- TYPE_UNSPECIFIED
|
||||
- EYES
|
||||
- HEART
|
||||
- LAUGH
|
||||
- ROCKET
|
||||
- THUMBS_DOWN
|
||||
- THUMBS_UP
|
||||
default: TYPE_UNSPECIFIED
|
||||
apiv2RowStatus:
|
||||
type: string
|
||||
enum:
|
||||
@ -1562,6 +1684,8 @@ definitions:
|
||||
$ref: '#/definitions/apiv2Webhook'
|
||||
v2DeleteInboxResponse:
|
||||
type: object
|
||||
v2DeleteMemoReactionResponse:
|
||||
type: object
|
||||
v2DeleteMemoResponse:
|
||||
type: object
|
||||
v2DeleteResourceResponse:
|
||||
@ -1702,6 +1826,14 @@ definitions:
|
||||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/v2Memo'
|
||||
v2ListMemoReactionsResponse:
|
||||
type: object
|
||||
properties:
|
||||
reactions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/apiv2Reaction'
|
||||
v2ListMemoRelationsResponse:
|
||||
type: object
|
||||
properties:
|
||||
@ -1822,6 +1954,12 @@ definitions:
|
||||
type: object
|
||||
$ref: '#/definitions/v2MemoRelation'
|
||||
readOnly: true
|
||||
reactions:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/apiv2Reaction'
|
||||
readOnly: true
|
||||
v2MemoRelation:
|
||||
type: object
|
||||
properties:
|
||||
@ -1936,6 +2074,11 @@ definitions:
|
||||
properties:
|
||||
workspaceProfile:
|
||||
$ref: '#/definitions/v2WorkspaceProfile'
|
||||
v2UpsertMemoReactionResponse:
|
||||
type: object
|
||||
properties:
|
||||
reaction:
|
||||
$ref: '#/definitions/apiv2Reaction'
|
||||
v2UpsertTagRequest:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -530,6 +530,11 @@ func (s *APIV2Service) convertMemoFromStore(ctx context.Context, memo *store.Mem
|
||||
return nil, errors.Wrap(err, "failed to list memo resources")
|
||||
}
|
||||
|
||||
listMemoReactionsResponse, err := s.ListMemoReactions(ctx, &apiv2pb.ListMemoReactionsRequest{Id: memo.ID})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to list memo reactions")
|
||||
}
|
||||
|
||||
return &apiv2pb.Memo{
|
||||
Id: int32(memo.ID),
|
||||
Name: memo.ResourceName,
|
||||
@ -545,6 +550,7 @@ func (s *APIV2Service) convertMemoFromStore(ctx context.Context, memo *store.Mem
|
||||
ParentId: memo.ParentID,
|
||||
Relations: listMemoRelationsResponse.Relations,
|
||||
Resources: listMemoResourcesResponse.Resources,
|
||||
Reactions: listMemoReactionsResponse.Reactions,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
83
api/v2/reaction_service.go
Normal file
83
api/v2/reaction_service.go
Normal file
@ -0,0 +1,83 @@
|
||||
package v2
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
apiv2pb "github.com/usememos/memos/proto/gen/api/v2"
|
||||
storepb "github.com/usememos/memos/proto/gen/store"
|
||||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
||||
func (s *APIV2Service) ListMemoReactions(ctx context.Context, request *apiv2pb.ListMemoReactionsRequest) (*apiv2pb.ListMemoReactionsResponse, error) {
|
||||
contentID := fmt.Sprintf("memos/%d", request.Id)
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &contentID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
|
||||
response := &apiv2pb.ListMemoReactionsResponse{
|
||||
Reactions: []*apiv2pb.Reaction{},
|
||||
}
|
||||
for _, reaction := range reactions {
|
||||
reactionMessage, err := s.convertReactionFromStore(ctx, reaction)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to convert reaction")
|
||||
}
|
||||
response.Reactions = append(response.Reactions, reactionMessage)
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (s *APIV2Service) UpsertMemoReaction(ctx context.Context, request *apiv2pb.UpsertMemoReactionRequest) (*apiv2pb.UpsertMemoReactionResponse, error) {
|
||||
user, err := getCurrentUser(ctx, s.Store)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user")
|
||||
}
|
||||
reaction, err := s.Store.UpsertReaction(ctx, &storepb.Reaction{
|
||||
CreatorId: user.ID,
|
||||
ContentId: request.Reaction.ContentId,
|
||||
ReactionType: storepb.Reaction_Type(request.Reaction.ReactionType),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to upsert reaction")
|
||||
}
|
||||
|
||||
reactionMessage, err := s.convertReactionFromStore(ctx, reaction)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to convert reaction")
|
||||
}
|
||||
return &apiv2pb.UpsertMemoReactionResponse{
|
||||
Reaction: reactionMessage,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *APIV2Service) DeleteMemoReaction(ctx context.Context, request *apiv2pb.DeleteMemoReactionRequest) (*apiv2pb.DeleteMemoReactionResponse, error) {
|
||||
if err := s.Store.DeleteReaction(ctx, &store.DeleteReaction{
|
||||
ID: request.Id,
|
||||
}); err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to delete reaction")
|
||||
}
|
||||
|
||||
return &apiv2pb.DeleteMemoReactionResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *APIV2Service) convertReactionFromStore(ctx context.Context, reaction *storepb.Reaction) (*apiv2pb.Reaction, error) {
|
||||
creator, err := s.Store.GetUser(ctx, &store.FindUser{
|
||||
ID: &reaction.CreatorId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &apiv2pb.Reaction{
|
||||
Id: reaction.Id,
|
||||
Creator: fmt.Sprintf("%s%s", UserNamePrefix, creator.Username),
|
||||
ContentId: reaction.ContentId,
|
||||
ReactionType: apiv2pb.Reaction_Type(reaction.ReactionType),
|
||||
}, nil
|
||||
}
|
@ -4,6 +4,7 @@ package memos.api.v2;
|
||||
|
||||
import "api/v2/common.proto";
|
||||
import "api/v2/memo_relation_service.proto";
|
||||
import "api/v2/reaction_service.proto";
|
||||
import "api/v2/resource_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
@ -48,6 +49,10 @@ service MemoService {
|
||||
option (google.api.http) = {delete: "/api/v2/memos/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// ExportMemos exports memos.
|
||||
rpc ExportMemos(ExportMemosRequest) returns (ExportMemosResponse) {
|
||||
option (google.api.http) = {post: "/api/v2/memos:export"};
|
||||
}
|
||||
// SetMemoResources sets resources for a memo.
|
||||
rpc SetMemoResources(SetMemoResourcesRequest) returns (SetMemoResourcesResponse) {
|
||||
option (google.api.http) = {
|
||||
@ -84,15 +89,26 @@ service MemoService {
|
||||
option (google.api.http) = {get: "/api/v2/memos/{id}/comments"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// ExportMemos exports memos.
|
||||
rpc ExportMemos(ExportMemosRequest) returns (ExportMemosResponse) {
|
||||
option (google.api.http) = {post: "/api/v2/memos:export"};
|
||||
}
|
||||
// GetUserMemosStats gets stats of memos for a user.
|
||||
rpc GetUserMemosStats(GetUserMemosStatsRequest) returns (GetUserMemosStatsResponse) {
|
||||
option (google.api.http) = {get: "/api/v2/memos/stats"};
|
||||
option (google.api.method_signature) = "username";
|
||||
}
|
||||
// ListMemoReactions lists reactions for a memo.
|
||||
rpc ListMemoReactions(ListMemoReactionsRequest) returns (ListMemoReactionsResponse) {
|
||||
option (google.api.http) = {get: "/api/v2/memos/{id}/reactions"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// UpsertMemoReaction upserts a reaction for a memo.
|
||||
rpc UpsertMemoReaction(UpsertMemoReactionRequest) returns (UpsertMemoReactionResponse) {
|
||||
option (google.api.http) = {post: "/api/v2/memos/{id}/reactions"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// DeleteMemoReaction deletes a reaction for a memo.
|
||||
rpc DeleteMemoReaction(DeleteMemoReactionRequest) returns (DeleteMemoReactionResponse) {
|
||||
option (google.api.http) = {delete: "/api/v2/memos/{id}/reactions/{reaction_id}"};
|
||||
option (google.api.method_signature) = "id,reaction_id";
|
||||
}
|
||||
}
|
||||
|
||||
enum Visibility {
|
||||
@ -137,6 +153,8 @@ message Memo {
|
||||
repeated Resource resources = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated MemoRelation relations = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
repeated Reaction reactions = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
|
||||
message CreateMemoRequest {
|
||||
@ -202,6 +220,15 @@ message DeleteMemoRequest {
|
||||
|
||||
message DeleteMemoResponse {}
|
||||
|
||||
message ExportMemosRequest {
|
||||
// Same as ListMemosRequest.filter
|
||||
string filter = 1;
|
||||
}
|
||||
|
||||
message ExportMemosResponse {
|
||||
bytes content = 1;
|
||||
}
|
||||
|
||||
message SetMemoResourcesRequest {
|
||||
int32 id = 1;
|
||||
|
||||
@ -273,11 +300,28 @@ message GetUserMemosStatsResponse {
|
||||
map<string, int32> stats = 1;
|
||||
}
|
||||
|
||||
message ExportMemosRequest {
|
||||
// Same as ListMemosRequest.filter
|
||||
string filter = 1;
|
||||
message ListMemoReactionsRequest {
|
||||
int32 id = 1;
|
||||
}
|
||||
|
||||
message ExportMemosResponse {
|
||||
bytes content = 1;
|
||||
message ListMemoReactionsResponse {
|
||||
repeated Reaction reactions = 1;
|
||||
}
|
||||
|
||||
message UpsertMemoReactionRequest {
|
||||
int32 id = 1;
|
||||
|
||||
Reaction reaction = 2;
|
||||
}
|
||||
|
||||
message UpsertMemoReactionResponse {
|
||||
Reaction reaction = 1;
|
||||
}
|
||||
|
||||
message DeleteMemoReactionRequest {
|
||||
int32 id = 1;
|
||||
|
||||
int32 reaction_id = 2;
|
||||
}
|
||||
|
||||
message DeleteMemoReactionResponse {}
|
||||
|
24
proto/api/v2/reaction_service.proto
Normal file
24
proto/api/v2/reaction_service.proto
Normal file
@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package memos.api.v2;
|
||||
|
||||
option go_package = "gen/api/v2";
|
||||
|
||||
message Reaction {
|
||||
int32 id = 1;
|
||||
|
||||
string creator = 2;
|
||||
|
||||
string content_id = 3;
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
EYES = 1;
|
||||
HEART = 2;
|
||||
LAUGH = 3;
|
||||
ROCKET = 4;
|
||||
THUMBS_DOWN = 5;
|
||||
THUMBS_UP = 6;
|
||||
}
|
||||
Type reaction_type = 4;
|
||||
}
|
@ -80,6 +80,11 @@
|
||||
|
||||
- [MemoRelation.Type](#memos-api-v2-MemoRelation-Type)
|
||||
|
||||
- [api/v2/reaction_service.proto](#api_v2_reaction_service-proto)
|
||||
- [Reaction](#memos-api-v2-Reaction)
|
||||
|
||||
- [Reaction.Type](#memos-api-v2-Reaction-Type)
|
||||
|
||||
- [api/v2/resource_service.proto](#api_v2_resource_service-proto)
|
||||
- [CreateResourceRequest](#memos-api-v2-CreateResourceRequest)
|
||||
- [CreateResourceResponse](#memos-api-v2-CreateResourceResponse)
|
||||
@ -102,6 +107,8 @@
|
||||
- [CreateMemoCommentResponse](#memos-api-v2-CreateMemoCommentResponse)
|
||||
- [CreateMemoRequest](#memos-api-v2-CreateMemoRequest)
|
||||
- [CreateMemoResponse](#memos-api-v2-CreateMemoResponse)
|
||||
- [DeleteMemoReactionRequest](#memos-api-v2-DeleteMemoReactionRequest)
|
||||
- [DeleteMemoReactionResponse](#memos-api-v2-DeleteMemoReactionResponse)
|
||||
- [DeleteMemoRequest](#memos-api-v2-DeleteMemoRequest)
|
||||
- [DeleteMemoResponse](#memos-api-v2-DeleteMemoResponse)
|
||||
- [ExportMemosRequest](#memos-api-v2-ExportMemosRequest)
|
||||
@ -115,6 +122,8 @@
|
||||
- [GetUserMemosStatsResponse.StatsEntry](#memos-api-v2-GetUserMemosStatsResponse-StatsEntry)
|
||||
- [ListMemoCommentsRequest](#memos-api-v2-ListMemoCommentsRequest)
|
||||
- [ListMemoCommentsResponse](#memos-api-v2-ListMemoCommentsResponse)
|
||||
- [ListMemoReactionsRequest](#memos-api-v2-ListMemoReactionsRequest)
|
||||
- [ListMemoReactionsResponse](#memos-api-v2-ListMemoReactionsResponse)
|
||||
- [ListMemoRelationsRequest](#memos-api-v2-ListMemoRelationsRequest)
|
||||
- [ListMemoRelationsResponse](#memos-api-v2-ListMemoRelationsResponse)
|
||||
- [ListMemoResourcesRequest](#memos-api-v2-ListMemoResourcesRequest)
|
||||
@ -128,6 +137,8 @@
|
||||
- [SetMemoResourcesResponse](#memos-api-v2-SetMemoResourcesResponse)
|
||||
- [UpdateMemoRequest](#memos-api-v2-UpdateMemoRequest)
|
||||
- [UpdateMemoResponse](#memos-api-v2-UpdateMemoResponse)
|
||||
- [UpsertMemoReactionRequest](#memos-api-v2-UpsertMemoReactionRequest)
|
||||
- [UpsertMemoReactionResponse](#memos-api-v2-UpsertMemoReactionResponse)
|
||||
|
||||
- [Visibility](#memos-api-v2-Visibility)
|
||||
|
||||
@ -1125,6 +1136,57 @@ Used internally for obfuscating the page token.
|
||||
|
||||
|
||||
|
||||
<a name="api_v2_reaction_service-proto"></a>
|
||||
<p align="right"><a href="#top">Top</a></p>
|
||||
|
||||
## api/v2/reaction_service.proto
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-Reaction"></a>
|
||||
|
||||
### Reaction
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [int32](#int32) | | |
|
||||
| creator | [string](#string) | | |
|
||||
| content_id | [string](#string) | | |
|
||||
| reaction_type | [Reaction.Type](#memos-api-v2-Reaction-Type) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-Reaction-Type"></a>
|
||||
|
||||
### Reaction.Type
|
||||
|
||||
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| TYPE_UNSPECIFIED | 0 | |
|
||||
| EYES | 1 | |
|
||||
| HEART | 2 | |
|
||||
| LAUGH | 3 | |
|
||||
| ROCKET | 4 | |
|
||||
| THUMBS_DOWN | 5 | |
|
||||
| THUMBS_UP | 6 | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="api_v2_resource_service-proto"></a>
|
||||
<p align="right"><a href="#top">Top</a></p>
|
||||
|
||||
@ -1421,6 +1483,32 @@ Used internally for obfuscating the page token.
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-DeleteMemoReactionRequest"></a>
|
||||
|
||||
### DeleteMemoReactionRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [int32](#int32) | | |
|
||||
| reaction_id | [int32](#int32) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-DeleteMemoReactionResponse"></a>
|
||||
|
||||
### DeleteMemoReactionResponse
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-DeleteMemoRequest"></a>
|
||||
|
||||
### DeleteMemoRequest
|
||||
@ -1614,6 +1702,36 @@ Used internally for obfuscating the page token.
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-ListMemoReactionsRequest"></a>
|
||||
|
||||
### ListMemoReactionsRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [int32](#int32) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-ListMemoReactionsResponse"></a>
|
||||
|
||||
### ListMemoReactionsResponse
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| reactions | [Reaction](#memos-api-v2-Reaction) | repeated | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-ListMemoRelationsRequest"></a>
|
||||
|
||||
### ListMemoRelationsRequest
|
||||
@ -1729,6 +1847,7 @@ Used internally for obfuscating the page token.
|
||||
| parent_id | [int32](#int32) | optional | |
|
||||
| resources | [Resource](#memos-api-v2-Resource) | repeated | |
|
||||
| relations | [MemoRelation](#memos-api-v2-MemoRelation) | repeated | |
|
||||
| reactions | [Reaction](#memos-api-v2-Reaction) | repeated | |
|
||||
|
||||
|
||||
|
||||
@ -1818,6 +1937,37 @@ Used internally for obfuscating the page token.
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-UpsertMemoReactionRequest"></a>
|
||||
|
||||
### UpsertMemoReactionRequest
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [int32](#int32) | | |
|
||||
| reaction | [Reaction](#memos-api-v2-Reaction) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-UpsertMemoReactionResponse"></a>
|
||||
|
||||
### UpsertMemoReactionResponse
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| reaction | [Reaction](#memos-api-v2-Reaction) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="memos-api-v2-Visibility"></a>
|
||||
@ -1851,14 +2001,17 @@ Used internally for obfuscating the page token.
|
||||
| GetMemoByName | [GetMemoByNameRequest](#memos-api-v2-GetMemoByNameRequest) | [GetMemoByNameResponse](#memos-api-v2-GetMemoByNameResponse) | GetMemoByName gets a memo by name. |
|
||||
| UpdateMemo | [UpdateMemoRequest](#memos-api-v2-UpdateMemoRequest) | [UpdateMemoResponse](#memos-api-v2-UpdateMemoResponse) | UpdateMemo updates a memo. |
|
||||
| DeleteMemo | [DeleteMemoRequest](#memos-api-v2-DeleteMemoRequest) | [DeleteMemoResponse](#memos-api-v2-DeleteMemoResponse) | DeleteMemo deletes a memo by id. |
|
||||
| ExportMemos | [ExportMemosRequest](#memos-api-v2-ExportMemosRequest) | [ExportMemosResponse](#memos-api-v2-ExportMemosResponse) | ExportMemos exports memos. |
|
||||
| SetMemoResources | [SetMemoResourcesRequest](#memos-api-v2-SetMemoResourcesRequest) | [SetMemoResourcesResponse](#memos-api-v2-SetMemoResourcesResponse) | SetMemoResources sets resources for a memo. |
|
||||
| ListMemoResources | [ListMemoResourcesRequest](#memos-api-v2-ListMemoResourcesRequest) | [ListMemoResourcesResponse](#memos-api-v2-ListMemoResourcesResponse) | ListMemoResources lists resources for a memo. |
|
||||
| SetMemoRelations | [SetMemoRelationsRequest](#memos-api-v2-SetMemoRelationsRequest) | [SetMemoRelationsResponse](#memos-api-v2-SetMemoRelationsResponse) | SetMemoRelations sets relations for a memo. |
|
||||
| ListMemoRelations | [ListMemoRelationsRequest](#memos-api-v2-ListMemoRelationsRequest) | [ListMemoRelationsResponse](#memos-api-v2-ListMemoRelationsResponse) | ListMemoRelations lists relations for a memo. |
|
||||
| CreateMemoComment | [CreateMemoCommentRequest](#memos-api-v2-CreateMemoCommentRequest) | [CreateMemoCommentResponse](#memos-api-v2-CreateMemoCommentResponse) | CreateMemoComment creates a comment for a memo. |
|
||||
| ListMemoComments | [ListMemoCommentsRequest](#memos-api-v2-ListMemoCommentsRequest) | [ListMemoCommentsResponse](#memos-api-v2-ListMemoCommentsResponse) | ListMemoComments lists comments for a memo. |
|
||||
| ExportMemos | [ExportMemosRequest](#memos-api-v2-ExportMemosRequest) | [ExportMemosResponse](#memos-api-v2-ExportMemosResponse) | ExportMemos exports memos. |
|
||||
| GetUserMemosStats | [GetUserMemosStatsRequest](#memos-api-v2-GetUserMemosStatsRequest) | [GetUserMemosStatsResponse](#memos-api-v2-GetUserMemosStatsResponse) | GetUserMemosStats gets stats of memos for a user. |
|
||||
| ListMemoReactions | [ListMemoReactionsRequest](#memos-api-v2-ListMemoReactionsRequest) | [ListMemoReactionsResponse](#memos-api-v2-ListMemoReactionsResponse) | ListMemoReactions lists reactions for a memo. |
|
||||
| UpsertMemoReaction | [UpsertMemoReactionRequest](#memos-api-v2-UpsertMemoReactionRequest) | [UpsertMemoReactionResponse](#memos-api-v2-UpsertMemoReactionResponse) | UpsertMemoReaction upserts a reaction for a memo. |
|
||||
| DeleteMemoReaction | [DeleteMemoReactionRequest](#memos-api-v2-DeleteMemoReactionRequest) | [DeleteMemoReactionResponse](#memos-api-v2-DeleteMemoReactionResponse) | DeleteMemoReaction deletes a reaction for a memo. |
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -357,6 +357,42 @@ func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runti
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_MemoService_ExportMemos_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_MemoService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ExportMemosRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ExportMemos_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ExportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_MemoService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ExportMemosRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ExportMemos_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ExportMemos(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_MemoService_SetMemoResources_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SetMemoResourcesRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@ -719,42 +755,6 @@ func local_request_MemoService_ListMemoComments_0(ctx context.Context, marshaler
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_MemoService_ExportMemos_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_MemoService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ExportMemosRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ExportMemos_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ExportMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_MemoService_ExportMemos_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ExportMemosRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_ExportMemos_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ExportMemos(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_MemoService_GetUserMemosStats_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
@ -791,6 +791,200 @@ func local_request_MemoService_GetUserMemosStats_0(ctx context.Context, marshale
|
||||
|
||||
}
|
||||
|
||||
func request_MemoService_ListMemoReactions_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListMemoReactionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := client.ListMemoReactions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_MemoService_ListMemoReactions_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListMemoReactionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
msg, err := server.ListMemoReactions(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_MemoService_UpsertMemoReaction_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}}
|
||||
)
|
||||
|
||||
func request_MemoService_UpsertMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq UpsertMemoReactionRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_UpsertMemoReaction_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.UpsertMemoReaction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_MemoService_UpsertMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq UpsertMemoReactionRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_UpsertMemoReaction_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.UpsertMemoReaction(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq DeleteMemoReactionRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["reaction_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reaction_id")
|
||||
}
|
||||
|
||||
protoReq.ReactionId, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reaction_id", err)
|
||||
}
|
||||
|
||||
msg, err := client.DeleteMemoReaction(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_MemoService_DeleteMemoReaction_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq DeleteMemoReactionRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
}
|
||||
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
}
|
||||
|
||||
val, ok = pathParams["reaction_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reaction_id")
|
||||
}
|
||||
|
||||
protoReq.ReactionId, err = runtime.Int32(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reaction_id", err)
|
||||
}
|
||||
|
||||
msg, err := server.DeleteMemoReaction(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterMemoServiceHandlerServer registers the http handlers for service MemoService to "mux".
|
||||
// UnaryRPC :call MemoServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
@ -947,6 +1141,31 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.MemoService/ExportMemos", runtime.WithHTTPPathPattern("/api/v2/memos:export"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_MemoService_ExportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_SetMemoResources_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -1097,31 +1316,6 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.MemoService/ExportMemos", runtime.WithHTTPPathPattern("/api/v2/memos:export"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_MemoService_ExportMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_MemoService_GetUserMemosStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -1147,6 +1341,81 @@ func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_MemoService_ListMemoReactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.MemoService/ListMemoReactions", runtime.WithHTTPPathPattern("/api/v2/memos/{id}/reactions"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_MemoService_ListMemoReactions_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_ListMemoReactions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_UpsertMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.MemoService/UpsertMemoReaction", runtime.WithHTTPPathPattern("/api/v2/memos/{id}/reactions"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_MemoService_UpsertMemoReaction_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_UpsertMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_MemoService_DeleteMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v2.MemoService/DeleteMemoReaction", runtime.WithHTTPPathPattern("/api/v2/memos/{id}/reactions/{reaction_id}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_MemoService_DeleteMemoReaction_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_DeleteMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1320,6 +1589,28 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.MemoService/ExportMemos", runtime.WithHTTPPathPattern("/api/v2/memos:export"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_MemoService_ExportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_SetMemoResources_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -1452,28 +1743,6 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_ExportMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.MemoService/ExportMemos", runtime.WithHTTPPathPattern("/api/v2/memos:export"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_MemoService_ExportMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_ExportMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_MemoService_GetUserMemosStats_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@ -1496,6 +1765,72 @@ func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_MemoService_ListMemoReactions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.MemoService/ListMemoReactions", runtime.WithHTTPPathPattern("/api/v2/memos/{id}/reactions"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_MemoService_ListMemoReactions_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_ListMemoReactions_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_MemoService_UpsertMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.MemoService/UpsertMemoReaction", runtime.WithHTTPPathPattern("/api/v2/memos/{id}/reactions"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_MemoService_UpsertMemoReaction_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_UpsertMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("DELETE", pattern_MemoService_DeleteMemoReaction_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v2.MemoService/DeleteMemoReaction", runtime.WithHTTPPathPattern("/api/v2/memos/{id}/reactions/{reaction_id}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_MemoService_DeleteMemoReaction_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_MemoService_DeleteMemoReaction_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1512,6 +1847,8 @@ var (
|
||||
|
||||
pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "memos", "id"}, ""))
|
||||
|
||||
pattern_MemoService_ExportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "memos"}, "export"))
|
||||
|
||||
pattern_MemoService_SetMemoResources_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "memos", "id", "resources"}, ""))
|
||||
|
||||
pattern_MemoService_ListMemoResources_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "memos", "id", "resources"}, ""))
|
||||
@ -1524,9 +1861,13 @@ var (
|
||||
|
||||
pattern_MemoService_ListMemoComments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "memos", "id", "comments"}, ""))
|
||||
|
||||
pattern_MemoService_ExportMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "memos"}, "export"))
|
||||
|
||||
pattern_MemoService_GetUserMemosStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v2", "memos", "stats"}, ""))
|
||||
|
||||
pattern_MemoService_ListMemoReactions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "memos", "id", "reactions"}, ""))
|
||||
|
||||
pattern_MemoService_UpsertMemoReaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "memos", "id", "reactions"}, ""))
|
||||
|
||||
pattern_MemoService_DeleteMemoReaction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"api", "v2", "memos", "id", "reactions", "reaction_id"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
@ -1542,6 +1883,8 @@ var (
|
||||
|
||||
forward_MemoService_DeleteMemo_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_ExportMemos_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_SetMemoResources_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_ListMemoResources_0 = runtime.ForwardResponseMessage
|
||||
@ -1554,7 +1897,11 @@ var (
|
||||
|
||||
forward_MemoService_ListMemoComments_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_ExportMemos_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_GetUserMemosStats_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_ListMemoReactions_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_UpsertMemoReaction_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_MemoService_DeleteMemoReaction_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
@ -19,20 +19,23 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
MemoService_CreateMemo_FullMethodName = "/memos.api.v2.MemoService/CreateMemo"
|
||||
MemoService_ListMemos_FullMethodName = "/memos.api.v2.MemoService/ListMemos"
|
||||
MemoService_GetMemo_FullMethodName = "/memos.api.v2.MemoService/GetMemo"
|
||||
MemoService_GetMemoByName_FullMethodName = "/memos.api.v2.MemoService/GetMemoByName"
|
||||
MemoService_UpdateMemo_FullMethodName = "/memos.api.v2.MemoService/UpdateMemo"
|
||||
MemoService_DeleteMemo_FullMethodName = "/memos.api.v2.MemoService/DeleteMemo"
|
||||
MemoService_SetMemoResources_FullMethodName = "/memos.api.v2.MemoService/SetMemoResources"
|
||||
MemoService_ListMemoResources_FullMethodName = "/memos.api.v2.MemoService/ListMemoResources"
|
||||
MemoService_SetMemoRelations_FullMethodName = "/memos.api.v2.MemoService/SetMemoRelations"
|
||||
MemoService_ListMemoRelations_FullMethodName = "/memos.api.v2.MemoService/ListMemoRelations"
|
||||
MemoService_CreateMemoComment_FullMethodName = "/memos.api.v2.MemoService/CreateMemoComment"
|
||||
MemoService_ListMemoComments_FullMethodName = "/memos.api.v2.MemoService/ListMemoComments"
|
||||
MemoService_ExportMemos_FullMethodName = "/memos.api.v2.MemoService/ExportMemos"
|
||||
MemoService_GetUserMemosStats_FullMethodName = "/memos.api.v2.MemoService/GetUserMemosStats"
|
||||
MemoService_CreateMemo_FullMethodName = "/memos.api.v2.MemoService/CreateMemo"
|
||||
MemoService_ListMemos_FullMethodName = "/memos.api.v2.MemoService/ListMemos"
|
||||
MemoService_GetMemo_FullMethodName = "/memos.api.v2.MemoService/GetMemo"
|
||||
MemoService_GetMemoByName_FullMethodName = "/memos.api.v2.MemoService/GetMemoByName"
|
||||
MemoService_UpdateMemo_FullMethodName = "/memos.api.v2.MemoService/UpdateMemo"
|
||||
MemoService_DeleteMemo_FullMethodName = "/memos.api.v2.MemoService/DeleteMemo"
|
||||
MemoService_ExportMemos_FullMethodName = "/memos.api.v2.MemoService/ExportMemos"
|
||||
MemoService_SetMemoResources_FullMethodName = "/memos.api.v2.MemoService/SetMemoResources"
|
||||
MemoService_ListMemoResources_FullMethodName = "/memos.api.v2.MemoService/ListMemoResources"
|
||||
MemoService_SetMemoRelations_FullMethodName = "/memos.api.v2.MemoService/SetMemoRelations"
|
||||
MemoService_ListMemoRelations_FullMethodName = "/memos.api.v2.MemoService/ListMemoRelations"
|
||||
MemoService_CreateMemoComment_FullMethodName = "/memos.api.v2.MemoService/CreateMemoComment"
|
||||
MemoService_ListMemoComments_FullMethodName = "/memos.api.v2.MemoService/ListMemoComments"
|
||||
MemoService_GetUserMemosStats_FullMethodName = "/memos.api.v2.MemoService/GetUserMemosStats"
|
||||
MemoService_ListMemoReactions_FullMethodName = "/memos.api.v2.MemoService/ListMemoReactions"
|
||||
MemoService_UpsertMemoReaction_FullMethodName = "/memos.api.v2.MemoService/UpsertMemoReaction"
|
||||
MemoService_DeleteMemoReaction_FullMethodName = "/memos.api.v2.MemoService/DeleteMemoReaction"
|
||||
)
|
||||
|
||||
// MemoServiceClient is the client API for MemoService service.
|
||||
@ -51,6 +54,8 @@ type MemoServiceClient interface {
|
||||
UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*UpdateMemoResponse, error)
|
||||
// DeleteMemo deletes a memo by id.
|
||||
DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*DeleteMemoResponse, error)
|
||||
// ExportMemos exports memos.
|
||||
ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*ExportMemosResponse, error)
|
||||
// SetMemoResources sets resources for a memo.
|
||||
SetMemoResources(ctx context.Context, in *SetMemoResourcesRequest, opts ...grpc.CallOption) (*SetMemoResourcesResponse, error)
|
||||
// ListMemoResources lists resources for a memo.
|
||||
@ -63,10 +68,14 @@ type MemoServiceClient interface {
|
||||
CreateMemoComment(ctx context.Context, in *CreateMemoCommentRequest, opts ...grpc.CallOption) (*CreateMemoCommentResponse, error)
|
||||
// ListMemoComments lists comments for a memo.
|
||||
ListMemoComments(ctx context.Context, in *ListMemoCommentsRequest, opts ...grpc.CallOption) (*ListMemoCommentsResponse, error)
|
||||
// ExportMemos exports memos.
|
||||
ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*ExportMemosResponse, error)
|
||||
// GetUserMemosStats gets stats of memos for a user.
|
||||
GetUserMemosStats(ctx context.Context, in *GetUserMemosStatsRequest, opts ...grpc.CallOption) (*GetUserMemosStatsResponse, error)
|
||||
// ListMemoReactions lists reactions for a memo.
|
||||
ListMemoReactions(ctx context.Context, in *ListMemoReactionsRequest, opts ...grpc.CallOption) (*ListMemoReactionsResponse, error)
|
||||
// UpsertMemoReaction upserts a reaction for a memo.
|
||||
UpsertMemoReaction(ctx context.Context, in *UpsertMemoReactionRequest, opts ...grpc.CallOption) (*UpsertMemoReactionResponse, error)
|
||||
// DeleteMemoReaction deletes a reaction for a memo.
|
||||
DeleteMemoReaction(ctx context.Context, in *DeleteMemoReactionRequest, opts ...grpc.CallOption) (*DeleteMemoReactionResponse, error)
|
||||
}
|
||||
|
||||
type memoServiceClient struct {
|
||||
@ -131,6 +140,15 @@ func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoReques
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*ExportMemosResponse, error) {
|
||||
out := new(ExportMemosResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_ExportMemos_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) SetMemoResources(ctx context.Context, in *SetMemoResourcesRequest, opts ...grpc.CallOption) (*SetMemoResourcesResponse, error) {
|
||||
out := new(SetMemoResourcesResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_SetMemoResources_FullMethodName, in, out, opts...)
|
||||
@ -185,18 +203,36 @@ func (c *memoServiceClient) ListMemoComments(ctx context.Context, in *ListMemoCo
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) ExportMemos(ctx context.Context, in *ExportMemosRequest, opts ...grpc.CallOption) (*ExportMemosResponse, error) {
|
||||
out := new(ExportMemosResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_ExportMemos_FullMethodName, in, out, opts...)
|
||||
func (c *memoServiceClient) GetUserMemosStats(ctx context.Context, in *GetUserMemosStatsRequest, opts ...grpc.CallOption) (*GetUserMemosStatsResponse, error) {
|
||||
out := new(GetUserMemosStatsResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_GetUserMemosStats_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) GetUserMemosStats(ctx context.Context, in *GetUserMemosStatsRequest, opts ...grpc.CallOption) (*GetUserMemosStatsResponse, error) {
|
||||
out := new(GetUserMemosStatsResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_GetUserMemosStats_FullMethodName, in, out, opts...)
|
||||
func (c *memoServiceClient) ListMemoReactions(ctx context.Context, in *ListMemoReactionsRequest, opts ...grpc.CallOption) (*ListMemoReactionsResponse, error) {
|
||||
out := new(ListMemoReactionsResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_ListMemoReactions_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) UpsertMemoReaction(ctx context.Context, in *UpsertMemoReactionRequest, opts ...grpc.CallOption) (*UpsertMemoReactionResponse, error) {
|
||||
out := new(UpsertMemoReactionResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_UpsertMemoReaction_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *memoServiceClient) DeleteMemoReaction(ctx context.Context, in *DeleteMemoReactionRequest, opts ...grpc.CallOption) (*DeleteMemoReactionResponse, error) {
|
||||
out := new(DeleteMemoReactionResponse)
|
||||
err := c.cc.Invoke(ctx, MemoService_DeleteMemoReaction_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -219,6 +255,8 @@ type MemoServiceServer interface {
|
||||
UpdateMemo(context.Context, *UpdateMemoRequest) (*UpdateMemoResponse, error)
|
||||
// DeleteMemo deletes a memo by id.
|
||||
DeleteMemo(context.Context, *DeleteMemoRequest) (*DeleteMemoResponse, error)
|
||||
// ExportMemos exports memos.
|
||||
ExportMemos(context.Context, *ExportMemosRequest) (*ExportMemosResponse, error)
|
||||
// SetMemoResources sets resources for a memo.
|
||||
SetMemoResources(context.Context, *SetMemoResourcesRequest) (*SetMemoResourcesResponse, error)
|
||||
// ListMemoResources lists resources for a memo.
|
||||
@ -231,10 +269,14 @@ type MemoServiceServer interface {
|
||||
CreateMemoComment(context.Context, *CreateMemoCommentRequest) (*CreateMemoCommentResponse, error)
|
||||
// ListMemoComments lists comments for a memo.
|
||||
ListMemoComments(context.Context, *ListMemoCommentsRequest) (*ListMemoCommentsResponse, error)
|
||||
// ExportMemos exports memos.
|
||||
ExportMemos(context.Context, *ExportMemosRequest) (*ExportMemosResponse, error)
|
||||
// GetUserMemosStats gets stats of memos for a user.
|
||||
GetUserMemosStats(context.Context, *GetUserMemosStatsRequest) (*GetUserMemosStatsResponse, error)
|
||||
// ListMemoReactions lists reactions for a memo.
|
||||
ListMemoReactions(context.Context, *ListMemoReactionsRequest) (*ListMemoReactionsResponse, error)
|
||||
// UpsertMemoReaction upserts a reaction for a memo.
|
||||
UpsertMemoReaction(context.Context, *UpsertMemoReactionRequest) (*UpsertMemoReactionResponse, error)
|
||||
// DeleteMemoReaction deletes a reaction for a memo.
|
||||
DeleteMemoReaction(context.Context, *DeleteMemoReactionRequest) (*DeleteMemoReactionResponse, error)
|
||||
mustEmbedUnimplementedMemoServiceServer()
|
||||
}
|
||||
|
||||
@ -260,6 +302,9 @@ func (UnimplementedMemoServiceServer) UpdateMemo(context.Context, *UpdateMemoReq
|
||||
func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoRequest) (*DeleteMemoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteMemo not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) ExportMemos(context.Context, *ExportMemosRequest) (*ExportMemosResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExportMemos not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) SetMemoResources(context.Context, *SetMemoResourcesRequest) (*SetMemoResourcesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetMemoResources not implemented")
|
||||
}
|
||||
@ -278,12 +323,18 @@ func (UnimplementedMemoServiceServer) CreateMemoComment(context.Context, *Create
|
||||
func (UnimplementedMemoServiceServer) ListMemoComments(context.Context, *ListMemoCommentsRequest) (*ListMemoCommentsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListMemoComments not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) ExportMemos(context.Context, *ExportMemosRequest) (*ExportMemosResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ExportMemos not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) GetUserMemosStats(context.Context, *GetUserMemosStatsRequest) (*GetUserMemosStatsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserMemosStats not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) ListMemoReactions(context.Context, *ListMemoReactionsRequest) (*ListMemoReactionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListMemoReactions not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) UpsertMemoReaction(context.Context, *UpsertMemoReactionRequest) (*UpsertMemoReactionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpsertMemoReaction not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) DeleteMemoReaction(context.Context, *DeleteMemoReactionRequest) (*DeleteMemoReactionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteMemoReaction not implemented")
|
||||
}
|
||||
func (UnimplementedMemoServiceServer) mustEmbedUnimplementedMemoServiceServer() {}
|
||||
|
||||
// UnsafeMemoServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
@ -405,6 +456,24 @@ func _MemoService_DeleteMemo_Handler(srv interface{}, ctx context.Context, dec f
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_ExportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportMemosRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MemoServiceServer).ExportMemos(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MemoService_ExportMemos_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MemoServiceServer).ExportMemos(ctx, req.(*ExportMemosRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_SetMemoResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetMemoResourcesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -513,24 +582,6 @@ func _MemoService_ListMemoComments_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_ExportMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportMemosRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MemoServiceServer).ExportMemos(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MemoService_ExportMemos_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MemoServiceServer).ExportMemos(ctx, req.(*ExportMemosRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_GetUserMemosStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserMemosStatsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -549,6 +600,60 @@ func _MemoService_GetUserMemosStats_Handler(srv interface{}, ctx context.Context
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_ListMemoReactions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListMemoReactionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MemoServiceServer).ListMemoReactions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MemoService_ListMemoReactions_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MemoServiceServer).ListMemoReactions(ctx, req.(*ListMemoReactionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_UpsertMemoReaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpsertMemoReactionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MemoServiceServer).UpsertMemoReaction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MemoService_UpsertMemoReaction_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MemoServiceServer).UpsertMemoReaction(ctx, req.(*UpsertMemoReactionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MemoService_DeleteMemoReaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteMemoReactionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MemoServiceServer).DeleteMemoReaction(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MemoService_DeleteMemoReaction_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MemoServiceServer).DeleteMemoReaction(ctx, req.(*DeleteMemoReactionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// MemoService_ServiceDesc is the grpc.ServiceDesc for MemoService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -580,6 +685,10 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "DeleteMemo",
|
||||
Handler: _MemoService_DeleteMemo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExportMemos",
|
||||
Handler: _MemoService_ExportMemos_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetMemoResources",
|
||||
Handler: _MemoService_SetMemoResources_Handler,
|
||||
@ -604,14 +713,22 @@ var MemoService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ListMemoComments",
|
||||
Handler: _MemoService_ListMemoComments_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExportMemos",
|
||||
Handler: _MemoService_ExportMemos_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserMemosStats",
|
||||
Handler: _MemoService_GetUserMemosStats_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListMemoReactions",
|
||||
Handler: _MemoService_ListMemoReactions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpsertMemoReaction",
|
||||
Handler: _MemoService_UpsertMemoReaction_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteMemoReaction",
|
||||
Handler: _MemoService_DeleteMemoReaction_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "api/v2/memo_service.proto",
|
||||
|
256
proto/gen/api/v2/reaction_service.pb.go
Normal file
256
proto/gen/api/v2/reaction_service.pb.go
Normal file
@ -0,0 +1,256 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc (unknown)
|
||||
// source: api/v2/reaction_service.proto
|
||||
|
||||
package apiv2
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Reaction_Type int32
|
||||
|
||||
const (
|
||||
Reaction_TYPE_UNSPECIFIED Reaction_Type = 0
|
||||
Reaction_EYES Reaction_Type = 1
|
||||
Reaction_HEART Reaction_Type = 2
|
||||
Reaction_LAUGH Reaction_Type = 3
|
||||
Reaction_ROCKET Reaction_Type = 4
|
||||
Reaction_THUMBS_DOWN Reaction_Type = 5
|
||||
Reaction_THUMBS_UP Reaction_Type = 6
|
||||
)
|
||||
|
||||
// Enum value maps for Reaction_Type.
|
||||
var (
|
||||
Reaction_Type_name = map[int32]string{
|
||||
0: "TYPE_UNSPECIFIED",
|
||||
1: "EYES",
|
||||
2: "HEART",
|
||||
3: "LAUGH",
|
||||
4: "ROCKET",
|
||||
5: "THUMBS_DOWN",
|
||||
6: "THUMBS_UP",
|
||||
}
|
||||
Reaction_Type_value = map[string]int32{
|
||||
"TYPE_UNSPECIFIED": 0,
|
||||
"EYES": 1,
|
||||
"HEART": 2,
|
||||
"LAUGH": 3,
|
||||
"ROCKET": 4,
|
||||
"THUMBS_DOWN": 5,
|
||||
"THUMBS_UP": 6,
|
||||
}
|
||||
)
|
||||
|
||||
func (x Reaction_Type) Enum() *Reaction_Type {
|
||||
p := new(Reaction_Type)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x Reaction_Type) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (Reaction_Type) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_api_v2_reaction_service_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (Reaction_Type) Type() protoreflect.EnumType {
|
||||
return &file_api_v2_reaction_service_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x Reaction_Type) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Reaction_Type.Descriptor instead.
|
||||
func (Reaction_Type) EnumDescriptor() ([]byte, []int) {
|
||||
return file_api_v2_reaction_service_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
type Reaction struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
ContentId string `protobuf:"bytes,3,opt,name=content_id,json=contentId,proto3" json:"content_id,omitempty"`
|
||||
ReactionType Reaction_Type `protobuf:"varint,4,opt,name=reaction_type,json=reactionType,proto3,enum=memos.api.v2.Reaction_Type" json:"reaction_type,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Reaction) Reset() {
|
||||
*x = Reaction{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_api_v2_reaction_service_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Reaction) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Reaction) ProtoMessage() {}
|
||||
|
||||
func (x *Reaction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v2_reaction_service_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Reaction.ProtoReflect.Descriptor instead.
|
||||
func (*Reaction) Descriptor() ([]byte, []int) {
|
||||
return file_api_v2_reaction_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Reaction) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Reaction) GetCreator() string {
|
||||
if x != nil {
|
||||
return x.Creator
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Reaction) GetContentId() string {
|
||||
if x != nil {
|
||||
return x.ContentId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Reaction) GetReactionType() Reaction_Type {
|
||||
if x != nil {
|
||||
return x.ReactionType
|
||||
}
|
||||
return Reaction_TYPE_UNSPECIFIED
|
||||
}
|
||||
|
||||
var File_api_v2_reaction_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_api_v2_reaction_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x0c, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x22, 0xff, 0x01,
|
||||
0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72,
|
||||
0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65,
|
||||
0x61, 0x74, 0x6f, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x49, 0x64, 0x12, 0x40, 0x0a, 0x0d, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6d, 0x65, 0x6d,
|
||||
0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0c, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x68, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a,
|
||||
0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
|
||||
0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x45, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x09, 0x0a,
|
||||
0x05, 0x48, 0x45, 0x41, 0x52, 0x54, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x41, 0x55, 0x47,
|
||||
0x48, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x04, 0x12,
|
||||
0x0f, 0x0a, 0x0b, 0x54, 0x48, 0x55, 0x4d, 0x42, 0x53, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x05,
|
||||
0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x55, 0x4d, 0x42, 0x53, 0x5f, 0x55, 0x50, 0x10, 0x06, 0x42,
|
||||
0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x2e, 0x76, 0x32, 0x42, 0x14, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f,
|
||||
0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65,
|
||||
0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02,
|
||||
0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69,
|
||||
0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c,
|
||||
0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56,
|
||||
0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e,
|
||||
0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_api_v2_reaction_service_proto_rawDescOnce sync.Once
|
||||
file_api_v2_reaction_service_proto_rawDescData = file_api_v2_reaction_service_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_api_v2_reaction_service_proto_rawDescGZIP() []byte {
|
||||
file_api_v2_reaction_service_proto_rawDescOnce.Do(func() {
|
||||
file_api_v2_reaction_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_reaction_service_proto_rawDescData)
|
||||
})
|
||||
return file_api_v2_reaction_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_api_v2_reaction_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_api_v2_reaction_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_api_v2_reaction_service_proto_goTypes = []interface{}{
|
||||
(Reaction_Type)(0), // 0: memos.api.v2.Reaction.Type
|
||||
(*Reaction)(nil), // 1: memos.api.v2.Reaction
|
||||
}
|
||||
var file_api_v2_reaction_service_proto_depIdxs = []int32{
|
||||
0, // 0: memos.api.v2.Reaction.reaction_type:type_name -> memos.api.v2.Reaction.Type
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_api_v2_reaction_service_proto_init() }
|
||||
func file_api_v2_reaction_service_proto_init() {
|
||||
if File_api_v2_reaction_service_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_api_v2_reaction_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Reaction); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_api_v2_reaction_service_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_api_v2_reaction_service_proto_goTypes,
|
||||
DependencyIndexes: file_api_v2_reaction_service_proto_depIdxs,
|
||||
EnumInfos: file_api_v2_reaction_service_proto_enumTypes,
|
||||
MessageInfos: file_api_v2_reaction_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_api_v2_reaction_service_proto = out.File
|
||||
file_api_v2_reaction_service_proto_rawDesc = nil
|
||||
file_api_v2_reaction_service_proto_goTypes = nil
|
||||
file_api_v2_reaction_service_proto_depIdxs = nil
|
||||
}
|
@ -213,11 +213,12 @@
|
||||
| Name | Number | Description |
|
||||
| ---- | ------ | ----------- |
|
||||
| TYPE_UNSPECIFIED | 0 | |
|
||||
| HEART | 1 | |
|
||||
| THUMBS_UP | 2 | |
|
||||
| THUMBS_DOWN | 3 | |
|
||||
| LAUGH | 4 | |
|
||||
| ROCKET | 5 | |
|
||||
| EYES | 1 | |
|
||||
| HEART | 2 | |
|
||||
| LAUGH | 3 | |
|
||||
| ROCKET | 4 | |
|
||||
| THUMBS_DOWN | 5 | |
|
||||
| THUMBS_UP | 6 | |
|
||||
|
||||
|
||||
|
||||
|
@ -24,30 +24,33 @@ type Reaction_Type int32
|
||||
|
||||
const (
|
||||
Reaction_TYPE_UNSPECIFIED Reaction_Type = 0
|
||||
Reaction_HEART Reaction_Type = 1
|
||||
Reaction_THUMBS_UP Reaction_Type = 2
|
||||
Reaction_THUMBS_DOWN Reaction_Type = 3
|
||||
Reaction_LAUGH Reaction_Type = 4
|
||||
Reaction_ROCKET Reaction_Type = 5
|
||||
Reaction_EYES Reaction_Type = 1
|
||||
Reaction_HEART Reaction_Type = 2
|
||||
Reaction_LAUGH Reaction_Type = 3
|
||||
Reaction_ROCKET Reaction_Type = 4
|
||||
Reaction_THUMBS_DOWN Reaction_Type = 5
|
||||
Reaction_THUMBS_UP Reaction_Type = 6
|
||||
)
|
||||
|
||||
// Enum value maps for Reaction_Type.
|
||||
var (
|
||||
Reaction_Type_name = map[int32]string{
|
||||
0: "TYPE_UNSPECIFIED",
|
||||
1: "HEART",
|
||||
2: "THUMBS_UP",
|
||||
3: "THUMBS_DOWN",
|
||||
4: "LAUGH",
|
||||
5: "ROCKET",
|
||||
1: "EYES",
|
||||
2: "HEART",
|
||||
3: "LAUGH",
|
||||
4: "ROCKET",
|
||||
5: "THUMBS_DOWN",
|
||||
6: "THUMBS_UP",
|
||||
}
|
||||
Reaction_Type_value = map[string]int32{
|
||||
"TYPE_UNSPECIFIED": 0,
|
||||
"HEART": 1,
|
||||
"THUMBS_UP": 2,
|
||||
"THUMBS_DOWN": 3,
|
||||
"LAUGH": 4,
|
||||
"ROCKET": 5,
|
||||
"EYES": 1,
|
||||
"HEART": 2,
|
||||
"LAUGH": 3,
|
||||
"ROCKET": 4,
|
||||
"THUMBS_DOWN": 5,
|
||||
"THUMBS_UP": 6,
|
||||
}
|
||||
)
|
||||
|
||||
@ -164,7 +167,7 @@ var File_store_reaction_proto protoreflect.FileDescriptor
|
||||
var file_store_reaction_proto_rawDesc = []byte{
|
||||
0x0a, 0x14, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74,
|
||||
0x6f, 0x72, 0x65, 0x22, 0x98, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x6f, 0x72, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64,
|
||||
0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x73, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x73, 0x12,
|
||||
@ -175,24 +178,24 @@ var file_store_reaction_proto_rawDesc = []byte{
|
||||
0x0d, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65,
|
||||
0x52, 0x0c, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5e,
|
||||
0x52, 0x0c, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x68,
|
||||
0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55,
|
||||
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05,
|
||||
0x48, 0x45, 0x41, 0x52, 0x54, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x55, 0x4d, 0x42,
|
||||
0x53, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x48, 0x55, 0x4d, 0x42, 0x53,
|
||||
0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x41, 0x55, 0x47, 0x48,
|
||||
0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x05, 0x42, 0x98,
|
||||
0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x65, 0x42, 0x0d, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02,
|
||||
0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f,
|
||||
0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65,
|
||||
0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47,
|
||||
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d,
|
||||
0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04,
|
||||
0x45, 0x59, 0x45, 0x53, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x45, 0x41, 0x52, 0x54, 0x10,
|
||||
0x02, 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x41, 0x55, 0x47, 0x48, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06,
|
||||
0x52, 0x4f, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x54, 0x48, 0x55, 0x4d,
|
||||
0x42, 0x53, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x55,
|
||||
0x4d, 0x42, 0x53, 0x5f, 0x55, 0x50, 0x10, 0x06, 0x42, 0x98, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d,
|
||||
0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x0d, 0x52, 0x65,
|
||||
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d,
|
||||
0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67,
|
||||
0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02,
|
||||
0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d,
|
||||
0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d,
|
||||
0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74,
|
||||
0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -17,11 +17,12 @@ message Reaction {
|
||||
|
||||
enum Type {
|
||||
TYPE_UNSPECIFIED = 0;
|
||||
HEART = 1;
|
||||
THUMBS_UP = 2;
|
||||
THUMBS_DOWN = 3;
|
||||
LAUGH = 4;
|
||||
ROCKET = 5;
|
||||
EYES = 1;
|
||||
HEART = 2;
|
||||
LAUGH = 3;
|
||||
ROCKET = 4;
|
||||
THUMBS_DOWN = 5;
|
||||
THUMBS_UP = 6;
|
||||
}
|
||||
Type reaction_type = 5;
|
||||
}
|
||||
|
@ -8,19 +8,19 @@ import (
|
||||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
||||
func (d *DB) CreateReaction(ctx context.Context, create *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
func (d *DB) UpsertReaction(ctx context.Context, upsert *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
fields := []string{"`creator_id`", "`content_id`", "`reaction_type`"}
|
||||
placeholder := []string{"?", "?", "?"}
|
||||
args := []interface{}{create.CreatorId, create.ContentId, create.ReactionType.String()}
|
||||
args := []interface{}{upsert.CreatorId, upsert.ContentId, upsert.ReactionType.String()}
|
||||
stmt := "INSERT INTO `reaction` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`"
|
||||
if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
|
||||
&create.Id,
|
||||
&create.CreatedTs,
|
||||
&upsert.Id,
|
||||
&upsert.CreatedTs,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reaction := create
|
||||
reaction := upsert
|
||||
return reaction, nil
|
||||
}
|
||||
|
||||
|
@ -8,18 +8,18 @@ import (
|
||||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
||||
func (d *DB) CreateReaction(ctx context.Context, create *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
func (d *DB) UpsertReaction(ctx context.Context, upsert *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
fields := []string{"creator_id", "content_id", "reaction_type"}
|
||||
args := []interface{}{create.CreatorId, create.ContentId, create.ReactionType.String()}
|
||||
args := []interface{}{upsert.CreatorId, upsert.ContentId, upsert.ReactionType.String()}
|
||||
stmt := "INSERT INTO reaction (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts"
|
||||
if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
|
||||
&create.Id,
|
||||
&create.CreatedTs,
|
||||
&upsert.Id,
|
||||
&upsert.CreatedTs,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reaction := create
|
||||
reaction := upsert
|
||||
return reaction, nil
|
||||
}
|
||||
|
||||
|
@ -150,5 +150,6 @@ CREATE TABLE reaction (
|
||||
created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
|
||||
creator_id INTEGER NOT NULL,
|
||||
content_id TEXT NOT NULL,
|
||||
reaction_type TEXT NOT NULL
|
||||
reaction_type TEXT NOT NULL,
|
||||
UNIQUE(creator_id, content_id, reaction_type)
|
||||
);
|
||||
|
@ -8,19 +8,19 @@ import (
|
||||
"github.com/usememos/memos/store"
|
||||
)
|
||||
|
||||
func (d *DB) CreateReaction(ctx context.Context, create *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
func (d *DB) UpsertReaction(ctx context.Context, upsert *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
fields := []string{"`creator_id`", "`content_id`", "`reaction_type`"}
|
||||
placeholder := []string{"?", "?", "?"}
|
||||
args := []interface{}{create.CreatorId, create.ContentId, create.ReactionType.String()}
|
||||
args := []interface{}{upsert.CreatorId, upsert.ContentId, upsert.ReactionType.String()}
|
||||
stmt := "INSERT INTO `reaction` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`"
|
||||
if err := d.db.QueryRowContext(ctx, stmt, args...).Scan(
|
||||
&create.Id,
|
||||
&create.CreatedTs,
|
||||
&upsert.Id,
|
||||
&upsert.CreatedTs,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reaction := create
|
||||
reaction := upsert
|
||||
return reaction, nil
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ type Driver interface {
|
||||
DeleteWebhook(ctx context.Context, delete *DeleteWebhook) error
|
||||
|
||||
// Reaction model related methods.
|
||||
CreateReaction(ctx context.Context, create *storepb.Reaction) (*storepb.Reaction, error)
|
||||
UpsertReaction(ctx context.Context, create *storepb.Reaction) (*storepb.Reaction, error)
|
||||
ListReactions(ctx context.Context, find *FindReaction) ([]*storepb.Reaction, error)
|
||||
DeleteReaction(ctx context.Context, delete *DeleteReaction) error
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ type DeleteReaction struct {
|
||||
ID int32
|
||||
}
|
||||
|
||||
func (s *Store) CreateReaction(ctx context.Context, create *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
return s.driver.CreateReaction(ctx, create)
|
||||
func (s *Store) UpsertReaction(ctx context.Context, upsert *storepb.Reaction) (*storepb.Reaction, error) {
|
||||
return s.driver.UpsertReaction(ctx, upsert)
|
||||
}
|
||||
|
||||
func (s *Store) ListReactions(ctx context.Context, find *FindReaction) ([]*storepb.Reaction, error) {
|
||||
|
Reference in New Issue
Block a user