mirror of
https://github.com/usememos/memos.git
synced 2025-11-10 01:10:52 +08:00
refactor: webhook service
This commit is contained in:
parent
c9ab03e1a0
commit
3b0c87591f
10 changed files with 1774 additions and 910 deletions
|
|
@ -2,9 +2,12 @@ syntax = "proto3";
|
|||
|
||||
package memos.api.v1;
|
||||
|
||||
import "api/v1/common.proto";
|
||||
import "api/v1/memo_service.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "google/api/client.proto";
|
||||
import "google/api/field_behavior.proto";
|
||||
import "google/api/resource.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
|
@ -12,91 +15,191 @@ import "google/protobuf/timestamp.proto";
|
|||
option go_package = "gen/api/v1";
|
||||
|
||||
service WebhookService {
|
||||
// CreateWebhook creates a new webhook.
|
||||
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/webhooks"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
// GetWebhook returns a webhook by id.
|
||||
rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {get: "/api/v1/webhooks/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
}
|
||||
// ListWebhooks returns a list of webhooks.
|
||||
rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse) {
|
||||
option (google.api.http) = {get: "/api/v1/webhooks"};
|
||||
}
|
||||
|
||||
// GetWebhook gets a webhook by name.
|
||||
rpc GetWebhook(GetWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {get: "/api/v1/{name=webhooks/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
|
||||
// CreateWebhook creates a new webhook.
|
||||
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/v1/webhooks"
|
||||
body: "webhook"
|
||||
};
|
||||
option (google.api.method_signature) = "webhook";
|
||||
}
|
||||
|
||||
// UpdateWebhook updates a webhook.
|
||||
rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
|
||||
option (google.api.http) = {
|
||||
patch: "/api/v1/webhooks/{webhook.id}"
|
||||
patch: "/api/v1/{webhook.name=webhooks/*}"
|
||||
body: "webhook"
|
||||
};
|
||||
option (google.api.method_signature) = "webhook,update_mask";
|
||||
}
|
||||
// DeleteWebhook deletes a webhook by id.
|
||||
|
||||
// DeleteWebhook deletes a webhook.
|
||||
rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {delete: "/api/v1/webhooks/{id}"};
|
||||
option (google.api.method_signature) = "id";
|
||||
option (google.api.http) = {delete: "/api/v1/{name=webhooks/*}"};
|
||||
option (google.api.method_signature) = "name";
|
||||
}
|
||||
}
|
||||
|
||||
message Webhook {
|
||||
int32 id = 1;
|
||||
option (google.api.resource) = {
|
||||
type: "memos.api.v1/Webhook"
|
||||
pattern: "webhooks/{webhook}"
|
||||
name_field: "name"
|
||||
singular: "webhook"
|
||||
plural: "webhooks"
|
||||
};
|
||||
|
||||
// The name of the creator.
|
||||
string creator = 2;
|
||||
// The resource name of the webhook.
|
||||
// Format: webhooks/{webhook}
|
||||
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
|
||||
|
||||
google.protobuf.Timestamp create_time = 3;
|
||||
// Output only. The system generated unique identifier.
|
||||
string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
google.protobuf.Timestamp update_time = 4;
|
||||
// Required. The display name of the webhook.
|
||||
string display_name = 3 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
string name = 5;
|
||||
// Required. The target URL for the webhook.
|
||||
string url = 4 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
string url = 6;
|
||||
}
|
||||
// Output only. The resource name of the creator.
|
||||
// Format: users/{user}
|
||||
string creator = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
message CreateWebhookRequest {
|
||||
string name = 1;
|
||||
// The state of the webhook.
|
||||
State state = 6 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
string url = 2;
|
||||
}
|
||||
// Output only. The creation timestamp.
|
||||
google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
message GetWebhookRequest {
|
||||
int32 id = 1;
|
||||
// Output only. The last update timestamp.
|
||||
google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
// Output only. The etag for this resource.
|
||||
string etag = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
}
|
||||
|
||||
message ListWebhooksRequest {
|
||||
// The name of the creator.
|
||||
string creator = 2;
|
||||
// Optional. The maximum number of webhooks to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 50 webhooks will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. A page token, received from a previous `ListWebhooks` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. Filter to apply to the list results.
|
||||
// Example: "state=ACTIVE" or "creator=users/123"
|
||||
// Supported operators: =, !=, <, <=, >, >=, :
|
||||
// Supported fields: display_name, url, creator, state, create_time, update_time
|
||||
string filter = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. The order to sort results by.
|
||||
// Example: "create_time desc" or "display_name asc"
|
||||
string order_by = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. If true, show deleted webhooks in the response.
|
||||
bool show_deleted = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message ListWebhooksResponse {
|
||||
// The list of webhooks.
|
||||
repeated Webhook webhooks = 1;
|
||||
|
||||
// A token that can be sent as `page_token` to retrieve the next page.
|
||||
// If this field is omitted, there are no subsequent pages.
|
||||
string next_page_token = 2;
|
||||
|
||||
// The total count of webhooks (may be approximate).
|
||||
int32 total_size = 3;
|
||||
}
|
||||
|
||||
message GetWebhookRequest {
|
||||
// Required. The resource name of the webhook.
|
||||
// Format: webhooks/{webhook}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Webhook"}
|
||||
];
|
||||
|
||||
// Optional. The fields to return in the response.
|
||||
// If not specified, all fields are returned.
|
||||
google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message CreateWebhookRequest {
|
||||
// Required. The webhook to create.
|
||||
Webhook webhook = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.field_behavior) = INPUT_ONLY
|
||||
];
|
||||
|
||||
// Optional. The webhook ID to use for this webhook.
|
||||
// If empty, a unique ID will be generated.
|
||||
// Must match the pattern [a-z0-9-]+
|
||||
string webhook_id = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. If set, validate the request but don't actually create the webhook.
|
||||
bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
|
||||
// Optional. An idempotency token that can be used to ensure that multiple
|
||||
// requests to create a webhook have the same result.
|
||||
string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message UpdateWebhookRequest {
|
||||
Webhook webhook = 1;
|
||||
// Required. The webhook to update.
|
||||
Webhook webhook = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
google.protobuf.FieldMask update_mask = 2;
|
||||
// Required. The list of fields to update.
|
||||
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// Optional. If set to true, allows updating sensitive fields.
|
||||
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message DeleteWebhookRequest {
|
||||
int32 id = 1;
|
||||
// Required. The resource name of the webhook to delete.
|
||||
// Format: webhooks/{webhook}
|
||||
string name = 1 [
|
||||
(google.api.field_behavior) = REQUIRED,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/Webhook"}
|
||||
];
|
||||
|
||||
// Optional. If set to true, the webhook will be deleted even if it has associated data.
|
||||
bool force = 2 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
||||
message WebhookRequestPayload {
|
||||
string url = 1;
|
||||
// The target URL for the webhook request.
|
||||
string url = 1 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
string activity_type = 2;
|
||||
// The type of activity that triggered this webhook.
|
||||
string activity_type = 2 [(google.api.field_behavior) = REQUIRED];
|
||||
|
||||
// The name of the creator.
|
||||
// The resource name of the creator.
|
||||
// Format: users/{user}
|
||||
string creator = 3;
|
||||
string creator = 3 [
|
||||
(google.api.field_behavior) = OUTPUT_ONLY,
|
||||
(google.api.resource_reference) = {type: "memos.api.v1/User"}
|
||||
];
|
||||
|
||||
google.protobuf.Timestamp create_time = 4;
|
||||
// The creation timestamp of the activity.
|
||||
google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
|
||||
|
||||
Memo memo = 5;
|
||||
// The memo that triggered this webhook (if applicable).
|
||||
Memo memo = 5 [(google.api.field_behavior) = OPTIONAL];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,26 @@ const (
|
|||
|
||||
type Webhook struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// The name of the creator.
|
||||
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
|
||||
UpdateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
|
||||
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"`
|
||||
// The resource name of the webhook.
|
||||
// Format: webhooks/{webhook}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Output only. The system generated unique identifier.
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||
// Required. The display name of the webhook.
|
||||
DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
// Required. The target URL for the webhook.
|
||||
Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
|
||||
// Output only. The resource name of the creator.
|
||||
// Format: users/{user}
|
||||
Creator string `protobuf:"bytes,5,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
// The state of the webhook.
|
||||
State State `protobuf:"varint,6,opt,name=state,proto3,enum=memos.api.v1.State" json:"state,omitempty"`
|
||||
// Output only. The creation timestamp.
|
||||
CreateTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
|
||||
// Output only. The last update timestamp.
|
||||
UpdateTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
|
||||
// Output only. The etag for this resource.
|
||||
Etag string `protobuf:"bytes,9,opt,name=etag,proto3" json:"etag,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -68,11 +81,32 @@ func (*Webhook) Descriptor() ([]byte, []int) {
|
|||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Webhook) GetId() int32 {
|
||||
func (x *Webhook) GetName() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
return x.Name
|
||||
}
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Webhook) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Webhook) GetDisplayName() string {
|
||||
if x != nil {
|
||||
return x.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Webhook) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Webhook) GetCreator() string {
|
||||
|
|
@ -82,6 +116,13 @@ func (x *Webhook) GetCreator() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *Webhook) GetState() State {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return State_STATE_UNSPECIFIED
|
||||
}
|
||||
|
||||
func (x *Webhook) GetCreateTime() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.CreateTime
|
||||
|
|
@ -96,127 +137,40 @@ func (x *Webhook) GetUpdateTime() *timestamppb.Timestamp {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *Webhook) GetName() string {
|
||||
func (x *Webhook) GetEtag() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
return x.Etag
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Webhook) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) Reset() {
|
||||
*x = CreateWebhookRequest{}
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateWebhookRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateWebhookRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateWebhookRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) Reset() {
|
||||
*x = GetWebhookRequest{}
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetWebhookRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetWebhookRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetWebhookRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) GetId() int32 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListWebhooksRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The name of the creator.
|
||||
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
// Optional. The maximum number of webhooks to return.
|
||||
// The service may return fewer than this value.
|
||||
// If unspecified, at most 50 webhooks will be returned.
|
||||
// The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
|
||||
// Optional. A page token, received from a previous `ListWebhooks` call.
|
||||
// Provide this to retrieve the subsequent page.
|
||||
PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
|
||||
// Optional. Filter to apply to the list results.
|
||||
// Example: "state=ACTIVE" or "creator=users/123"
|
||||
// Supported operators: =, !=, <, <=, >, >=, :
|
||||
// Supported fields: display_name, url, creator, state, create_time, update_time
|
||||
Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`
|
||||
// Optional. The order to sort results by.
|
||||
// Example: "create_time desc" or "display_name asc"
|
||||
OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
|
||||
// Optional. If true, show deleted webhooks in the response.
|
||||
ShowDeleted bool `protobuf:"varint,5,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListWebhooksRequest) Reset() {
|
||||
*x = ListWebhooksRequest{}
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[3]
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -228,7 +182,7 @@ func (x *ListWebhooksRequest) String() string {
|
|||
func (*ListWebhooksRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[3]
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -241,26 +195,60 @@ func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use ListWebhooksRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListWebhooksRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{3}
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ListWebhooksRequest) GetCreator() string {
|
||||
func (x *ListWebhooksRequest) GetPageSize() int32 {
|
||||
if x != nil {
|
||||
return x.Creator
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListWebhooksRequest) GetPageToken() string {
|
||||
if x != nil {
|
||||
return x.PageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListWebhooksRequest) GetFilter() string {
|
||||
if x != nil {
|
||||
return x.Filter
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListWebhooksRequest) GetOrderBy() string {
|
||||
if x != nil {
|
||||
return x.OrderBy
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListWebhooksRequest) GetShowDeleted() bool {
|
||||
if x != nil {
|
||||
return x.ShowDeleted
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ListWebhooksResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Webhooks []*Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"`
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The list of webhooks.
|
||||
Webhooks []*Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"`
|
||||
// A token that can be sent as `page_token` to retrieve the next page.
|
||||
// If this field is omitted, there are no subsequent pages.
|
||||
NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
|
||||
// The total count of webhooks (may be approximate).
|
||||
TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListWebhooksResponse) Reset() {
|
||||
*x = ListWebhooksResponse{}
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[4]
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -272,7 +260,7 @@ func (x *ListWebhooksResponse) String() string {
|
|||
func (*ListWebhooksResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[4]
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -285,7 +273,7 @@ func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use ListWebhooksResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListWebhooksResponse) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{4}
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ListWebhooksResponse) GetWebhooks() []*Webhook {
|
||||
|
|
@ -295,10 +283,159 @@ func (x *ListWebhooksResponse) GetWebhooks() []*Webhook {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *ListWebhooksResponse) GetNextPageToken() string {
|
||||
if x != nil {
|
||||
return x.NextPageToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListWebhooksResponse) GetTotalSize() int32 {
|
||||
if x != nil {
|
||||
return x.TotalSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Required. The resource name of the webhook.
|
||||
// Format: webhooks/{webhook}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Optional. The fields to return in the response.
|
||||
// If not specified, all fields are returned.
|
||||
ReadMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=read_mask,json=readMask,proto3" json:"read_mask,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) Reset() {
|
||||
*x = GetWebhookRequest{}
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetWebhookRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetWebhookRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetWebhookRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetWebhookRequest) GetReadMask() *fieldmaskpb.FieldMask {
|
||||
if x != nil {
|
||||
return x.ReadMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Required. The webhook to create.
|
||||
Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"`
|
||||
// Optional. The webhook ID to use for this webhook.
|
||||
// If empty, a unique ID will be generated.
|
||||
// Must match the pattern [a-z0-9-]+
|
||||
WebhookId string `protobuf:"bytes,2,opt,name=webhook_id,json=webhookId,proto3" json:"webhook_id,omitempty"`
|
||||
// Optional. If set, validate the request but don't actually create the webhook.
|
||||
ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"`
|
||||
// Optional. An idempotency token that can be used to ensure that multiple
|
||||
// requests to create a webhook have the same result.
|
||||
RequestId string `protobuf:"bytes,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) Reset() {
|
||||
*x = CreateWebhookRequest{}
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateWebhookRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_api_v1_webhook_service_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateWebhookRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateWebhookRequest) Descriptor() ([]byte, []int) {
|
||||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) GetWebhook() *Webhook {
|
||||
if x != nil {
|
||||
return x.Webhook
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) GetWebhookId() string {
|
||||
if x != nil {
|
||||
return x.WebhookId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) GetValidateOnly() bool {
|
||||
if x != nil {
|
||||
return x.ValidateOnly
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CreateWebhookRequest) GetRequestId() string {
|
||||
if x != nil {
|
||||
return x.RequestId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UpdateWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"`
|
||||
UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Required. The webhook to update.
|
||||
Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"`
|
||||
// Required. The list of fields to update.
|
||||
UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
|
||||
// Optional. If set to true, allows updating sensitive fields.
|
||||
AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -347,9 +484,20 @@ func (x *UpdateWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdateWebhookRequest) GetAllowMissing() bool {
|
||||
if x != nil {
|
||||
return x.AllowMissing
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type DeleteWebhookRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Required. The resource name of the webhook to delete.
|
||||
// Format: webhooks/{webhook}
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Optional. If set to true, the webhook will be deleted even if it has associated data.
|
||||
Force bool `protobuf:"varint,2,opt,name=force,proto3" json:"force,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -384,22 +532,33 @@ func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {
|
|||
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *DeleteWebhookRequest) GetId() int32 {
|
||||
func (x *DeleteWebhookRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
return x.Name
|
||||
}
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeleteWebhookRequest) GetForce() bool {
|
||||
if x != nil {
|
||||
return x.Force
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type WebhookRequestPayload struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||
ActivityType string `protobuf:"bytes,2,opt,name=activity_type,json=activityType,proto3" json:"activity_type,omitempty"`
|
||||
// The name of the creator.
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// The target URL for the webhook request.
|
||||
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||
// The type of activity that triggered this webhook.
|
||||
ActivityType string `protobuf:"bytes,2,opt,name=activity_type,json=activityType,proto3" json:"activity_type,omitempty"`
|
||||
// The resource name of the creator.
|
||||
// Format: users/{user}
|
||||
Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
|
||||
Memo *Memo `protobuf:"bytes,5,opt,name=memo,proto3" json:"memo,omitempty"`
|
||||
Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"`
|
||||
// The creation timestamp of the activity.
|
||||
CreateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
|
||||
// The memo that triggered this webhook (if applicable).
|
||||
Memo *Memo `protobuf:"bytes,5,opt,name=memo,proto3" json:"memo,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -473,45 +632,67 @@ var File_api_v1_webhook_service_proto protoreflect.FileDescriptor
|
|||
|
||||
const file_api_v1_webhook_service_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1capi/v1/webhook_service.proto\x12\fmemos.api.v1\x1a\x19api/v1/memo_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xd3\x01\n" +
|
||||
"\aWebhook\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x05R\x02id\x12\x18\n" +
|
||||
"\acreator\x18\x02 \x01(\tR\acreator\x12;\n" +
|
||||
"\vcreate_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\n" +
|
||||
"createTime\x12;\n" +
|
||||
"\vupdate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\n" +
|
||||
"updateTime\x12\x12\n" +
|
||||
"\x04name\x18\x05 \x01(\tR\x04name\x12\x10\n" +
|
||||
"\x03url\x18\x06 \x01(\tR\x03url\"<\n" +
|
||||
"\x14CreateWebhookRequest\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" +
|
||||
"\x03url\x18\x02 \x01(\tR\x03url\"#\n" +
|
||||
"\x11GetWebhookRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x05R\x02id\"/\n" +
|
||||
"\x13ListWebhooksRequest\x12\x18\n" +
|
||||
"\acreator\x18\x02 \x01(\tR\acreator\"I\n" +
|
||||
"\x14ListWebhooksResponse\x121\n" +
|
||||
"\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\"\x84\x01\n" +
|
||||
"\x14UpdateWebhookRequest\x12/\n" +
|
||||
"\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookR\awebhook\x12;\n" +
|
||||
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
|
||||
"updateMask\"&\n" +
|
||||
"\x14DeleteWebhookRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x05R\x02id\"\xcd\x01\n" +
|
||||
"\x15WebhookRequestPayload\x12\x10\n" +
|
||||
"\x03url\x18\x01 \x01(\tR\x03url\x12#\n" +
|
||||
"\ractivity_type\x18\x02 \x01(\tR\factivityType\x12\x18\n" +
|
||||
"\acreator\x18\x03 \x01(\tR\acreator\x12;\n" +
|
||||
"\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\n" +
|
||||
"createTime\x12&\n" +
|
||||
"\x04memo\x18\x05 \x01(\v2\x12.memos.api.v1.MemoR\x04memo2\xd8\x04\n" +
|
||||
"\x0eWebhookService\x12g\n" +
|
||||
"\rCreateWebhook\x12\".memos.api.v1.CreateWebhookRequest\x1a\x15.memos.api.v1.Webhook\"\x1b\x82\xd3\xe4\x93\x02\x15:\x01*\"\x10/api/v1/webhooks\x12h\n" +
|
||||
"\x1capi/v1/webhook_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x19api/v1/memo_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xac\x03\n" +
|
||||
"\aWebhook\x12\x17\n" +
|
||||
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x15\n" +
|
||||
"\x03uid\x18\x02 \x01(\tB\x03\xe0A\x03R\x03uid\x12&\n" +
|
||||
"\fdisplay_name\x18\x03 \x01(\tB\x03\xe0A\x02R\vdisplayName\x12\x15\n" +
|
||||
"\x03url\x18\x04 \x01(\tB\x03\xe0A\x02R\x03url\x12\x1d\n" +
|
||||
"\acreator\x18\x05 \x01(\tB\x03\xe0A\x03R\acreator\x12.\n" +
|
||||
"\x05state\x18\x06 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x02R\x05state\x12@\n" +
|
||||
"\vcreate_time\x18\a \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
|
||||
"createTime\x12@\n" +
|
||||
"\vupdate_time\x18\b \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
|
||||
"updateTime\x12\x17\n" +
|
||||
"\x04etag\x18\t \x01(\tB\x03\xe0A\x03R\x04etag:F\xeaAC\n" +
|
||||
"\x14memos.api.v1/Webhook\x12\x12webhooks/{webhook}\x1a\x04name*\bwebhooks2\awebhook\"\xc0\x01\n" +
|
||||
"\x13ListWebhooksRequest\x12 \n" +
|
||||
"\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
|
||||
"\n" +
|
||||
"GetWebhook\x12\x1f.memos.api.v1.GetWebhookRequest\x1a\x15.memos.api.v1.Webhook\"\"\xdaA\x02id\x82\xd3\xe4\x93\x02\x17\x12\x15/api/v1/webhooks/{id}\x12o\n" +
|
||||
"\fListWebhooks\x12!.memos.api.v1.ListWebhooksRequest\x1a\".memos.api.v1.ListWebhooksResponse\"\x18\x82\xd3\xe4\x93\x02\x12\x12\x10/api/v1/webhooks\x12\x90\x01\n" +
|
||||
"\rUpdateWebhook\x12\".memos.api.v1.UpdateWebhookRequest\x1a\x15.memos.api.v1.Webhook\"D\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x02(:\awebhook2\x1d/api/v1/webhooks/{webhook.id}\x12o\n" +
|
||||
"\rDeleteWebhook\x12\".memos.api.v1.DeleteWebhookRequest\x1a\x16.google.protobuf.Empty\"\"\xdaA\x02id\x82\xd3\xe4\x93\x02\x17*\x15/api/v1/webhooks/{id}B\xab\x01\n" +
|
||||
"page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\x12\x1b\n" +
|
||||
"\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter\x12\x1e\n" +
|
||||
"\border_by\x18\x04 \x01(\tB\x03\xe0A\x01R\aorderBy\x12&\n" +
|
||||
"\fshow_deleted\x18\x05 \x01(\bB\x03\xe0A\x01R\vshowDeleted\"\x90\x01\n" +
|
||||
"\x14ListWebhooksResponse\x121\n" +
|
||||
"\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\x12&\n" +
|
||||
"\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
|
||||
"\n" +
|
||||
"total_size\x18\x03 \x01(\x05R\ttotalSize\"\x83\x01\n" +
|
||||
"\x11GetWebhookRequest\x120\n" +
|
||||
"\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
|
||||
"\x14memos.api.v1/WebhookR\x04name\x12<\n" +
|
||||
"\tread_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\breadMask\"\xc1\x01\n" +
|
||||
"\x14CreateWebhookRequest\x127\n" +
|
||||
"\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookB\x06\xe0A\x02\xe0A\x04R\awebhook\x12\"\n" +
|
||||
"\n" +
|
||||
"webhook_id\x18\x02 \x01(\tB\x03\xe0A\x01R\twebhookId\x12(\n" +
|
||||
"\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" +
|
||||
"\n" +
|
||||
"request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xb8\x01\n" +
|
||||
"\x14UpdateWebhookRequest\x124\n" +
|
||||
"\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookB\x03\xe0A\x02R\awebhook\x12@\n" +
|
||||
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" +
|
||||
"updateMask\x12(\n" +
|
||||
"\rallow_missing\x18\x03 \x01(\bB\x03\xe0A\x01R\fallowMissing\"c\n" +
|
||||
"\x14DeleteWebhookRequest\x120\n" +
|
||||
"\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
|
||||
"\x14memos.api.v1/WebhookR\x04name\x12\x19\n" +
|
||||
"\x05force\x18\x02 \x01(\bB\x03\xe0A\x01R\x05force\"\xfc\x01\n" +
|
||||
"\x15WebhookRequestPayload\x12\x15\n" +
|
||||
"\x03url\x18\x01 \x01(\tB\x03\xe0A\x02R\x03url\x12(\n" +
|
||||
"\ractivity_type\x18\x02 \x01(\tB\x03\xe0A\x02R\factivityType\x123\n" +
|
||||
"\acreator\x18\x03 \x01(\tB\x19\xe0A\x03\xfaA\x13\n" +
|
||||
"\x11memos.api.v1/UserR\acreator\x12@\n" +
|
||||
"\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
|
||||
"createTime\x12+\n" +
|
||||
"\x04memo\x18\x05 \x01(\v2\x12.memos.api.v1.MemoB\x03\xe0A\x01R\x04memo2\xf8\x04\n" +
|
||||
"\x0eWebhookService\x12o\n" +
|
||||
"\fListWebhooks\x12!.memos.api.v1.ListWebhooksRequest\x1a\".memos.api.v1.ListWebhooksResponse\"\x18\x82\xd3\xe4\x93\x02\x12\x12\x10/api/v1/webhooks\x12n\n" +
|
||||
"\n" +
|
||||
"GetWebhook\x12\x1f.memos.api.v1.GetWebhookRequest\x1a\x15.memos.api.v1.Webhook\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b\x12\x19/api/v1/{name=webhooks/*}\x12w\n" +
|
||||
"\rCreateWebhook\x12\".memos.api.v1.CreateWebhookRequest\x1a\x15.memos.api.v1.Webhook\"+\xdaA\awebhook\x82\xd3\xe4\x93\x02\x1b:\awebhook\"\x10/api/v1/webhooks\x12\x94\x01\n" +
|
||||
"\rUpdateWebhook\x12\".memos.api.v1.UpdateWebhookRequest\x1a\x15.memos.api.v1.Webhook\"H\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x02,:\awebhook2!/api/v1/{webhook.name=webhooks/*}\x12u\n" +
|
||||
"\rDeleteWebhook\x12\".memos.api.v1.DeleteWebhookRequest\x1a\x16.google.protobuf.Empty\"(\xdaA\x04name\x82\xd3\xe4\x93\x02\x1b*\x19/api/v1/{name=webhooks/*}B\xab\x01\n" +
|
||||
"\x10com.memos.api.v1B\x13WebhookServiceProtoP\x01Z0github.com/usememos/memos/proto/gen/api/v1;apiv1\xa2\x02\x03MAX\xaa\x02\fMemos.Api.V1\xca\x02\fMemos\\Api\\V1\xe2\x02\x18Memos\\Api\\V1\\GPBMetadata\xea\x02\x0eMemos::Api::V1b\x06proto3"
|
||||
|
||||
var (
|
||||
|
|
@ -529,41 +710,45 @@ func file_api_v1_webhook_service_proto_rawDescGZIP() []byte {
|
|||
var file_api_v1_webhook_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_api_v1_webhook_service_proto_goTypes = []any{
|
||||
(*Webhook)(nil), // 0: memos.api.v1.Webhook
|
||||
(*CreateWebhookRequest)(nil), // 1: memos.api.v1.CreateWebhookRequest
|
||||
(*GetWebhookRequest)(nil), // 2: memos.api.v1.GetWebhookRequest
|
||||
(*ListWebhooksRequest)(nil), // 3: memos.api.v1.ListWebhooksRequest
|
||||
(*ListWebhooksResponse)(nil), // 4: memos.api.v1.ListWebhooksResponse
|
||||
(*ListWebhooksRequest)(nil), // 1: memos.api.v1.ListWebhooksRequest
|
||||
(*ListWebhooksResponse)(nil), // 2: memos.api.v1.ListWebhooksResponse
|
||||
(*GetWebhookRequest)(nil), // 3: memos.api.v1.GetWebhookRequest
|
||||
(*CreateWebhookRequest)(nil), // 4: memos.api.v1.CreateWebhookRequest
|
||||
(*UpdateWebhookRequest)(nil), // 5: memos.api.v1.UpdateWebhookRequest
|
||||
(*DeleteWebhookRequest)(nil), // 6: memos.api.v1.DeleteWebhookRequest
|
||||
(*WebhookRequestPayload)(nil), // 7: memos.api.v1.WebhookRequestPayload
|
||||
(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
|
||||
(*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask
|
||||
(*Memo)(nil), // 10: memos.api.v1.Memo
|
||||
(*emptypb.Empty)(nil), // 11: google.protobuf.Empty
|
||||
(State)(0), // 8: memos.api.v1.State
|
||||
(*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
|
||||
(*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask
|
||||
(*Memo)(nil), // 11: memos.api.v1.Memo
|
||||
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
|
||||
}
|
||||
var file_api_v1_webhook_service_proto_depIdxs = []int32{
|
||||
8, // 0: memos.api.v1.Webhook.create_time:type_name -> google.protobuf.Timestamp
|
||||
8, // 1: memos.api.v1.Webhook.update_time:type_name -> google.protobuf.Timestamp
|
||||
0, // 2: memos.api.v1.ListWebhooksResponse.webhooks:type_name -> memos.api.v1.Webhook
|
||||
0, // 3: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
|
||||
9, // 4: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask
|
||||
8, // 5: memos.api.v1.WebhookRequestPayload.create_time:type_name -> google.protobuf.Timestamp
|
||||
10, // 6: memos.api.v1.WebhookRequestPayload.memo:type_name -> memos.api.v1.Memo
|
||||
1, // 7: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest
|
||||
2, // 8: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest
|
||||
3, // 9: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest
|
||||
5, // 10: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest
|
||||
6, // 11: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest
|
||||
0, // 12: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook
|
||||
0, // 13: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook
|
||||
4, // 14: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse
|
||||
0, // 15: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook
|
||||
11, // 16: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty
|
||||
12, // [12:17] is the sub-list for method output_type
|
||||
7, // [7:12] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
8, // 0: memos.api.v1.Webhook.state:type_name -> memos.api.v1.State
|
||||
9, // 1: memos.api.v1.Webhook.create_time:type_name -> google.protobuf.Timestamp
|
||||
9, // 2: memos.api.v1.Webhook.update_time:type_name -> google.protobuf.Timestamp
|
||||
0, // 3: memos.api.v1.ListWebhooksResponse.webhooks:type_name -> memos.api.v1.Webhook
|
||||
10, // 4: memos.api.v1.GetWebhookRequest.read_mask:type_name -> google.protobuf.FieldMask
|
||||
0, // 5: memos.api.v1.CreateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
|
||||
0, // 6: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
|
||||
10, // 7: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask
|
||||
9, // 8: memos.api.v1.WebhookRequestPayload.create_time:type_name -> google.protobuf.Timestamp
|
||||
11, // 9: memos.api.v1.WebhookRequestPayload.memo:type_name -> memos.api.v1.Memo
|
||||
1, // 10: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest
|
||||
3, // 11: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest
|
||||
4, // 12: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest
|
||||
5, // 13: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest
|
||||
6, // 14: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest
|
||||
2, // 15: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse
|
||||
0, // 16: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook
|
||||
0, // 17: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook
|
||||
0, // 18: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook
|
||||
12, // 19: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty
|
||||
15, // [15:20] is the sub-list for method output_type
|
||||
10, // [10:15] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_api_v1_webhook_service_proto_init() }
|
||||
|
|
@ -571,6 +756,7 @@ func file_api_v1_webhook_service_proto_init() {
|
|||
if File_api_v1_webhook_service_proto != nil {
|
||||
return
|
||||
}
|
||||
file_api_v1_common_proto_init()
|
||||
file_api_v1_memo_service_proto_init()
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
|
|
|||
|
|
@ -35,67 +35,6 @@ var (
|
|||
_ = metadata.Join
|
||||
)
|
||||
|
||||
func request_WebhookService_CreateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CreateWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.CreateWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WebhookService_CreateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CreateWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.CreateWebhook(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
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.GetWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
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.GetWebhook(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
var filter_WebhookService_ListWebhooks_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
|
||||
func request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
|
|
@ -129,7 +68,96 @@ func local_request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler
|
|||
return msg, metadata, err
|
||||
}
|
||||
|
||||
var filter_WebhookService_UpdateWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"webhook": 0, "id": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
|
||||
var filter_WebhookService_GetWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
|
||||
func request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
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)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_GetWebhook_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GetWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
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)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_GetWebhook_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GetWebhook(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
var filter_WebhookService_CreateWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"webhook": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
|
||||
func request_WebhookService_CreateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CreateWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_CreateWebhook_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.CreateWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_WebhookService_CreateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CreateWebhookRequest
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Webhook); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_CreateWebhook_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.CreateWebhook(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
var filter_WebhookService_UpdateWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"webhook": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}}
|
||||
|
||||
func request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
|
|
@ -151,13 +179,13 @@ func request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler runti
|
|||
protoReq.UpdateMask = fieldMask
|
||||
}
|
||||
}
|
||||
val, ok := pathParams["webhook.id"]
|
||||
val, ok := pathParams["webhook.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.id")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.name")
|
||||
}
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "webhook.id", val)
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "webhook.name", val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.id", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.name", err)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
|
|
@ -189,13 +217,13 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler
|
|||
protoReq.UpdateMask = fieldMask
|
||||
}
|
||||
}
|
||||
val, ok := pathParams["webhook.id"]
|
||||
val, ok := pathParams["webhook.name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.id")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "webhook.name")
|
||||
}
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "webhook.id", val)
|
||||
err = runtime.PopulateFieldFromPath(&protoReq, "webhook.name", val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.id", err)
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "webhook.name", err)
|
||||
}
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
|
|
@ -207,6 +235,8 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler
|
|||
return msg, metadata, err
|
||||
}
|
||||
|
||||
var filter_WebhookService_DeleteWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
|
||||
|
||||
func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq DeleteWebhookRequest
|
||||
|
|
@ -214,13 +244,19 @@ func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runti
|
|||
err error
|
||||
)
|
||||
io.Copy(io.Discard, req.Body)
|
||||
val, ok := pathParams["id"]
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
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)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_DeleteWebhook_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.DeleteWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
|
@ -232,13 +268,19 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler
|
|||
metadata runtime.ServerMetadata
|
||||
err error
|
||||
)
|
||||
val, ok := pathParams["id"]
|
||||
val, ok := pathParams["name"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
|
||||
}
|
||||
protoReq.Id, err = runtime.Int32(val)
|
||||
protoReq.Name, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
|
||||
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)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_DeleteWebhook_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.DeleteWebhook(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
|
@ -250,46 +292,6 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler
|
|||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWebhookServiceHandlerFromEndpoint instead.
|
||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
||||
func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WebhookServiceServer) error {
|
||||
mux.Handle(http.MethodPost, pattern_WebhookService_CreateWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WebhookService_CreateWebhook_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_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WebhookService_GetWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{id}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WebhookService_GetWebhook_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_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WebhookService_ListWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
|
|
@ -310,13 +312,53 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve
|
|||
}
|
||||
forward_WebhookService_ListWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WebhookService_GetWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=webhooks/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WebhookService_GetWebhook_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_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_WebhookService_CreateWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_WebhookService_CreateWebhook_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_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPatch, pattern_WebhookService_UpdateWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/UpdateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{webhook.id}"))
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/UpdateWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=webhooks/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
|
|
@ -336,7 +378,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve
|
|||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/DeleteWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{id}"))
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/DeleteWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=webhooks/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
|
|
@ -390,40 +432,6 @@ func RegisterWebhookServiceHandler(ctx context.Context, mux *runtime.ServeMux, c
|
|||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "WebhookServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
||||
func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WebhookServiceClient) error {
|
||||
mux.Handle(http.MethodPost, pattern_WebhookService_CreateWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WebhookService_GetWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{id}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WebhookService_GetWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WebhookService_ListWebhooks_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
|
|
@ -441,11 +449,45 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve
|
|||
}
|
||||
forward_WebhookService_ListWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodGet, pattern_WebhookService_GetWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=webhooks/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WebhookService_GetWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_WebhookService_CreateWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPatch, pattern_WebhookService_UpdateWebhook_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)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/UpdateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{webhook.id}"))
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/UpdateWebhook", runtime.WithHTTPPathPattern("/api/v1/{webhook.name=webhooks/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
|
|
@ -462,7 +504,7 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve
|
|||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/DeleteWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{id}"))
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/DeleteWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=webhooks/*}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
|
|
@ -479,17 +521,17 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve
|
|||
}
|
||||
|
||||
var (
|
||||
pattern_WebhookService_CreateWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "webhooks"}, ""))
|
||||
pattern_WebhookService_GetWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "webhooks", "id"}, ""))
|
||||
pattern_WebhookService_ListWebhooks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "webhooks"}, ""))
|
||||
pattern_WebhookService_UpdateWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "webhooks", "webhook.id"}, ""))
|
||||
pattern_WebhookService_DeleteWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "webhooks", "id"}, ""))
|
||||
pattern_WebhookService_GetWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "webhooks", "name"}, ""))
|
||||
pattern_WebhookService_CreateWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "webhooks"}, ""))
|
||||
pattern_WebhookService_UpdateWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "webhooks", "webhook.name"}, ""))
|
||||
pattern_WebhookService_DeleteWebhook_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "webhooks", "name"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_WebhookService_CreateWebhook_0 = runtime.ForwardResponseMessage
|
||||
forward_WebhookService_GetWebhook_0 = runtime.ForwardResponseMessage
|
||||
forward_WebhookService_ListWebhooks_0 = runtime.ForwardResponseMessage
|
||||
forward_WebhookService_GetWebhook_0 = runtime.ForwardResponseMessage
|
||||
forward_WebhookService_CreateWebhook_0 = runtime.ForwardResponseMessage
|
||||
forward_WebhookService_UpdateWebhook_0 = runtime.ForwardResponseMessage
|
||||
forward_WebhookService_DeleteWebhook_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import (
|
|||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
WebhookService_CreateWebhook_FullMethodName = "/memos.api.v1.WebhookService/CreateWebhook"
|
||||
WebhookService_GetWebhook_FullMethodName = "/memos.api.v1.WebhookService/GetWebhook"
|
||||
WebhookService_ListWebhooks_FullMethodName = "/memos.api.v1.WebhookService/ListWebhooks"
|
||||
WebhookService_GetWebhook_FullMethodName = "/memos.api.v1.WebhookService/GetWebhook"
|
||||
WebhookService_CreateWebhook_FullMethodName = "/memos.api.v1.WebhookService/CreateWebhook"
|
||||
WebhookService_UpdateWebhook_FullMethodName = "/memos.api.v1.WebhookService/UpdateWebhook"
|
||||
WebhookService_DeleteWebhook_FullMethodName = "/memos.api.v1.WebhookService/DeleteWebhook"
|
||||
)
|
||||
|
|
@ -31,15 +31,15 @@ const (
|
|||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type WebhookServiceClient interface {
|
||||
// CreateWebhook creates a new webhook.
|
||||
CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
|
||||
// GetWebhook returns a webhook by id.
|
||||
GetWebhook(ctx context.Context, in *GetWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
|
||||
// ListWebhooks returns a list of webhooks.
|
||||
ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error)
|
||||
// GetWebhook gets a webhook by name.
|
||||
GetWebhook(ctx context.Context, in *GetWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
|
||||
// CreateWebhook creates a new webhook.
|
||||
CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
|
||||
// UpdateWebhook updates a webhook.
|
||||
UpdateWebhook(ctx context.Context, in *UpdateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error)
|
||||
// DeleteWebhook deletes a webhook by id.
|
||||
// DeleteWebhook deletes a webhook.
|
||||
DeleteWebhook(ctx context.Context, in *DeleteWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
|
|
@ -51,10 +51,10 @@ func NewWebhookServiceClient(cc grpc.ClientConnInterface) WebhookServiceClient {
|
|||
return &webhookServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *webhookServiceClient) CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error) {
|
||||
func (c *webhookServiceClient) ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Webhook)
|
||||
err := c.cc.Invoke(ctx, WebhookService_CreateWebhook_FullMethodName, in, out, cOpts...)
|
||||
out := new(ListWebhooksResponse)
|
||||
err := c.cc.Invoke(ctx, WebhookService_ListWebhooks_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -71,10 +71,10 @@ func (c *webhookServiceClient) GetWebhook(ctx context.Context, in *GetWebhookReq
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *webhookServiceClient) ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error) {
|
||||
func (c *webhookServiceClient) CreateWebhook(ctx context.Context, in *CreateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListWebhooksResponse)
|
||||
err := c.cc.Invoke(ctx, WebhookService_ListWebhooks_FullMethodName, in, out, cOpts...)
|
||||
out := new(Webhook)
|
||||
err := c.cc.Invoke(ctx, WebhookService_CreateWebhook_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -105,15 +105,15 @@ func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, in *DeleteWebh
|
|||
// All implementations must embed UnimplementedWebhookServiceServer
|
||||
// for forward compatibility.
|
||||
type WebhookServiceServer interface {
|
||||
// CreateWebhook creates a new webhook.
|
||||
CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error)
|
||||
// GetWebhook returns a webhook by id.
|
||||
GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error)
|
||||
// ListWebhooks returns a list of webhooks.
|
||||
ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error)
|
||||
// GetWebhook gets a webhook by name.
|
||||
GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error)
|
||||
// CreateWebhook creates a new webhook.
|
||||
CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error)
|
||||
// UpdateWebhook updates a webhook.
|
||||
UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error)
|
||||
// DeleteWebhook deletes a webhook by id.
|
||||
// DeleteWebhook deletes a webhook.
|
||||
DeleteWebhook(context.Context, *DeleteWebhookRequest) (*emptypb.Empty, error)
|
||||
mustEmbedUnimplementedWebhookServiceServer()
|
||||
}
|
||||
|
|
@ -125,14 +125,14 @@ type WebhookServiceServer interface {
|
|||
// pointer dereference when methods are called.
|
||||
type UnimplementedWebhookServiceServer struct{}
|
||||
|
||||
func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented")
|
||||
func (UnimplementedWebhookServiceServer) ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListWebhooks not implemented")
|
||||
}
|
||||
func (UnimplementedWebhookServiceServer) GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetWebhook not implemented")
|
||||
}
|
||||
func (UnimplementedWebhookServiceServer) ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListWebhooks not implemented")
|
||||
func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented")
|
||||
}
|
||||
func (UnimplementedWebhookServiceServer) UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWebhook not implemented")
|
||||
|
|
@ -161,20 +161,20 @@ func RegisterWebhookServiceServer(s grpc.ServiceRegistrar, srv WebhookServiceSer
|
|||
s.RegisterService(&WebhookService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _WebhookService_CreateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateWebhookRequest)
|
||||
func _WebhookService_ListWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListWebhooksRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WebhookServiceServer).CreateWebhook(ctx, in)
|
||||
return srv.(WebhookServiceServer).ListWebhooks(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: WebhookService_CreateWebhook_FullMethodName,
|
||||
FullMethod: WebhookService_ListWebhooks_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WebhookServiceServer).CreateWebhook(ctx, req.(*CreateWebhookRequest))
|
||||
return srv.(WebhookServiceServer).ListWebhooks(ctx, req.(*ListWebhooksRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
|
@ -197,20 +197,20 @@ func _WebhookService_GetWebhook_Handler(srv interface{}, ctx context.Context, de
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WebhookService_ListWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListWebhooksRequest)
|
||||
func _WebhookService_CreateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateWebhookRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WebhookServiceServer).ListWebhooks(ctx, in)
|
||||
return srv.(WebhookServiceServer).CreateWebhook(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: WebhookService_ListWebhooks_FullMethodName,
|
||||
FullMethod: WebhookService_CreateWebhook_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WebhookServiceServer).ListWebhooks(ctx, req.(*ListWebhooksRequest))
|
||||
return srv.(WebhookServiceServer).CreateWebhook(ctx, req.(*CreateWebhookRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
|
@ -259,16 +259,16 @@ var WebhookService_ServiceDesc = grpc.ServiceDesc{
|
|||
HandlerType: (*WebhookServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateWebhook",
|
||||
Handler: _WebhookService_CreateWebhook_Handler,
|
||||
MethodName: "ListWebhooks",
|
||||
Handler: _WebhookService_ListWebhooks_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetWebhook",
|
||||
Handler: _WebhookService_GetWebhook_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListWebhooks",
|
||||
Handler: _WebhookService_ListWebhooks_Handler,
|
||||
MethodName: "CreateWebhook",
|
||||
Handler: _WebhookService_CreateWebhook_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateWebhook",
|
||||
|
|
|
|||
|
|
@ -609,11 +609,44 @@ paths:
|
|||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: creator
|
||||
description: The name of the creator.
|
||||
- name: pageSize
|
||||
description: |-
|
||||
Optional. The maximum number of webhooks to return.
|
||||
The service may return fewer than this value.
|
||||
If unspecified, at most 50 webhooks will be returned.
|
||||
The maximum value is 1000; values above 1000 will be coerced to 1000.
|
||||
in: query
|
||||
required: false
|
||||
type: integer
|
||||
format: int32
|
||||
- name: pageToken
|
||||
description: |-
|
||||
Optional. A page token, received from a previous `ListWebhooks` call.
|
||||
Provide this to retrieve the subsequent page.
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
- name: filter
|
||||
description: |-
|
||||
Optional. Filter to apply to the list results.
|
||||
Example: "state=ACTIVE" or "creator=users/123"
|
||||
Supported operators: =, !=, <, <=, >, >=, :
|
||||
Supported fields: display_name, url, creator, state, create_time, update_time
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
- name: orderBy
|
||||
description: |-
|
||||
Optional. The order to sort results by.
|
||||
Example: "create_time desc" or "display_name asc"
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
- name: showDeleted
|
||||
description: Optional. If true, show deleted webhooks in the response.
|
||||
in: query
|
||||
required: false
|
||||
type: boolean
|
||||
tags:
|
||||
- WebhookService
|
||||
post:
|
||||
|
|
@ -629,93 +662,34 @@ paths:
|
|||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: body
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/v1CreateWebhookRequest'
|
||||
tags:
|
||||
- WebhookService
|
||||
/api/v1/webhooks/{id}:
|
||||
get:
|
||||
summary: GetWebhook returns a webhook by id.
|
||||
operationId: WebhookService_GetWebhook
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v1Webhook'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
tags:
|
||||
- WebhookService
|
||||
delete:
|
||||
summary: DeleteWebhook deletes a webhook by id.
|
||||
operationId: WebhookService_DeleteWebhook
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
type: object
|
||||
properties: {}
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
tags:
|
||||
- WebhookService
|
||||
/api/v1/webhooks/{webhook.id}:
|
||||
patch:
|
||||
summary: UpdateWebhook updates a webhook.
|
||||
operationId: WebhookService_UpdateWebhook
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v1Webhook'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: webhook.id
|
||||
in: path
|
||||
required: true
|
||||
type: integer
|
||||
format: int32
|
||||
- name: webhook
|
||||
description: Required. The webhook to create.
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
creator:
|
||||
type: string
|
||||
description: The name of the creator.
|
||||
createTime:
|
||||
type: string
|
||||
format: date-time
|
||||
updateTime:
|
||||
type: string
|
||||
format: date-time
|
||||
name:
|
||||
type: string
|
||||
url:
|
||||
type: string
|
||||
$ref: '#/definitions/v1Webhook'
|
||||
required:
|
||||
- webhook
|
||||
- name: webhookId
|
||||
description: |-
|
||||
Optional. The webhook ID to use for this webhook.
|
||||
If empty, a unique ID will be generated.
|
||||
Must match the pattern [a-z0-9-]+
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
- name: validateOnly
|
||||
description: Optional. If set, validate the request but don't actually create the webhook.
|
||||
in: query
|
||||
required: false
|
||||
type: boolean
|
||||
- name: requestId
|
||||
description: |-
|
||||
Optional. An idempotency token that can be used to ensure that multiple
|
||||
requests to create a webhook have the same result.
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
tags:
|
||||
- WebhookService
|
||||
/api/v1/workspace/profile:
|
||||
|
|
@ -1172,6 +1146,36 @@ paths:
|
|||
tags:
|
||||
- ResourceService
|
||||
/api/v1/{name_5}:
|
||||
get:
|
||||
summary: GetWebhook gets a webhook by name.
|
||||
operationId: WebhookService_GetWebhook
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v1Webhook'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: name_5
|
||||
description: |-
|
||||
Required. The resource name of the webhook.
|
||||
Format: webhooks/{webhook}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: webhooks/[^/]+
|
||||
- name: readMask
|
||||
description: |-
|
||||
Optional. The fields to return in the response.
|
||||
If not specified, all fields are returned.
|
||||
in: query
|
||||
required: false
|
||||
type: string
|
||||
tags:
|
||||
- WebhookService
|
||||
delete:
|
||||
summary: DeleteMemo deletes a memo.
|
||||
operationId: MemoService_DeleteMemo
|
||||
|
|
@ -1194,6 +1198,36 @@ paths:
|
|||
pattern: memos/[^/]+
|
||||
tags:
|
||||
- MemoService
|
||||
/api/v1/{name_6}:
|
||||
delete:
|
||||
summary: DeleteWebhook deletes a webhook.
|
||||
operationId: WebhookService_DeleteWebhook
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
type: object
|
||||
properties: {}
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: name_6
|
||||
description: |-
|
||||
Required. The resource name of the webhook to delete.
|
||||
Format: webhooks/{webhook}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: webhooks/[^/]+
|
||||
- name: force
|
||||
description: Optional. If set to true, the webhook will be deleted even if it has associated data.
|
||||
in: query
|
||||
required: false
|
||||
type: boolean
|
||||
tags:
|
||||
- WebhookService
|
||||
/api/v1/{name}:
|
||||
get:
|
||||
summary: GetActivity returns the activity with the given id.
|
||||
|
|
@ -2022,6 +2056,81 @@ paths:
|
|||
type: boolean
|
||||
tags:
|
||||
- UserService
|
||||
/api/v1/{webhook.name}:
|
||||
patch:
|
||||
summary: UpdateWebhook updates a webhook.
|
||||
operationId: WebhookService_UpdateWebhook
|
||||
responses:
|
||||
"200":
|
||||
description: A successful response.
|
||||
schema:
|
||||
$ref: '#/definitions/v1Webhook'
|
||||
default:
|
||||
description: An unexpected error response.
|
||||
schema:
|
||||
$ref: '#/definitions/googlerpcStatus'
|
||||
parameters:
|
||||
- name: webhook.name
|
||||
description: |-
|
||||
The resource name of the webhook.
|
||||
Format: webhooks/{webhook}
|
||||
in: path
|
||||
required: true
|
||||
type: string
|
||||
pattern: webhooks/[^/]+
|
||||
- name: webhook
|
||||
description: Required. The webhook to update.
|
||||
in: body
|
||||
required: true
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
uid:
|
||||
type: string
|
||||
description: Output only. The system generated unique identifier.
|
||||
readOnly: true
|
||||
displayName:
|
||||
type: string
|
||||
description: Required. The display name of the webhook.
|
||||
url:
|
||||
type: string
|
||||
description: Required. The target URL for the webhook.
|
||||
creator:
|
||||
type: string
|
||||
title: |-
|
||||
Output only. The resource name of the creator.
|
||||
Format: users/{user}
|
||||
readOnly: true
|
||||
state:
|
||||
$ref: '#/definitions/v1State'
|
||||
description: The state of the webhook.
|
||||
createTime:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Output only. The creation timestamp.
|
||||
readOnly: true
|
||||
updateTime:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Output only. The last update timestamp.
|
||||
readOnly: true
|
||||
etag:
|
||||
type: string
|
||||
description: Output only. The etag for this resource.
|
||||
readOnly: true
|
||||
title: Required. The webhook to update.
|
||||
required:
|
||||
- displayName
|
||||
- url
|
||||
- state
|
||||
- webhook
|
||||
- name: allowMissing
|
||||
description: Optional. If set to true, allows updating sensitive fields.
|
||||
in: query
|
||||
required: false
|
||||
type: boolean
|
||||
tags:
|
||||
- WebhookService
|
||||
/file/{name}/{filename}:
|
||||
get:
|
||||
summary: GetResourceBinary returns a resource binary by name.
|
||||
|
|
@ -2726,13 +2835,6 @@ definitions:
|
|||
properties:
|
||||
content:
|
||||
type: string
|
||||
v1CreateWebhookRequest:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
url:
|
||||
type: string
|
||||
v1Direction:
|
||||
type: string
|
||||
enum:
|
||||
|
|
@ -3011,6 +3113,16 @@ definitions:
|
|||
items:
|
||||
type: object
|
||||
$ref: '#/definitions/v1Webhook'
|
||||
description: The list of webhooks.
|
||||
nextPageToken:
|
||||
type: string
|
||||
description: |-
|
||||
A token that can be sent as `page_token` to retrieve the next page.
|
||||
If this field is omitted, there are no subsequent pages.
|
||||
totalSize:
|
||||
type: integer
|
||||
format: int32
|
||||
description: The total count of webhooks (may be approximate).
|
||||
v1MathBlockNode:
|
||||
type: object
|
||||
properties:
|
||||
|
|
@ -3526,22 +3638,48 @@ definitions:
|
|||
v1Webhook:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
name:
|
||||
type: string
|
||||
title: |-
|
||||
The resource name of the webhook.
|
||||
Format: webhooks/{webhook}
|
||||
uid:
|
||||
type: string
|
||||
description: Output only. The system generated unique identifier.
|
||||
readOnly: true
|
||||
displayName:
|
||||
type: string
|
||||
description: Required. The display name of the webhook.
|
||||
url:
|
||||
type: string
|
||||
description: Required. The target URL for the webhook.
|
||||
creator:
|
||||
type: string
|
||||
description: The name of the creator.
|
||||
title: |-
|
||||
Output only. The resource name of the creator.
|
||||
Format: users/{user}
|
||||
readOnly: true
|
||||
state:
|
||||
$ref: '#/definitions/v1State'
|
||||
description: The state of the webhook.
|
||||
createTime:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Output only. The creation timestamp.
|
||||
readOnly: true
|
||||
updateTime:
|
||||
type: string
|
||||
format: date-time
|
||||
name:
|
||||
type: string
|
||||
url:
|
||||
description: Output only. The last update timestamp.
|
||||
readOnly: true
|
||||
etag:
|
||||
type: string
|
||||
description: Output only. The etag for this resource.
|
||||
readOnly: true
|
||||
required:
|
||||
- displayName
|
||||
- url
|
||||
- state
|
||||
v1WorkspaceProfile:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const (
|
|||
InboxNamePrefix = "inboxes/"
|
||||
IdentityProviderNamePrefix = "identityProviders/"
|
||||
ActivityNamePrefix = "activities/"
|
||||
WebhookNamePrefix = "webhooks/"
|
||||
)
|
||||
|
||||
// GetNameParentTokens returns the tokens from a resource name.
|
||||
|
|
@ -117,3 +118,16 @@ func ExtractActivityIDFromName(name string) (int32, error) {
|
|||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
// ExtractWebhookIDFromName returns the webhook ID from a resource name.
|
||||
func ExtractWebhookIDFromName(name string) (int32, error) {
|
||||
tokens, err := GetNameParentTokens(name, WebhookNamePrefix)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
id, err := util.ConvertStringToInt32(tokens[0])
|
||||
if err != nil {
|
||||
return 0, errors.Errorf("invalid webhook ID %q", tokens[0])
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package v1
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -21,10 +22,21 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWe
|
|||
return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
|
||||
}
|
||||
|
||||
// TODO: Handle webhook_id, validate_only, and request_id fields
|
||||
if request.ValidateOnly {
|
||||
// Perform validation checks without actually creating the webhook
|
||||
return &v1pb.Webhook{
|
||||
DisplayName: request.Webhook.DisplayName,
|
||||
Url: request.Webhook.Url,
|
||||
Creator: fmt.Sprintf("users/%d", currentUser.ID),
|
||||
State: request.Webhook.State,
|
||||
}, nil
|
||||
}
|
||||
|
||||
webhook, err := s.Store.CreateWebhook(ctx, &store.Webhook{
|
||||
CreatorID: currentUser.ID,
|
||||
Name: request.Name,
|
||||
URL: strings.TrimSpace(request.Url),
|
||||
Name: request.Webhook.DisplayName,
|
||||
URL: strings.TrimSpace(request.Webhook.Url),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to create webhook, error: %+v", err)
|
||||
|
|
@ -32,21 +44,24 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWe
|
|||
return convertWebhookFromStore(webhook), nil
|
||||
}
|
||||
|
||||
func (s *APIV1Service) ListWebhooks(ctx context.Context, request *v1pb.ListWebhooksRequest) (*v1pb.ListWebhooksResponse, error) {
|
||||
creatorID, err := ExtractUserIDFromName(request.Creator)
|
||||
func (s *APIV1Service) ListWebhooks(ctx context.Context, _ *v1pb.ListWebhooksRequest) (*v1pb.ListWebhooksResponse, error) {
|
||||
currentUser, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid creator name: %v", err)
|
||||
return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
|
||||
}
|
||||
|
||||
// TODO: Implement proper filtering, ordering, and pagination
|
||||
// For now, list webhooks for the current user
|
||||
webhooks, err := s.Store.ListWebhooks(ctx, &store.FindWebhook{
|
||||
CreatorID: &creatorID,
|
||||
CreatorID: ¤tUser.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list webhooks, error: %+v", err)
|
||||
}
|
||||
|
||||
response := &v1pb.ListWebhooksResponse{
|
||||
Webhooks: []*v1pb.Webhook{},
|
||||
Webhooks: []*v1pb.Webhook{},
|
||||
TotalSize: int32(len(webhooks)),
|
||||
}
|
||||
for _, webhook := range webhooks {
|
||||
response.Webhooks = append(response.Webhooks, convertWebhookFromStore(webhook))
|
||||
|
|
@ -55,13 +70,18 @@ func (s *APIV1Service) ListWebhooks(ctx context.Context, request *v1pb.ListWebho
|
|||
}
|
||||
|
||||
func (s *APIV1Service) GetWebhook(ctx context.Context, request *v1pb.GetWebhookRequest) (*v1pb.Webhook, error) {
|
||||
webhookID, err := ExtractWebhookIDFromName(request.Name)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
|
||||
}
|
||||
|
||||
currentUser, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
|
||||
}
|
||||
|
||||
webhook, err := s.Store.GetWebhook(ctx, &store.FindWebhook{
|
||||
ID: &request.Id,
|
||||
ID: &webhookID,
|
||||
CreatorID: ¤tUser.ID,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -70,7 +90,12 @@ func (s *APIV1Service) GetWebhook(ctx context.Context, request *v1pb.GetWebhookR
|
|||
if webhook == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "webhook not found")
|
||||
}
|
||||
return convertWebhookFromStore(webhook), nil
|
||||
|
||||
webhookPb := convertWebhookFromStore(webhook)
|
||||
|
||||
// TODO: Implement read_mask field filtering
|
||||
|
||||
return webhookPb, nil
|
||||
}
|
||||
|
||||
func (s *APIV1Service) UpdateWebhook(ctx context.Context, request *v1pb.UpdateWebhookRequest) (*v1pb.Webhook, error) {
|
||||
|
|
@ -78,13 +103,43 @@ func (s *APIV1Service) UpdateWebhook(ctx context.Context, request *v1pb.UpdateWe
|
|||
return nil, status.Errorf(codes.InvalidArgument, "update_mask is required")
|
||||
}
|
||||
|
||||
update := &store.UpdateWebhook{}
|
||||
webhookID, err := ExtractWebhookIDFromName(request.Webhook.Name)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
|
||||
}
|
||||
|
||||
currentUser, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
|
||||
}
|
||||
|
||||
// Check if webhook exists and user has permission
|
||||
existingWebhook, err := s.Store.GetWebhook(ctx, &store.FindWebhook{
|
||||
ID: &webhookID,
|
||||
CreatorID: ¤tUser.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get webhook: %v", err)
|
||||
}
|
||||
if existingWebhook == nil {
|
||||
if request.AllowMissing {
|
||||
// Could create webhook if missing, but for now return not found
|
||||
return nil, status.Errorf(codes.NotFound, "webhook not found")
|
||||
}
|
||||
return nil, status.Errorf(codes.NotFound, "webhook not found")
|
||||
}
|
||||
|
||||
update := &store.UpdateWebhook{
|
||||
ID: webhookID,
|
||||
}
|
||||
for _, field := range request.UpdateMask.Paths {
|
||||
switch field {
|
||||
case "name":
|
||||
update.Name = &request.Webhook.Name
|
||||
case "display_name":
|
||||
update.Name = &request.Webhook.DisplayName
|
||||
case "url":
|
||||
update.URL = &request.Webhook.Url
|
||||
default:
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid update path: %s", field)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +151,32 @@ func (s *APIV1Service) UpdateWebhook(ctx context.Context, request *v1pb.UpdateWe
|
|||
}
|
||||
|
||||
func (s *APIV1Service) DeleteWebhook(ctx context.Context, request *v1pb.DeleteWebhookRequest) (*emptypb.Empty, error) {
|
||||
err := s.Store.DeleteWebhook(ctx, &store.DeleteWebhook{
|
||||
ID: request.Id,
|
||||
webhookID, err := ExtractWebhookIDFromName(request.Name)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "invalid webhook name: %v", err)
|
||||
}
|
||||
|
||||
currentUser, err := s.GetCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
|
||||
}
|
||||
|
||||
// Check if webhook exists and user has permission
|
||||
webhook, err := s.Store.GetWebhook(ctx, &store.FindWebhook{
|
||||
ID: &webhookID,
|
||||
CreatorID: ¤tUser.ID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get webhook: %v", err)
|
||||
}
|
||||
if webhook == nil {
|
||||
return nil, status.Errorf(codes.NotFound, "webhook not found")
|
||||
}
|
||||
|
||||
// TODO: Handle force field properly
|
||||
|
||||
err = s.Store.DeleteWebhook(ctx, &store.DeleteWebhook{
|
||||
ID: webhookID,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to delete webhook, error: %+v", err)
|
||||
|
|
@ -106,12 +185,19 @@ func (s *APIV1Service) DeleteWebhook(ctx context.Context, request *v1pb.DeleteWe
|
|||
}
|
||||
|
||||
func convertWebhookFromStore(webhook *store.Webhook) *v1pb.Webhook {
|
||||
// Generate etag using MD5 hash of webhook data
|
||||
etag := fmt.Sprintf("%x", md5.Sum([]byte(fmt.Sprintf("%d-%d-%s-%s",
|
||||
webhook.ID, webhook.UpdatedTs, webhook.Name, webhook.URL))))
|
||||
|
||||
return &v1pb.Webhook{
|
||||
Id: webhook.ID,
|
||||
CreateTime: timestamppb.New(time.Unix(webhook.CreatedTs, 0)),
|
||||
UpdateTime: timestamppb.New(time.Unix(webhook.UpdatedTs, 0)),
|
||||
Creator: fmt.Sprintf("%s%d", UserNamePrefix, webhook.CreatorID),
|
||||
Name: webhook.Name,
|
||||
Url: webhook.URL,
|
||||
Name: fmt.Sprintf("webhooks/%d", webhook.ID),
|
||||
Uid: fmt.Sprintf("%d", webhook.ID),
|
||||
DisplayName: webhook.Name,
|
||||
Url: webhook.URL,
|
||||
Creator: fmt.Sprintf("users/%d", webhook.CreatorID),
|
||||
State: v1pb.State_NORMAL, // Default to NORMAL state for webhooks
|
||||
CreateTime: timestamppb.New(time.Unix(webhook.CreatedTs, 0)),
|
||||
UpdateTime: timestamppb.New(time.Unix(webhook.UpdatedTs, 0)),
|
||||
Etag: etag,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,34 +8,34 @@ import { useTranslate } from "@/utils/i18n";
|
|||
import { generateDialog } from "./Dialog";
|
||||
|
||||
interface Props extends DialogProps {
|
||||
webhookId?: number;
|
||||
webhookName?: string;
|
||||
onConfirm: () => void;
|
||||
}
|
||||
|
||||
interface State {
|
||||
name: string;
|
||||
displayName: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
|
||||
const { webhookId, destroy, onConfirm } = props;
|
||||
const { webhookName, destroy, onConfirm } = props;
|
||||
const t = useTranslate();
|
||||
const [state, setState] = useState({
|
||||
name: "",
|
||||
displayName: "",
|
||||
url: "",
|
||||
});
|
||||
const requestState = useLoading(false);
|
||||
const isCreating = webhookId === undefined;
|
||||
const isCreating = webhookName === undefined;
|
||||
|
||||
useEffect(() => {
|
||||
if (webhookId) {
|
||||
if (webhookName) {
|
||||
webhookServiceClient
|
||||
.getWebhook({
|
||||
id: webhookId,
|
||||
name: webhookName,
|
||||
})
|
||||
.then((webhook) => {
|
||||
setState({
|
||||
name: webhook.name,
|
||||
displayName: webhook.displayName,
|
||||
url: webhook.url,
|
||||
});
|
||||
});
|
||||
|
|
@ -51,7 +51,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
|
|||
|
||||
const handleTitleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setPartialState({
|
||||
name: e.target.value,
|
||||
displayName: e.target.value,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
|
|||
};
|
||||
|
||||
const handleSaveBtnClick = async () => {
|
||||
if (!state.name || !state.url) {
|
||||
if (!state.displayName || !state.url) {
|
||||
toast.error(t("message.fill-all-required-fields"));
|
||||
return;
|
||||
}
|
||||
|
|
@ -70,17 +70,19 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
|
|||
try {
|
||||
if (isCreating) {
|
||||
await webhookServiceClient.createWebhook({
|
||||
name: state.name,
|
||||
url: state.url,
|
||||
webhook: {
|
||||
displayName: state.displayName,
|
||||
url: state.url,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await webhookServiceClient.updateWebhook({
|
||||
webhook: {
|
||||
id: webhookId,
|
||||
name: state.name,
|
||||
name: webhookName,
|
||||
displayName: state.displayName,
|
||||
url: state.url,
|
||||
},
|
||||
updateMask: ["name", "url"],
|
||||
updateMask: ["display_name", "url"],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +114,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
|
|||
className="w-full"
|
||||
type="text"
|
||||
placeholder={t("setting.webhook-section.create-dialog.an-easy-to-remember-name")}
|
||||
value={state.name}
|
||||
value={state.displayName}
|
||||
onChange={handleTitleInputChange}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,39 +3,35 @@ import { ExternalLinkIcon, TrashIcon } from "lucide-react";
|
|||
import { useEffect, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { webhookServiceClient } from "@/grpcweb";
|
||||
import useCurrentUser from "@/hooks/useCurrentUser";
|
||||
import { Webhook } from "@/types/proto/api/v1/webhook_service";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import showCreateWebhookDialog from "../CreateWebhookDialog";
|
||||
|
||||
const listWebhooks = async (user: string) => {
|
||||
const { webhooks } = await webhookServiceClient.listWebhooks({
|
||||
creator: user,
|
||||
});
|
||||
const listWebhooks = async () => {
|
||||
const { webhooks } = await webhookServiceClient.listWebhooks({});
|
||||
return webhooks;
|
||||
};
|
||||
|
||||
const WebhookSection = () => {
|
||||
const t = useTranslate();
|
||||
const currentUser = useCurrentUser();
|
||||
const [webhooks, setWebhooks] = useState<Webhook[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
listWebhooks(currentUser.name).then((webhooks) => {
|
||||
listWebhooks().then((webhooks) => {
|
||||
setWebhooks(webhooks);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleCreateAccessTokenDialogConfirm = async () => {
|
||||
const webhooks = await listWebhooks(currentUser.name);
|
||||
const webhooks = await listWebhooks();
|
||||
setWebhooks(webhooks);
|
||||
};
|
||||
|
||||
const handleDeleteWebhook = async (webhook: Webhook) => {
|
||||
const confirmed = window.confirm(`Are you sure to delete webhook \`${webhook.name}\`? You cannot undo this action.`);
|
||||
const confirmed = window.confirm(`Are you sure to delete webhook \`${webhook.displayName}\`? You cannot undo this action.`);
|
||||
if (confirmed) {
|
||||
await webhookServiceClient.deleteWebhook({ id: webhook.id });
|
||||
setWebhooks(webhooks.filter((item) => item.id !== webhook.id));
|
||||
await webhookServiceClient.deleteWebhook({ name: webhook.name });
|
||||
setWebhooks(webhooks.filter((item) => item.name !== webhook.name));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,8 +73,8 @@ const WebhookSection = () => {
|
|||
</thead>
|
||||
<tbody className="divide-y divide-gray-200 dark:divide-gray-500">
|
||||
{webhooks.map((webhook) => (
|
||||
<tr key={webhook.id}>
|
||||
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-900 dark:text-gray-400">{webhook.name}</td>
|
||||
<tr key={webhook.name}>
|
||||
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-900 dark:text-gray-400">{webhook.displayName}</td>
|
||||
<td className="max-w-[200px] px-3 py-2 text-sm text-gray-900 dark:text-gray-400 truncate" title={webhook.url}>
|
||||
{webhook.url}
|
||||
</td>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue