From 9b159368737798e30a894a7f9c84fe52a78b8ee8 Mon Sep 17 00:00:00 2001 From: Johnny Date: Mon, 23 Jun 2025 22:55:14 +0800 Subject: [PATCH] refactor: clean unused fields --- plugin/filter/common_converter.go | 8 +- plugin/filter/dialect.go | 50 ++--- plugin/filter/templates.go | 14 +- proto/api/v1/auth_service.proto | 50 ++--- proto/api/v1/idp_service.proto | 11 +- proto/api/v1/shortcut_service.proto | 12 -- proto/api/v1/webhook_service.proto | 46 +--- proto/gen/api/v1/auth_service.pb.go | 184 ++++++++-------- proto/gen/api/v1/idp_service.pb.go | 43 +--- proto/gen/api/v1/idp_service.pb.gw.go | 14 -- proto/gen/api/v1/shortcut_service.pb.go | 52 +---- proto/gen/api/v1/shortcut_service.pb.gw.go | 14 -- proto/gen/api/v1/webhook_service.pb.go | 191 +++-------------- proto/gen/api/v1/webhook_service.pb.gw.go | 42 ---- proto/gen/apidocs.swagger.yaml | 189 ++++------------- server/router/api/v1/webhook_service.go | 7 +- store/db/mysql/memo_filter.go | 2 +- store/db/postgres/memo_filter.go | 3 +- store/db/sqlite/memo_filter.go | 2 +- web/src/types/proto/api/v1/auth_service.ts | 58 ++--- web/src/types/proto/api/v1/idp_service.ts | 50 +---- .../types/proto/api/v1/shortcut_service.ts | 60 +----- web/src/types/proto/api/v1/webhook_service.ts | 199 +----------------- 23 files changed, 293 insertions(+), 1008 deletions(-) diff --git a/plugin/filter/common_converter.go b/plugin/filter/common_converter.go index 7c25b87c5..407e4d9ea 100644 --- a/plugin/filter/common_converter.go +++ b/plugin/filter/common_converter.go @@ -9,13 +9,13 @@ import ( exprv1 "google.golang.org/genproto/googleapis/api/expr/v1alpha1" ) -// CommonSQLConverter handles the common CEL to SQL conversion logic +// CommonSQLConverter handles the common CEL to SQL conversion logic. type CommonSQLConverter struct { dialect SQLDialect paramIndex int } -// NewCommonSQLConverter creates a new converter with the specified dialect +// NewCommonSQLConverter creates a new converter with the specified dialect. func NewCommonSQLConverter(dialect SQLDialect) *CommonSQLConverter { return &CommonSQLConverter{ dialect: dialect, @@ -23,7 +23,7 @@ func NewCommonSQLConverter(dialect SQLDialect) *CommonSQLConverter { } } -// ConvertExprToSQL converts a CEL expression to SQL using the configured dialect +// ConvertExprToSQL converts a CEL expression to SQL using the configured dialect. func (c *CommonSQLConverter) ConvertExprToSQL(ctx *ConvertContext, expr *exprv1.Expr) error { if v, ok := expr.ExprKind.(*exprv1.Expr_CallExpr); ok { switch v.CallExpr.Function { @@ -428,7 +428,7 @@ func (c *CommonSQLConverter) handleBooleanComparison(ctx *ConvertContext, field, return nil } -func (c *CommonSQLConverter) getComparisonOperator(function string) string { +func (*CommonSQLConverter) getComparisonOperator(function string) string { switch function { case "_==_": return "=" diff --git a/plugin/filter/dialect.go b/plugin/filter/dialect.go index 4f25fedbf..6c6ab4ca0 100644 --- a/plugin/filter/dialect.go +++ b/plugin/filter/dialect.go @@ -5,7 +5,7 @@ import ( "strings" ) -// SQLDialect defines database-specific SQL generation methods +// SQLDialect defines database-specific SQL generation methods. type SQLDialect interface { // Basic field access GetTablePrefix() string @@ -27,7 +27,7 @@ type SQLDialect interface { GetCurrentTimestamp() string } -// DatabaseType represents the type of database +// DatabaseType represents the type of database. type DatabaseType string const ( @@ -36,7 +36,7 @@ const ( PostgreSQL DatabaseType = "postgres" ) -// GetDialect returns the appropriate dialect for the database type +// GetDialect returns the appropriate dialect for the database type. func GetDialect(dbType DatabaseType) SQLDialect { switch dbType { case SQLite: @@ -50,14 +50,14 @@ func GetDialect(dbType DatabaseType) SQLDialect { } } -// SQLiteDialect implements SQLDialect for SQLite +// SQLiteDialect implements SQLDialect for SQLite. type SQLiteDialect struct{} -func (d *SQLiteDialect) GetTablePrefix() string { +func (*SQLiteDialect) GetTablePrefix() string { return "`memo`" } -func (d *SQLiteDialect) GetParameterPlaceholder(index int) string { +func (*SQLiteDialect) GetParameterPlaceholder(_ int) string { return "?" } @@ -69,15 +69,15 @@ func (d *SQLiteDialect) GetJSONArrayLength(path string) string { return fmt.Sprintf("JSON_ARRAY_LENGTH(COALESCE(%s, JSON_ARRAY()))", d.GetJSONExtract(path)) } -func (d *SQLiteDialect) GetJSONContains(path, element string) string { +func (d *SQLiteDialect) GetJSONContains(path, _ string) string { return fmt.Sprintf("%s LIKE ?", d.GetJSONExtract(path)) } -func (d *SQLiteDialect) GetJSONLike(path, pattern string) string { +func (d *SQLiteDialect) GetJSONLike(path, _ string) string { return fmt.Sprintf("%s LIKE ?", d.GetJSONExtract(path)) } -func (d *SQLiteDialect) GetBooleanValue(value bool) interface{} { +func (*SQLiteDialect) GetBooleanValue(value bool) interface{} { if value { return 1 } @@ -96,18 +96,18 @@ func (d *SQLiteDialect) GetTimestampComparison(field string) string { return fmt.Sprintf("%s.`%s`", d.GetTablePrefix(), field) } -func (d *SQLiteDialect) GetCurrentTimestamp() string { +func (*SQLiteDialect) GetCurrentTimestamp() string { return "strftime('%s', 'now')" } -// MySQLDialect implements SQLDialect for MySQL +// MySQLDialect implements SQLDialect for MySQL. type MySQLDialect struct{} -func (d *MySQLDialect) GetTablePrefix() string { +func (*MySQLDialect) GetTablePrefix() string { return "`memo`" } -func (d *MySQLDialect) GetParameterPlaceholder(index int) string { +func (*MySQLDialect) GetParameterPlaceholder(_ int) string { return "?" } @@ -119,15 +119,15 @@ func (d *MySQLDialect) GetJSONArrayLength(path string) string { return fmt.Sprintf("JSON_LENGTH(COALESCE(%s, JSON_ARRAY()))", d.GetJSONExtract(path)) } -func (d *MySQLDialect) GetJSONContains(path, element string) string { +func (d *MySQLDialect) GetJSONContains(path, _ string) string { return fmt.Sprintf("JSON_CONTAINS(%s, ?)", d.GetJSONExtract(path)) } -func (d *MySQLDialect) GetJSONLike(path, pattern string) string { +func (d *MySQLDialect) GetJSONLike(path, _ string) string { return fmt.Sprintf("%s LIKE ?", d.GetJSONExtract(path)) } -func (d *MySQLDialect) GetBooleanValue(value bool) interface{} { +func (*MySQLDialect) GetBooleanValue(value bool) interface{} { return value } @@ -147,18 +147,18 @@ func (d *MySQLDialect) GetTimestampComparison(field string) string { return fmt.Sprintf("UNIX_TIMESTAMP(%s.`%s`)", d.GetTablePrefix(), field) } -func (d *MySQLDialect) GetCurrentTimestamp() string { +func (*MySQLDialect) GetCurrentTimestamp() string { return "UNIX_TIMESTAMP()" } -// PostgreSQLDialect implements SQLDialect for PostgreSQL +// PostgreSQLDialect implements SQLDialect for PostgreSQL. type PostgreSQLDialect struct{} -func (d *PostgreSQLDialect) GetTablePrefix() string { +func (*PostgreSQLDialect) GetTablePrefix() string { return "memo" } -func (d *PostgreSQLDialect) GetParameterPlaceholder(index int) string { +func (*PostgreSQLDialect) GetParameterPlaceholder(index int) string { return fmt.Sprintf("$%d", index) } @@ -181,21 +181,21 @@ func (d *PostgreSQLDialect) GetJSONArrayLength(path string) string { return fmt.Sprintf("jsonb_array_length(COALESCE(%s.%s, '[]'::jsonb))", d.GetTablePrefix(), jsonPath) } -func (d *PostgreSQLDialect) GetJSONContains(path, element string) string { +func (d *PostgreSQLDialect) GetJSONContains(path, _ string) string { jsonPath := strings.Replace(path, "$.tags", "payload->'tags'", 1) return fmt.Sprintf("%s.%s @> jsonb_build_array(?)", d.GetTablePrefix(), jsonPath) } -func (d *PostgreSQLDialect) GetJSONLike(path, pattern string) string { +func (d *PostgreSQLDialect) GetJSONLike(path, _ string) string { jsonPath := strings.Replace(path, "$.tags", "payload->'tags'", 1) return fmt.Sprintf("%s.%s @> jsonb_build_array(?)", d.GetTablePrefix(), jsonPath) } -func (d *PostgreSQLDialect) GetBooleanValue(value bool) interface{} { +func (*PostgreSQLDialect) GetBooleanValue(value bool) interface{} { return value } -func (d *PostgreSQLDialect) GetBooleanComparison(path string, value bool) string { +func (d *PostgreSQLDialect) GetBooleanComparison(path string, _ bool) string { return fmt.Sprintf("(%s)::boolean = ?", d.GetJSONExtract(path)) } @@ -207,6 +207,6 @@ func (d *PostgreSQLDialect) GetTimestampComparison(field string) string { return fmt.Sprintf("EXTRACT(EPOCH FROM %s.%s)", d.GetTablePrefix(), field) } -func (d *PostgreSQLDialect) GetCurrentTimestamp() string { +func (*PostgreSQLDialect) GetCurrentTimestamp() string { return "EXTRACT(EPOCH FROM NOW())" } diff --git a/plugin/filter/templates.go b/plugin/filter/templates.go index b6dcaeaf3..73e1f1df3 100644 --- a/plugin/filter/templates.go +++ b/plugin/filter/templates.go @@ -4,14 +4,14 @@ import ( "fmt" ) -// SQLTemplate holds database-specific SQL fragments +// SQLTemplate holds database-specific SQL fragments. type SQLTemplate struct { SQLite string MySQL string PostgreSQL string } -// TemplateDBType represents the database type for templates +// TemplateDBType represents the database type for templates. type TemplateDBType string const ( @@ -20,7 +20,7 @@ const ( PostgreSQLTemplate TemplateDBType = "postgres" ) -// SQLTemplates contains common SQL patterns for different databases +// SQLTemplates contains common SQL patterns for different databases. var SQLTemplates = map[string]SQLTemplate{ "json_extract": { SQLite: "JSON_EXTRACT(`memo`.`payload`, '%s')", @@ -94,7 +94,7 @@ var SQLTemplates = map[string]SQLTemplate{ }, } -// GetSQL returns the appropriate SQL for the given template and database type +// GetSQL returns the appropriate SQL for the given template and database type. func GetSQL(templateName string, dbType TemplateDBType) string { template, exists := SQLTemplates[templateName] if !exists { @@ -113,7 +113,7 @@ func GetSQL(templateName string, dbType TemplateDBType) string { } } -// GetParameterPlaceholder returns the appropriate parameter placeholder for the database +// GetParameterPlaceholder returns the appropriate parameter placeholder for the database. func GetParameterPlaceholder(dbType TemplateDBType, index int) string { switch dbType { case PostgreSQLTemplate: @@ -123,7 +123,7 @@ func GetParameterPlaceholder(dbType TemplateDBType, index int) string { } } -// GetParameterValue returns the appropriate parameter value for the database +// GetParameterValue returns the appropriate parameter value for the database. func GetParameterValue(dbType TemplateDBType, templateName string, value interface{}) interface{} { switch templateName { case "json_contains_element", "json_contains_tag": @@ -136,7 +136,7 @@ func GetParameterValue(dbType TemplateDBType, templateName string, value interfa } } -// FormatPlaceholders formats a list of placeholders for the given database type +// FormatPlaceholders formats a list of placeholders for the given database type. func FormatPlaceholders(dbType TemplateDBType, count int, startIndex int) []string { placeholders := make([]string, count) for i := 0; i < count; i++ { diff --git a/proto/api/v1/auth_service.proto b/proto/api/v1/auth_service.proto index b956d35bc..7c24ecfc8 100644 --- a/proto/api/v1/auth_service.proto +++ b/proto/api/v1/auth_service.proto @@ -39,6 +39,32 @@ message GetCurrentSessionResponse { } message CreateSessionRequest { + // Nested message for password-based authentication credentials. + message PasswordCredentials { + // The username to sign in with. + // Required field for password-based authentication. + string username = 1 [(google.api.field_behavior) = REQUIRED]; + + // The password to sign in with. + // Required field for password-based authentication. + string password = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Nested message for SSO authentication credentials. + message SSOCredentials { + // The ID of the SSO provider. + // Required field to identify the SSO provider. + int32 idp_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // The authorization code from the SSO provider. + // Required field for completing the SSO flow. + string code = 2 [(google.api.field_behavior) = REQUIRED]; + + // The redirect URI used in the SSO flow. + // Required field for security validation. + string redirect_uri = 3 [(google.api.field_behavior) = REQUIRED]; + } + // Provide one authentication method (username/password or SSO). // Required field to specify the authentication method. oneof method { @@ -54,28 +80,4 @@ message CreateSessionRequest { bool never_expire = 3 [(google.api.field_behavior) = OPTIONAL]; } -message PasswordCredentials { - // The username to sign in with. - // Required field for password-based authentication. - string username = 1 [(google.api.field_behavior) = REQUIRED]; - - // The password to sign in with. - // Required field for password-based authentication. - string password = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SSOCredentials { - // The ID of the SSO provider. - // Required field to identify the SSO provider. - int32 idp_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The authorization code from the SSO provider. - // Required field for completing the SSO flow. - string code = 2 [(google.api.field_behavior) = REQUIRED]; - - // The redirect URI used in the SSO flow. - // Required field for security validation. - string redirect_uri = 3 [(google.api.field_behavior) = REQUIRED]; -} - message DeleteSessionRequest {} diff --git a/proto/api/v1/idp_service.proto b/proto/api/v1/idp_service.proto index 4a9d287dc..a35e6722c 100644 --- a/proto/api/v1/idp_service.proto +++ b/proto/api/v1/idp_service.proto @@ -103,20 +103,11 @@ message OAuth2Config { FieldMapping field_mapping = 7; } -message ListIdentityProvidersRequest { - // Optional. The maximum number of identity providers to return. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} +message ListIdentityProvidersRequest {} message ListIdentityProvidersResponse { // The list of identity providers. repeated IdentityProvider identity_providers = 1; - - // A token for the next page of results. - string next_page_token = 2; } message GetIdentityProviderRequest { diff --git a/proto/api/v1/shortcut_service.proto b/proto/api/v1/shortcut_service.proto index 6f27d4680..7ebb87807 100644 --- a/proto/api/v1/shortcut_service.proto +++ b/proto/api/v1/shortcut_service.proto @@ -75,23 +75,11 @@ message ListShortcutsRequest { (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = {child_type: "memos.api.v1/Shortcut"} ]; - - // Optional. The maximum number of shortcuts to return. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token for pagination. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; } message ListShortcutsResponse { // The list of shortcuts. repeated Shortcut shortcuts = 1; - - // A token for the next page of results. - string next_page_token = 2; - - // The total count of shortcuts. - int32 total_size = 3; } message GetShortcutRequest { diff --git a/proto/api/v1/webhook_service.proto b/proto/api/v1/webhook_service.proto index 27ce2d5c1..24b2fba98 100644 --- a/proto/api/v1/webhook_service.proto +++ b/proto/api/v1/webhook_service.proto @@ -84,41 +84,11 @@ message Webhook { google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; } -message ListWebhooksRequest { - // Optional. The maximum number of webhooks to return. - // The service may return fewer than this value. - // If unspecified, at most 50 webhooks will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListWebhooks` call. - // Provide this to retrieve the subsequent page. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter to apply to the list results. - // Example: "state=ACTIVE" or "creator=users/123" - // Supported operators: =, !=, <, <=, >, >=, : - // Supported fields: display_name, url, creator, state, create_time, update_time - string filter = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The order to sort results by. - // Example: "create_time desc" or "display_name asc" - string order_by = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, show deleted webhooks in the response. - bool show_deleted = 5 [(google.api.field_behavior) = OPTIONAL]; -} +message ListWebhooksRequest {} message ListWebhooksResponse { // The list of webhooks. repeated Webhook webhooks = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // The total count of webhooks (may be approximate). - int32 total_size = 3; } message GetWebhookRequest { @@ -128,10 +98,6 @@ message GetWebhookRequest { (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 { @@ -148,10 +114,6 @@ message CreateWebhookRequest { // 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 { @@ -160,9 +122,6 @@ message UpdateWebhookRequest { // Required. The list of fields to update. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If set to true, allows updating sensitive fields. - bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; } message DeleteWebhookRequest { @@ -172,9 +131,6 @@ message DeleteWebhookRequest { (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 { diff --git a/proto/gen/api/v1/auth_service.pb.go b/proto/gen/api/v1/auth_service.pb.go index 9dd4a2b30..69f8488fb 100644 --- a/proto/gen/api/v1/auth_service.pb.go +++ b/proto/gen/api/v1/auth_service.pb.go @@ -110,7 +110,7 @@ type CreateSessionRequest struct { // // Types that are valid to be assigned to Method: // - // *CreateSessionRequest_PasswordCredentials + // *CreateSessionRequest_PasswordCredentials_ // *CreateSessionRequest_SsoCredentials Method isCreateSessionRequest_Method `protobuf_oneof:"method"` // Whether the session should never expire. @@ -157,16 +157,16 @@ func (x *CreateSessionRequest) GetMethod() isCreateSessionRequest_Method { return nil } -func (x *CreateSessionRequest) GetPasswordCredentials() *PasswordCredentials { +func (x *CreateSessionRequest) GetPasswordCredentials() *CreateSessionRequest_PasswordCredentials { if x != nil { - if x, ok := x.Method.(*CreateSessionRequest_PasswordCredentials); ok { + if x, ok := x.Method.(*CreateSessionRequest_PasswordCredentials_); ok { return x.PasswordCredentials } } return nil } -func (x *CreateSessionRequest) GetSsoCredentials() *SSOCredentials { +func (x *CreateSessionRequest) GetSsoCredentials() *CreateSessionRequest_SSOCredentials { if x != nil { if x, ok := x.Method.(*CreateSessionRequest_SsoCredentials); ok { return x.SsoCredentials @@ -186,21 +186,58 @@ type isCreateSessionRequest_Method interface { isCreateSessionRequest_Method() } -type CreateSessionRequest_PasswordCredentials struct { +type CreateSessionRequest_PasswordCredentials_ struct { // Username and password authentication method. - PasswordCredentials *PasswordCredentials `protobuf:"bytes,1,opt,name=password_credentials,json=passwordCredentials,proto3,oneof"` + PasswordCredentials *CreateSessionRequest_PasswordCredentials `protobuf:"bytes,1,opt,name=password_credentials,json=passwordCredentials,proto3,oneof"` } type CreateSessionRequest_SsoCredentials struct { // SSO provider authentication method. - SsoCredentials *SSOCredentials `protobuf:"bytes,2,opt,name=sso_credentials,json=ssoCredentials,proto3,oneof"` + SsoCredentials *CreateSessionRequest_SSOCredentials `protobuf:"bytes,2,opt,name=sso_credentials,json=ssoCredentials,proto3,oneof"` } -func (*CreateSessionRequest_PasswordCredentials) isCreateSessionRequest_Method() {} +func (*CreateSessionRequest_PasswordCredentials_) isCreateSessionRequest_Method() {} func (*CreateSessionRequest_SsoCredentials) isCreateSessionRequest_Method() {} -type PasswordCredentials struct { +type DeleteSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSessionRequest) Reset() { + *x = DeleteSessionRequest{} + mi := &file_api_v1_auth_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSessionRequest) ProtoMessage() {} + +func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_auth_service_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSessionRequest.ProtoReflect.Descriptor instead. +func (*DeleteSessionRequest) Descriptor() ([]byte, []int) { + return file_api_v1_auth_service_proto_rawDescGZIP(), []int{3} +} + +// Nested message for password-based authentication credentials. +type CreateSessionRequest_PasswordCredentials struct { state protoimpl.MessageState `protogen:"open.v1"` // The username to sign in with. // Required field for password-based authentication. @@ -212,21 +249,21 @@ type PasswordCredentials struct { sizeCache protoimpl.SizeCache } -func (x *PasswordCredentials) Reset() { - *x = PasswordCredentials{} - mi := &file_api_v1_auth_service_proto_msgTypes[3] +func (x *CreateSessionRequest_PasswordCredentials) Reset() { + *x = CreateSessionRequest_PasswordCredentials{} + mi := &file_api_v1_auth_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *PasswordCredentials) String() string { +func (x *CreateSessionRequest_PasswordCredentials) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PasswordCredentials) ProtoMessage() {} +func (*CreateSessionRequest_PasswordCredentials) ProtoMessage() {} -func (x *PasswordCredentials) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[3] +func (x *CreateSessionRequest_PasswordCredentials) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_auth_service_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -237,26 +274,27 @@ func (x *PasswordCredentials) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PasswordCredentials.ProtoReflect.Descriptor instead. -func (*PasswordCredentials) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{3} +// Deprecated: Use CreateSessionRequest_PasswordCredentials.ProtoReflect.Descriptor instead. +func (*CreateSessionRequest_PasswordCredentials) Descriptor() ([]byte, []int) { + return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2, 0} } -func (x *PasswordCredentials) GetUsername() string { +func (x *CreateSessionRequest_PasswordCredentials) GetUsername() string { if x != nil { return x.Username } return "" } -func (x *PasswordCredentials) GetPassword() string { +func (x *CreateSessionRequest_PasswordCredentials) GetPassword() string { if x != nil { return x.Password } return "" } -type SSOCredentials struct { +// Nested message for SSO authentication credentials. +type CreateSessionRequest_SSOCredentials struct { state protoimpl.MessageState `protogen:"open.v1"` // The ID of the SSO provider. // Required field to identify the SSO provider. @@ -271,21 +309,21 @@ type SSOCredentials struct { sizeCache protoimpl.SizeCache } -func (x *SSOCredentials) Reset() { - *x = SSOCredentials{} - mi := &file_api_v1_auth_service_proto_msgTypes[4] +func (x *CreateSessionRequest_SSOCredentials) Reset() { + *x = CreateSessionRequest_SSOCredentials{} + mi := &file_api_v1_auth_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SSOCredentials) String() string { +func (x *CreateSessionRequest_SSOCredentials) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SSOCredentials) ProtoMessage() {} +func (*CreateSessionRequest_SSOCredentials) ProtoMessage() {} -func (x *SSOCredentials) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[4] +func (x *CreateSessionRequest_SSOCredentials) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_auth_service_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -296,68 +334,32 @@ func (x *SSOCredentials) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SSOCredentials.ProtoReflect.Descriptor instead. -func (*SSOCredentials) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{4} +// Deprecated: Use CreateSessionRequest_SSOCredentials.ProtoReflect.Descriptor instead. +func (*CreateSessionRequest_SSOCredentials) Descriptor() ([]byte, []int) { + return file_api_v1_auth_service_proto_rawDescGZIP(), []int{2, 1} } -func (x *SSOCredentials) GetIdpId() int32 { +func (x *CreateSessionRequest_SSOCredentials) GetIdpId() int32 { if x != nil { return x.IdpId } return 0 } -func (x *SSOCredentials) GetCode() string { +func (x *CreateSessionRequest_SSOCredentials) GetCode() string { if x != nil { return x.Code } return "" } -func (x *SSOCredentials) GetRedirectUri() string { +func (x *CreateSessionRequest_SSOCredentials) GetRedirectUri() string { if x != nil { return x.RedirectUri } return "" } -type DeleteSessionRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *DeleteSessionRequest) Reset() { - *x = DeleteSessionRequest{} - mi := &file_api_v1_auth_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *DeleteSessionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteSessionRequest) ProtoMessage() {} - -func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_auth_service_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteSessionRequest.ProtoReflect.Descriptor instead. -func (*DeleteSessionRequest) Descriptor() ([]byte, []int) { - return file_api_v1_auth_service_proto_rawDescGZIP(), []int{5} -} - var File_api_v1_auth_service_proto protoreflect.FileDescriptor const file_api_v1_auth_service_proto_rawDesc = "" + @@ -365,19 +367,19 @@ const file_api_v1_auth_service_proto_rawDesc = "" + "\x19api/v1/auth_service.proto\x12\fmemos.api.v1\x1a\x19api/v1/user_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x1a\n" + "\x18GetCurrentSessionRequest\"C\n" + "\x19GetCurrentSessionResponse\x12&\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\"\xe9\x01\n" + - "\x14CreateSessionRequest\x12V\n" + - "\x14password_credentials\x18\x01 \x01(\v2!.memos.api.v1.PasswordCredentialsH\x00R\x13passwordCredentials\x12G\n" + - "\x0fsso_credentials\x18\x02 \x01(\v2\x1c.memos.api.v1.SSOCredentialsH\x00R\x0essoCredentials\x12&\n" + - "\fnever_expire\x18\x03 \x01(\bB\x03\xe0A\x01R\vneverExpireB\b\n" + - "\x06method\"W\n" + + "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\"\xdb\x03\n" + + "\x14CreateSessionRequest\x12k\n" + + "\x14password_credentials\x18\x01 \x01(\v26.memos.api.v1.CreateSessionRequest.PasswordCredentialsH\x00R\x13passwordCredentials\x12\\\n" + + "\x0fsso_credentials\x18\x02 \x01(\v21.memos.api.v1.CreateSessionRequest.SSOCredentialsH\x00R\x0essoCredentials\x12&\n" + + "\fnever_expire\x18\x03 \x01(\bB\x03\xe0A\x01R\vneverExpire\x1aW\n" + "\x13PasswordCredentials\x12\x1f\n" + "\busername\x18\x01 \x01(\tB\x03\xe0A\x02R\busername\x12\x1f\n" + - "\bpassword\x18\x02 \x01(\tB\x03\xe0A\x02R\bpassword\"m\n" + + "\bpassword\x18\x02 \x01(\tB\x03\xe0A\x02R\bpassword\x1am\n" + "\x0eSSOCredentials\x12\x1a\n" + "\x06idp_id\x18\x01 \x01(\x05B\x03\xe0A\x02R\x05idpId\x12\x17\n" + "\x04code\x18\x02 \x01(\tB\x03\xe0A\x02R\x04code\x12&\n" + - "\fredirect_uri\x18\x03 \x01(\tB\x03\xe0A\x02R\vredirectUri\"\x16\n" + + "\fredirect_uri\x18\x03 \x01(\tB\x03\xe0A\x02R\vredirectUriB\b\n" + + "\x06method\"\x16\n" + "\x14DeleteSessionRequest2\xe4\x02\n" + "\vAuthService\x12v\n" + "\x11GetCurrentSession\x12&.memos.api.v1.GetCurrentSessionRequest\x1a\x12.memos.api.v1.User\"%\x82\xd3\xe4\x93\x02\x1f\x12\x1d/api/v1/auth/sessions/current\x12i\n" + @@ -399,22 +401,22 @@ func file_api_v1_auth_service_proto_rawDescGZIP() []byte { var file_api_v1_auth_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_api_v1_auth_service_proto_goTypes = []any{ - (*GetCurrentSessionRequest)(nil), // 0: memos.api.v1.GetCurrentSessionRequest - (*GetCurrentSessionResponse)(nil), // 1: memos.api.v1.GetCurrentSessionResponse - (*CreateSessionRequest)(nil), // 2: memos.api.v1.CreateSessionRequest - (*PasswordCredentials)(nil), // 3: memos.api.v1.PasswordCredentials - (*SSOCredentials)(nil), // 4: memos.api.v1.SSOCredentials - (*DeleteSessionRequest)(nil), // 5: memos.api.v1.DeleteSessionRequest - (*User)(nil), // 6: memos.api.v1.User - (*emptypb.Empty)(nil), // 7: google.protobuf.Empty + (*GetCurrentSessionRequest)(nil), // 0: memos.api.v1.GetCurrentSessionRequest + (*GetCurrentSessionResponse)(nil), // 1: memos.api.v1.GetCurrentSessionResponse + (*CreateSessionRequest)(nil), // 2: memos.api.v1.CreateSessionRequest + (*DeleteSessionRequest)(nil), // 3: memos.api.v1.DeleteSessionRequest + (*CreateSessionRequest_PasswordCredentials)(nil), // 4: memos.api.v1.CreateSessionRequest.PasswordCredentials + (*CreateSessionRequest_SSOCredentials)(nil), // 5: memos.api.v1.CreateSessionRequest.SSOCredentials + (*User)(nil), // 6: memos.api.v1.User + (*emptypb.Empty)(nil), // 7: google.protobuf.Empty } var file_api_v1_auth_service_proto_depIdxs = []int32{ 6, // 0: memos.api.v1.GetCurrentSessionResponse.user:type_name -> memos.api.v1.User - 3, // 1: memos.api.v1.CreateSessionRequest.password_credentials:type_name -> memos.api.v1.PasswordCredentials - 4, // 2: memos.api.v1.CreateSessionRequest.sso_credentials:type_name -> memos.api.v1.SSOCredentials + 4, // 1: memos.api.v1.CreateSessionRequest.password_credentials:type_name -> memos.api.v1.CreateSessionRequest.PasswordCredentials + 5, // 2: memos.api.v1.CreateSessionRequest.sso_credentials:type_name -> memos.api.v1.CreateSessionRequest.SSOCredentials 0, // 3: memos.api.v1.AuthService.GetCurrentSession:input_type -> memos.api.v1.GetCurrentSessionRequest 2, // 4: memos.api.v1.AuthService.CreateSession:input_type -> memos.api.v1.CreateSessionRequest - 5, // 5: memos.api.v1.AuthService.DeleteSession:input_type -> memos.api.v1.DeleteSessionRequest + 3, // 5: memos.api.v1.AuthService.DeleteSession:input_type -> memos.api.v1.DeleteSessionRequest 6, // 6: memos.api.v1.AuthService.GetCurrentSession:output_type -> memos.api.v1.User 6, // 7: memos.api.v1.AuthService.CreateSession:output_type -> memos.api.v1.User 7, // 8: memos.api.v1.AuthService.DeleteSession:output_type -> google.protobuf.Empty @@ -432,7 +434,7 @@ func file_api_v1_auth_service_proto_init() { } file_api_v1_user_service_proto_init() file_api_v1_auth_service_proto_msgTypes[2].OneofWrappers = []any{ - (*CreateSessionRequest_PasswordCredentials)(nil), + (*CreateSessionRequest_PasswordCredentials_)(nil), (*CreateSessionRequest_SsoCredentials)(nil), } type x struct{} diff --git a/proto/gen/api/v1/idp_service.pb.go b/proto/gen/api/v1/idp_service.pb.go index a24be8513..0b20b930c 100644 --- a/proto/gen/api/v1/idp_service.pb.go +++ b/proto/gen/api/v1/idp_service.pb.go @@ -380,11 +380,7 @@ func (x *OAuth2Config) GetFieldMapping() *FieldMapping { } type ListIdentityProvidersRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The maximum number of identity providers to return. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -419,28 +415,12 @@ func (*ListIdentityProvidersRequest) Descriptor() ([]byte, []int) { return file_api_v1_idp_service_proto_rawDescGZIP(), []int{4} } -func (x *ListIdentityProvidersRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListIdentityProvidersRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - type ListIdentityProvidersResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // The list of identity providers. IdentityProviders []*IdentityProvider `protobuf:"bytes,1,rep,name=identity_providers,json=identityProviders,proto3" json:"identity_providers,omitempty"` - // A token for the next page of results. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ListIdentityProvidersResponse) Reset() { @@ -480,13 +460,6 @@ func (x *ListIdentityProvidersResponse) GetIdentityProviders() []*IdentityProvid return nil } -func (x *ListIdentityProvidersResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - type GetIdentityProviderRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the identity provider to get. @@ -723,14 +696,10 @@ const file_api_v1_idp_service_proto_rawDesc = "" + "\ttoken_url\x18\x04 \x01(\tR\btokenUrl\x12\"\n" + "\ruser_info_url\x18\x05 \x01(\tR\vuserInfoUrl\x12\x16\n" + "\x06scopes\x18\x06 \x03(\tR\x06scopes\x12?\n" + - "\rfield_mapping\x18\a \x01(\v2\x1a.memos.api.v1.FieldMappingR\ffieldMapping\"d\n" + - "\x1cListIdentityProvidersRequest\x12 \n" + - "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x02 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x96\x01\n" + + "\rfield_mapping\x18\a \x01(\v2\x1a.memos.api.v1.FieldMappingR\ffieldMapping\"\x1e\n" + + "\x1cListIdentityProvidersRequest\"n\n" + "\x1dListIdentityProvidersResponse\x12M\n" + - "\x12identity_providers\x18\x01 \x03(\v2\x1e.memos.api.v1.IdentityProviderR\x11identityProviders\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"W\n" + + "\x12identity_providers\x18\x01 \x03(\v2\x1e.memos.api.v1.IdentityProviderR\x11identityProviders\"W\n" + "\x1aGetIdentityProviderRequest\x129\n" + "\x04name\x18\x01 \x01(\tB%\xe0A\x02\xfaA\x1f\n" + "\x1dmemos.api.v1/IdentityProviderR\x04name\"\xa8\x01\n" + diff --git a/proto/gen/api/v1/idp_service.pb.gw.go b/proto/gen/api/v1/idp_service.pb.gw.go index 85cffd215..94d74df83 100644 --- a/proto/gen/api/v1/idp_service.pb.gw.go +++ b/proto/gen/api/v1/idp_service.pb.gw.go @@ -35,8 +35,6 @@ var ( _ = metadata.Join ) -var filter_IdentityProviderService_ListIdentityProviders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} - func request_IdentityProviderService_ListIdentityProviders_0(ctx context.Context, marshaler runtime.Marshaler, client IdentityProviderServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq ListIdentityProvidersRequest @@ -45,12 +43,6 @@ func request_IdentityProviderService_ListIdentityProviders_0(ctx context.Context if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_IdentityProviderService_ListIdentityProviders_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := client.ListIdentityProviders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -60,12 +52,6 @@ func local_request_IdentityProviderService_ListIdentityProviders_0(ctx context.C protoReq ListIdentityProvidersRequest metadata runtime.ServerMetadata ) - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_IdentityProviderService_ListIdentityProviders_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := server.ListIdentityProviders(ctx, &protoReq) return msg, metadata, err } diff --git a/proto/gen/api/v1/shortcut_service.pb.go b/proto/gen/api/v1/shortcut_service.pb.go index 0149be9d5..7c75683fe 100644 --- a/proto/gen/api/v1/shortcut_service.pb.go +++ b/proto/gen/api/v1/shortcut_service.pb.go @@ -92,11 +92,7 @@ type ListShortcutsRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The parent resource where shortcuts are listed. // Format: users/{user} - Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` - // Optional. The maximum number of shortcuts to return. - PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token for pagination. - PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -138,28 +134,10 @@ func (x *ListShortcutsRequest) GetParent() string { return "" } -func (x *ListShortcutsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListShortcutsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - type ListShortcutsResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // The list of shortcuts. - Shortcuts []*Shortcut `protobuf:"bytes,1,rep,name=shortcuts,proto3" json:"shortcuts,omitempty"` - // A token for the next page of results. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` - // The total count of shortcuts. - TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` + Shortcuts []*Shortcut `protobuf:"bytes,1,rep,name=shortcuts,proto3" json:"shortcuts,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -201,20 +179,6 @@ func (x *ListShortcutsResponse) GetShortcuts() []*Shortcut { return nil } -func (x *ListShortcutsResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -func (x *ListShortcutsResponse) GetTotalSize() int32 { - if x != nil { - return x.TotalSize - } - return 0 -} - type GetShortcutRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the shortcut to retrieve. @@ -434,17 +398,11 @@ const file_api_v1_shortcut_service_proto_rawDesc = "" + "\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12\x19\n" + "\x05title\x18\x02 \x01(\tB\x03\xe0A\x02R\x05title\x12\x1b\n" + "\x06filter\x18\x03 \x01(\tB\x03\xe0A\x01R\x06filter:R\xeaAO\n" + - "\x15memos.api.v1/Shortcut\x12!users/{user}/shortcuts/{shortcut}*\tshortcuts2\bshortcut\"\x93\x01\n" + + "\x15memos.api.v1/Shortcut\x12!users/{user}/shortcuts/{shortcut}*\tshortcuts2\bshortcut\"M\n" + "\x14ListShortcutsRequest\x125\n" + - "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api.v1/ShortcutR\x06parent\x12 \n" + - "\tpage_size\x18\x02 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "page_token\x18\x03 \x01(\tB\x03\xe0A\x01R\tpageToken\"\x94\x01\n" + + "\x06parent\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\x12\x15memos.api.v1/ShortcutR\x06parent\"M\n" + "\x15ListShortcutsResponse\x124\n" + - "\tshortcuts\x18\x01 \x03(\v2\x16.memos.api.v1.ShortcutR\tshortcuts\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" + - "\n" + - "total_size\x18\x03 \x01(\x05R\ttotalSize\"G\n" + + "\tshortcuts\x18\x01 \x03(\v2\x16.memos.api.v1.ShortcutR\tshortcuts\"G\n" + "\x12GetShortcutRequest\x121\n" + "\x04name\x18\x01 \x01(\tB\x1d\xe0A\x02\xfaA\x17\n" + "\x15memos.api.v1/ShortcutR\x04name\"\xb1\x01\n" + diff --git a/proto/gen/api/v1/shortcut_service.pb.gw.go b/proto/gen/api/v1/shortcut_service.pb.gw.go index 0d3228f5e..0e15ae291 100644 --- a/proto/gen/api/v1/shortcut_service.pb.gw.go +++ b/proto/gen/api/v1/shortcut_service.pb.gw.go @@ -35,8 +35,6 @@ var ( _ = metadata.Join ) -var filter_ShortcutService_ListShortcuts_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - func request_ShortcutService_ListShortcuts_0(ctx context.Context, marshaler runtime.Marshaler, client ShortcutServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq ListShortcutsRequest @@ -54,12 +52,6 @@ func request_ShortcutService_ListShortcuts_0(ctx context.Context, marshaler runt if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ShortcutService_ListShortcuts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := client.ListShortcuts(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -78,12 +70,6 @@ func local_request_ShortcutService_ListShortcuts_0(ctx context.Context, marshale if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_ShortcutService_ListShortcuts_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := server.ListShortcuts(ctx, &protoReq) return msg, metadata, err } diff --git a/proto/gen/api/v1/webhook_service.pb.go b/proto/gen/api/v1/webhook_service.pb.go index d92078236..e877b5769 100644 --- a/proto/gen/api/v1/webhook_service.pb.go +++ b/proto/gen/api/v1/webhook_service.pb.go @@ -127,25 +127,7 @@ func (x *Webhook) GetUpdateTime() *timestamppb.Timestamp { } type ListWebhooksRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Optional. The maximum number of webhooks to return. - // The service may return fewer than this value. - // If unspecified, at most 50 webhooks will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // Optional. A page token, received from a previous `ListWebhooks` call. - // Provide this to retrieve the subsequent page. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` - // Optional. Filter to apply to the list results. - // Example: "state=ACTIVE" or "creator=users/123" - // Supported operators: =, !=, <, <=, >, >=, : - // Supported fields: display_name, url, creator, state, create_time, update_time - Filter string `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` - // Optional. The order to sort results by. - // Example: "create_time desc" or "display_name asc" - OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"` - // Optional. If true, show deleted webhooks in the response. - ShowDeleted bool `protobuf:"varint,5,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -180,50 +162,10 @@ func (*ListWebhooksRequest) Descriptor() ([]byte, []int) { return file_api_v1_webhook_service_proto_rawDescGZIP(), []int{1} } -func (x *ListWebhooksRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListWebhooksRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - -func (x *ListWebhooksRequest) GetFilter() string { - if x != nil { - return x.Filter - } - return "" -} - -func (x *ListWebhooksRequest) GetOrderBy() string { - if x != nil { - return x.OrderBy - } - return "" -} - -func (x *ListWebhooksRequest) GetShowDeleted() bool { - if x != nil { - return x.ShowDeleted - } - return false -} - type ListWebhooksResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // 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"` + Webhooks []*Webhook `protobuf:"bytes,1,rep,name=webhooks,proto3" json:"webhooks,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -265,28 +207,11 @@ func (x *ListWebhooksResponse) GetWebhooks() []*Webhook { return nil } -func (x *ListWebhooksResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - -func (x *ListWebhooksResponse) GetTotalSize() int32 { - if x != nil { - return x.TotalSize - } - return 0 -} - type GetWebhookRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The resource name of the webhook. // Format: webhooks/{webhook} - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Optional. The fields to return in the response. - // If not specified, all fields are returned. - ReadMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=read_mask,json=readMask,proto3" json:"read_mask,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -328,13 +253,6 @@ func (x *GetWebhookRequest) GetName() string { return "" } -func (x *GetWebhookRequest) GetReadMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.ReadMask - } - return nil -} - type CreateWebhookRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The webhook to create. @@ -344,10 +262,7 @@ type CreateWebhookRequest struct { // 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"` + ValidateOnly bool `protobuf:"varint,3,opt,name=validate_only,json=validateOnly,proto3" json:"validate_only,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -403,21 +318,12 @@ func (x *CreateWebhookRequest) GetValidateOnly() bool { return false } -func (x *CreateWebhookRequest) GetRequestId() string { - if x != nil { - return x.RequestId - } - return "" -} - type UpdateWebhookRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // Required. The webhook to update. Webhook *Webhook `protobuf:"bytes,1,opt,name=webhook,proto3" json:"webhook,omitempty"` // Required. The list of fields to update. - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` - // Optional. If set to true, allows updating sensitive fields. - AllowMissing bool `protobuf:"varint,3,opt,name=allow_missing,json=allowMissing,proto3" json:"allow_missing,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -466,20 +372,11 @@ func (x *UpdateWebhookRequest) GetUpdateMask() *fieldmaskpb.FieldMask { return nil } -func (x *UpdateWebhookRequest) GetAllowMissing() bool { - if x != nil { - return x.AllowMissing - } - return false -} - type DeleteWebhookRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // 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"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -521,13 +418,6 @@ func (x *DeleteWebhookRequest) GetName() string { return "" } -func (x *DeleteWebhookRequest) GetForce() bool { - if x != nil { - return x.Force - } - return false -} - type WebhookRequestPayload struct { state protoimpl.MessageState `protogen:"open.v1"` // The target URL for the webhook request. @@ -625,39 +515,25 @@ const file_api_v1_webhook_service_proto_rawDesc = "" + "createTime\x12@\n" + "\vupdate_time\x18\a \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "updateTime:F\xeaAC\n" + - "\x14memos.api.v1/Webhook\x12\x12webhooks/{webhook}\x1a\x04name*\bwebhooks2\awebhook\"\xc0\x01\n" + - "\x13ListWebhooksRequest\x12 \n" + - "\tpage_size\x18\x01 \x01(\x05B\x03\xe0A\x01R\bpageSize\x12\"\n" + - "\n" + - "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" + + "\x14memos.api.v1/Webhook\x12\x12webhooks/{webhook}\x1a\x04name*\bwebhooks2\awebhook\"\x15\n" + + "\x13ListWebhooksRequest\"I\n" + "\x14ListWebhooksResponse\x121\n" + - "\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\x12\x1d\n" + - "\n" + - "total_size\x18\x03 \x01(\x05R\ttotalSize\"\x83\x01\n" + + "\bwebhooks\x18\x01 \x03(\v2\x15.memos.api.v1.WebhookR\bwebhooks\"E\n" + "\x11GetWebhookRequest\x120\n" + "\x04name\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" + - "\x14memos.api.v1/WebhookR\x04name\x12<\n" + - "\tread_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x01R\breadMask\"\xc1\x01\n" + + "\x14memos.api.v1/WebhookR\x04name\"\x9d\x01\n" + "\x14CreateWebhookRequest\x127\n" + "\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookB\x06\xe0A\x02\xe0A\x04R\awebhook\x12\"\n" + "\n" + "webhook_id\x18\x02 \x01(\tB\x03\xe0A\x01R\twebhookId\x12(\n" + - "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\x12\"\n" + - "\n" + - "request_id\x18\x04 \x01(\tB\x03\xe0A\x01R\trequestId\"\xb8\x01\n" + + "\rvalidate_only\x18\x03 \x01(\bB\x03\xe0A\x01R\fvalidateOnly\"\x8e\x01\n" + "\x14UpdateWebhookRequest\x124\n" + "\awebhook\x18\x01 \x01(\v2\x15.memos.api.v1.WebhookB\x03\xe0A\x02R\awebhook\x12@\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskB\x03\xe0A\x02R\n" + - "updateMask\x12(\n" + - "\rallow_missing\x18\x03 \x01(\bB\x03\xe0A\x01R\fallowMissing\"c\n" + + "updateMask\"H\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" + + "\x14memos.api.v1/WebhookR\x04name\"\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" + @@ -708,27 +584,26 @@ var file_api_v1_webhook_service_proto_depIdxs = []int32{ 9, // 1: memos.api.v1.Webhook.create_time:type_name -> google.protobuf.Timestamp 9, // 2: memos.api.v1.Webhook.update_time:type_name -> google.protobuf.Timestamp 0, // 3: memos.api.v1.ListWebhooksResponse.webhooks:type_name -> memos.api.v1.Webhook - 10, // 4: memos.api.v1.GetWebhookRequest.read_mask:type_name -> google.protobuf.FieldMask - 0, // 5: memos.api.v1.CreateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook - 0, // 6: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook - 10, // 7: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask - 9, // 8: memos.api.v1.WebhookRequestPayload.create_time:type_name -> google.protobuf.Timestamp - 11, // 9: memos.api.v1.WebhookRequestPayload.memo:type_name -> memos.api.v1.Memo - 1, // 10: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest - 3, // 11: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest - 4, // 12: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest - 5, // 13: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest - 6, // 14: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest - 2, // 15: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse - 0, // 16: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook - 0, // 17: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook - 0, // 18: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook - 12, // 19: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty - 15, // [15:20] is the sub-list for method output_type - 10, // [10:15] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 0, // 4: memos.api.v1.CreateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook + 0, // 5: memos.api.v1.UpdateWebhookRequest.webhook:type_name -> memos.api.v1.Webhook + 10, // 6: memos.api.v1.UpdateWebhookRequest.update_mask:type_name -> google.protobuf.FieldMask + 9, // 7: memos.api.v1.WebhookRequestPayload.create_time:type_name -> google.protobuf.Timestamp + 11, // 8: memos.api.v1.WebhookRequestPayload.memo:type_name -> memos.api.v1.Memo + 1, // 9: memos.api.v1.WebhookService.ListWebhooks:input_type -> memos.api.v1.ListWebhooksRequest + 3, // 10: memos.api.v1.WebhookService.GetWebhook:input_type -> memos.api.v1.GetWebhookRequest + 4, // 11: memos.api.v1.WebhookService.CreateWebhook:input_type -> memos.api.v1.CreateWebhookRequest + 5, // 12: memos.api.v1.WebhookService.UpdateWebhook:input_type -> memos.api.v1.UpdateWebhookRequest + 6, // 13: memos.api.v1.WebhookService.DeleteWebhook:input_type -> memos.api.v1.DeleteWebhookRequest + 2, // 14: memos.api.v1.WebhookService.ListWebhooks:output_type -> memos.api.v1.ListWebhooksResponse + 0, // 15: memos.api.v1.WebhookService.GetWebhook:output_type -> memos.api.v1.Webhook + 0, // 16: memos.api.v1.WebhookService.CreateWebhook:output_type -> memos.api.v1.Webhook + 0, // 17: memos.api.v1.WebhookService.UpdateWebhook:output_type -> memos.api.v1.Webhook + 12, // 18: memos.api.v1.WebhookService.DeleteWebhook:output_type -> google.protobuf.Empty + 14, // [14:19] is the sub-list for method output_type + 9, // [9:14] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_api_v1_webhook_service_proto_init() } diff --git a/proto/gen/api/v1/webhook_service.pb.gw.go b/proto/gen/api/v1/webhook_service.pb.gw.go index 03aefd82d..1b3572ca9 100644 --- a/proto/gen/api/v1/webhook_service.pb.gw.go +++ b/proto/gen/api/v1/webhook_service.pb.gw.go @@ -35,8 +35,6 @@ var ( _ = metadata.Join ) -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 ( protoReq ListWebhooksRequest @@ -45,12 +43,6 @@ func request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler runtim if req.Body != nil { _, _ = io.Copy(io.Discard, req.Body) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - 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 } @@ -60,18 +52,10 @@ func local_request_WebhookService_ListWebhooks_0(ctx context.Context, marshaler protoReq ListWebhooksRequest metadata runtime.ServerMetadata ) - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_ListWebhooks_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := server.ListWebhooks(ctx, &protoReq) 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) { var ( protoReq GetWebhookRequest @@ -89,12 +73,6 @@ func request_WebhookService_GetWebhook_0(ctx context.Context, marshaler runtime. if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_GetWebhook_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := client.GetWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -113,12 +91,6 @@ func local_request_WebhookService_GetWebhook_0(ctx context.Context, marshaler ru if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_GetWebhook_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := server.GetWebhook(ctx, &protoReq) return msg, metadata, err } @@ -245,8 +217,6 @@ func local_request_WebhookService_UpdateWebhook_0(ctx context.Context, marshaler return msg, metadata, err } -var filter_WebhookService_DeleteWebhook_0 = &utilities.DoubleArray{Encoding: map[string]int{"name": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} - func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runtime.Marshaler, client WebhookServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var ( protoReq DeleteWebhookRequest @@ -264,12 +234,6 @@ func request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler runti if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_DeleteWebhook_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := client.DeleteWebhook(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } @@ -288,12 +252,6 @@ func local_request_WebhookService_DeleteWebhook_0(ctx context.Context, marshaler if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WebhookService_DeleteWebhook_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } msg, err := server.DeleteWebhook(ctx, &protoReq) return msg, metadata, err } diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index 36274c313..4b952d281 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -201,18 +201,6 @@ paths: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' - parameters: - - name: pageSize - description: Optional. The maximum number of identity providers to return. - in: query - required: false - type: integer - format: int32 - - name: pageToken - description: Optional. A page token for pagination. - in: query - required: false - type: string tags: - IdentityProviderService post: @@ -627,45 +615,6 @@ paths: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' - parameters: - - name: pageSize - description: |- - Optional. The maximum number of webhooks to return. - The service may return fewer than this value. - If unspecified, at most 50 webhooks will be returned. - The maximum value is 1000; values above 1000 will be coerced to 1000. - in: query - required: false - type: integer - format: int32 - - name: pageToken - description: |- - Optional. A page token, received from a previous `ListWebhooks` call. - Provide this to retrieve the subsequent page. - in: query - required: false - type: string - - name: filter - description: |- - Optional. Filter to apply to the list results. - Example: "state=ACTIVE" or "creator=users/123" - Supported operators: =, !=, <, <=, >, >=, : - Supported fields: display_name, url, creator, state, create_time, update_time - in: query - required: false - type: string - - name: orderBy - description: |- - Optional. The order to sort results by. - Example: "create_time desc" or "display_name asc" - in: query - required: false - type: string - - name: showDeleted - description: Optional. If true, show deleted webhooks in the response. - in: query - required: false - type: boolean tags: - WebhookService post: @@ -702,13 +651,6 @@ paths: in: query required: false type: boolean - - name: requestId - description: |- - Optional. An idempotency token that can be used to ensure that multiple - requests to create a webhook have the same result. - in: query - required: false - type: string tags: - WebhookService /api/v1/workspace/profile: @@ -1314,13 +1256,6 @@ paths: 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: @@ -1448,11 +1383,6 @@ paths: 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}: @@ -2098,17 +2028,6 @@ paths: required: true type: string pattern: users/[^/]+ - - name: pageSize - description: Optional. The maximum number of shortcuts to return. - in: query - required: false - type: integer - format: int32 - - name: pageToken - description: Optional. A page token for pagination. - in: query - required: false - type: string tags: - ShortcutService post: @@ -2472,11 +2391,6 @@ paths: - 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}: @@ -2529,6 +2443,47 @@ definitions: - INFO: Info level. - WARN: Warn level. - ERROR: Error level. + CreateSessionRequestPasswordCredentials: + type: object + properties: + username: + type: string + description: |- + The username to sign in with. + Required field for password-based authentication. + password: + type: string + description: |- + The password to sign in with. + Required field for password-based authentication. + description: Nested message for password-based authentication credentials. + required: + - username + - password + CreateSessionRequestSSOCredentials: + type: object + properties: + idpId: + type: integer + format: int32 + description: |- + The ID of the SSO provider. + Required field to identify the SSO provider. + code: + type: string + description: |- + The authorization code from the SSO provider. + Required field for completing the SSO flow. + redirectUri: + type: string + description: |- + The redirect URI used in the SSO flow. + Required field for security validation. + description: Nested message for SSO authentication credentials. + required: + - idpId + - code + - redirectUri ListNodeKind: type: string enum: @@ -3316,10 +3271,10 @@ definitions: type: object properties: passwordCredentials: - $ref: '#/definitions/v1PasswordCredentials' + $ref: '#/definitions/CreateSessionRequestPasswordCredentials' description: Username and password authentication method. ssoCredentials: - $ref: '#/definitions/v1SSOCredentials' + $ref: '#/definitions/CreateSessionRequestSSOCredentials' description: SSO provider authentication method. neverExpire: type: boolean @@ -3531,9 +3486,6 @@ definitions: type: object $ref: '#/definitions/apiv1IdentityProvider' description: The list of identity providers. - nextPageToken: - type: string - description: A token for the next page of results. v1ListInboxesResponse: type: object properties: @@ -3656,13 +3608,6 @@ definitions: type: object $ref: '#/definitions/apiv1Shortcut' description: The list of shortcuts. - nextPageToken: - type: string - description: A token for the next page of results. - totalSize: - type: integer - format: int32 - description: The total count of shortcuts. v1ListUserAccessTokensResponse: type: object properties: @@ -3715,15 +3660,6 @@ definitions: type: object $ref: '#/definitions/v1Webhook' description: The list of webhooks. - nextPageToken: - type: string - description: |- - A token that can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. - totalSize: - type: integer - format: int32 - description: The total count of webhooks (may be approximate). v1MathBlockNode: type: object properties: @@ -3930,22 +3866,6 @@ definitions: type: object $ref: '#/definitions/v1Node' description: The parsed markdown nodes. - v1PasswordCredentials: - type: object - properties: - username: - type: string - description: |- - The username to sign in with. - Required field for password-based authentication. - password: - type: string - description: |- - The password to sign in with. - Required field for password-based authentication. - required: - - username - - password v1Reaction: type: object properties: @@ -4004,29 +3924,6 @@ definitions: markdown: type: string description: The restored markdown content. - v1SSOCredentials: - type: object - properties: - idpId: - type: integer - format: int32 - description: |- - The ID of the SSO provider. - Required field to identify the SSO provider. - code: - type: string - description: |- - The authorization code from the SSO provider. - Required field for completing the SSO flow. - redirectUri: - type: string - description: |- - The redirect URI used in the SSO flow. - Required field for security validation. - required: - - idpId - - code - - redirectUri v1SearchUsersResponse: type: object properties: diff --git a/server/router/api/v1/webhook_service.go b/server/router/api/v1/webhook_service.go index 48600d222..379ee27bc 100644 --- a/server/router/api/v1/webhook_service.go +++ b/server/router/api/v1/webhook_service.go @@ -78,8 +78,7 @@ func (s *APIV1Service) ListWebhooks(ctx context.Context, _ *v1pb.ListWebhooksReq } response := &v1pb.ListWebhooksResponse{ - Webhooks: []*v1pb.Webhook{}, - TotalSize: int32(len(webhooks)), + Webhooks: []*v1pb.Webhook{}, } for _, webhook := range webhooks { response.Webhooks = append(response.Webhooks, convertWebhookFromStore(webhook)) @@ -146,10 +145,6 @@ func (s *APIV1Service) UpdateWebhook(ctx context.Context, request *v1pb.UpdateWe 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") } diff --git a/store/db/mysql/memo_filter.go b/store/db/mysql/memo_filter.go index d671568f5..8ae703468 100644 --- a/store/db/mysql/memo_filter.go +++ b/store/db/mysql/memo_filter.go @@ -284,7 +284,7 @@ func (d *DB) convertWithTemplates(ctx *filter.ConvertContext, expr *exprv1.Expr) return nil } -func (d *DB) getComparisonOperator(function string) string { +func (*DB) getComparisonOperator(function string) string { switch function { case "_==_": return "=" diff --git a/store/db/postgres/memo_filter.go b/store/db/postgres/memo_filter.go index 61f052f49..b886960cc 100644 --- a/store/db/postgres/memo_filter.go +++ b/store/db/postgres/memo_filter.go @@ -18,7 +18,6 @@ func (d *DB) ConvertExprToSQL(ctx *filter.ConvertContext, expr *exprv1.Expr) err } func (d *DB) convertWithParameterIndex(ctx *filter.ConvertContext, expr *exprv1.Expr, dbType filter.TemplateDBType, paramIndex int) (int, error) { - if v, ok := expr.ExprKind.(*exprv1.Expr_CallExpr); ok { switch v.CallExpr.Function { case "_||_", "_&&_": @@ -306,7 +305,7 @@ func (d *DB) convertWithParameterIndex(ctx *filter.ConvertContext, expr *exprv1. return paramIndex, nil } -func (d *DB) getComparisonOperator(function string) string { +func (*DB) getComparisonOperator(function string) string { switch function { case "_==_": return "=" diff --git a/store/db/sqlite/memo_filter.go b/store/db/sqlite/memo_filter.go index d055706cb..9ace5c332 100644 --- a/store/db/sqlite/memo_filter.go +++ b/store/db/sqlite/memo_filter.go @@ -284,7 +284,7 @@ func (d *DB) convertWithTemplates(ctx *filter.ConvertContext, expr *exprv1.Expr) return nil } -func (d *DB) getComparisonOperator(function string) string { +func (*DB) getComparisonOperator(function string) string { switch function { case "_==_": return "=" diff --git a/web/src/types/proto/api/v1/auth_service.ts b/web/src/types/proto/api/v1/auth_service.ts index 1650ceb5c..897afca64 100644 --- a/web/src/types/proto/api/v1/auth_service.ts +++ b/web/src/types/proto/api/v1/auth_service.ts @@ -21,11 +21,11 @@ export interface GetCurrentSessionResponse { export interface CreateSessionRequest { /** Username and password authentication method. */ passwordCredentials?: - | PasswordCredentials + | CreateSessionRequest_PasswordCredentials | undefined; /** SSO provider authentication method. */ ssoCredentials?: - | SSOCredentials + | CreateSessionRequest_SSOCredentials | undefined; /** * Whether the session should never expire. @@ -34,7 +34,8 @@ export interface CreateSessionRequest { neverExpire: boolean; } -export interface PasswordCredentials { +/** Nested message for password-based authentication credentials. */ +export interface CreateSessionRequest_PasswordCredentials { /** * The username to sign in with. * Required field for password-based authentication. @@ -47,7 +48,8 @@ export interface PasswordCredentials { password: string; } -export interface SSOCredentials { +/** Nested message for SSO authentication credentials. */ +export interface CreateSessionRequest_SSOCredentials { /** * The ID of the SSO provider. * Required field to identify the SSO provider. @@ -155,10 +157,10 @@ function createBaseCreateSessionRequest(): CreateSessionRequest { export const CreateSessionRequest: MessageFns = { encode(message: CreateSessionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.passwordCredentials !== undefined) { - PasswordCredentials.encode(message.passwordCredentials, writer.uint32(10).fork()).join(); + CreateSessionRequest_PasswordCredentials.encode(message.passwordCredentials, writer.uint32(10).fork()).join(); } if (message.ssoCredentials !== undefined) { - SSOCredentials.encode(message.ssoCredentials, writer.uint32(18).fork()).join(); + CreateSessionRequest_SSOCredentials.encode(message.ssoCredentials, writer.uint32(18).fork()).join(); } if (message.neverExpire !== false) { writer.uint32(24).bool(message.neverExpire); @@ -178,7 +180,7 @@ export const CreateSessionRequest: MessageFns = { break; } - message.passwordCredentials = PasswordCredentials.decode(reader, reader.uint32()); + message.passwordCredentials = CreateSessionRequest_PasswordCredentials.decode(reader, reader.uint32()); continue; } case 2: { @@ -186,7 +188,7 @@ export const CreateSessionRequest: MessageFns = { break; } - message.ssoCredentials = SSOCredentials.decode(reader, reader.uint32()); + message.ssoCredentials = CreateSessionRequest_SSOCredentials.decode(reader, reader.uint32()); continue; } case 3: { @@ -212,22 +214,22 @@ export const CreateSessionRequest: MessageFns = { fromPartial(object: DeepPartial): CreateSessionRequest { const message = createBaseCreateSessionRequest(); message.passwordCredentials = (object.passwordCredentials !== undefined && object.passwordCredentials !== null) - ? PasswordCredentials.fromPartial(object.passwordCredentials) + ? CreateSessionRequest_PasswordCredentials.fromPartial(object.passwordCredentials) : undefined; message.ssoCredentials = (object.ssoCredentials !== undefined && object.ssoCredentials !== null) - ? SSOCredentials.fromPartial(object.ssoCredentials) + ? CreateSessionRequest_SSOCredentials.fromPartial(object.ssoCredentials) : undefined; message.neverExpire = object.neverExpire ?? false; return message; }, }; -function createBasePasswordCredentials(): PasswordCredentials { +function createBaseCreateSessionRequest_PasswordCredentials(): CreateSessionRequest_PasswordCredentials { return { username: "", password: "" }; } -export const PasswordCredentials: MessageFns = { - encode(message: PasswordCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { +export const CreateSessionRequest_PasswordCredentials: MessageFns = { + encode(message: CreateSessionRequest_PasswordCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.username !== "") { writer.uint32(10).string(message.username); } @@ -237,10 +239,10 @@ export const PasswordCredentials: MessageFns = { return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): PasswordCredentials { + decode(input: BinaryReader | Uint8Array, length?: number): CreateSessionRequest_PasswordCredentials { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePasswordCredentials(); + const message = createBaseCreateSessionRequest_PasswordCredentials(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -269,23 +271,23 @@ export const PasswordCredentials: MessageFns = { return message; }, - create(base?: DeepPartial): PasswordCredentials { - return PasswordCredentials.fromPartial(base ?? {}); + create(base?: DeepPartial): CreateSessionRequest_PasswordCredentials { + return CreateSessionRequest_PasswordCredentials.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): PasswordCredentials { - const message = createBasePasswordCredentials(); + fromPartial(object: DeepPartial): CreateSessionRequest_PasswordCredentials { + const message = createBaseCreateSessionRequest_PasswordCredentials(); message.username = object.username ?? ""; message.password = object.password ?? ""; return message; }, }; -function createBaseSSOCredentials(): SSOCredentials { +function createBaseCreateSessionRequest_SSOCredentials(): CreateSessionRequest_SSOCredentials { return { idpId: 0, code: "", redirectUri: "" }; } -export const SSOCredentials: MessageFns = { - encode(message: SSOCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { +export const CreateSessionRequest_SSOCredentials: MessageFns = { + encode(message: CreateSessionRequest_SSOCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.idpId !== 0) { writer.uint32(8).int32(message.idpId); } @@ -298,10 +300,10 @@ export const SSOCredentials: MessageFns = { return writer; }, - decode(input: BinaryReader | Uint8Array, length?: number): SSOCredentials { + decode(input: BinaryReader | Uint8Array, length?: number): CreateSessionRequest_SSOCredentials { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSSOCredentials(); + const message = createBaseCreateSessionRequest_SSOCredentials(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -338,11 +340,11 @@ export const SSOCredentials: MessageFns = { return message; }, - create(base?: DeepPartial): SSOCredentials { - return SSOCredentials.fromPartial(base ?? {}); + create(base?: DeepPartial): CreateSessionRequest_SSOCredentials { + return CreateSessionRequest_SSOCredentials.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): SSOCredentials { - const message = createBaseSSOCredentials(); + fromPartial(object: DeepPartial): CreateSessionRequest_SSOCredentials { + const message = createBaseCreateSessionRequest_SSOCredentials(); message.idpId = object.idpId ?? 0; message.code = object.code ?? ""; message.redirectUri = object.redirectUri ?? ""; diff --git a/web/src/types/proto/api/v1/idp_service.ts b/web/src/types/proto/api/v1/idp_service.ts index bb0d8cddd..225184811 100644 --- a/web/src/types/proto/api/v1/idp_service.ts +++ b/web/src/types/proto/api/v1/idp_service.ts @@ -83,17 +83,11 @@ export interface OAuth2Config { } export interface ListIdentityProvidersRequest { - /** Optional. The maximum number of identity providers to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; } export interface ListIdentityProvidersResponse { /** The list of identity providers. */ identityProviders: IdentityProvider[]; - /** A token for the next page of results. */ - nextPageToken: string; } export interface GetIdentityProviderRequest { @@ -491,17 +485,11 @@ export const OAuth2Config: MessageFns = { }; function createBaseListIdentityProvidersRequest(): ListIdentityProvidersRequest { - return { pageSize: 0, pageToken: "" }; + return {}; } export const ListIdentityProvidersRequest: MessageFns = { - encode(message: ListIdentityProvidersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.pageSize !== 0) { - writer.uint32(8).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(18).string(message.pageToken); - } + encode(_: ListIdentityProvidersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, @@ -512,22 +500,6 @@ export const ListIdentityProvidersRequest: MessageFns>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - message.pageToken = reader.string(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -540,16 +512,14 @@ export const ListIdentityProvidersRequest: MessageFns): ListIdentityProvidersRequest { return ListIdentityProvidersRequest.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): ListIdentityProvidersRequest { + fromPartial(_: DeepPartial): ListIdentityProvidersRequest { const message = createBaseListIdentityProvidersRequest(); - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; return message; }, }; function createBaseListIdentityProvidersResponse(): ListIdentityProvidersResponse { - return { identityProviders: [], nextPageToken: "" }; + return { identityProviders: [] }; } export const ListIdentityProvidersResponse: MessageFns = { @@ -557,9 +527,6 @@ export const ListIdentityProvidersResponse: MessageFns): ListIdentityProvidersResponse { const message = createBaseListIdentityProvidersResponse(); message.identityProviders = object.identityProviders?.map((e) => IdentityProvider.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; return message; }, }; diff --git a/web/src/types/proto/api/v1/shortcut_service.ts b/web/src/types/proto/api/v1/shortcut_service.ts index 5d5466af8..b8ebb343d 100644 --- a/web/src/types/proto/api/v1/shortcut_service.ts +++ b/web/src/types/proto/api/v1/shortcut_service.ts @@ -29,19 +29,11 @@ export interface ListShortcutsRequest { * Format: users/{user} */ parent: string; - /** Optional. The maximum number of shortcuts to return. */ - pageSize: number; - /** Optional. A page token for pagination. */ - pageToken: string; } export interface ListShortcutsResponse { /** The list of shortcuts. */ shortcuts: Shortcut[]; - /** A token for the next page of results. */ - nextPageToken: string; - /** The total count of shortcuts. */ - totalSize: number; } export interface GetShortcutRequest { @@ -154,7 +146,7 @@ export const Shortcut: MessageFns = { }; function createBaseListShortcutsRequest(): ListShortcutsRequest { - return { parent: "", pageSize: 0, pageToken: "" }; + return { parent: "" }; } export const ListShortcutsRequest: MessageFns = { @@ -162,12 +154,6 @@ export const ListShortcutsRequest: MessageFns = { if (message.parent !== "") { writer.uint32(10).string(message.parent); } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - if (message.pageToken !== "") { - writer.uint32(26).string(message.pageToken); - } return writer; }, @@ -186,22 +172,6 @@ export const ListShortcutsRequest: MessageFns = { message.parent = reader.string(); continue; } - case 2: { - if (tag !== 16) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 3: { - if (tag !== 26) { - break; - } - - message.pageToken = reader.string(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -217,14 +187,12 @@ export const ListShortcutsRequest: MessageFns = { fromPartial(object: DeepPartial): ListShortcutsRequest { const message = createBaseListShortcutsRequest(); message.parent = object.parent ?? ""; - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; return message; }, }; function createBaseListShortcutsResponse(): ListShortcutsResponse { - return { shortcuts: [], nextPageToken: "", totalSize: 0 }; + return { shortcuts: [] }; } export const ListShortcutsResponse: MessageFns = { @@ -232,12 +200,6 @@ export const ListShortcutsResponse: MessageFns = { for (const v of message.shortcuts) { Shortcut.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; }, @@ -256,22 +218,6 @@ export const ListShortcutsResponse: MessageFns = { message.shortcuts.push(Shortcut.decode(reader, reader.uint32())); continue; } - case 2: { - if (tag !== 18) { - break; - } - - message.nextPageToken = reader.string(); - continue; - } - case 3: { - if (tag !== 24) { - break; - } - - message.totalSize = reader.int32(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -287,8 +233,6 @@ export const ListShortcutsResponse: MessageFns = { fromPartial(object: DeepPartial): ListShortcutsResponse { const message = createBaseListShortcutsResponse(); message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; return message; }, }; diff --git a/web/src/types/proto/api/v1/webhook_service.ts b/web/src/types/proto/api/v1/webhook_service.ts index 1b1be65e8..d81193138 100644 --- a/web/src/types/proto/api/v1/webhook_service.ts +++ b/web/src/types/proto/api/v1/webhook_service.ts @@ -40,44 +40,11 @@ export interface Webhook { } export interface ListWebhooksRequest { - /** - * 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 ListWebhooksResponse { /** 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 GetWebhookRequest { @@ -86,11 +53,6 @@ export interface GetWebhookRequest { * 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 CreateWebhookRequest { @@ -106,11 +68,6 @@ export interface CreateWebhookRequest { 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 { @@ -119,11 +76,7 @@ export interface UpdateWebhookRequest { | Webhook | undefined; /** Required. The list of fields to update. */ - updateMask?: - | string[] - | undefined; - /** Optional. If set to true, allows updating sensitive fields. */ - allowMissing: boolean; + updateMask?: string[] | undefined; } export interface DeleteWebhookRequest { @@ -132,8 +85,6 @@ export interface DeleteWebhookRequest { * 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 { @@ -281,26 +232,11 @@ export const Webhook: MessageFns = { }; function createBaseListWebhooksRequest(): ListWebhooksRequest { - return { pageSize: 0, pageToken: "", filter: "", orderBy: "", showDeleted: false }; + return {}; } export const ListWebhooksRequest: MessageFns = { - encode(message: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { - if (message.pageSize !== 0) { - writer.uint32(8).int32(message.pageSize); - } - if (message.pageToken !== "") { - 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); - } + encode(_: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { return writer; }, @@ -311,46 +247,6 @@ export const ListWebhooksRequest: MessageFns = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: { - if (tag !== 8) { - break; - } - - message.pageSize = reader.int32(); - continue; - } - case 2: { - if (tag !== 18) { - break; - } - - 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; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -363,19 +259,14 @@ export const ListWebhooksRequest: MessageFns = { create(base?: DeepPartial): ListWebhooksRequest { return ListWebhooksRequest.fromPartial(base ?? {}); }, - fromPartial(object: DeepPartial): ListWebhooksRequest { + fromPartial(_: DeepPartial): ListWebhooksRequest { const message = createBaseListWebhooksRequest(); - message.pageSize = object.pageSize ?? 0; - message.pageToken = object.pageToken ?? ""; - message.filter = object.filter ?? ""; - message.orderBy = object.orderBy ?? ""; - message.showDeleted = object.showDeleted ?? false; return message; }, }; function createBaseListWebhooksResponse(): ListWebhooksResponse { - return { webhooks: [], nextPageToken: "", totalSize: 0 }; + return { webhooks: [] }; } export const ListWebhooksResponse: MessageFns = { @@ -383,12 +274,6 @@ export const ListWebhooksResponse: MessageFns = { for (const v of message.webhooks) { 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; }, @@ -407,22 +292,6 @@ export const ListWebhooksResponse: MessageFns = { 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; - } - - message.totalSize = reader.int32(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -438,14 +307,12 @@ export const ListWebhooksResponse: MessageFns = { fromPartial(object: DeepPartial): ListWebhooksResponse { const message = createBaseListWebhooksResponse(); message.webhooks = object.webhooks?.map((e) => Webhook.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.totalSize = object.totalSize ?? 0; return message; }, }; function createBaseGetWebhookRequest(): GetWebhookRequest { - return { name: "", readMask: undefined }; + return { name: "" }; } export const GetWebhookRequest: MessageFns = { @@ -453,9 +320,6 @@ export const GetWebhookRequest: MessageFns = { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.readMask !== undefined) { - FieldMask.encode(FieldMask.wrap(message.readMask), writer.uint32(18).fork()).join(); - } return writer; }, @@ -474,14 +338,6 @@ export const GetWebhookRequest: MessageFns = { message.name = reader.string(); continue; } - case 2: { - if (tag !== 18) { - break; - } - - message.readMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -497,13 +353,12 @@ export const GetWebhookRequest: MessageFns = { fromPartial(object: DeepPartial): GetWebhookRequest { const message = createBaseGetWebhookRequest(); message.name = object.name ?? ""; - message.readMask = object.readMask ?? undefined; return message; }, }; function createBaseCreateWebhookRequest(): CreateWebhookRequest { - return { webhook: undefined, webhookId: "", validateOnly: false, requestId: "" }; + return { webhook: undefined, webhookId: "", validateOnly: false }; } export const CreateWebhookRequest: MessageFns = { @@ -517,9 +372,6 @@ export const CreateWebhookRequest: MessageFns = { if (message.validateOnly !== false) { writer.uint32(24).bool(message.validateOnly); } - if (message.requestId !== "") { - writer.uint32(34).string(message.requestId); - } return writer; }, @@ -554,14 +406,6 @@ export const CreateWebhookRequest: MessageFns = { message.validateOnly = reader.bool(); continue; } - case 4: { - if (tag !== 34) { - break; - } - - message.requestId = reader.string(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -581,13 +425,12 @@ export const CreateWebhookRequest: MessageFns = { : undefined; message.webhookId = object.webhookId ?? ""; message.validateOnly = object.validateOnly ?? false; - message.requestId = object.requestId ?? ""; return message; }, }; function createBaseUpdateWebhookRequest(): UpdateWebhookRequest { - return { webhook: undefined, updateMask: undefined, allowMissing: false }; + return { webhook: undefined, updateMask: undefined }; } export const UpdateWebhookRequest: MessageFns = { @@ -598,9 +441,6 @@ export const UpdateWebhookRequest: MessageFns = { if (message.updateMask !== undefined) { FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); } - if (message.allowMissing !== false) { - writer.uint32(24).bool(message.allowMissing); - } return writer; }, @@ -627,14 +467,6 @@ export const UpdateWebhookRequest: MessageFns = { message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); continue; } - case 3: { - if (tag !== 24) { - break; - } - - message.allowMissing = reader.bool(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -653,13 +485,12 @@ export const UpdateWebhookRequest: MessageFns = { ? Webhook.fromPartial(object.webhook) : undefined; message.updateMask = object.updateMask ?? undefined; - message.allowMissing = object.allowMissing ?? false; return message; }, }; function createBaseDeleteWebhookRequest(): DeleteWebhookRequest { - return { name: "", force: false }; + return { name: "" }; } export const DeleteWebhookRequest: MessageFns = { @@ -667,9 +498,6 @@ export const DeleteWebhookRequest: MessageFns = { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.force !== false) { - writer.uint32(16).bool(message.force); - } return writer; }, @@ -688,14 +516,6 @@ export const DeleteWebhookRequest: MessageFns = { message.name = reader.string(); continue; } - case 2: { - if (tag !== 16) { - break; - } - - message.force = reader.bool(); - continue; - } } if ((tag & 7) === 4 || tag === 0) { break; @@ -711,7 +531,6 @@ export const DeleteWebhookRequest: MessageFns = { fromPartial(object: DeepPartial): DeleteWebhookRequest { const message = createBaseDeleteWebhookRequest(); message.name = object.name ?? ""; - message.force = object.force ?? false; return message; }, };