Commit 9b159368 authored by Johnny's avatar Johnny

refactor: clean unused fields

parent 778a5eb1
......@@ -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 "="
......
......@@ -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())"
}
......@@ -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++ {
......
......@@ -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 {}
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
This diff is collapsed.
......@@ -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" +
......
......@@ -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
}
......
......@@ -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" +
......
......@@ -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
}
......
This diff is collapsed.
......@@ -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
}
......
......@@ -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:
......
......@@ -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")
}
......
......@@ -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 "="
......
......@@ -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 "="
......
......@@ -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 "="
......
......@@ -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<CreateSessionRequest> = {
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<CreateSessionRequest> = {
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<CreateSessionRequest> = {
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<CreateSessionRequest> = {
fromPartial(object: DeepPartial<CreateSessionRequest>): 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<PasswordCredentials> = {
encode(message: PasswordCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
export const CreateSessionRequest_PasswordCredentials: MessageFns<CreateSessionRequest_PasswordCredentials> = {
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<PasswordCredentials> = {
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<PasswordCredentials> = {
return message;
},
create(base?: DeepPartial<PasswordCredentials>): PasswordCredentials {
return PasswordCredentials.fromPartial(base ?? {});
create(base?: DeepPartial<CreateSessionRequest_PasswordCredentials>): CreateSessionRequest_PasswordCredentials {
return CreateSessionRequest_PasswordCredentials.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<PasswordCredentials>): PasswordCredentials {
const message = createBasePasswordCredentials();
fromPartial(object: DeepPartial<CreateSessionRequest_PasswordCredentials>): 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<SSOCredentials> = {
encode(message: SSOCredentials, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
export const CreateSessionRequest_SSOCredentials: MessageFns<CreateSessionRequest_SSOCredentials> = {
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<SSOCredentials> = {
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<SSOCredentials> = {
return message;
},
create(base?: DeepPartial<SSOCredentials>): SSOCredentials {
return SSOCredentials.fromPartial(base ?? {});
create(base?: DeepPartial<CreateSessionRequest_SSOCredentials>): CreateSessionRequest_SSOCredentials {
return CreateSessionRequest_SSOCredentials.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<SSOCredentials>): SSOCredentials {
const message = createBaseSSOCredentials();
fromPartial(object: DeepPartial<CreateSessionRequest_SSOCredentials>): CreateSessionRequest_SSOCredentials {
const message = createBaseCreateSessionRequest_SSOCredentials();
message.idpId = object.idpId ?? 0;
message.code = object.code ?? "";
message.redirectUri = object.redirectUri ?? "";
......
......@@ -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<OAuth2Config> = {
};
function createBaseListIdentityProvidersRequest(): ListIdentityProvidersRequest {
return { pageSize: 0, pageToken: "" };
return {};
}
export const ListIdentityProvidersRequest: MessageFns<ListIdentityProvidersRequest> = {
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<ListIdentityProvidersReque
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;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -540,16 +512,14 @@ export const ListIdentityProvidersRequest: MessageFns<ListIdentityProvidersReque
create(base?: DeepPartial<ListIdentityProvidersRequest>): ListIdentityProvidersRequest {
return ListIdentityProvidersRequest.fromPartial(base ?? {});
},
fromPartial(object: DeepPartial<ListIdentityProvidersRequest>): ListIdentityProvidersRequest {
fromPartial(_: DeepPartial<ListIdentityProvidersRequest>): 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<ListIdentityProvidersResponse> = {
......@@ -557,9 +527,6 @@ export const ListIdentityProvidersResponse: MessageFns<ListIdentityProvidersResp
for (const v of message.identityProviders) {
IdentityProvider.encode(v!, writer.uint32(10).fork()).join();
}
if (message.nextPageToken !== "") {
writer.uint32(18).string(message.nextPageToken);
}
return writer;
},
......@@ -578,14 +545,6 @@ export const ListIdentityProvidersResponse: MessageFns<ListIdentityProvidersResp
message.identityProviders.push(IdentityProvider.decode(reader, reader.uint32()));
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.nextPageToken = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
......@@ -601,7 +560,6 @@ export const ListIdentityProvidersResponse: MessageFns<ListIdentityProvidersResp
fromPartial(object: DeepPartial<ListIdentityProvidersResponse>): ListIdentityProvidersResponse {
const message = createBaseListIdentityProvidersResponse();
message.identityProviders = object.identityProviders?.map((e) => IdentityProvider.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
return message;
},
};
......
......@@ -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<Shortcut> = {
};
function createBaseListShortcutsRequest(): ListShortcutsRequest {
return { parent: "", pageSize: 0, pageToken: "" };
return { parent: "" };
}
export const ListShortcutsRequest: MessageFns<ListShortcutsRequest> = {
......@@ -162,12 +154,6 @@ export const ListShortcutsRequest: MessageFns<ListShortcutsRequest> = {
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<ListShortcutsRequest> = {
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<ListShortcutsRequest> = {
fromPartial(object: DeepPartial<ListShortcutsRequest>): 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<ListShortcutsResponse> = {
......@@ -232,12 +200,6 @@ export const ListShortcutsResponse: MessageFns<ListShortcutsResponse> = {
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<ListShortcutsResponse> = {
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<ListShortcutsResponse> = {
fromPartial(object: DeepPartial<ListShortcutsResponse>): ListShortcutsResponse {
const message = createBaseListShortcutsResponse();
message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || [];
message.nextPageToken = object.nextPageToken ?? "";
message.totalSize = object.totalSize ?? 0;
return message;
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment