Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
185ec2ad
Commit
185ec2ad
authored
Feb 06, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update inbox service
parent
6b59c767
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
238 additions
and
122 deletions
+238
-122
apidocs.swagger.md
api/v2/apidocs.swagger.md
+66
-10
apidocs.swagger.yaml
api/v2/apidocs.swagger.yaml
+52
-45
inbox_service.go
api/v2/inbox_service.go
+1
-1
inbox_service.proto
proto/api/v2/inbox_service.proto
+9
-5
README.md
proto/gen/api/v2/README.md
+1
-0
inbox_service.pb.go
proto/gen/api/v2/inbox_service.pb.go
+67
-54
inbox_service.pb.gw.go
proto/gen/api/v2/inbox_service.pb.gw.go
+41
-7
inbox.ts
web/src/store/v1/inbox.ts
+1
-0
No files found.
api/v2/apidocs.swagger.md
View file @
185ec2ad
...
...
@@ -120,44 +120,81 @@ ListInboxes lists inboxes for a user.
| 200 | A successful response. |
[
v2ListInboxesResponse
](
#v2listinboxesresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /
v2/inboxes
### /
api/v2/{name_1}
####
PATCH
####
DELETE
##### Summary
UpdateInbox upda
tes an inbox.
DeleteInbox dele
tes an inbox.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
|
inbox | body | | Yes |
[
v2Inbox
](
#v2inbox
)
|
|
name_1 | path | The name of the inbox to delete. Format: inboxes/{inbox} | Yes | string
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
UpdateInboxResponse
](
#v2upda
teinboxresponse
)
|
| 200 | A successful response. |
[
v2
DeleteInboxResponse
](
#v2dele
teinboxresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /v2/{name}
### /api/v2/{name}
#### GET
##### Summary
GetUser gets a user by name.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | path | The name of the user. Format: users/{username} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2GetUserResponse
](
#v2getuserresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### DELETE
##### Summary
DeleteInbox deletes an inbox.
DeleteUser deletes a user.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | path | The name of the user. Format: users/{username} | Yes | string |
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2DeleteUserResponse
](
#v2deleteuserresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### PATCH
##### Summary
UpdateInbox updates an inbox.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | path | The name of the inbox to delete. Format: inboxes/{inbox} | Yes | string |
| inbox | body | | Yes |
[
v2Inbox
](
#v2inbox
)
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2
DeleteInboxResponse
](
#v2dele
teinboxresponse
)
|
| 200 | A successful response. |
[
v2
UpdateInboxResponse
](
#v2upda
teinboxresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
---
...
...
@@ -437,7 +474,7 @@ ExportMemos exports memos.
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response.
(streaming responses) | {
**"result"**
:
[
v2ExportMemosResponse
](
#v2exportmemosresponse
)
,
**"error"**
:
[
googlerpcStatus
](
#googlerpcstatus
)
}
|
| 200 | A successful response.
|
[
v2ExportMemosResponse
](
#v2exportmemosresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
---
...
...
@@ -729,6 +766,25 @@ DeleteUser deletes a user.
| 200 | A successful response. |
[
v2DeleteUserResponse
](
#v2deleteuserresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
#### PATCH
##### Summary
UpdateInbox updates an inbox.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ------ |
| name | path | The name of the inbox to delete. Format: inboxes/{inbox} | Yes | string |
| inbox | body | | Yes |
[
v2Inbox
](
#v2inbox
)
|
##### Responses
| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | A successful response. |
[
v2UpdateInboxResponse
](
#v2updateinboxresponse
)
|
| default | An unexpected error response. |
[
googlerpcStatus
](
#googlerpcstatus
)
|
### /api/v2/{name}/access_tokens
#### GET
...
...
@@ -1246,7 +1302,7 @@ GetActivity returns the activity with the given id.
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
|
file
| byte | | No |
|
content
| byte | | No |
#### v2GetActivityResponse
...
...
api/v2/apidocs.swagger.yaml
View file @
185ec2ad
...
...
@@ -948,6 +948,30 @@ paths:
$ref
:
'
#/definitions/v2WorkspaceProfile'
tags
:
-
WorkspaceService
/api/v2/{name_1}
:
delete
:
summary
:
DeleteInbox deletes an inbox.
operationId
:
InboxService_DeleteInbox
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v2DeleteInboxResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
name_1
description
:
|-
The name of the inbox to delete.
Format: inboxes/{inbox}
in: path
required: true
type: string
pattern: inboxes/[^/]+
tags
:
-
InboxService
/api/v2/{name}
:
get
:
summary
:
GetUser gets a user by name.
...
...
@@ -995,6 +1019,34 @@ paths:
pattern: users/[^/]+
tags
:
-
UserService
patch
:
summary
:
UpdateInbox updates an inbox.
operationId
:
InboxService_UpdateInbox
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v2UpdateInboxResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
name
description
:
|-
The name of the inbox to delete.
Format: inboxes/{inbox}
in: path
required: true
type: string
pattern: inboxes/[^/]+
-
name
:
inbox
in
:
body
required
:
true
schema
:
$ref
:
'
#/definitions/v2Inbox'
tags
:
-
InboxService
/api/v2/{name}/access_tokens
:
get
:
summary
:
ListUserAccessTokens returns a list of access tokens for a user.
...
...
@@ -1237,51 +1289,6 @@ paths:
format
:
int32
tags
:
-
ActivityService
/v2/inboxes
:
patch
:
summary
:
UpdateInbox updates an inbox.
operationId
:
InboxService_UpdateInbox
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v2UpdateInboxResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
inbox
in
:
body
required
:
true
schema
:
$ref
:
'
#/definitions/v2Inbox'
tags
:
-
InboxService
/v2/{name}
:
delete
:
summary
:
DeleteInbox deletes an inbox.
operationId
:
InboxService_DeleteInbox
responses
:
"
200"
:
description
:
A successful response.
schema
:
$ref
:
'
#/definitions/v2DeleteInboxResponse'
default
:
description
:
An unexpected error response.
schema
:
$ref
:
'
#/definitions/googlerpcStatus'
parameters
:
-
name
:
name
description
:
|-
The name of the inbox to delete.
Format: inboxes/{inbox}
in: path
required: true
type: string
pattern: inboxes/[^/]+
tags
:
-
InboxService
definitions
:
MemoServiceSetMemoRelationsBody
:
type
:
object
...
...
api/v2/inbox_service.go
View file @
185ec2ad
...
...
@@ -46,7 +46,7 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"update mask is required"
)
}
inboxID
,
err
:=
ExtractInboxIDFromName
(
request
.
Inbox
.
Name
)
inboxID
,
err
:=
ExtractInboxIDFromName
(
request
.
Name
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"invalid inbox name: %v"
,
err
)
}
...
...
proto/api/v2/inbox_service.proto
View file @
185ec2ad
...
...
@@ -17,14 +17,14 @@ service InboxService {
// UpdateInbox updates an inbox.
rpc
UpdateInbox
(
UpdateInboxRequest
)
returns
(
UpdateInboxResponse
)
{
option
(
google.api.http
)
=
{
patch
:
"/
v2/inboxes
"
patch
:
"/
api/v2/{name=inboxes/*}
"
body
:
"inbox"
};
option
(
google.api.method_signature
)
=
"inbox,update_mask"
;
option
(
google.api.method_signature
)
=
"
name,
inbox,update_mask"
;
}
// DeleteInbox deletes an inbox.
rpc
DeleteInbox
(
DeleteInboxRequest
)
returns
(
DeleteInboxResponse
)
{
option
(
google.api.http
)
=
{
delete
:
"/v2/{name=inboxes/*}"
};
option
(
google.api.http
)
=
{
delete
:
"/
api/
v2/{name=inboxes/*}"
};
option
(
google.api.method_signature
)
=
"name"
;
}
}
...
...
@@ -67,9 +67,13 @@ message ListInboxesResponse {
}
message
UpdateInboxRequest
{
Inbox
inbox
=
1
;
// The name of the inbox to delete.
// Format: inboxes/{inbox}
string
name
=
1
;
Inbox
inbox
=
2
;
google.protobuf.FieldMask
update_mask
=
2
;
google.protobuf.FieldMask
update_mask
=
3
;
}
message
UpdateInboxResponse
{
...
...
proto/gen/api/v2/README.md
View file @
185ec2ad
...
...
@@ -1008,6 +1008,7 @@ Used internally for obfuscating the page token.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| name |
[
string
](
#string
)
| | The name of the inbox to delete. Format: inboxes/{inbox} |
| inbox |
[
Inbox
](
#memos-api-v2-Inbox
)
| | |
| update_mask |
[
google.protobuf.FieldMask
](
#google-protobuf-FieldMask
)
| | |
...
...
proto/gen/api/v2/inbox_service.pb.go
View file @
185ec2ad
This diff is collapsed.
Click to expand it.
proto/gen/api/v2/inbox_service.pb.gw.go
View file @
185ec2ad
...
...
@@ -68,7 +68,7 @@ func local_request_InboxService_ListInboxes_0(ctx context.Context, marshaler run
}
var
(
filter_InboxService_UpdateInbox_0
=
&
utilities
.
DoubleArray
{
Encoding
:
map
[
string
]
int
{
"inbox"
:
0
},
Base
:
[]
int
{
1
,
2
,
0
,
0
},
Check
:
[]
int
{
0
,
1
,
2
,
2
}}
filter_InboxService_UpdateInbox_0
=
&
utilities
.
DoubleArray
{
Encoding
:
map
[
string
]
int
{
"inbox"
:
0
,
"name"
:
1
},
Base
:
[]
int
{
1
,
2
,
4
,
0
,
0
,
0
,
0
},
Check
:
[]
int
{
0
,
1
,
1
,
2
,
2
,
3
,
3
}}
)
func
request_InboxService_UpdateInbox_0
(
ctx
context
.
Context
,
marshaler
runtime
.
Marshaler
,
client
InboxServiceClient
,
req
*
http
.
Request
,
pathParams
map
[
string
]
string
)
(
proto
.
Message
,
runtime
.
ServerMetadata
,
error
)
{
...
...
@@ -90,6 +90,23 @@ func request_InboxService_UpdateInbox_0(ctx context.Context, marshaler runtime.M
}
}
var
(
val
string
ok
bool
err
error
_
=
err
)
val
,
ok
=
pathParams
[
"name"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"name"
)
}
protoReq
.
Name
,
err
=
runtime
.
String
(
val
)
if
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"type mismatch, parameter: %s, error: %v"
,
"name"
,
err
)
}
if
err
:=
req
.
ParseForm
();
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"%v"
,
err
)
}
...
...
@@ -121,6 +138,23 @@ func local_request_InboxService_UpdateInbox_0(ctx context.Context, marshaler run
}
}
var
(
val
string
ok
bool
err
error
_
=
err
)
val
,
ok
=
pathParams
[
"name"
]
if
!
ok
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"missing parameter %s"
,
"name"
)
}
protoReq
.
Name
,
err
=
runtime
.
String
(
val
)
if
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"type mismatch, parameter: %s, error: %v"
,
"name"
,
err
)
}
if
err
:=
req
.
ParseForm
();
err
!=
nil
{
return
nil
,
metadata
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"%v"
,
err
)
}
...
...
@@ -224,7 +258,7 @@ func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
inboundMarshaler
,
outboundMarshaler
:=
runtime
.
MarshalerForRequest
(
mux
,
req
)
var
err
error
var
annotatedContext
context
.
Context
annotatedContext
,
err
=
runtime
.
AnnotateIncomingContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/UpdateInbox"
,
runtime
.
WithHTTPPathPattern
(
"/
v2/inboxes
"
))
annotatedContext
,
err
=
runtime
.
AnnotateIncomingContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/UpdateInbox"
,
runtime
.
WithHTTPPathPattern
(
"/
api/v2/{name=inboxes/*}
"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
...
...
@@ -249,7 +283,7 @@ func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
inboundMarshaler
,
outboundMarshaler
:=
runtime
.
MarshalerForRequest
(
mux
,
req
)
var
err
error
var
annotatedContext
context
.
Context
annotatedContext
,
err
=
runtime
.
AnnotateIncomingContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/DeleteInbox"
,
runtime
.
WithHTTPPathPattern
(
"/v2/{name=inboxes/*}"
))
annotatedContext
,
err
=
runtime
.
AnnotateIncomingContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/DeleteInbox"
,
runtime
.
WithHTTPPathPattern
(
"/
api/
v2/{name=inboxes/*}"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
...
...
@@ -335,7 +369,7 @@ func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
inboundMarshaler
,
outboundMarshaler
:=
runtime
.
MarshalerForRequest
(
mux
,
req
)
var
err
error
var
annotatedContext
context
.
Context
annotatedContext
,
err
=
runtime
.
AnnotateContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/UpdateInbox"
,
runtime
.
WithHTTPPathPattern
(
"/
v2/inboxes
"
))
annotatedContext
,
err
=
runtime
.
AnnotateContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/UpdateInbox"
,
runtime
.
WithHTTPPathPattern
(
"/
api/v2/{name=inboxes/*}
"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
...
...
@@ -357,7 +391,7 @@ func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
inboundMarshaler
,
outboundMarshaler
:=
runtime
.
MarshalerForRequest
(
mux
,
req
)
var
err
error
var
annotatedContext
context
.
Context
annotatedContext
,
err
=
runtime
.
AnnotateContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/DeleteInbox"
,
runtime
.
WithHTTPPathPattern
(
"/v2/{name=inboxes/*}"
))
annotatedContext
,
err
=
runtime
.
AnnotateContext
(
ctx
,
mux
,
req
,
"/memos.api.v2.InboxService/DeleteInbox"
,
runtime
.
WithHTTPPathPattern
(
"/
api/
v2/{name=inboxes/*}"
))
if
err
!=
nil
{
runtime
.
HTTPError
(
ctx
,
mux
,
outboundMarshaler
,
w
,
req
,
err
)
return
...
...
@@ -379,9 +413,9 @@ func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
var
(
pattern_InboxService_ListInboxes_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
},
[]
string
{
"api"
,
"v2"
,
"inboxes"
},
""
))
pattern_InboxService_UpdateInbox_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
},
[]
string
{
"v2"
,
"inboxes
"
},
""
))
pattern_InboxService_UpdateInbox_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
2
,
5
,
3
},
[]
string
{
"api"
,
"v2"
,
"inboxes"
,
"name
"
},
""
))
pattern_InboxService_DeleteInbox_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
1
,
0
,
4
,
2
,
5
,
2
},
[]
string
{
"v2"
,
"inboxes"
,
"name"
},
""
))
pattern_InboxService_DeleteInbox_0
=
runtime
.
MustPattern
(
runtime
.
NewPattern
(
1
,
[]
int
{
2
,
0
,
2
,
1
,
2
,
2
,
1
,
0
,
4
,
2
,
5
,
3
},
[]
string
{
"api"
,
"v2"
,
"inboxes"
,
"name"
},
""
))
)
var
(
...
...
web/src/store/v1/inbox.ts
View file @
185ec2ad
...
...
@@ -20,6 +20,7 @@ export const useInboxStore = create(
},
updateInbox
:
async
(
inbox
:
Partial
<
Inbox
>
,
updateMask
:
string
[])
=>
{
const
{
inbox
:
updatedInbox
}
=
await
inboxServiceClient
.
updateInbox
({
name
:
inbox
.
name
,
inbox
,
updateMask
,
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment