Commit 3b0c8759 authored by Steven's avatar Steven

refactor: webhook service

parent c9ab03e1
...@@ -2,9 +2,12 @@ syntax = "proto3"; ...@@ -2,9 +2,12 @@ syntax = "proto3";
package memos.api.v1; package memos.api.v1;
import "api/v1/common.proto";
import "api/v1/memo_service.proto"; import "api/v1/memo_service.proto";
import "google/api/annotations.proto"; import "google/api/annotations.proto";
import "google/api/client.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/empty.proto";
import "google/protobuf/field_mask.proto"; import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
...@@ -12,91 +15,191 @@ import "google/protobuf/timestamp.proto"; ...@@ -12,91 +15,191 @@ import "google/protobuf/timestamp.proto";
option go_package = "gen/api/v1"; option go_package = "gen/api/v1";
service WebhookService { service WebhookService {
// 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. // CreateWebhook creates a new webhook.
rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) { rpc CreateWebhook(CreateWebhookRequest) returns (Webhook) {
option (google.api.http) = { option (google.api.http) = {
post: "/api/v1/webhooks" post: "/api/v1/webhooks"
body: "*" body: "webhook"
}; };
option (google.api.method_signature) = "webhook";
} }
// 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"};
}
// UpdateWebhook updates a webhook. // UpdateWebhook updates a webhook.
rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) { rpc UpdateWebhook(UpdateWebhookRequest) returns (Webhook) {
option (google.api.http) = { option (google.api.http) = {
patch: "/api/v1/webhooks/{webhook.id}" patch: "/api/v1/{webhook.name=webhooks/*}"
body: "webhook" body: "webhook"
}; };
option (google.api.method_signature) = "webhook,update_mask"; 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) { rpc DeleteWebhook(DeleteWebhookRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {delete: "/api/v1/webhooks/{id}"}; option (google.api.http) = {delete: "/api/v1/{name=webhooks/*}"};
option (google.api.method_signature) = "id"; option (google.api.method_signature) = "name";
} }
} }
message Webhook { 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. // The resource name of the webhook.
string creator = 2; // 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 { // The state of the webhook.
string name = 1; 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 { // Output only. The last update timestamp.
int32 id = 1; 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 { message ListWebhooksRequest {
// The name of the creator. // Optional. The maximum number of webhooks to return.
string creator = 2; // 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 { message ListWebhooksResponse {
// The list of webhooks.
repeated Webhook webhooks = 1; 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 { message UpdateWebhookRequest {
Webhook webhook = 1; // Required. The webhook to update.
Webhook webhook = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The list of fields to update.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
google.protobuf.FieldMask update_mask = 2; // Optional. If set to true, allows updating sensitive fields.
bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL];
} }
message DeleteWebhookRequest { 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 { 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} // 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 ( ...@@ -27,13 +27,26 @@ const (
type Webhook struct { type Webhook struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // The resource name of the webhook.
// The name of the creator. // Format: webhooks/{webhook}
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // Output only. The system generated unique identifier.
UpdateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` // Required. The display name of the webhook.
Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"` 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
...@@ -68,11 +81,32 @@ func (*Webhook) Descriptor() ([]byte, []int) { ...@@ -68,11 +81,32 @@ func (*Webhook) Descriptor() ([]byte, []int) {
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{0} return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{0}
} }
func (x *Webhook) GetId() int32 { func (x *Webhook) GetName() string {
if x != nil { 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 { func (x *Webhook) GetCreator() string {
...@@ -82,6 +116,13 @@ func (x *Webhook) GetCreator() string { ...@@ -82,6 +116,13 @@ func (x *Webhook) GetCreator() string {
return "" return ""
} }
func (x *Webhook) GetState() State {
if x != nil {
return x.State
}
return State_STATE_UNSPECIFIED
}
func (x *Webhook) GetCreateTime() *timestamppb.Timestamp { func (x *Webhook) GetCreateTime() *timestamppb.Timestamp {
if x != nil { if x != nil {
return x.CreateTime return x.CreateTime
...@@ -96,42 +137,51 @@ func (x *Webhook) GetUpdateTime() *timestamppb.Timestamp { ...@@ -96,42 +137,51 @@ func (x *Webhook) GetUpdateTime() *timestamppb.Timestamp {
return nil return nil
} }
func (x *Webhook) GetName() string { func (x *Webhook) GetEtag() string {
if x != nil { if x != nil {
return x.Name return x.Etag
} }
return "" return ""
} }
func (x *Webhook) GetUrl() string { type ListWebhooksRequest struct {
if x != nil { state protoimpl.MessageState `protogen:"open.v1"`
return x.Url // Optional. The maximum number of webhooks to return.
} // The service may return fewer than this value.
return "" // 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"`
type CreateWebhookRequest struct { // Optional. A page token, received from a previous `ListWebhooks` call.
state protoimpl.MessageState `protogen:"open.v1"` // Provide this to retrieve the subsequent page.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *CreateWebhookRequest) Reset() { func (x *ListWebhooksRequest) Reset() {
*x = CreateWebhookRequest{} *x = ListWebhooksRequest{}
mi := &file_api_v1_webhook_service_proto_msgTypes[1] mi := &file_api_v1_webhook_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *CreateWebhookRequest) String() string { func (x *ListWebhooksRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*CreateWebhookRequest) ProtoMessage() {} func (*ListWebhooksRequest) ProtoMessage() {}
func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message { func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_webhook_service_proto_msgTypes[1] mi := &file_api_v1_webhook_service_proto_msgTypes[1]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
...@@ -143,46 +193,73 @@ func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message { ...@@ -143,46 +193,73 @@ func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use CreateWebhookRequest.ProtoReflect.Descriptor instead. // Deprecated: Use ListWebhooksRequest.ProtoReflect.Descriptor instead.
func (*CreateWebhookRequest) Descriptor() ([]byte, []int) { func (*ListWebhooksRequest) Descriptor() ([]byte, []int) {
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{1} return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{1}
} }
func (x *CreateWebhookRequest) GetName() string { func (x *ListWebhooksRequest) GetPageSize() int32 {
if x != nil { if x != nil {
return x.Name return x.PageSize
}
return 0
}
func (x *ListWebhooksRequest) GetPageToken() string {
if x != nil {
return x.PageToken
} }
return "" return ""
} }
func (x *CreateWebhookRequest) GetUrl() string { func (x *ListWebhooksRequest) GetFilter() string {
if x != nil { if x != nil {
return x.Url return x.Filter
} }
return "" return ""
} }
type GetWebhookRequest struct { func (x *ListWebhooksRequest) GetOrderBy() string {
state protoimpl.MessageState `protogen:"open.v1"` if x != nil {
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` 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"`
// 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *GetWebhookRequest) Reset() { func (x *ListWebhooksResponse) Reset() {
*x = GetWebhookRequest{} *x = ListWebhooksResponse{}
mi := &file_api_v1_webhook_service_proto_msgTypes[2] mi := &file_api_v1_webhook_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *GetWebhookRequest) String() string { func (x *ListWebhooksResponse) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*GetWebhookRequest) ProtoMessage() {} func (*ListWebhooksResponse) ProtoMessage() {}
func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message { func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_webhook_service_proto_msgTypes[2] mi := &file_api_v1_webhook_service_proto_msgTypes[2]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
...@@ -194,40 +271,58 @@ func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message { ...@@ -194,40 +271,58 @@ func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use GetWebhookRequest.ProtoReflect.Descriptor instead. // Deprecated: Use ListWebhooksResponse.ProtoReflect.Descriptor instead.
func (*GetWebhookRequest) Descriptor() ([]byte, []int) { func (*ListWebhooksResponse) Descriptor() ([]byte, []int) {
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{2} return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{2}
} }
func (x *GetWebhookRequest) GetId() int32 { func (x *ListWebhooksResponse) GetWebhooks() []*Webhook {
if x != nil {
return x.Webhooks
}
return nil
}
func (x *ListWebhooksResponse) GetNextPageToken() string {
if x != nil {
return x.NextPageToken
}
return ""
}
func (x *ListWebhooksResponse) GetTotalSize() int32 {
if x != nil { if x != nil {
return x.Id return x.TotalSize
} }
return 0 return 0
} }
type ListWebhooksRequest struct { type GetWebhookRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// The name of the creator. // Required. The resource name of the webhook.
Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` // 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *ListWebhooksRequest) Reset() { func (x *GetWebhookRequest) Reset() {
*x = ListWebhooksRequest{} *x = GetWebhookRequest{}
mi := &file_api_v1_webhook_service_proto_msgTypes[3] mi := &file_api_v1_webhook_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *ListWebhooksRequest) String() string { func (x *GetWebhookRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*ListWebhooksRequest) ProtoMessage() {} func (*GetWebhookRequest) ProtoMessage() {}
func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message { func (x *GetWebhookRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_webhook_service_proto_msgTypes[3] mi := &file_api_v1_webhook_service_proto_msgTypes[3]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
...@@ -239,39 +334,56 @@ func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message { ...@@ -239,39 +334,56 @@ func (x *ListWebhooksRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use ListWebhooksRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetWebhookRequest.ProtoReflect.Descriptor instead.
func (*ListWebhooksRequest) Descriptor() ([]byte, []int) { func (*GetWebhookRequest) Descriptor() ([]byte, []int) {
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{3} return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{3}
} }
func (x *ListWebhooksRequest) GetCreator() string { func (x *GetWebhookRequest) GetName() string {
if x != nil { if x != nil {
return x.Creator return x.Name
} }
return "" return ""
} }
type ListWebhooksResponse struct { func (x *GetWebhookRequest) GetReadMask() *fieldmaskpb.FieldMask {
state protoimpl.MessageState `protogen:"open.v1"` if x != nil {
Webhooks []*Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *ListWebhooksResponse) Reset() { func (x *CreateWebhookRequest) Reset() {
*x = ListWebhooksResponse{} *x = CreateWebhookRequest{}
mi := &file_api_v1_webhook_service_proto_msgTypes[4] mi := &file_api_v1_webhook_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *ListWebhooksResponse) String() string { func (x *CreateWebhookRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*ListWebhooksResponse) ProtoMessage() {} func (*CreateWebhookRequest) ProtoMessage() {}
func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message { func (x *CreateWebhookRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_webhook_service_proto_msgTypes[4] mi := &file_api_v1_webhook_service_proto_msgTypes[4]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
...@@ -283,22 +395,47 @@ func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message { ...@@ -283,22 +395,47 @@ func (x *ListWebhooksResponse) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use ListWebhooksResponse.ProtoReflect.Descriptor instead. // Deprecated: Use CreateWebhookRequest.ProtoReflect.Descriptor instead.
func (*ListWebhooksResponse) Descriptor() ([]byte, []int) { func (*CreateWebhookRequest) Descriptor() ([]byte, []int) {
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{4} return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{4}
} }
func (x *ListWebhooksResponse) GetWebhooks() []*Webhook { func (x *CreateWebhookRequest) GetWebhook() *Webhook {
if x != nil { if x != nil {
return x.Webhooks return x.Webhook
} }
return nil 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 { type UpdateWebhookRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"` // Required. The webhook to update.
UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
...@@ -347,9 +484,20 @@ func (x *UpdateWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { ...@@ -347,9 +484,20 @@ func (x *UpdateWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
return nil return nil
} }
func (x *UpdateWebhookRequest) GetAllowMissing() bool {
if x != nil {
return x.AllowMissing
}
return false
}
type DeleteWebhookRequest struct { type DeleteWebhookRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
...@@ -384,22 +532,33 @@ func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) { ...@@ -384,22 +532,33 @@ func (*DeleteWebhookRequest) Descriptor() ([]byte, []int) {
return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{6} return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{6}
} }
func (x *DeleteWebhookRequest) GetId() int32 { func (x *DeleteWebhookRequest) GetName() string {
if x != nil { 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 { type WebhookRequestPayload struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` // The target URL for the webhook request.
ActivityType string `protobuf:"bytes,2,opt,name=activity_type,json=activityType,proto3" json:"activity_type,omitempty"` Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
// The name of the creator. // 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} // Format: users/{user}
Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"` 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"` // The creation timestamp of the activity.
Memo *Memo `protobuf:"bytes,5,opt,name=memo,proto3" json:"memo,omitempty"` 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 unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
...@@ -473,45 +632,67 @@ var File_api_v1_webhook_service_proto protoreflect.FileDescriptor ...@@ -473,45 +632,67 @@ var File_api_v1_webhook_service_proto protoreflect.FileDescriptor
const file_api_v1_webhook_service_proto_rawDesc = "" + const file_api_v1_webhook_service_proto_rawDesc = "" +
"\n" + "\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" + "\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\x0e\n" + "\aWebhook\x12\x17\n" +
"\x02id\x18\x01 \x01(\x05R\x02id\x12\x18\n" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x15\n" +
"\acreator\x18\x02 \x01(\tR\acreator\x12;\n" + "\x03uid\x18\x02 \x01(\tB\x03\xe0A\x03R\x03uid\x12&\n" +
"\vcreate_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampR\n" + "\fdisplay_name\x18\x03 \x01(\tB\x03\xe0A\x02R\vdisplayName\x12\x15\n" +
"createTime\x12;\n" + "\x03url\x18\x04 \x01(\tB\x03\xe0A\x02R\x03url\x12\x1d\n" +
"\vupdate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\n" + "\acreator\x18\x05 \x01(\tB\x03\xe0A\x03R\acreator\x12.\n" +
"updateTime\x12\x12\n" + "\x05state\x18\x06 \x01(\x0e2\x13.memos.api.v1.StateB\x03\xe0A\x02R\x05state\x12@\n" +
"\x04name\x18\x05 \x01(\tR\x04name\x12\x10\n" + "\vcreate_time\x18\a \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
"\x03url\x18\x06 \x01(\tR\x03url\"<\n" + "createTime\x12@\n" +
"\x14CreateWebhookRequest\x12\x12\n" + "\vupdate_time\x18\b \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" + "updateTime\x12\x17\n" +
"\x03url\x18\x02 \x01(\tR\x03url\"#\n" + "\x04etag\x18\t \x01(\tB\x03\xe0A\x03R\x04etag:F\xeaAC\n" +
"\x11GetWebhookRequest\x12\x0e\n" + "\x14memos.api.v1/Webhook\x12\x12webhooks/{webhook}\x1a\x04name*\bwebhooks2\awebhook\"\xc0\x01\n" +
"\x02id\x18\x01 \x01(\x05R\x02id\"/\n" + "\x13ListWebhooksRequest\x12 \n" +
"\x13ListWebhooksRequest\x12\x18\n" + "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" +
"\acreator\x18\x02 \x01(\tR\acreator\"I\n" + "\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" + "\x14ListWebhooksResponse\x121\n" +
"\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\"\x84\x01\n" + "\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\x12&\n" +
"\x14UpdateWebhookRequest\x12/\n" + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" +
"\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookR\awebhook\x12;\n" + "\n" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + "total_size\x18\x03 \x01(\x05R\ttotalSize\"\x83\x01\n" +
"updateMask\"&\n" + "\x11GetWebhookRequest\x120\n" +
"\x14DeleteWebhookRequest\x12\x0e\n" + "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
"\x02id\x18\x01 \x01(\x05R\x02id\"\xcd\x01\n" + "\x14memos.api.v1/WebhookR\x04name\x12<\n" +
"\x15WebhookRequestPayload\x12\x10\n" + "\tread_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\breadMask\"\xc1\x01\n" +
"\x03url\x18\x01 \x01(\tR\x03url\x12#\n" + "\x14CreateWebhookRequest\x127\n" +
"\ractivity_type\x18\x02 \x01(\tR\factivityType\x12\x18\n" + "\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookB\x06\xe0A\x02\xe0A\x04R\awebhook\x12\"\n" +
"\acreator\x18\x03 \x01(\tR\acreator\x12;\n" + "\n" +
"\vcreate_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\n" + "webhook_id\x18\x02 \x01(\tB\x03\xe0A\x01R\twebhookId\x12(\n" +
"createTime\x12&\n" + "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" +
"\x04memo\x18\x05 \x01(\v2\x12.memos.api.v1.MemoR\x04memo2\xd8\x04\n" + "\n" +
"\x0eWebhookService\x12g\n" + "request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xb8\x01\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" + "\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" + "\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" + "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" +
"\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" + "\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\"D\xdaA\x13webhook,update_mask\x82\xd3\xe4\x93\x02(:\awebhook2\x1d/api/v1/webhooks/{webhook.id}\x12o\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\x02id\x82\xd3\xe4\x93\x02\x17*\x15/api/v1/webhooks/{id}B\xab\x01\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" "\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 ( var (
...@@ -529,41 +710,45 @@ func file_api_v1_webhook_service_proto_rawDescGZIP() []byte { ...@@ -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_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_api_v1_webhook_service_proto_goTypes = []any{ var file_api_v1_webhook_service_proto_goTypes = []any{
(*Webhook)(nil), // 0: memos.api.v1.Webhook (*Webhook)(nil), // 0: memos.api.v1.Webhook
(*CreateWebhookRequest)(nil), // 1: memos.api.v1.CreateWebhookRequest (*ListWebhooksRequest)(nil), // 1: memos.api.v1.ListWebhooksRequest
(*GetWebhookRequest)(nil), // 2: memos.api.v1.GetWebhookRequest (*ListWebhooksResponse)(nil), // 2: memos.api.v1.ListWebhooksResponse
(*ListWebhooksRequest)(nil), // 3: memos.api.v1.ListWebhooksRequest (*GetWebhookRequest)(nil), // 3: memos.api.v1.GetWebhookRequest
(*ListWebhooksResponse)(nil), // 4: memos.api.v1.ListWebhooksResponse (*CreateWebhookRequest)(nil), // 4: memos.api.v1.CreateWebhookRequest
(*UpdateWebhookRequest)(nil), // 5: memos.api.v1.UpdateWebhookRequest (*UpdateWebhookRequest)(nil), // 5: memos.api.v1.UpdateWebhookRequest
(*DeleteWebhookRequest)(nil), // 6: memos.api.v1.DeleteWebhookRequest (*DeleteWebhookRequest)(nil), // 6: memos.api.v1.DeleteWebhookRequest
(*WebhookRequestPayload)(nil), // 7: memos.api.v1.WebhookRequestPayload (*WebhookRequestPayload)(nil), // 7: memos.api.v1.WebhookRequestPayload
(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp (State)(0), // 8: memos.api.v1.State
(*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
(*Memo)(nil), // 10: memos.api.v1.Memo (*fieldmaskpb.FieldMask)(nil), // 10: google.protobuf.FieldMask
(*emptypb.Empty)(nil), // 11: google.protobuf.Empty (*Memo)(nil), // 11: memos.api.v1.Memo
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
} }
var file_api_v1_webhook_service_proto_depIdxs = []int32{ var file_api_v1_webhook_service_proto_depIdxs = []int32{
8, // 0: memos.api.v1.Webhook.create_time:type_name -> google.protobuf.Timestamp 8, // 0: memos.api.v1.Webhook.state:type_name -> memos.api.v1.State
8, // 1: memos.api.v1.Webhook.update_time:type_name -> google.protobuf.Timestamp 9, // 1: memos.api.v1.Webhook.create_time:type_name -> google.protobuf.Timestamp
0, // 2: memos.api.v1.ListWebhooksResponse.webhooks:type_name -> memos.api.v1.Webhook 9, // 2: memos.api.v1.Webhook.update_time:type_name -> google.protobuf.Timestamp
0, // 3: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook 0, // 3: memos.api.v1.ListWebhooksResponse.webhooks:type_name -> memos.api.v1.Webhook
9, // 4: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask 10, // 4: memos.api.v1.GetWebhookRequest.read_mask:type_name -> google.protobuf.FieldMask
8, // 5: memos.api.v1.WebhookRequestPayload.create_time:type_name -> google.protobuf.Timestamp 0, // 5: memos.api.v1.CreateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
10, // 6: memos.api.v1.WebhookRequestPayload.memo:type_name -> memos.api.v1.Memo 0, // 6: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook
1, // 7: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest 10, // 7: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask
2, // 8: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest 9, // 8: memos.api.v1.WebhookRequestPayload.create_time:type_name -> google.protobuf.Timestamp
3, // 9: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest 11, // 9: memos.api.v1.WebhookRequestPayload.memo:type_name -> memos.api.v1.Memo
5, // 10: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest 1, // 10: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest
6, // 11: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest 3, // 11: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest
0, // 12: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook 4, // 12: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest
0, // 13: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook 5, // 13: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest
4, // 14: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse 6, // 14: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest
0, // 15: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook 2, // 15: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse
11, // 16: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty 0, // 16: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook
12, // [12:17] is the sub-list for method output_type 0, // 17: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook
7, // [7:12] is the sub-list for method input_type 0, // 18: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook
7, // [7:7] is the sub-list for extension type_name 12, // 19: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty
7, // [7:7] is the sub-list for extension extendee 15, // [15:20] is the sub-list for method output_type
0, // [0:7] is the sub-list for field type_name 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() } func init() { file_api_v1_webhook_service_proto_init() }
...@@ -571,6 +756,7 @@ func 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 { if File_api_v1_webhook_service_proto != nil {
return return
} }
file_api_v1_common_proto_init()
file_api_v1_memo_service_proto_init() file_api_v1_memo_service_proto_init()
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
......
...@@ -35,30 +35,41 @@ var ( ...@@ -35,30 +35,41 @@ var (
_ = metadata.Join _ = 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 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) {
var ( var (
protoReq CreateWebhookRequest protoReq ListWebhooksRequest
metadata runtime.ServerMetadata metadata runtime.ServerMetadata
) )
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { io.Copy(io.Discard, req.Body)
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.CreateWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_ListWebhooks_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ListWebhooks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err 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) { func local_request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var ( var (
protoReq CreateWebhookRequest protoReq ListWebhooksRequest
metadata runtime.ServerMetadata metadata runtime.ServerMetadata
) )
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.CreateWebhook(ctx, &protoReq) if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_ListWebhooks_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ListWebhooks(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
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) { 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 ( var (
protoReq GetWebhookRequest protoReq GetWebhookRequest
...@@ -66,13 +77,19 @@ func request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime. ...@@ -66,13 +77,19 @@ func request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime.
err error err error
) )
io.Copy(io.Discard, req.Body) io.Copy(io.Discard, req.Body)
val, ok := pathParams["id"] val, ok := pathParams["name"]
if !ok { 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 { 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_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)) msg, err := client.GetWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
...@@ -84,52 +101,63 @@ func local_request_WebhookService_GetWebhook_0(ctx context.Context, marshaler ru ...@@ -84,52 +101,63 @@ func local_request_WebhookService_GetWebhook_0(ctx context.Context, marshaler ru
metadata runtime.ServerMetadata metadata runtime.ServerMetadata
err error err error
) )
val, ok := pathParams["id"] val, ok := pathParams["name"]
if !ok { 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 { 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_GetWebhook_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.GetWebhook(ctx, &protoReq) msg, err := server.GetWebhook(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
var filter_WebhookService_ListWebhooks_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} 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_ListWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 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 ( var (
protoReq ListWebhooksRequest protoReq CreateWebhookRequest
metadata runtime.ServerMetadata metadata runtime.ServerMetadata
) )
io.Copy(io.Discard, req.Body) 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 { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_ListWebhooks_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_CreateWebhook_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.ListWebhooks(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.CreateWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler runtime.Marshaler, server WebhookServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 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 ( var (
protoReq ListWebhooksRequest protoReq CreateWebhookRequest
metadata runtime.ServerMetadata 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 { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_ListWebhooks_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_CreateWebhook_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.ListWebhooks(ctx, &protoReq) msg, err := server.CreateWebhook(ctx, &protoReq)
return msg, metadata, err 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_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) { 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 ( var (
...@@ -151,13 +179,13 @@ func request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler runti ...@@ -151,13 +179,13 @@ func request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler runti
protoReq.UpdateMask = fieldMask protoReq.UpdateMask = fieldMask
} }
} }
val, ok := pathParams["webhook.id"] val, ok := pathParams["webhook.name"]
if !ok { 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 { 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 { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
...@@ -189,13 +217,13 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler ...@@ -189,13 +217,13 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler
protoReq.UpdateMask = fieldMask protoReq.UpdateMask = fieldMask
} }
} }
val, ok := pathParams["webhook.id"] val, ok := pathParams["webhook.name"]
if !ok { 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 { 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 { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
...@@ -207,6 +235,8 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler ...@@ -207,6 +235,8 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler
return msg, metadata, err 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) { 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 ( var (
protoReq DeleteWebhookRequest protoReq DeleteWebhookRequest
...@@ -214,13 +244,19 @@ func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runti ...@@ -214,13 +244,19 @@ func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runti
err error err error
) )
io.Copy(io.Discard, req.Body) io.Copy(io.Discard, req.Body)
val, ok := pathParams["id"] val, ok := pathParams["name"]
if !ok { 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 { 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)) msg, err := client.DeleteWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
...@@ -232,13 +268,19 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler ...@@ -232,13 +268,19 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler
metadata runtime.ServerMetadata metadata runtime.ServerMetadata
err error err error
) )
val, ok := pathParams["id"] val, ok := pathParams["name"]
if !ok { 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 { 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) msg, err := server.DeleteWebhook(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
...@@ -250,25 +292,25 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler ...@@ -250,25 +292,25 @@ 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. // 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. // 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 { 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks")) annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/ListWebhooks", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, server, req, pathParams) resp, md, err := local_request_WebhookService_ListWebhooks_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil { if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
...@@ -276,7 +318,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve ...@@ -276,7 +318,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{id}")) annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=webhooks/*}"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -290,25 +332,25 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve ...@@ -290,25 +332,25 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve
} }
forward_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/ListWebhooks", runtime.WithHTTPPathPattern("/api/v1/webhooks")) annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_WebhookService_ListWebhooks_0(annotatedContext, inboundMarshaler, server, req, pathParams) 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()) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil { if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_WebhookService_ListWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
...@@ -316,7 +358,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve ...@@ -316,7 +358,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 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 { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -336,7 +378,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve ...@@ -336,7 +378,7 @@ func RegisterWebhookServiceHandlerServer(ctx context.Context, mux *runtime.Serve
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 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 { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -390,28 +432,28 @@ func RegisterWebhookServiceHandler(ctx context.Context, mux *runtime.ServeMux, c ...@@ -390,28 +432,28 @@ 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 // 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. // "WebhookServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WebhookServiceClient) error { 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks")) annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/ListWebhooks", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams) resp, md, err := request_WebhookService_ListWebhooks_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil { if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_WebhookService_CreateWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks/{id}")) annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/GetWebhook", runtime.WithHTTPPathPattern("/api/v1/{name=webhooks/*}"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -424,28 +466,28 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve ...@@ -424,28 +466,28 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve
} }
forward_WebhookService_GetWebhook_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/ListWebhooks", runtime.WithHTTPPathPattern("/api/v1/webhooks")) annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WebhookService/CreateWebhook", runtime.WithHTTPPathPattern("/api/v1/webhooks"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_WebhookService_ListWebhooks_0(annotatedContext, inboundMarshaler, client, req, pathParams) resp, md, err := request_WebhookService_CreateWebhook_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil { if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_WebhookService_ListWebhooks_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 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) { 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()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 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 { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -462,7 +504,7 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve ...@@ -462,7 +504,7 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 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 { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
...@@ -479,17 +521,17 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve ...@@ -479,17 +521,17 @@ func RegisterWebhookServiceHandlerClient(ctx context.Context, mux *runtime.Serve
} }
var ( 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_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_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_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_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 ( var (
forward_WebhookService_CreateWebhook_0 = runtime.ForwardResponseMessage
forward_WebhookService_GetWebhook_0 = runtime.ForwardResponseMessage
forward_WebhookService_ListWebhooks_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_UpdateWebhook_0 = runtime.ForwardResponseMessage
forward_WebhookService_DeleteWebhook_0 = runtime.ForwardResponseMessage forward_WebhookService_DeleteWebhook_0 = runtime.ForwardResponseMessage
) )
...@@ -20,9 +20,9 @@ import ( ...@@ -20,9 +20,9 @@ import (
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion9
const ( 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_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_UpdateWebhook_FullMethodName = "/memos.api.v1.WebhookService/UpdateWebhook"
WebhookService_DeleteWebhook_FullMethodName = "/memos.api.v1.WebhookService/DeleteWebhook" WebhookService_DeleteWebhook_FullMethodName = "/memos.api.v1.WebhookService/DeleteWebhook"
) )
...@@ -31,15 +31,15 @@ const ( ...@@ -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. // 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 { 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 returns a list of webhooks.
ListWebhooks(ctx context.Context, in *ListWebhooksRequest, opts ...grpc.CallOption) (*ListWebhooksResponse, error) 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 updates a webhook.
UpdateWebhook(ctx context.Context, in *UpdateWebhookRequest, opts ...grpc.CallOption) (*Webhook, error) 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) DeleteWebhook(ctx context.Context, in *DeleteWebhookRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
} }
...@@ -51,10 +51,10 @@ func NewWebhookServiceClient(cc grpc.ClientConnInterface) WebhookServiceClient { ...@@ -51,10 +51,10 @@ func NewWebhookServiceClient(cc grpc.ClientConnInterface) WebhookServiceClient {
return &webhookServiceClient{cc} 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...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Webhook) out := new(ListWebhooksResponse)
err := c.cc.Invoke(ctx, WebhookService_CreateWebhook_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, WebhookService_ListWebhooks_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -71,10 +71,10 @@ func (c *webhookServiceClient) GetWebhook(ctx context.Context, in *GetWebhookReq ...@@ -71,10 +71,10 @@ func (c *webhookServiceClient) GetWebhook(ctx context.Context, in *GetWebhookReq
return out, nil 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...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListWebhooksResponse) out := new(Webhook)
err := c.cc.Invoke(ctx, WebhookService_ListWebhooks_FullMethodName, in, out, cOpts...) err := c.cc.Invoke(ctx, WebhookService_CreateWebhook_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -105,15 +105,15 @@ func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, in *DeleteWebh ...@@ -105,15 +105,15 @@ func (c *webhookServiceClient) DeleteWebhook(ctx context.Context, in *DeleteWebh
// All implementations must embed UnimplementedWebhookServiceServer // All implementations must embed UnimplementedWebhookServiceServer
// for forward compatibility. // for forward compatibility.
type WebhookServiceServer interface { 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 returns a list of webhooks.
ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) 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 updates a webhook.
UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error) UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error)
// DeleteWebhook deletes a webhook by id. // DeleteWebhook deletes a webhook.
DeleteWebhook(context.Context, *DeleteWebhookRequest) (*emptypb.Empty, error) DeleteWebhook(context.Context, *DeleteWebhookRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedWebhookServiceServer() mustEmbedUnimplementedWebhookServiceServer()
} }
...@@ -125,14 +125,14 @@ type WebhookServiceServer interface { ...@@ -125,14 +125,14 @@ type WebhookServiceServer interface {
// pointer dereference when methods are called. // pointer dereference when methods are called.
type UnimplementedWebhookServiceServer struct{} type UnimplementedWebhookServiceServer struct{}
func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) { func (UnimplementedWebhookServiceServer) ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented") return nil, status.Errorf(codes.Unimplemented, "method ListWebhooks not implemented")
} }
func (UnimplementedWebhookServiceServer) GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error) { func (UnimplementedWebhookServiceServer) GetWebhook(context.Context, *GetWebhookRequest) (*Webhook, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetWebhook not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetWebhook not implemented")
} }
func (UnimplementedWebhookServiceServer) ListWebhooks(context.Context, *ListWebhooksRequest) (*ListWebhooksResponse, error) { func (UnimplementedWebhookServiceServer) CreateWebhook(context.Context, *CreateWebhookRequest) (*Webhook, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListWebhooks not implemented") return nil, status.Errorf(codes.Unimplemented, "method CreateWebhook not implemented")
} }
func (UnimplementedWebhookServiceServer) UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error) { func (UnimplementedWebhookServiceServer) UpdateWebhook(context.Context, *UpdateWebhookRequest) (*Webhook, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateWebhook not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateWebhook not implemented")
...@@ -161,20 +161,20 @@ func RegisterWebhookServiceServer(s grpc.ServiceRegistrar, srv WebhookServiceSer ...@@ -161,20 +161,20 @@ func RegisterWebhookServiceServer(s grpc.ServiceRegistrar, srv WebhookServiceSer
s.RegisterService(&WebhookService_ServiceDesc, srv) s.RegisterService(&WebhookService_ServiceDesc, srv)
} }
func _WebhookService_CreateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _WebhookService_ListWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateWebhookRequest) in := new(ListWebhooksRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(WebhookServiceServer).CreateWebhook(ctx, in) return srv.(WebhookServiceServer).ListWebhooks(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: WebhookService_CreateWebhook_FullMethodName, FullMethod: WebhookService_ListWebhooks_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { 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) return interceptor(ctx, in, info, handler)
} }
...@@ -197,20 +197,20 @@ func _WebhookService_GetWebhook_Handler(srv interface{}, ctx context.Context, de ...@@ -197,20 +197,20 @@ func _WebhookService_GetWebhook_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _WebhookService_ListWebhooks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _WebhookService_CreateWebhook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListWebhooksRequest) in := new(CreateWebhookRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(WebhookServiceServer).ListWebhooks(ctx, in) return srv.(WebhookServiceServer).CreateWebhook(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: WebhookService_ListWebhooks_FullMethodName, FullMethod: WebhookService_CreateWebhook_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { 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) return interceptor(ctx, in, info, handler)
} }
...@@ -259,16 +259,16 @@ var WebhookService_ServiceDesc = grpc.ServiceDesc{ ...@@ -259,16 +259,16 @@ var WebhookService_ServiceDesc = grpc.ServiceDesc{
HandlerType: (*WebhookServiceServer)(nil), HandlerType: (*WebhookServiceServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {
MethodName: "CreateWebhook", MethodName: "ListWebhooks",
Handler: _WebhookService_CreateWebhook_Handler, Handler: _WebhookService_ListWebhooks_Handler,
}, },
{ {
MethodName: "GetWebhook", MethodName: "GetWebhook",
Handler: _WebhookService_GetWebhook_Handler, Handler: _WebhookService_GetWebhook_Handler,
}, },
{ {
MethodName: "ListWebhooks", MethodName: "CreateWebhook",
Handler: _WebhookService_ListWebhooks_Handler, Handler: _WebhookService_CreateWebhook_Handler,
}, },
{ {
MethodName: "UpdateWebhook", MethodName: "UpdateWebhook",
......
...@@ -609,11 +609,44 @@ paths: ...@@ -609,11 +609,44 @@ paths:
schema: schema:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: parameters:
- name: creator - name: pageSize
description: The name of the creator. 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 in: query
required: false required: false
type: string 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: tags:
- WebhookService - WebhookService
post: post:
...@@ -629,93 +662,34 @@ paths: ...@@ -629,93 +662,34 @@ paths:
schema: schema:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
parameters: 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 - name: webhook
description: Required. The webhook to create.
in: body in: body
required: true required: true
schema: schema:
type: object $ref: '#/definitions/v1Webhook'
properties: required:
creator: - webhook
type: string - name: webhookId
description: The name of the creator. description: |-
createTime: Optional. The webhook ID to use for this webhook.
type: string If empty, a unique ID will be generated.
format: date-time Must match the pattern [a-z0-9-]+
updateTime: in: query
type: string required: false
format: date-time type: string
name: - name: validateOnly
type: string description: Optional. If set, validate the request but don't actually create the webhook.
url: in: query
type: string 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: tags:
- WebhookService - WebhookService
/api/v1/workspace/profile: /api/v1/workspace/profile:
...@@ -1172,6 +1146,36 @@ paths: ...@@ -1172,6 +1146,36 @@ paths:
tags: tags:
- ResourceService - ResourceService
/api/v1/{name_5}: /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: delete:
summary: DeleteMemo deletes a memo. summary: DeleteMemo deletes a memo.
operationId: MemoService_DeleteMemo operationId: MemoService_DeleteMemo
...@@ -1194,6 +1198,36 @@ paths: ...@@ -1194,6 +1198,36 @@ paths:
pattern: memos/[^/]+ pattern: memos/[^/]+
tags: tags:
- MemoService - 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}: /api/v1/{name}:
get: get:
summary: GetActivity returns the activity with the given id. summary: GetActivity returns the activity with the given id.
...@@ -2022,6 +2056,81 @@ paths: ...@@ -2022,6 +2056,81 @@ paths:
type: boolean type: boolean
tags: tags:
- UserService - 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}: /file/{name}/{filename}:
get: get:
summary: GetResourceBinary returns a resource binary by name. summary: GetResourceBinary returns a resource binary by name.
...@@ -2726,13 +2835,6 @@ definitions: ...@@ -2726,13 +2835,6 @@ definitions:
properties: properties:
content: content:
type: string type: string
v1CreateWebhookRequest:
type: object
properties:
name:
type: string
url:
type: string
v1Direction: v1Direction:
type: string type: string
enum: enum:
...@@ -3011,6 +3113,16 @@ definitions: ...@@ -3011,6 +3113,16 @@ definitions:
items: items:
type: object type: object
$ref: '#/definitions/v1Webhook' $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: v1MathBlockNode:
type: object type: object
properties: properties:
...@@ -3526,22 +3638,48 @@ definitions: ...@@ -3526,22 +3638,48 @@ definitions:
v1Webhook: v1Webhook:
type: object type: object
properties: properties:
id: name:
type: integer type: string
format: int32 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: creator:
type: string 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: createTime:
type: string type: string
format: date-time format: date-time
description: Output only. The creation timestamp.
readOnly: true
updateTime: updateTime:
type: string type: string
format: date-time format: date-time
name: description: Output only. The last update timestamp.
type: string readOnly: true
url: etag:
type: string type: string
description: Output only. The etag for this resource.
readOnly: true
required:
- displayName
- url
- state
v1WorkspaceProfile: v1WorkspaceProfile:
type: object type: object
properties: properties:
......
...@@ -17,6 +17,7 @@ const ( ...@@ -17,6 +17,7 @@ const (
InboxNamePrefix = "inboxes/" InboxNamePrefix = "inboxes/"
IdentityProviderNamePrefix = "identityProviders/" IdentityProviderNamePrefix = "identityProviders/"
ActivityNamePrefix = "activities/" ActivityNamePrefix = "activities/"
WebhookNamePrefix = "webhooks/"
) )
// GetNameParentTokens returns the tokens from a resource name. // GetNameParentTokens returns the tokens from a resource name.
...@@ -117,3 +118,16 @@ func ExtractActivityIDFromName(name string) (int32, error) { ...@@ -117,3 +118,16 @@ func ExtractActivityIDFromName(name string) (int32, error) {
} }
return id, nil 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 ...@@ -2,6 +2,7 @@ package v1
import ( import (
"context" "context"
"crypto/md5"
"fmt" "fmt"
"strings" "strings"
"time" "time"
...@@ -21,10 +22,21 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWe ...@@ -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) 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{ webhook, err := s.Store.CreateWebhook(ctx, &store.Webhook{
CreatorID: currentUser.ID, CreatorID: currentUser.ID,
Name: request.Name, Name: request.Webhook.DisplayName,
URL: strings.TrimSpace(request.Url), URL: strings.TrimSpace(request.Webhook.Url),
}) })
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to create webhook, error: %+v", err) 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 ...@@ -32,21 +44,24 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWe
return convertWebhookFromStore(webhook), nil return convertWebhookFromStore(webhook), nil
} }
func (s *APIV1Service) ListWebhooks(ctx context.Context, request *v1pb.ListWebhooksRequest) (*v1pb.ListWebhooksResponse, error) { func (s *APIV1Service) ListWebhooks(ctx context.Context, _ *v1pb.ListWebhooksRequest) (*v1pb.ListWebhooksResponse, error) {
creatorID, err := ExtractUserIDFromName(request.Creator) currentUser, err := s.GetCurrentUser(ctx)
if err != nil { 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{ webhooks, err := s.Store.ListWebhooks(ctx, &store.FindWebhook{
CreatorID: &creatorID, CreatorID: &currentUser.ID,
}) })
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to list webhooks, error: %+v", err) return nil, status.Errorf(codes.Internal, "failed to list webhooks, error: %+v", err)
} }
response := &v1pb.ListWebhooksResponse{ response := &v1pb.ListWebhooksResponse{
Webhooks: []*v1pb.Webhook{}, Webhooks: []*v1pb.Webhook{},
TotalSize: int32(len(webhooks)),
} }
for _, webhook := range webhooks { for _, webhook := range webhooks {
response.Webhooks = append(response.Webhooks, convertWebhookFromStore(webhook)) response.Webhooks = append(response.Webhooks, convertWebhookFromStore(webhook))
...@@ -55,13 +70,18 @@ func (s *APIV1Service) ListWebhooks(ctx context.Context, request *v1pb.ListWebho ...@@ -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) { 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) currentUser, err := s.GetCurrentUser(ctx)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get user: %v", err) return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)
} }
webhook, err := s.Store.GetWebhook(ctx, &store.FindWebhook{ webhook, err := s.Store.GetWebhook(ctx, &store.FindWebhook{
ID: &request.Id, ID: &webhookID,
CreatorID: &currentUser.ID, CreatorID: &currentUser.ID,
}) })
if err != nil { if err != nil {
...@@ -70,7 +90,12 @@ func (s *APIV1Service) GetWebhook(ctx context.Context, request *v1pb.GetWebhookR ...@@ -70,7 +90,12 @@ func (s *APIV1Service) GetWebhook(ctx context.Context, request *v1pb.GetWebhookR
if webhook == nil { if webhook == nil {
return nil, status.Errorf(codes.NotFound, "webhook not found") 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) { 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 ...@@ -78,13 +103,43 @@ func (s *APIV1Service) UpdateWebhook(ctx context.Context, request *v1pb.UpdateWe
return nil, status.Errorf(codes.InvalidArgument, "update_mask is required") 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: &currentUser.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 { for _, field := range request.UpdateMask.Paths {
switch field { switch field {
case "name": case "display_name":
update.Name = &request.Webhook.Name update.Name = &request.Webhook.DisplayName
case "url": case "url":
update.URL = &request.Webhook.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 ...@@ -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) { func (s *APIV1Service) DeleteWebhook(ctx context.Context, request *v1pb.DeleteWebhookRequest) (*emptypb.Empty, error) {
err := s.Store.DeleteWebhook(ctx, &store.DeleteWebhook{ webhookID, err := ExtractWebhookIDFromName(request.Name)
ID: request.Id, 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: &currentUser.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 { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to delete webhook, error: %+v", err) 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 ...@@ -106,12 +185,19 @@ func (s *APIV1Service) DeleteWebhook(ctx context.Context, request *v1pb.DeleteWe
} }
func convertWebhookFromStore(webhook *store.Webhook) *v1pb.Webhook { 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{ return &v1pb.Webhook{
Id: webhook.ID, Name: fmt.Sprintf("webhooks/%d", webhook.ID),
CreateTime: timestamppb.New(time.Unix(webhook.CreatedTs, 0)), Uid: fmt.Sprintf("%d", webhook.ID),
UpdateTime: timestamppb.New(time.Unix(webhook.UpdatedTs, 0)), DisplayName: webhook.Name,
Creator: fmt.Sprintf("%s%d", UserNamePrefix, webhook.CreatorID), Url: webhook.URL,
Name: webhook.Name, Creator: fmt.Sprintf("users/%d", webhook.CreatorID),
Url: webhook.URL, 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"; ...@@ -8,34 +8,34 @@ import { useTranslate } from "@/utils/i18n";
import { generateDialog } from "./Dialog"; import { generateDialog } from "./Dialog";
interface Props extends DialogProps { interface Props extends DialogProps {
webhookId?: number; webhookName?: string;
onConfirm: () => void; onConfirm: () => void;
} }
interface State { interface State {
name: string; displayName: string;
url: string; url: string;
} }
const CreateWebhookDialog: React.FC<Props> = (props: Props) => { const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
const { webhookId, destroy, onConfirm } = props; const { webhookName, destroy, onConfirm } = props;
const t = useTranslate(); const t = useTranslate();
const [state, setState] = useState({ const [state, setState] = useState({
name: "", displayName: "",
url: "", url: "",
}); });
const requestState = useLoading(false); const requestState = useLoading(false);
const isCreating = webhookId === undefined; const isCreating = webhookName === undefined;
useEffect(() => { useEffect(() => {
if (webhookId) { if (webhookName) {
webhookServiceClient webhookServiceClient
.getWebhook({ .getWebhook({
id: webhookId, name: webhookName,
}) })
.then((webhook) => { .then((webhook) => {
setState({ setState({
name: webhook.name, displayName: webhook.displayName,
url: webhook.url, url: webhook.url,
}); });
}); });
...@@ -51,7 +51,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => { ...@@ -51,7 +51,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
const handleTitleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { const handleTitleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setPartialState({ setPartialState({
name: e.target.value, displayName: e.target.value,
}); });
}; };
...@@ -62,7 +62,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => { ...@@ -62,7 +62,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
}; };
const handleSaveBtnClick = async () => { const handleSaveBtnClick = async () => {
if (!state.name || !state.url) { if (!state.displayName || !state.url) {
toast.error(t("message.fill-all-required-fields")); toast.error(t("message.fill-all-required-fields"));
return; return;
} }
...@@ -70,17 +70,19 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => { ...@@ -70,17 +70,19 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
try { try {
if (isCreating) { if (isCreating) {
await webhookServiceClient.createWebhook({ await webhookServiceClient.createWebhook({
name: state.name, webhook: {
url: state.url, displayName: state.displayName,
url: state.url,
},
}); });
} else { } else {
await webhookServiceClient.updateWebhook({ await webhookServiceClient.updateWebhook({
webhook: { webhook: {
id: webhookId, name: webhookName,
name: state.name, displayName: state.displayName,
url: state.url, url: state.url,
}, },
updateMask: ["name", "url"], updateMask: ["display_name", "url"],
}); });
} }
...@@ -112,7 +114,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => { ...@@ -112,7 +114,7 @@ const CreateWebhookDialog: React.FC<Props> = (props: Props) => {
className="w-full" className="w-full"
type="text" type="text"
placeholder={t("setting.webhook-section.create-dialog.an-easy-to-remember-name")} placeholder={t("setting.webhook-section.create-dialog.an-easy-to-remember-name")}
value={state.name} value={state.displayName}
onChange={handleTitleInputChange} onChange={handleTitleInputChange}
/> />
</div> </div>
......
...@@ -3,39 +3,35 @@ import { ExternalLinkIcon, TrashIcon } from "lucide-react"; ...@@ -3,39 +3,35 @@ import { ExternalLinkIcon, TrashIcon } from "lucide-react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { webhookServiceClient } from "@/grpcweb"; import { webhookServiceClient } from "@/grpcweb";
import useCurrentUser from "@/hooks/useCurrentUser";
import { Webhook } from "@/types/proto/api/v1/webhook_service"; import { Webhook } from "@/types/proto/api/v1/webhook_service";
import { useTranslate } from "@/utils/i18n"; import { useTranslate } from "@/utils/i18n";
import showCreateWebhookDialog from "../CreateWebhookDialog"; import showCreateWebhookDialog from "../CreateWebhookDialog";
const listWebhooks = async (user: string) => { const listWebhooks = async () => {
const { webhooks } = await webhookServiceClient.listWebhooks({ const { webhooks } = await webhookServiceClient.listWebhooks({});
creator: user,
});
return webhooks; return webhooks;
}; };
const WebhookSection = () => { const WebhookSection = () => {
const t = useTranslate(); const t = useTranslate();
const currentUser = useCurrentUser();
const [webhooks, setWebhooks] = useState<Webhook[]>([]); const [webhooks, setWebhooks] = useState<Webhook[]>([]);
useEffect(() => { useEffect(() => {
listWebhooks(currentUser.name).then((webhooks) => { listWebhooks().then((webhooks) => {
setWebhooks(webhooks); setWebhooks(webhooks);
}); });
}, []); }, []);
const handleCreateAccessTokenDialogConfirm = async () => { const handleCreateAccessTokenDialogConfirm = async () => {
const webhooks = await listWebhooks(currentUser.name); const webhooks = await listWebhooks();
setWebhooks(webhooks); setWebhooks(webhooks);
}; };
const handleDeleteWebhook = async (webhook: Webhook) => { 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) { if (confirmed) {
await webhookServiceClient.deleteWebhook({ id: webhook.id }); await webhookServiceClient.deleteWebhook({ name: webhook.name });
setWebhooks(webhooks.filter((item) => item.id !== webhook.id)); setWebhooks(webhooks.filter((item) => item.name !== webhook.name));
} }
}; };
...@@ -77,8 +73,8 @@ const WebhookSection = () => { ...@@ -77,8 +73,8 @@ const WebhookSection = () => {
</thead> </thead>
<tbody className="divide-y divide-gray-200 dark:divide-gray-500"> <tbody className="divide-y divide-gray-200 dark:divide-gray-500">
{webhooks.map((webhook) => ( {webhooks.map((webhook) => (
<tr key={webhook.id}> <tr key={webhook.name}>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-900 dark:text-gray-400">{webhook.name}</td> <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}> <td className="max-w-[200px] px-3 py-2 text-sm text-gray-900 dark:text-gray-400 truncate" title={webhook.url}>
{webhook.url} {webhook.url}
</td> </td>
......
...@@ -9,82 +9,199 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; ...@@ -9,82 +9,199 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Empty } from "../../google/protobuf/empty"; import { Empty } from "../../google/protobuf/empty";
import { FieldMask } from "../../google/protobuf/field_mask"; import { FieldMask } from "../../google/protobuf/field_mask";
import { Timestamp } from "../../google/protobuf/timestamp"; import { Timestamp } from "../../google/protobuf/timestamp";
import { State, stateFromJSON, stateToNumber } from "./common";
import { Memo } from "./memo_service"; import { Memo } from "./memo_service";
export const protobufPackage = "memos.api.v1"; export const protobufPackage = "memos.api.v1";
export interface Webhook { export interface Webhook {
id: number; /**
/** The name of the creator. */ * The resource name of the webhook.
creator: string; * Format: webhooks/{webhook}
createTime?: Date | undefined; */
updateTime?: Date | undefined;
name: string; name: string;
/** Output only. The system generated unique identifier. */
uid: string;
/** Required. The display name of the webhook. */
displayName: string;
/** Required. The target URL for the webhook. */
url: string; url: string;
/**
* Output only. The resource name of the creator.
* Format: users/{user}
*/
creator: string;
/** The state of the webhook. */
state: State;
/** Output only. The creation timestamp. */
createTime?:
| Date
| undefined;
/** Output only. The last update timestamp. */
updateTime?:
| Date
| undefined;
/** Output only. The etag for this resource. */
etag: string;
} }
export interface CreateWebhookRequest { export interface ListWebhooksRequest {
name: string; /**
url: string; * 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: number;
/**
* Optional. A page token, received from a previous `ListWebhooks` call.
* Provide this to retrieve the subsequent page.
*/
pageToken: string;
/**
* 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;
/**
* Optional. The order to sort results by.
* Example: "create_time desc" or "display_name asc"
*/
orderBy: string;
/** Optional. If true, show deleted webhooks in the response. */
showDeleted: boolean;
} }
export interface GetWebhookRequest { export interface ListWebhooksResponse {
id: number; /** The list of webhooks. */
webhooks: Webhook[];
/**
* 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;
/** The total count of webhooks (may be approximate). */
totalSize: number;
} }
export interface ListWebhooksRequest { export interface GetWebhookRequest {
/** The name of the creator. */ /**
creator: string; * Required. The resource name of the webhook.
* Format: webhooks/{webhook}
*/
name: string;
/**
* Optional. The fields to return in the response.
* If not specified, all fields are returned.
*/
readMask?: string[] | undefined;
} }
export interface ListWebhooksResponse { export interface CreateWebhookRequest {
webhooks: Webhook[]; /** Required. The webhook to create. */
webhook?:
| Webhook
| undefined;
/**
* 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;
/** Optional. If set, validate the request but don't actually create the webhook. */
validateOnly: boolean;
/**
* Optional. An idempotency token that can be used to ensure that multiple
* requests to create a webhook have the same result.
*/
requestId: string;
} }
export interface UpdateWebhookRequest { export interface UpdateWebhookRequest {
webhook?: Webhook | undefined; /** Required. The webhook to update. */
updateMask?: string[] | undefined; webhook?:
| Webhook
| undefined;
/** Required. The list of fields to update. */
updateMask?:
| string[]
| undefined;
/** Optional. If set to true, allows updating sensitive fields. */
allowMissing: boolean;
} }
export interface DeleteWebhookRequest { export interface DeleteWebhookRequest {
id: number; /**
* Required. The resource name of the webhook to delete.
* Format: webhooks/{webhook}
*/
name: string;
/** Optional. If set to true, the webhook will be deleted even if it has associated data. */
force: boolean;
} }
export interface WebhookRequestPayload { export interface WebhookRequestPayload {
/** The target URL for the webhook request. */
url: string; url: string;
/** The type of activity that triggered this webhook. */
activityType: string; activityType: string;
/** /**
* The name of the creator. * The resource name of the creator.
* Format: users/{user} * Format: users/{user}
*/ */
creator: string; creator: string;
createTime?: Date | undefined; /** The creation timestamp of the activity. */
createTime?:
| Date
| undefined;
/** The memo that triggered this webhook (if applicable). */
memo?: Memo | undefined; memo?: Memo | undefined;
} }
function createBaseWebhook(): Webhook { function createBaseWebhook(): Webhook {
return { id: 0, creator: "", createTime: undefined, updateTime: undefined, name: "", url: "" }; return {
name: "",
uid: "",
displayName: "",
url: "",
creator: "",
state: State.STATE_UNSPECIFIED,
createTime: undefined,
updateTime: undefined,
etag: "",
};
} }
export const Webhook: MessageFns<Webhook> = { export const Webhook: MessageFns<Webhook> = {
encode(message: Webhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: Webhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== 0) { if (message.name !== "") {
writer.uint32(8).int32(message.id); writer.uint32(10).string(message.name);
}
if (message.uid !== "") {
writer.uint32(18).string(message.uid);
}
if (message.displayName !== "") {
writer.uint32(26).string(message.displayName);
}
if (message.url !== "") {
writer.uint32(34).string(message.url);
} }
if (message.creator !== "") { if (message.creator !== "") {
writer.uint32(18).string(message.creator); writer.uint32(42).string(message.creator);
}
if (message.state !== State.STATE_UNSPECIFIED) {
writer.uint32(48).int32(stateToNumber(message.state));
} }
if (message.createTime !== undefined) { if (message.createTime !== undefined) {
Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).join(); Timestamp.encode(toTimestamp(message.createTime), writer.uint32(58).fork()).join();
} }
if (message.updateTime !== undefined) { if (message.updateTime !== undefined) {
Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(34).fork()).join(); Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(66).fork()).join();
}
if (message.name !== "") {
writer.uint32(42).string(message.name);
} }
if (message.url !== "") { if (message.etag !== "") {
writer.uint32(50).string(message.url); writer.uint32(74).string(message.etag);
} }
return writer; return writer;
}, },
...@@ -97,11 +214,11 @@ export const Webhook: MessageFns<Webhook> = { ...@@ -97,11 +214,11 @@ export const Webhook: MessageFns<Webhook> = {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
case 1: { case 1: {
if (tag !== 8) { if (tag !== 10) {
break; break;
} }
message.id = reader.int32(); message.name = reader.string();
continue; continue;
} }
case 2: { case 2: {
...@@ -109,7 +226,7 @@ export const Webhook: MessageFns<Webhook> = { ...@@ -109,7 +226,7 @@ export const Webhook: MessageFns<Webhook> = {
break; break;
} }
message.creator = reader.string(); message.uid = reader.string();
continue; continue;
} }
case 3: { case 3: {
...@@ -117,7 +234,7 @@ export const Webhook: MessageFns<Webhook> = { ...@@ -117,7 +234,7 @@ export const Webhook: MessageFns<Webhook> = {
break; break;
} }
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); message.displayName = reader.string();
continue; continue;
} }
case 4: { case 4: {
...@@ -125,7 +242,7 @@ export const Webhook: MessageFns<Webhook> = { ...@@ -125,7 +242,7 @@ export const Webhook: MessageFns<Webhook> = {
break; break;
} }
message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); message.url = reader.string();
continue; continue;
} }
case 5: { case 5: {
...@@ -133,15 +250,39 @@ export const Webhook: MessageFns<Webhook> = { ...@@ -133,15 +250,39 @@ export const Webhook: MessageFns<Webhook> = {
break; break;
} }
message.name = reader.string(); message.creator = reader.string();
continue; continue;
} }
case 6: { case 6: {
if (tag !== 50) { if (tag !== 48) {
break; break;
} }
message.url = reader.string(); message.state = stateFromJSON(reader.int32());
continue;
}
case 7: {
if (tag !== 58) {
break;
}
message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 8: {
if (tag !== 66) {
break;
}
message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
continue;
}
case 9: {
if (tag !== 74) {
break;
}
message.etag = reader.string();
continue; continue;
} }
} }
...@@ -158,44 +299,56 @@ export const Webhook: MessageFns<Webhook> = { ...@@ -158,44 +299,56 @@ export const Webhook: MessageFns<Webhook> = {
}, },
fromPartial(object: DeepPartial<Webhook>): Webhook { fromPartial(object: DeepPartial<Webhook>): Webhook {
const message = createBaseWebhook(); const message = createBaseWebhook();
message.id = object.id ?? 0; message.name = object.name ?? "";
message.uid = object.uid ?? "";
message.displayName = object.displayName ?? "";
message.url = object.url ?? "";
message.creator = object.creator ?? ""; message.creator = object.creator ?? "";
message.state = object.state ?? State.STATE_UNSPECIFIED;
message.createTime = object.createTime ?? undefined; message.createTime = object.createTime ?? undefined;
message.updateTime = object.updateTime ?? undefined; message.updateTime = object.updateTime ?? undefined;
message.name = object.name ?? ""; message.etag = object.etag ?? "";
message.url = object.url ?? "";
return message; return message;
}, },
}; };
function createBaseCreateWebhookRequest(): CreateWebhookRequest { function createBaseListWebhooksRequest(): ListWebhooksRequest {
return { name: "", url: "" }; return { pageSize: 0, pageToken: "", filter: "", orderBy: "", showDeleted: false };
} }
export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = { export const ListWebhooksRequest: MessageFns<ListWebhooksRequest> = {
encode(message: CreateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") { if (message.pageSize !== 0) {
writer.uint32(10).string(message.name); writer.uint32(8).int32(message.pageSize);
} }
if (message.url !== "") { if (message.pageToken !== "") {
writer.uint32(18).string(message.url); writer.uint32(18).string(message.pageToken);
}
if (message.filter !== "") {
writer.uint32(26).string(message.filter);
}
if (message.orderBy !== "") {
writer.uint32(34).string(message.orderBy);
}
if (message.showDeleted !== false) {
writer.uint32(40).bool(message.showDeleted);
} }
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): CreateWebhookRequest { decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCreateWebhookRequest(); const message = createBaseListWebhooksRequest();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
case 1: { case 1: {
if (tag !== 10) { if (tag !== 8) {
break; break;
} }
message.name = reader.string(); message.pageSize = reader.int32();
continue; continue;
} }
case 2: { case 2: {
...@@ -203,7 +356,31 @@ export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = { ...@@ -203,7 +356,31 @@ export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = {
break; break;
} }
message.url = reader.string(); message.pageToken = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.filter = reader.string();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.orderBy = reader.string();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.showDeleted = reader.bool();
continue; continue;
} }
} }
...@@ -215,42 +392,67 @@ export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = { ...@@ -215,42 +392,67 @@ export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = {
return message; return message;
}, },
create(base?: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest { create(base?: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest {
return CreateWebhookRequest.fromPartial(base ?? {}); return ListWebhooksRequest.fromPartial(base ?? {});
}, },
fromPartial(object: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest { fromPartial(object: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest {
const message = createBaseCreateWebhookRequest(); const message = createBaseListWebhooksRequest();
message.name = object.name ?? ""; message.pageSize = object.pageSize ?? 0;
message.url = object.url ?? ""; message.pageToken = object.pageToken ?? "";
message.filter = object.filter ?? "";
message.orderBy = object.orderBy ?? "";
message.showDeleted = object.showDeleted ?? false;
return message; return message;
}, },
}; };
function createBaseGetWebhookRequest(): GetWebhookRequest { function createBaseListWebhooksResponse(): ListWebhooksResponse {
return { id: 0 }; return { webhooks: [], nextPageToken: "", totalSize: 0 };
} }
export const GetWebhookRequest: MessageFns<GetWebhookRequest> = { export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = {
encode(message: GetWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: ListWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== 0) { for (const v of message.webhooks) {
writer.uint32(8).int32(message.id); Webhook.encode(v!, writer.uint32(10).fork()).join();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
}
if (message.totalSize !== 0) {
writer.uint32(24).int32(message.totalSize);
} }
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): GetWebhookRequest { decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksResponse {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGetWebhookRequest(); const message = createBaseListWebhooksResponse();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
case 1: { case 1: {
if (tag !== 8) { if (tag !== 10) {
break;
}
message.webhooks.push(Webhook.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.nextPageToken = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break; break;
} }
message.id = reader.int32(); message.totalSize = reader.int32();
continue; continue;
} }
} }
...@@ -262,41 +464,54 @@ export const GetWebhookRequest: MessageFns<GetWebhookRequest> = { ...@@ -262,41 +464,54 @@ export const GetWebhookRequest: MessageFns<GetWebhookRequest> = {
return message; return message;
}, },
create(base?: DeepPartial<GetWebhookRequest>): GetWebhookRequest { create(base?: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse {
return GetWebhookRequest.fromPartial(base ?? {}); return ListWebhooksResponse.fromPartial(base ?? {});
}, },
fromPartial(object: DeepPartial<GetWebhookRequest>): GetWebhookRequest { fromPartial(object: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse {
const message = createBaseGetWebhookRequest(); const message = createBaseListWebhooksResponse();
message.id = object.id ?? 0; message.webhooks = object.webhooks?.map((e) => Webhook.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
message.totalSize = object.totalSize ?? 0;
return message; return message;
}, },
}; };
function createBaseListWebhooksRequest(): ListWebhooksRequest { function createBaseGetWebhookRequest(): GetWebhookRequest {
return { creator: "" }; return { name: "", readMask: undefined };
} }
export const ListWebhooksRequest: MessageFns<ListWebhooksRequest> = { export const GetWebhookRequest: MessageFns<GetWebhookRequest> = {
encode(message: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: GetWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.creator !== "") { if (message.name !== "") {
writer.uint32(18).string(message.creator); writer.uint32(10).string(message.name);
}
if (message.readMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.readMask), writer.uint32(18).fork()).join();
} }
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksRequest { decode(input: BinaryReader | Uint8Array, length?: number): GetWebhookRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListWebhooksRequest(); const message = createBaseGetWebhookRequest();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: { case 2: {
if (tag !== 18) { if (tag !== 18) {
break; break;
} }
message.creator = reader.string(); message.readMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue; continue;
} }
} }
...@@ -308,32 +523,42 @@ export const ListWebhooksRequest: MessageFns<ListWebhooksRequest> = { ...@@ -308,32 +523,42 @@ export const ListWebhooksRequest: MessageFns<ListWebhooksRequest> = {
return message; return message;
}, },
create(base?: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest { create(base?: DeepPartial<GetWebhookRequest>): GetWebhookRequest {
return ListWebhooksRequest.fromPartial(base ?? {}); return GetWebhookRequest.fromPartial(base ?? {});
}, },
fromPartial(object: DeepPartial<ListWebhooksRequest>): ListWebhooksRequest { fromPartial(object: DeepPartial<GetWebhookRequest>): GetWebhookRequest {
const message = createBaseListWebhooksRequest(); const message = createBaseGetWebhookRequest();
message.creator = object.creator ?? ""; message.name = object.name ?? "";
message.readMask = object.readMask ?? undefined;
return message; return message;
}, },
}; };
function createBaseListWebhooksResponse(): ListWebhooksResponse { function createBaseCreateWebhookRequest(): CreateWebhookRequest {
return { webhooks: [] }; return { webhook: undefined, webhookId: "", validateOnly: false, requestId: "" };
} }
export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = { export const CreateWebhookRequest: MessageFns<CreateWebhookRequest> = {
encode(message: ListWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: CreateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.webhooks) { if (message.webhook !== undefined) {
Webhook.encode(v!, writer.uint32(10).fork()).join(); Webhook.encode(message.webhook, writer.uint32(10).fork()).join();
}
if (message.webhookId !== "") {
writer.uint32(18).string(message.webhookId);
}
if (message.validateOnly !== false) {
writer.uint32(24).bool(message.validateOnly);
}
if (message.requestId !== "") {
writer.uint32(34).string(message.requestId);
} }
return writer; return writer;
}, },
decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksResponse { decode(input: BinaryReader | Uint8Array, length?: number): CreateWebhookRequest {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length; let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListWebhooksResponse(); const message = createBaseCreateWebhookRequest();
while (reader.pos < end) { while (reader.pos < end) {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
...@@ -342,7 +567,31 @@ export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = { ...@@ -342,7 +567,31 @@ export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = {
break; break;
} }
message.webhooks.push(Webhook.decode(reader, reader.uint32())); message.webhook = Webhook.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.webhookId = reader.string();
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.validateOnly = reader.bool();
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.requestId = reader.string();
continue; continue;
} }
} }
...@@ -354,18 +603,23 @@ export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = { ...@@ -354,18 +603,23 @@ export const ListWebhooksResponse: MessageFns<ListWebhooksResponse> = {
return message; return message;
}, },
create(base?: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse { create(base?: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest {
return ListWebhooksResponse.fromPartial(base ?? {}); return CreateWebhookRequest.fromPartial(base ?? {});
}, },
fromPartial(object: DeepPartial<ListWebhooksResponse>): ListWebhooksResponse { fromPartial(object: DeepPartial<CreateWebhookRequest>): CreateWebhookRequest {
const message = createBaseListWebhooksResponse(); const message = createBaseCreateWebhookRequest();
message.webhooks = object.webhooks?.map((e) => Webhook.fromPartial(e)) || []; message.webhook = (object.webhook !== undefined && object.webhook !== null)
? Webhook.fromPartial(object.webhook)
: undefined;
message.webhookId = object.webhookId ?? "";
message.validateOnly = object.validateOnly ?? false;
message.requestId = object.requestId ?? "";
return message; return message;
}, },
}; };
function createBaseUpdateWebhookRequest(): UpdateWebhookRequest { function createBaseUpdateWebhookRequest(): UpdateWebhookRequest {
return { webhook: undefined, updateMask: undefined }; return { webhook: undefined, updateMask: undefined, allowMissing: false };
} }
export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = { export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = {
...@@ -376,6 +630,9 @@ export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = { ...@@ -376,6 +630,9 @@ export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = {
if (message.updateMask !== undefined) { if (message.updateMask !== undefined) {
FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join();
} }
if (message.allowMissing !== false) {
writer.uint32(24).bool(message.allowMissing);
}
return writer; return writer;
}, },
...@@ -402,6 +659,14 @@ export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = { ...@@ -402,6 +659,14 @@ export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = {
message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
continue; continue;
} }
case 3: {
if (tag !== 24) {
break;
}
message.allowMissing = reader.bool();
continue;
}
} }
if ((tag & 7) === 4 || tag === 0) { if ((tag & 7) === 4 || tag === 0) {
break; break;
...@@ -420,18 +685,22 @@ export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = { ...@@ -420,18 +685,22 @@ export const UpdateWebhookRequest: MessageFns<UpdateWebhookRequest> = {
? Webhook.fromPartial(object.webhook) ? Webhook.fromPartial(object.webhook)
: undefined; : undefined;
message.updateMask = object.updateMask ?? undefined; message.updateMask = object.updateMask ?? undefined;
message.allowMissing = object.allowMissing ?? false;
return message; return message;
}, },
}; };
function createBaseDeleteWebhookRequest(): DeleteWebhookRequest { function createBaseDeleteWebhookRequest(): DeleteWebhookRequest {
return { id: 0 }; return { name: "", force: false };
} }
export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = { export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = {
encode(message: DeleteWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { encode(message: DeleteWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== 0) { if (message.name !== "") {
writer.uint32(8).int32(message.id); writer.uint32(10).string(message.name);
}
if (message.force !== false) {
writer.uint32(16).bool(message.force);
} }
return writer; return writer;
}, },
...@@ -444,11 +713,19 @@ export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = { ...@@ -444,11 +713,19 @@ export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = {
const tag = reader.uint32(); const tag = reader.uint32();
switch (tag >>> 3) { switch (tag >>> 3) {
case 1: { case 1: {
if (tag !== 8) { if (tag !== 10) {
break; break;
} }
message.id = reader.int32(); message.name = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.force = reader.bool();
continue; continue;
} }
} }
...@@ -465,7 +742,8 @@ export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = { ...@@ -465,7 +742,8 @@ export const DeleteWebhookRequest: MessageFns<DeleteWebhookRequest> = {
}, },
fromPartial(object: DeepPartial<DeleteWebhookRequest>): DeleteWebhookRequest { fromPartial(object: DeepPartial<DeleteWebhookRequest>): DeleteWebhookRequest {
const message = createBaseDeleteWebhookRequest(); const message = createBaseDeleteWebhookRequest();
message.id = object.id ?? 0; message.name = object.name ?? "";
message.force = object.force ?? false;
return message; return message;
}, },
}; };
...@@ -569,23 +847,36 @@ export const WebhookServiceDefinition = { ...@@ -569,23 +847,36 @@ export const WebhookServiceDefinition = {
name: "WebhookService", name: "WebhookService",
fullName: "memos.api.v1.WebhookService", fullName: "memos.api.v1.WebhookService",
methods: { methods: {
/** CreateWebhook creates a new webhook. */ /** ListWebhooks returns a list of webhooks. */
createWebhook: { listWebhooks: {
name: "CreateWebhook", name: "ListWebhooks",
requestType: CreateWebhookRequest, requestType: ListWebhooksRequest,
requestStream: false,
responseType: ListWebhooksResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([18, 18, 16, 47, 97, 112, 105, 47, 118, 49, 47, 119, 101, 98, 104, 111, 111, 107, 115]),
],
},
},
},
/** GetWebhook gets a webhook by name. */
getWebhook: {
name: "GetWebhook",
requestType: GetWebhookRequest,
requestStream: false, requestStream: false,
responseType: Webhook, responseType: Webhook,
responseStream: false, responseStream: false,
options: { options: {
_unknownFields: { _unknownFields: {
8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
21, 27,
58, 18,
1, 25,
42,
34,
16,
47, 47,
97, 97,
112, 112,
...@@ -594,6 +885,12 @@ export const WebhookServiceDefinition = { ...@@ -594,6 +885,12 @@ export const WebhookServiceDefinition = {
118, 118,
49, 49,
47, 47,
123,
110,
97,
109,
101,
61,
119, 119,
101, 101,
98, 98,
...@@ -602,26 +899,38 @@ export const WebhookServiceDefinition = { ...@@ -602,26 +899,38 @@ export const WebhookServiceDefinition = {
111, 111,
107, 107,
115, 115,
47,
42,
125,
]), ]),
], ],
}, },
}, },
}, },
/** GetWebhook returns a webhook by id. */ /** CreateWebhook creates a new webhook. */
getWebhook: { createWebhook: {
name: "GetWebhook", name: "CreateWebhook",
requestType: GetWebhookRequest, requestType: CreateWebhookRequest,
requestStream: false, requestStream: false,
responseType: Webhook, responseType: Webhook,
responseStream: false, responseStream: false,
options: { options: {
_unknownFields: { _unknownFields: {
8410: [new Uint8Array([2, 105, 100])], 8410: [new Uint8Array([7, 119, 101, 98, 104, 111, 111, 107])],
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
23, 27,
18, 58,
21, 7,
119,
101,
98,
104,
111,
111,
107,
34,
16,
47, 47,
97, 97,
112, 112,
...@@ -638,31 +947,11 @@ export const WebhookServiceDefinition = { ...@@ -638,31 +947,11 @@ export const WebhookServiceDefinition = {
111, 111,
107, 107,
115, 115,
47,
123,
105,
100,
125,
]), ]),
], ],
}, },
}, },
}, },
/** ListWebhooks returns a list of webhooks. */
listWebhooks: {
name: "ListWebhooks",
requestType: ListWebhooksRequest,
requestStream: false,
responseType: ListWebhooksResponse,
responseStream: false,
options: {
_unknownFields: {
578365826: [
new Uint8Array([18, 18, 16, 47, 97, 112, 105, 47, 118, 49, 47, 119, 101, 98, 104, 111, 111, 107, 115]),
],
},
},
},
/** UpdateWebhook updates a webhook. */ /** UpdateWebhook updates a webhook. */
updateWebhook: { updateWebhook: {
name: "UpdateWebhook", name: "UpdateWebhook",
...@@ -698,7 +987,7 @@ export const WebhookServiceDefinition = { ...@@ -698,7 +987,7 @@ export const WebhookServiceDefinition = {
], ],
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
40, 44,
58, 58,
7, 7,
119, 119,
...@@ -709,7 +998,7 @@ export const WebhookServiceDefinition = { ...@@ -709,7 +998,7 @@ export const WebhookServiceDefinition = {
111, 111,
107, 107,
50, 50,
29, 33,
47, 47,
97, 97,
112, 112,
...@@ -718,6 +1007,7 @@ export const WebhookServiceDefinition = { ...@@ -718,6 +1007,7 @@ export const WebhookServiceDefinition = {
118, 118,
49, 49,
47, 47,
123,
119, 119,
101, 101,
98, 98,
...@@ -725,9 +1015,12 @@ export const WebhookServiceDefinition = { ...@@ -725,9 +1015,12 @@ export const WebhookServiceDefinition = {
111, 111,
111, 111,
107, 107,
115, 46,
47, 110,
123, 97,
109,
101,
61,
119, 119,
101, 101,
98, 98,
...@@ -735,16 +1028,16 @@ export const WebhookServiceDefinition = { ...@@ -735,16 +1028,16 @@ export const WebhookServiceDefinition = {
111, 111,
111, 111,
107, 107,
46, 115,
105, 47,
100, 42,
125, 125,
]), ]),
], ],
}, },
}, },
}, },
/** DeleteWebhook deletes a webhook by id. */ /** DeleteWebhook deletes a webhook. */
deleteWebhook: { deleteWebhook: {
name: "DeleteWebhook", name: "DeleteWebhook",
requestType: DeleteWebhookRequest, requestType: DeleteWebhookRequest,
...@@ -753,12 +1046,12 @@ export const WebhookServiceDefinition = { ...@@ -753,12 +1046,12 @@ export const WebhookServiceDefinition = {
responseStream: false, responseStream: false,
options: { options: {
_unknownFields: { _unknownFields: {
8410: [new Uint8Array([2, 105, 100])], 8410: [new Uint8Array([4, 110, 97, 109, 101])],
578365826: [ 578365826: [
new Uint8Array([ new Uint8Array([
23, 27,
42, 42,
21, 25,
47, 47,
97, 97,
112, 112,
...@@ -767,6 +1060,12 @@ export const WebhookServiceDefinition = { ...@@ -767,6 +1060,12 @@ export const WebhookServiceDefinition = {
118, 118,
49, 49,
47, 47,
123,
110,
97,
109,
101,
61,
119, 119,
101, 101,
98, 98,
...@@ -776,9 +1075,7 @@ export const WebhookServiceDefinition = { ...@@ -776,9 +1075,7 @@ export const WebhookServiceDefinition = {
107, 107,
115, 115,
47, 47,
123, 42,
105,
100,
125, 125,
]), ]),
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment