From 1a121e350b7c7f368f64ff1c3724e0c3e8b57d6a Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 17 Apr 2025 23:11:36 +0800 Subject: [PATCH] chore: update gitignore --- proto/buf.gen.yaml | 1 + proto/buf.lock | 7 +- proto/buf.yaml | 2 - proto/gen/api/v1/activity_service.pb.go | 8 +- proto/gen/api/v1/memo_service.pb.go | 44 +- proto/gen/api/v1/resource_service.pb.go | 12 +- proto/gen/api/v1/user_service.pb.go | 30 +- .../api/v1/workspace_setting_service.pb.go | 6 +- web/.gitignore | 2 +- web/package.json | 6 +- web/pnpm-lock.yaml | 156 - .../Settings/MemoRelatedSettings.tsx | 2 +- .../components/Settings/StorageSection.tsx | 2 +- .../components/Settings/WorkspaceSection.tsx | 2 +- .../UpdateCustomizedProfileDialog.tsx | 2 +- web/src/pages/Setting.tsx | 2 +- web/src/store/v2/workspace.ts | 12 +- .../types/proto/api/v1/activity_service.ts | 399 ++ web/src/types/proto/api/v1/auth_service.ts | 577 ++ web/src/types/proto/api/v1/common.ts | 167 + web/src/types/proto/api/v1/idp_service.ts | 1095 ++++ web/src/types/proto/api/v1/inbox_service.ts | 644 ++ .../types/proto/api/v1/markdown_service.ts | 3418 ++++++++++ web/src/types/proto/api/v1/memo_service.ts | 2946 +++++++++ .../types/proto/api/v1/reaction_service.ts | 122 + .../types/proto/api/v1/resource_service.ts | 897 +++ web/src/types/proto/api/v1/user_service.ts | 3065 +++++++++ web/src/types/proto/api/v1/webhook_service.ts | 816 +++ .../types/proto/api/v1/workspace_service.ts | 210 + .../proto/api/v1/workspace_setting_service.ts | 1115 ++++ web/src/types/proto/google/api/annotations.ts | 9 + web/src/types/proto/google/api/client.ts | 2087 ++++++ .../types/proto/google/api/field_behavior.ts | 145 + web/src/types/proto/google/api/http.ts | 670 ++ web/src/types/proto/google/api/httpbody.ts | 152 + .../types/proto/google/api/launch_stage.ts | 121 + web/src/types/proto/google/protobuf/any.ts | 206 + .../types/proto/google/protobuf/descriptor.ts | 5624 +++++++++++++++++ .../types/proto/google/protobuf/duration.ts | 172 + web/src/types/proto/google/protobuf/empty.ts | 71 + .../types/proto/google/protobuf/field_mask.ts | 291 + .../types/proto/google/protobuf/timestamp.ts | 201 + 42 files changed, 25291 insertions(+), 225 deletions(-) create mode 100644 web/src/types/proto/api/v1/activity_service.ts create mode 100644 web/src/types/proto/api/v1/auth_service.ts create mode 100644 web/src/types/proto/api/v1/common.ts create mode 100644 web/src/types/proto/api/v1/idp_service.ts create mode 100644 web/src/types/proto/api/v1/inbox_service.ts create mode 100644 web/src/types/proto/api/v1/markdown_service.ts create mode 100644 web/src/types/proto/api/v1/memo_service.ts create mode 100644 web/src/types/proto/api/v1/reaction_service.ts create mode 100644 web/src/types/proto/api/v1/resource_service.ts create mode 100644 web/src/types/proto/api/v1/user_service.ts create mode 100644 web/src/types/proto/api/v1/webhook_service.ts create mode 100644 web/src/types/proto/api/v1/workspace_service.ts create mode 100644 web/src/types/proto/api/v1/workspace_setting_service.ts create mode 100644 web/src/types/proto/google/api/annotations.ts create mode 100644 web/src/types/proto/google/api/client.ts create mode 100644 web/src/types/proto/google/api/field_behavior.ts create mode 100644 web/src/types/proto/google/api/http.ts create mode 100644 web/src/types/proto/google/api/httpbody.ts create mode 100644 web/src/types/proto/google/api/launch_stage.ts create mode 100644 web/src/types/proto/google/protobuf/any.ts create mode 100644 web/src/types/proto/google/protobuf/descriptor.ts create mode 100644 web/src/types/proto/google/protobuf/duration.ts create mode 100644 web/src/types/proto/google/protobuf/empty.ts create mode 100644 web/src/types/proto/google/protobuf/field_mask.ts create mode 100644 web/src/types/proto/google/protobuf/timestamp.ts diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index df606368..14b4cc25 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -1,4 +1,5 @@ version: v2 +clean: true managed: enabled: true disable: diff --git a/proto/buf.lock b/proto/buf.lock index 970c0af5..9a4fa6ce 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -2,8 +2,5 @@ version: v2 deps: - name: buf.build/googleapis/googleapis - commit: a86849a25cc04f4dbe9b15ddddfbc488 - digest: b5:a77a2082c596ee6800a23d8cecd021d316eb10565d6cb94532f2d7c567fe6c9a177b5bb123b51a3acb4f1f18d4f54a6da883afcb682919a137a8a37c020509a2 - - name: buf.build/grpc-ecosystem/grpc-gateway - commit: 3f42134f4c564983838425bc43c7a65f - digest: b5:291b947d8ac09492517557e4e72e294788cb8201afc7d0df7bda80fa10931adb60d4d669208a7696bf24f1ecb2a33a16d4c1e766e6f31809248b00343119569b + commit: 61b203b9a9164be9a834f58c37be6f62 + digest: b5:7811a98b35bd2e4ae5c3ac73c8b3d9ae429f3a790da15de188dc98fc2b77d6bb10e45711f14903af9553fa9821dff256054f2e4b7795789265bc476bec2f088c diff --git a/proto/buf.yaml b/proto/buf.yaml index b72ba50b..563f5f55 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,8 +1,6 @@ version: v2 -name: buf.build/yourselfhosted/memos deps: - buf.build/googleapis/googleapis - - buf.build/grpc-ecosystem/grpc-gateway lint: use: - BASIC diff --git a/proto/gen/api/v1/activity_service.pb.go b/proto/gen/api/v1/activity_service.pb.go index bbb16e25..7744974a 100644 --- a/proto/gen/api/v1/activity_service.pb.go +++ b/proto/gen/api/v1/activity_service.pb.go @@ -266,12 +266,12 @@ var File_api_v1_activity_service_proto protoreflect.FileDescriptor const file_api_v1_activity_service_proto_rawDesc = "" + "\n" + "\x1dapi/v1/activity_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xe5\x01\n" + - "\bActivity\x12\x19\n" + - "\x04name\x18\x01 \x01(\tB\x05\xe2A\x02\x03\bR\x04name\x12\x18\n" + + "\bActivity\x12\x1a\n" + + "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x12\x18\n" + "\acreator\x18\x02 \x01(\tR\acreator\x12\x12\n" + "\x04type\x18\x03 \x01(\tR\x04type\x12\x14\n" + - "\x05level\x18\x04 \x01(\tR\x05level\x12A\n" + - "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\n" + + "\x05level\x18\x04 \x01(\tR\x05level\x12@\n" + + "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "createTime\x127\n" + "\apayload\x18\x06 \x01(\v2\x1d.memos.api.v1.ActivityPayloadR\apayload\"^\n" + "\x0fActivityPayload\x12K\n" + diff --git a/proto/gen/api/v1/memo_service.pb.go b/proto/gen/api/v1/memo_service.pb.go index 54940a58..fef0fdeb 100644 --- a/proto/gen/api/v1/memo_service.pb.go +++ b/proto/gen/api/v1/memo_service.pb.go @@ -1666,9 +1666,9 @@ var File_api_v1_memo_service_proto protoreflect.FileDescriptor const file_api_v1_memo_service_proto_rawDesc = "" + "\n" + - "\x19api/v1/memo_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1dapi/v1/markdown_service.proto\x1a\x1dapi/v1/reaction_service.proto\x1a\x1dapi/v1/resource_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xf3\a\n" + - "\x04Memo\x12\x19\n" + - "\x04name\x18\x01 \x01(\tB\x05\xe2A\x02\x03\bR\x04name\x12)\n" + + "\x19api/v1/memo_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1dapi/v1/markdown_service.proto\x1a\x1dapi/v1/reaction_service.proto\x1a\x1dapi/v1/resource_service.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xee\a\n" + + "\x04Memo\x12\x1a\n" + + "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x12)\n" + "\x05state\x18\x03 \x01(\x0e2\x13.memos.api.v1.StateR\x05state\x12\x18\n" + "\acreator\x18\x04 \x01(\tR\acreator\x12;\n" + "\vcreate_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\n" + @@ -1676,20 +1676,20 @@ const file_api_v1_memo_service_proto_rawDesc = "" + "\vupdate_time\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\n" + "updateTime\x12=\n" + "\fdisplay_time\x18\a \x01(\v2\x1a.google.protobuf.TimestampR\vdisplayTime\x12\x18\n" + - "\acontent\x18\b \x01(\tR\acontent\x12.\n" + - "\x05nodes\x18\t \x03(\v2\x12.memos.api.v1.NodeB\x04\xe2A\x01\x03R\x05nodes\x128\n" + + "\acontent\x18\b \x01(\tR\acontent\x12-\n" + + "\x05nodes\x18\t \x03(\v2\x12.memos.api.v1.NodeB\x03\xe0A\x03R\x05nodes\x128\n" + "\n" + "visibility\x18\n" + " \x01(\x0e2\x18.memos.api.v1.VisibilityR\n" + - "visibility\x12\x18\n" + - "\x04tags\x18\v \x03(\tB\x04\xe2A\x01\x03R\x04tags\x12\x16\n" + + "visibility\x12\x17\n" + + "\x04tags\x18\v \x03(\tB\x03\xe0A\x03R\x04tags\x12\x16\n" + "\x06pinned\x18\f \x01(\bR\x06pinned\x124\n" + "\tresources\x18\x0e \x03(\v2\x16.memos.api.v1.ResourceR\tresources\x128\n" + - "\trelations\x18\x0f \x03(\v2\x1a.memos.api.v1.MemoRelationR\trelations\x12:\n" + - "\treactions\x18\x10 \x03(\v2\x16.memos.api.v1.ReactionB\x04\xe2A\x01\x03R\treactions\x12=\n" + - "\bproperty\x18\x11 \x01(\v2\x1b.memos.api.v1.Memo.PropertyB\x04\xe2A\x01\x03R\bproperty\x12!\n" + - "\x06parent\x18\x12 \x01(\tB\x04\xe2A\x01\x03H\x00R\x06parent\x88\x01\x01\x12\x1e\n" + - "\asnippet\x18\x13 \x01(\tB\x04\xe2A\x01\x03R\asnippet\x127\n" + + "\trelations\x18\x0f \x03(\v2\x1a.memos.api.v1.MemoRelationR\trelations\x129\n" + + "\treactions\x18\x10 \x03(\v2\x16.memos.api.v1.ReactionB\x03\xe0A\x03R\treactions\x12<\n" + + "\bproperty\x18\x11 \x01(\v2\x1b.memos.api.v1.Memo.PropertyB\x03\xe0A\x03R\bproperty\x12 \n" + + "\x06parent\x18\x12 \x01(\tB\x03\xe0A\x03H\x00R\x06parent\x88\x01\x01\x12\x1d\n" + + "\asnippet\x18\x13 \x01(\tB\x03\xe0A\x03R\asnippet\x127\n" + "\blocation\x18\x14 \x01(\v2\x16.memos.api.v1.LocationH\x01R\blocation\x88\x01\x01\x1a\x96\x01\n" + "\bProperty\x12\x19\n" + "\bhas_link\x18\x01 \x01(\bR\ahasLink\x12\"\n" + @@ -1701,9 +1701,9 @@ const file_api_v1_memo_service_proto_rawDesc = "" + "\bLocation\x12 \n" + "\vplaceholder\x18\x01 \x01(\tR\vplaceholder\x12\x1a\n" + "\blatitude\x18\x02 \x01(\x01R\blatitude\x12\x1c\n" + - "\tlongitude\x18\x03 \x01(\x01R\tlongitude\"A\n" + - "\x11CreateMemoRequest\x12,\n" + - "\x04memo\x18\x01 \x01(\v2\x12.memos.api.v1.MemoB\x04\xe2A\x01\x02R\x04memo\"\x93\x02\n" + + "\tlongitude\x18\x03 \x01(\x01R\tlongitude\"@\n" + + "\x11CreateMemoRequest\x12+\n" + + "\x04memo\x18\x01 \x01(\v2\x12.memos.api.v1.MemoB\x03\xe0A\x02R\x04memo\"\x93\x02\n" + "\x10ListMemosRequest\x12\x16\n" + "\x06parent\x18\x01 \x01(\tR\x06parent\x12\x1b\n" + "\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x1d\n" + @@ -1719,9 +1719,9 @@ const file_api_v1_memo_service_proto_rawDesc = "" + "\x05memos\x18\x01 \x03(\v2\x12.memos.api.v1.MemoR\x05memos\x12&\n" + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"$\n" + "\x0eGetMemoRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"~\n" + - "\x11UpdateMemoRequest\x12,\n" + - "\x04memo\x18\x01 \x01(\v2\x12.memos.api.v1.MemoB\x04\xe2A\x01\x02R\x04memo\x12;\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"}\n" + + "\x11UpdateMemoRequest\x12+\n" + + "\x04memo\x18\x01 \x01(\v2\x12.memos.api.v1.MemoB\x03\xe0A\x02R\x04memo\x12;\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + "updateMask\"'\n" + "\x11DeleteMemoRequest\x12\x12\n" + @@ -1740,15 +1740,15 @@ const file_api_v1_memo_service_proto_rawDesc = "" + "\x18ListMemoResourcesRequest\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\"Q\n" + "\x19ListMemoResourcesResponse\x124\n" + - "\tresources\x18\x01 \x03(\v2\x16.memos.api.v1.ResourceR\tresources\"\xc4\x02\n" + + "\tresources\x18\x01 \x03(\v2\x16.memos.api.v1.ResourceR\tresources\"\xc3\x02\n" + "\fMemoRelation\x123\n" + "\x04memo\x18\x01 \x01(\v2\x1f.memos.api.v1.MemoRelation.MemoR\x04memo\x12B\n" + "\frelated_memo\x18\x02 \x01(\v2\x1f.memos.api.v1.MemoRelation.MemoR\vrelatedMemo\x123\n" + - "\x04type\x18\x03 \x01(\x0e2\x1f.memos.api.v1.MemoRelation.TypeR\x04type\x1aL\n" + + "\x04type\x18\x03 \x01(\x0e2\x1f.memos.api.v1.MemoRelation.TypeR\x04type\x1aK\n" + "\x04Memo\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n" + - "\x03uid\x18\x02 \x01(\tR\x03uid\x12\x1e\n" + - "\asnippet\x18\x03 \x01(\tB\x04\xe2A\x01\x03R\asnippet\"8\n" + + "\x03uid\x18\x02 \x01(\tR\x03uid\x12\x1d\n" + + "\asnippet\x18\x03 \x01(\tB\x03\xe0A\x03R\asnippet\"8\n" + "\x04Type\x12\x14\n" + "\x10TYPE_UNSPECIFIED\x10\x00\x12\r\n" + "\tREFERENCE\x10\x01\x12\v\n" + diff --git a/proto/gen/api/v1/resource_service.pb.go b/proto/gen/api/v1/resource_service.pb.go index d36f4391..35475596 100644 --- a/proto/gen/api/v1/resource_service.pb.go +++ b/proto/gen/api/v1/resource_service.pb.go @@ -462,13 +462,13 @@ var File_api_v1_resource_service_proto protoreflect.FileDescriptor const file_api_v1_resource_service_proto_rawDesc = "" + "\n" + - "\x1dapi/v1/resource_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x99\x02\n" + - "\bResource\x12\x19\n" + - "\x04name\x18\x01 \x01(\tB\x05\xe2A\x02\x03\bR\x04name\x12A\n" + - "\vcreate_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\n" + + "\x1dapi/v1/resource_service.proto\x12\fmemos.api.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x98\x02\n" + + "\bResource\x12\x1a\n" + + "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x12@\n" + + "\vcreate_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "createTime\x12\x1a\n" + - "\bfilename\x18\x04 \x01(\tR\bfilename\x12\x1e\n" + - "\acontent\x18\x05 \x01(\fB\x04\xe2A\x01\x04R\acontent\x12#\n" + + "\bfilename\x18\x04 \x01(\tR\bfilename\x12\x1d\n" + + "\acontent\x18\x05 \x01(\fB\x03\xe0A\x04R\acontent\x12#\n" + "\rexternal_link\x18\x06 \x01(\tR\fexternalLink\x12\x12\n" + "\x04type\x18\a \x01(\tR\x04type\x12\x12\n" + "\x04size\x18\b \x01(\x03R\x04size\x12\x17\n" + diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.go index 87eef9b7..8123e2b1 100644 --- a/proto/gen/api/v1/user_service.pb.go +++ b/proto/gen/api/v1/user_service.pb.go @@ -1623,22 +1623,22 @@ var File_api_v1_user_service_proto protoreflect.FileDescriptor const file_api_v1_user_service_proto_rawDesc = "" + "\n" + - "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xed\x03\n" + - "\x04User\x12\x19\n" + - "\x04name\x18\x01 \x01(\tB\x05\xe2A\x02\x03\bR\x04name\x12+\n" + + "\x19api/v1/user_service.proto\x12\fmemos.api.v1\x1a\x13api/v1/common.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xeb\x03\n" + + "\x04User\x12\x1a\n" + + "\x04name\x18\x01 \x01(\tB\x06\xe0A\x03\xe0A\bR\x04name\x12+\n" + "\x04role\x18\x03 \x01(\x0e2\x17.memos.api.v1.User.RoleR\x04role\x12\x1a\n" + "\busername\x18\x04 \x01(\tR\busername\x12\x14\n" + "\x05email\x18\x05 \x01(\tR\x05email\x12\x1a\n" + "\bnickname\x18\x06 \x01(\tR\bnickname\x12\x1d\n" + "\n" + "avatar_url\x18\a \x01(\tR\tavatarUrl\x12 \n" + - "\vdescription\x18\b \x01(\tR\vdescription\x12 \n" + - "\bpassword\x18\t \x01(\tB\x04\xe2A\x01\x04R\bpassword\x12)\n" + + "\vdescription\x18\b \x01(\tR\vdescription\x12\x1f\n" + + "\bpassword\x18\t \x01(\tB\x03\xe0A\x04R\bpassword\x12)\n" + "\x05state\x18\n" + - " \x01(\x0e2\x13.memos.api.v1.StateR\x05state\x12A\n" + - "\vcreate_time\x18\v \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\n" + - "createTime\x12A\n" + - "\vupdate_time\x18\f \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\n" + + " \x01(\x0e2\x13.memos.api.v1.StateR\x05state\x12@\n" + + "\vcreate_time\x18\v \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + + "createTime\x12@\n" + + "\vupdate_time\x18\f \x01(\v2\x1a.google.protobuf.TimestampB\x03\xe0A\x03R\n" + "updateTime\";\n" + "\x04Role\x12\x14\n" + "\x10ROLE_UNSPECIFIED\x10\x00\x12\b\n" + @@ -1656,9 +1656,9 @@ const file_api_v1_user_service_proto_rawDesc = "" + "\x04name\x18\x01 \x01(\tR\x04name\x121\n" + "\thttp_body\x18\x02 \x01(\v2\x14.google.api.HttpBodyR\bhttpBody\";\n" + "\x11CreateUserRequest\x12&\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\"~\n" + - "\x11UpdateUserRequest\x12,\n" + - "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x04\xe2A\x01\x02R\x04user\x12;\n" + + "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserR\x04user\"}\n" + + "\x11UpdateUserRequest\x12+\n" + + "\x04user\x18\x01 \x01(\v2\x12.memos.api.v1.UserB\x03\xe0A\x02R\x04user\x12;\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + "updateMask\"'\n" + "\x11DeleteUserRequest\x12\x12\n" + @@ -1696,9 +1696,9 @@ const file_api_v1_user_service_proto_rawDesc = "" + "appearance\x12'\n" + "\x0fmemo_visibility\x18\x04 \x01(\tR\x0ememoVisibility\"+\n" + "\x15GetUserSettingRequest\x12\x12\n" + - "\x04name\x18\x01 \x01(\tR\x04name\"\x92\x01\n" + - "\x18UpdateUserSettingRequest\x129\n" + - "\asetting\x18\x01 \x01(\v2\x19.memos.api.v1.UserSettingB\x04\xe2A\x01\x02R\asetting\x12;\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x91\x01\n" + + "\x18UpdateUserSettingRequest\x128\n" + + "\asetting\x18\x01 \x01(\v2\x19.memos.api.v1.UserSettingB\x03\xe0A\x02R\asetting\x12;\n" + "\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" + "updateMask\"\xca\x01\n" + "\x0fUserAccessToken\x12!\n" + diff --git a/proto/gen/api/v1/workspace_setting_service.pb.go b/proto/gen/api/v1/workspace_setting_service.pb.go index b52f4265..ee095a37 100644 --- a/proto/gen/api/v1/workspace_setting_service.pb.go +++ b/proto/gen/api/v1/workspace_setting_service.pb.go @@ -812,9 +812,9 @@ const file_api_v1_workspace_setting_service_proto_rawDesc = "" + " \x03(\tR\treactions\x12<\n" + "\x1adisable_markdown_shortcuts\x18\v \x01(\bR\x18disableMarkdownShortcuts\x127\n" + "\x18enable_blur_nsfw_content\x18\f \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" + - "\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05\"6\n" + - "\x1aGetWorkspaceSettingRequest\x12\x18\n" + - "\x04name\x18\x01 \x01(\tB\x04\xe2A\x01\x02R\x04name\"V\n" + + "\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05\"5\n" + + "\x1aGetWorkspaceSettingRequest\x12\x17\n" + + "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"V\n" + "\x1aSetWorkspaceSettingRequest\x128\n" + "\asetting\x18\x01 \x01(\v2\x1e.memos.api.v1.WorkspaceSettingR\asetting2\xd9\x02\n" + "\x17WorkspaceSettingService\x12\x93\x01\n" + diff --git a/web/.gitignore b/web/.gitignore index 77f1076b..0e8b17df 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -4,4 +4,4 @@ node_modules dist dist-ssr *.local -src/types/proto +src/types/proto/store diff --git a/web/package.json b/web/package.json index f53377f5..6bc52cce 100644 --- a/web/package.json +++ b/web/package.json @@ -4,8 +4,7 @@ "dev": "vite", "build": "vite build", "release": "vite build --mode release --outDir=../server/router/frontend/dist --emptyOutDir", - "lint": "tsc --noEmit --skipLibCheck && eslint --ext .js,.ts,.tsx, src", - "postinstall": "cd ../proto && buf generate" + "lint": "tsc --noEmit --skipLibCheck && eslint --ext .js,.ts,.tsx, src" }, "dependencies": { "@dnd-kit/core": "^6.3.1", @@ -49,7 +48,6 @@ "zustand": "^5.0.3" }, "devDependencies": { - "@bufbuild/buf": "^1.52.1", "@bufbuild/protobuf": "^2.2.5", "@eslint/js": "^9.23.0", "@trivago/prettier-plugin-sort-imports": "^5.2.2", @@ -75,7 +73,6 @@ "nice-grpc-web": "^3.3.7", "postcss": "^8.5.3", "prettier": "^3.5.3", - "protobufjs": "^7.4.0", "terser": "^5.39.0", "typescript": "^5.8.2", "typescript-eslint": "^8.28.0", @@ -83,7 +80,6 @@ }, "pnpm": { "onlyBuiltDependencies": [ - "@bufbuild/buf", "esbuild" ] } diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 4374beee..70e7fe99 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -126,9 +126,6 @@ importers: specifier: ^5.0.3 version: 5.0.3(@types/react@18.3.18)(immer@10.1.1)(react@18.3.1)(use-sync-external-store@1.4.0(react@18.3.1)) devDependencies: - '@bufbuild/buf': - specifier: ^1.52.1 - version: 1.52.1 '@bufbuild/protobuf': specifier: ^2.2.5 version: 2.2.5 @@ -204,9 +201,6 @@ importers: prettier: specifier: ^3.5.3 version: 3.5.3 - protobufjs: - specifier: ^7.4.0 - version: 7.4.0 terser: specifier: ^5.39.0 version: 5.39.0 @@ -744,53 +738,6 @@ packages: '@braintree/sanitize-url@7.1.1': resolution: {integrity: sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==} - '@bufbuild/buf-darwin-arm64@1.52.1': - resolution: {integrity: sha512-c2iCRSvhrQVCe91xQNKhwy4ES3AN0kWP1oXnCe+bzReOrBsLef9gVoxKbDv5Ywkv+epfqhuAVbltpN37P4s9mQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - - '@bufbuild/buf-darwin-x64@1.52.1': - resolution: {integrity: sha512-2v742rgJBCe8E1H/u8ObUH4oeev5jCMP9TKPRy3iQZBFB2lXXgvKQCmSP2Du6Sc7bC3L4QxSbLfhJRobdjUR3Q==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - - '@bufbuild/buf-linux-aarch64@1.52.1': - resolution: {integrity: sha512-bnfDsmsnPlgNBueTzIemBuL4WxcASR7T+RIeTjur+VILN7kN6Pd8gUiNIQbZSvKwRdKGDRJXCfn404w+5Djo5A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - - '@bufbuild/buf-linux-armv7@1.52.1': - resolution: {integrity: sha512-+BvlP9FZu83dOoy2+fIw9/CuTq3TwDUXqfMU14b0CRDlx6eJsTbFMsYyNCQYdp9yJsLy3keEHKlBQkYdfd1wpQ==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - - '@bufbuild/buf-linux-x64@1.52.1': - resolution: {integrity: sha512-MIf62fmcV1FbBzojPfQAuE1BRspkgc6w5SDYdgimd85a9FYOrpUTkt31ZPjEz/swOuneGcDecayYtt6jWEcMGA==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - - '@bufbuild/buf-win32-arm64@1.52.1': - resolution: {integrity: sha512-QCKsJlgiEeY8bUipVO2WDQHHrSkmWUU7DAqZrw/ndHNCwg+//jhuwLYEbpbRiA1qG4Va6WzosR5/3VgOetyLuw==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - - '@bufbuild/buf-win32-x64@1.52.1': - resolution: {integrity: sha512-VzoN16/MbZ/ozLjFp5JKhSAhs9iOEPrp0hbCpO56o/0HXFQ96KNgNEP9vYD/E90DNHWW5sgoFk74zdJLXG8wXw==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - - '@bufbuild/buf@1.52.1': - resolution: {integrity: sha512-Sflcgagb/9gu3ShUF7jjJmYgMxut+YRNajPtTk20cUq5MIG8cCZeVfA6s6kDj2TG5QuAf49u5akTHPa5ZENr0A==} - engines: {node: '>=12'} - hasBin: true - '@bufbuild/protobuf@2.2.5': resolution: {integrity: sha512-/g5EzJifw5GF8aren8wZ/G5oMuPoGeS6MQD3ca8ddcvdXR5UELUfdTZITCGNhNXynY/AYl3Z4plmxdj/tRl/hQ==} @@ -1270,36 +1217,6 @@ packages: '@popperjs/core@2.11.8': resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} - '@protobufjs/aspromise@1.1.2': - resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} - - '@protobufjs/base64@1.1.2': - resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} - - '@protobufjs/codegen@2.0.4': - resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} - - '@protobufjs/eventemitter@1.1.0': - resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} - - '@protobufjs/fetch@1.1.0': - resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} - - '@protobufjs/float@1.0.2': - resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} - - '@protobufjs/inquire@1.1.0': - resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} - - '@protobufjs/path@1.1.2': - resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} - - '@protobufjs/pool@1.1.0': - resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} - - '@protobufjs/utf8@1.1.0': - resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} - '@radix-ui/primitive@1.1.1': resolution: {integrity: sha512-SJ31y+Q/zAyShtXJc8x83i9TYdbAfHZ++tUZnvjJJqFjzsdUnKsxPL6IEtBlxKkU7yzer//GQtZSV4GbldL3YA==} @@ -3359,10 +3276,6 @@ packages: prop-types@15.8.1: resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} - protobufjs@7.4.0: - resolution: {integrity: sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==} - engines: {node: '>=12.0.0'} - prr@1.0.1: resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} @@ -4767,37 +4680,6 @@ snapshots: '@braintree/sanitize-url@7.1.1': {} - '@bufbuild/buf-darwin-arm64@1.52.1': - optional: true - - '@bufbuild/buf-darwin-x64@1.52.1': - optional: true - - '@bufbuild/buf-linux-aarch64@1.52.1': - optional: true - - '@bufbuild/buf-linux-armv7@1.52.1': - optional: true - - '@bufbuild/buf-linux-x64@1.52.1': - optional: true - - '@bufbuild/buf-win32-arm64@1.52.1': - optional: true - - '@bufbuild/buf-win32-x64@1.52.1': - optional: true - - '@bufbuild/buf@1.52.1': - optionalDependencies: - '@bufbuild/buf-darwin-arm64': 1.52.1 - '@bufbuild/buf-darwin-x64': 1.52.1 - '@bufbuild/buf-linux-aarch64': 1.52.1 - '@bufbuild/buf-linux-armv7': 1.52.1 - '@bufbuild/buf-linux-x64': 1.52.1 - '@bufbuild/buf-win32-arm64': 1.52.1 - '@bufbuild/buf-win32-x64': 1.52.1 - '@bufbuild/protobuf@2.2.5': {} '@chevrotain/cst-dts-gen@11.0.3': @@ -5243,29 +5125,6 @@ snapshots: '@popperjs/core@2.11.8': {} - '@protobufjs/aspromise@1.1.2': {} - - '@protobufjs/base64@1.1.2': {} - - '@protobufjs/codegen@2.0.4': {} - - '@protobufjs/eventemitter@1.1.0': {} - - '@protobufjs/fetch@1.1.0': - dependencies: - '@protobufjs/aspromise': 1.1.2 - '@protobufjs/inquire': 1.1.0 - - '@protobufjs/float@1.0.2': {} - - '@protobufjs/inquire@1.1.0': {} - - '@protobufjs/path@1.1.2': {} - - '@protobufjs/pool@1.1.0': {} - - '@protobufjs/utf8@1.1.0': {} - '@radix-ui/primitive@1.1.1': {} '@radix-ui/react-arrow@1.1.2(@types/react-dom@18.3.5(@types/react@18.3.18))(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': @@ -7540,21 +7399,6 @@ snapshots: object-assign: 4.1.1 react-is: 16.13.1 - protobufjs@7.4.0: - dependencies: - '@protobufjs/aspromise': 1.1.2 - '@protobufjs/base64': 1.1.2 - '@protobufjs/codegen': 2.0.4 - '@protobufjs/eventemitter': 1.1.0 - '@protobufjs/fetch': 1.1.0 - '@protobufjs/float': 1.0.2 - '@protobufjs/inquire': 1.1.0 - '@protobufjs/path': 1.1.2 - '@protobufjs/pool': 1.1.0 - '@protobufjs/utf8': 1.1.0 - '@types/node': 22.13.10 - long: 5.3.1 - prr@1.0.1: optional: true diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsx index dbee0d86..1a69a528 100644 --- a/web/src/components/Settings/MemoRelatedSettings.tsx +++ b/web/src/components/Settings/MemoRelatedSettings.tsx @@ -6,8 +6,8 @@ import { useState } from "react"; import { toast } from "react-hot-toast"; import { workspaceSettingNamePrefix } from "@/store/v1"; import { workspaceStore } from "@/store/v2"; +import { WorkspaceSettingKey } from "@/store/v2/workspace"; import { WorkspaceMemoRelatedSetting } from "@/types/proto/api/v1/workspace_setting_service"; -import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; const MemoRelatedSettings = () => { diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsx index 8f62aa29..055c42d5 100644 --- a/web/src/components/Settings/StorageSection.tsx +++ b/web/src/components/Settings/StorageSection.tsx @@ -7,12 +7,12 @@ import { toast } from "react-hot-toast"; import { Link } from "react-router-dom"; import { workspaceSettingNamePrefix } from "@/store/v1"; import { workspaceStore } from "@/store/v2"; +import { WorkspaceSettingKey } from "@/store/v2/workspace"; import { WorkspaceStorageSetting, WorkspaceStorageSetting_S3Config, WorkspaceStorageSetting_StorageType, } from "@/types/proto/api/v1/workspace_setting_service"; -import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; const StorageSection = () => { diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx index 3337a12c..65bba4ce 100644 --- a/web/src/components/Settings/WorkspaceSection.tsx +++ b/web/src/components/Settings/WorkspaceSection.tsx @@ -8,9 +8,9 @@ import { Link } from "react-router-dom"; import { identityProviderServiceClient } from "@/grpcweb"; import { workspaceSettingNamePrefix } from "@/store/v1"; import { workspaceStore } from "@/store/v2"; +import { WorkspaceSettingKey } from "@/store/v2/workspace"; import { IdentityProvider } from "@/types/proto/api/v1/idp_service"; import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_service"; -import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsx index 9e0a7663..3475511c 100644 --- a/web/src/components/UpdateCustomizedProfileDialog.tsx +++ b/web/src/components/UpdateCustomizedProfileDialog.tsx @@ -5,8 +5,8 @@ import { useState } from "react"; import { toast } from "react-hot-toast"; import { workspaceSettingNamePrefix } from "@/store/v1"; import { workspaceStore } from "@/store/v2"; +import { WorkspaceSettingKey } from "@/store/v2/workspace"; import { WorkspaceCustomProfile } from "@/types/proto/api/v1/workspace_setting_service"; -import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import AppearanceSelect from "./AppearanceSelect"; import { generateDialog } from "./Dialog"; diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsx index 0c2d1b94..2d3eff39 100644 --- a/web/src/pages/Setting.tsx +++ b/web/src/pages/Setting.tsx @@ -15,8 +15,8 @@ import WorkspaceSection from "@/components/Settings/WorkspaceSection"; import useCurrentUser from "@/hooks/useCurrentUser"; import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { workspaceStore } from "@/store/v2"; +import { WorkspaceSettingKey } from "@/store/v2/workspace"; import { User_Role } from "@/types/proto/api/v1/user_service"; -import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; type SettingSection = "my-account" | "preference" | "member" | "system" | "memo-related" | "storage" | "sso"; diff --git a/web/src/store/v2/workspace.ts b/web/src/store/v2/workspace.ts index 9636e781..eb2431d5 100644 --- a/web/src/store/v2/workspace.ts +++ b/web/src/store/v2/workspace.ts @@ -3,10 +3,20 @@ import { makeAutoObservable } from "mobx"; import { workspaceServiceClient, workspaceSettingServiceClient } from "@/grpcweb"; import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service"; import { WorkspaceGeneralSetting, WorkspaceMemoRelatedSetting, WorkspaceSetting } from "@/types/proto/api/v1/workspace_setting_service"; -import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { isValidateLocale } from "@/utils/i18n"; import { workspaceSettingNamePrefix } from "../v1"; +export enum WorkspaceSettingKey { + /** BASIC - BASIC is the key for basic settings. */ + BASIC = "BASIC", + /** GENERAL - GENERAL is the key for general settings. */ + GENERAL = "GENERAL", + /** STORAGE - STORAGE is the key for storage settings. */ + STORAGE = "STORAGE", + /** MEMO_RELATED - MEMO_RELATED is the key for memo related settings. */ + MEMO_RELATED = "MEMO_RELATED", +} + class LocalState { locale: string = "en"; appearance: string = "system"; diff --git a/web/src/types/proto/api/v1/activity_service.ts b/web/src/types/proto/api/v1/activity_service.ts new file mode 100644 index 00000000..6543a453 --- /dev/null +++ b/web/src/types/proto/api/v1/activity_service.ts @@ -0,0 +1,399 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/activity_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "memos.api.v1"; + +export interface Activity { + /** + * The name of the activity. + * Format: activities/{id} + */ + name: string; + /** + * The name of the creator. + * Format: users/{user} + */ + creator: string; + /** The type of the activity. */ + type: string; + /** The level of the activity. */ + level: string; + /** The create time of the activity. */ + createTime?: + | Date + | undefined; + /** The payload of the activity. */ + payload?: ActivityPayload | undefined; +} + +export interface ActivityPayload { + memoComment?: ActivityMemoCommentPayload | undefined; +} + +/** ActivityMemoCommentPayload represents the payload of a memo comment activity. */ +export interface ActivityMemoCommentPayload { + /** + * The memo name of comment. + * Refer to `Memo.name`. + */ + memo: string; + /** The name of related memo. */ + relatedMemo: string; +} + +export interface GetActivityRequest { + /** + * The name of the activity. + * Format: activities/{id}, id is the system generated auto-incremented id. + */ + name: string; +} + +function createBaseActivity(): Activity { + return { name: "", creator: "", type: "", level: "", createTime: undefined, payload: undefined }; +} + +export const Activity: MessageFns = { + encode(message: Activity, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.level !== "") { + writer.uint32(34).string(message.level); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join(); + } + if (message.payload !== undefined) { + ActivityPayload.encode(message.payload, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Activity { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivity(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.level = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.payload = ActivityPayload.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Activity { + return Activity.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Activity { + const message = createBaseActivity(); + message.name = object.name ?? ""; + message.creator = object.creator ?? ""; + message.type = object.type ?? ""; + message.level = object.level ?? ""; + message.createTime = object.createTime ?? undefined; + message.payload = (object.payload !== undefined && object.payload !== null) + ? ActivityPayload.fromPartial(object.payload) + : undefined; + return message; + }, +}; + +function createBaseActivityPayload(): ActivityPayload { + return { memoComment: undefined }; +} + +export const ActivityPayload: MessageFns = { + encode(message: ActivityPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.memoComment !== undefined) { + ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivityPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivityPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memoComment = ActivityMemoCommentPayload.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ActivityPayload { + return ActivityPayload.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ActivityPayload { + const message = createBaseActivityPayload(); + message.memoComment = (object.memoComment !== undefined && object.memoComment !== null) + ? ActivityMemoCommentPayload.fromPartial(object.memoComment) + : undefined; + return message; + }, +}; + +function createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload { + return { memo: "", relatedMemo: "" }; +} + +export const ActivityMemoCommentPayload: MessageFns = { + encode(message: ActivityMemoCommentPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.memo !== "") { + writer.uint32(10).string(message.memo); + } + if (message.relatedMemo !== "") { + writer.uint32(18).string(message.relatedMemo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ActivityMemoCommentPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivityMemoCommentPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memo = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.relatedMemo = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ActivityMemoCommentPayload { + return ActivityMemoCommentPayload.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ActivityMemoCommentPayload { + const message = createBaseActivityMemoCommentPayload(); + message.memo = object.memo ?? ""; + message.relatedMemo = object.relatedMemo ?? ""; + return message; + }, +}; + +function createBaseGetActivityRequest(): GetActivityRequest { + return { name: "" }; +} + +export const GetActivityRequest: MessageFns = { + encode(message: GetActivityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetActivityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetActivityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetActivityRequest { + return GetActivityRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetActivityRequest { + const message = createBaseGetActivityRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +export type ActivityServiceDefinition = typeof ActivityServiceDefinition; +export const ActivityServiceDefinition = { + name: "ActivityService", + fullName: "memos.api.v1.ActivityService", + methods: { + /** GetActivity returns the activity with the given id. */ + getActivity: { + name: "GetActivity", + requestType: GetActivityRequest, + requestStream: false, + responseType: Activity, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 29, + 18, + 27, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 97, + 99, + 116, + 105, + 118, + 105, + 116, + 105, + 101, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/auth_service.ts b/web/src/types/proto/api/v1/auth_service.ts new file mode 100644 index 00000000..f35f8b62 --- /dev/null +++ b/web/src/types/proto/api/v1/auth_service.ts @@ -0,0 +1,577 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/auth_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Empty } from "../../google/protobuf/empty"; +import { User } from "./user_service"; + +export const protobufPackage = "memos.api.v1"; + +export interface GetAuthStatusRequest { +} + +export interface GetAuthStatusResponse { + user?: User | undefined; +} + +export interface SignInRequest { + /** The username to sign in with. */ + username: string; + /** The password to sign in with. */ + password: string; + /** Whether the session should never expire. */ + neverExpire: boolean; +} + +export interface SignInWithSSORequest { + /** The ID of the SSO provider. */ + idpId: number; + /** The code to sign in with. */ + code: string; + /** The redirect URI. */ + redirectUri: string; +} + +export interface SignUpRequest { + /** The username to sign up with. */ + username: string; + /** The password to sign up with. */ + password: string; +} + +export interface SignOutRequest { +} + +function createBaseGetAuthStatusRequest(): GetAuthStatusRequest { + return {}; +} + +export const GetAuthStatusRequest: MessageFns = { + encode(_: GetAuthStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthStatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetAuthStatusRequest { + return GetAuthStatusRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): GetAuthStatusRequest { + const message = createBaseGetAuthStatusRequest(); + return message; + }, +}; + +function createBaseGetAuthStatusResponse(): GetAuthStatusResponse { + return { user: undefined }; +} + +export const GetAuthStatusResponse: MessageFns = { + encode(message: GetAuthStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthStatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetAuthStatusResponse { + return GetAuthStatusResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetAuthStatusResponse { + const message = createBaseGetAuthStatusResponse(); + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +function createBaseSignInRequest(): SignInRequest { + return { username: "", password: "", neverExpire: false }; +} + +export const SignInRequest: MessageFns = { + encode(message: SignInRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.username !== "") { + writer.uint32(10).string(message.username); + } + if (message.password !== "") { + writer.uint32(18).string(message.password); + } + if (message.neverExpire !== false) { + writer.uint32(24).bool(message.neverExpire); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignInRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignInRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.username = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.password = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.neverExpire = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SignInRequest { + return SignInRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SignInRequest { + const message = createBaseSignInRequest(); + message.username = object.username ?? ""; + message.password = object.password ?? ""; + message.neverExpire = object.neverExpire ?? false; + return message; + }, +}; + +function createBaseSignInWithSSORequest(): SignInWithSSORequest { + return { idpId: 0, code: "", redirectUri: "" }; +} + +export const SignInWithSSORequest: MessageFns = { + encode(message: SignInWithSSORequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.idpId !== 0) { + writer.uint32(8).int32(message.idpId); + } + if (message.code !== "") { + writer.uint32(18).string(message.code); + } + if (message.redirectUri !== "") { + writer.uint32(26).string(message.redirectUri); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignInWithSSORequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignInWithSSORequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.idpId = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.code = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.redirectUri = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SignInWithSSORequest { + return SignInWithSSORequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SignInWithSSORequest { + const message = createBaseSignInWithSSORequest(); + message.idpId = object.idpId ?? 0; + message.code = object.code ?? ""; + message.redirectUri = object.redirectUri ?? ""; + return message; + }, +}; + +function createBaseSignUpRequest(): SignUpRequest { + return { username: "", password: "" }; +} + +export const SignUpRequest: MessageFns = { + encode(message: SignUpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.username !== "") { + writer.uint32(10).string(message.username); + } + if (message.password !== "") { + writer.uint32(18).string(message.password); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignUpRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignUpRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.username = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.password = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SignUpRequest { + return SignUpRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SignUpRequest { + const message = createBaseSignUpRequest(); + message.username = object.username ?? ""; + message.password = object.password ?? ""; + return message; + }, +}; + +function createBaseSignOutRequest(): SignOutRequest { + return {}; +} + +export const SignOutRequest: MessageFns = { + encode(_: SignOutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignOutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignOutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SignOutRequest { + return SignOutRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): SignOutRequest { + const message = createBaseSignOutRequest(); + return message; + }, +}; + +export type AuthServiceDefinition = typeof AuthServiceDefinition; +export const AuthServiceDefinition = { + name: "AuthService", + fullName: "memos.api.v1.AuthService", + methods: { + /** GetAuthStatus returns the current auth status of the user. */ + getAuthStatus: { + name: "GetAuthStatus", + requestType: GetAuthStatusRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 21, + 34, + 19, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 97, + 117, + 116, + 104, + 47, + 115, + 116, + 97, + 116, + 117, + 115, + ]), + ], + }, + }, + }, + /** SignIn signs in the user with the given username and password. */ + signIn: { + name: "SignIn", + requestType: SignInRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 21, + 34, + 19, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 97, + 117, + 116, + 104, + 47, + 115, + 105, + 103, + 110, + 105, + 110, + ]), + ], + }, + }, + }, + /** SignInWithSSO signs in the user with the given SSO code. */ + signInWithSSO: { + name: "SignInWithSSO", + requestType: SignInWithSSORequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 25, + 34, + 23, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 97, + 117, + 116, + 104, + 47, + 115, + 105, + 103, + 110, + 105, + 110, + 47, + 115, + 115, + 111, + ]), + ], + }, + }, + }, + /** SignUp signs up the user with the given username and password. */ + signUp: { + name: "SignUp", + requestType: SignUpRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 21, + 34, + 19, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 97, + 117, + 116, + 104, + 47, + 115, + 105, + 103, + 110, + 117, + 112, + ]), + ], + }, + }, + }, + /** SignOut signs out the user. */ + signOut: { + name: "SignOut", + requestType: SignOutRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 22, + 34, + 20, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 97, + 117, + 116, + 104, + 47, + 115, + 105, + 103, + 110, + 111, + 117, + 116, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/common.ts b/web/src/types/proto/api/v1/common.ts new file mode 100644 index 00000000..d71a08a1 --- /dev/null +++ b/web/src/types/proto/api/v1/common.ts @@ -0,0 +1,167 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/common.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "memos.api.v1"; + +export enum State { + STATE_UNSPECIFIED = "STATE_UNSPECIFIED", + NORMAL = "NORMAL", + ARCHIVED = "ARCHIVED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function stateFromJSON(object: any): State { + switch (object) { + case 0: + case "STATE_UNSPECIFIED": + return State.STATE_UNSPECIFIED; + case 1: + case "NORMAL": + return State.NORMAL; + case 2: + case "ARCHIVED": + return State.ARCHIVED; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} + +export function stateToNumber(object: State): number { + switch (object) { + case State.STATE_UNSPECIFIED: + return 0; + case State.NORMAL: + return 1; + case State.ARCHIVED: + return 2; + case State.UNRECOGNIZED: + default: + return -1; + } +} + +export enum Direction { + DIRECTION_UNSPECIFIED = "DIRECTION_UNSPECIFIED", + ASC = "ASC", + DESC = "DESC", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function directionFromJSON(object: any): Direction { + switch (object) { + case 0: + case "DIRECTION_UNSPECIFIED": + return Direction.DIRECTION_UNSPECIFIED; + case 1: + case "ASC": + return Direction.ASC; + case 2: + case "DESC": + return Direction.DESC; + case -1: + case "UNRECOGNIZED": + default: + return Direction.UNRECOGNIZED; + } +} + +export function directionToNumber(object: Direction): number { + switch (object) { + case Direction.DIRECTION_UNSPECIFIED: + return 0; + case Direction.ASC: + return 1; + case Direction.DESC: + return 2; + case Direction.UNRECOGNIZED: + default: + return -1; + } +} + +/** Used internally for obfuscating the page token. */ +export interface PageToken { + limit: number; + offset: number; +} + +function createBasePageToken(): PageToken { + return { limit: 0, offset: 0 }; +} + +export const PageToken: MessageFns = { + encode(message: PageToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.limit !== 0) { + writer.uint32(8).int32(message.limit); + } + if (message.offset !== 0) { + writer.uint32(16).int32(message.offset); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageToken { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.limit = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.offset = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): PageToken { + return PageToken.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PageToken { + const message = createBasePageToken(); + message.limit = object.limit ?? 0; + message.offset = object.offset ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/idp_service.ts b/web/src/types/proto/api/v1/idp_service.ts new file mode 100644 index 00000000..b24019ed --- /dev/null +++ b/web/src/types/proto/api/v1/idp_service.ts @@ -0,0 +1,1095 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/idp_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Empty } from "../../google/protobuf/empty"; +import { FieldMask } from "../../google/protobuf/field_mask"; + +export const protobufPackage = "memos.api.v1"; + +export interface IdentityProvider { + /** + * The name of the identityProvider. + * Format: identityProviders/{id}, id is the system generated auto-incremented id. + */ + name: string; + type: IdentityProvider_Type; + title: string; + identifierFilter: string; + config?: IdentityProviderConfig | undefined; +} + +export enum IdentityProvider_Type { + TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", + OAUTH2 = "OAUTH2", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function identityProvider_TypeFromJSON(object: any): IdentityProvider_Type { + switch (object) { + case 0: + case "TYPE_UNSPECIFIED": + return IdentityProvider_Type.TYPE_UNSPECIFIED; + case 1: + case "OAUTH2": + return IdentityProvider_Type.OAUTH2; + case -1: + case "UNRECOGNIZED": + default: + return IdentityProvider_Type.UNRECOGNIZED; + } +} + +export function identityProvider_TypeToNumber(object: IdentityProvider_Type): number { + switch (object) { + case IdentityProvider_Type.TYPE_UNSPECIFIED: + return 0; + case IdentityProvider_Type.OAUTH2: + return 1; + case IdentityProvider_Type.UNRECOGNIZED: + default: + return -1; + } +} + +export interface IdentityProviderConfig { + oauth2Config?: OAuth2Config | undefined; +} + +export interface FieldMapping { + identifier: string; + displayName: string; + email: string; +} + +export interface OAuth2Config { + clientId: string; + clientSecret: string; + authUrl: string; + tokenUrl: string; + userInfoUrl: string; + scopes: string[]; + fieldMapping?: FieldMapping | undefined; +} + +export interface ListIdentityProvidersRequest { +} + +export interface ListIdentityProvidersResponse { + identityProviders: IdentityProvider[]; +} + +export interface GetIdentityProviderRequest { + /** The name of the identityProvider to get. */ + name: string; +} + +export interface CreateIdentityProviderRequest { + /** The identityProvider to create. */ + identityProvider?: IdentityProvider | undefined; +} + +export interface UpdateIdentityProviderRequest { + /** The identityProvider to update. */ + identityProvider?: + | IdentityProvider + | undefined; + /** + * The update mask applies to the resource. Only the top level fields of + * IdentityProvider are supported. + */ + updateMask?: string[] | undefined; +} + +export interface DeleteIdentityProviderRequest { + /** The name of the identityProvider to delete. */ + name: string; +} + +function createBaseIdentityProvider(): IdentityProvider { + return { name: "", type: IdentityProvider_Type.TYPE_UNSPECIFIED, title: "", identifierFilter: "", config: undefined }; +} + +export const IdentityProvider: MessageFns = { + encode(message: IdentityProvider, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.type !== IdentityProvider_Type.TYPE_UNSPECIFIED) { + writer.uint32(16).int32(identityProvider_TypeToNumber(message.type)); + } + if (message.title !== "") { + writer.uint32(26).string(message.title); + } + if (message.identifierFilter !== "") { + writer.uint32(34).string(message.identifierFilter); + } + if (message.config !== undefined) { + IdentityProviderConfig.encode(message.config, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityProvider { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityProvider(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.type = identityProvider_TypeFromJSON(reader.int32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.title = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.identifierFilter = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.config = IdentityProviderConfig.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): IdentityProvider { + return IdentityProvider.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): IdentityProvider { + const message = createBaseIdentityProvider(); + message.name = object.name ?? ""; + message.type = object.type ?? IdentityProvider_Type.TYPE_UNSPECIFIED; + message.title = object.title ?? ""; + message.identifierFilter = object.identifierFilter ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? IdentityProviderConfig.fromPartial(object.config) + : undefined; + return message; + }, +}; + +function createBaseIdentityProviderConfig(): IdentityProviderConfig { + return { oauth2Config: undefined }; +} + +export const IdentityProviderConfig: MessageFns = { + encode(message: IdentityProviderConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.oauth2Config !== undefined) { + OAuth2Config.encode(message.oauth2Config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IdentityProviderConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentityProviderConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.oauth2Config = OAuth2Config.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): IdentityProviderConfig { + return IdentityProviderConfig.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): IdentityProviderConfig { + const message = createBaseIdentityProviderConfig(); + message.oauth2Config = (object.oauth2Config !== undefined && object.oauth2Config !== null) + ? OAuth2Config.fromPartial(object.oauth2Config) + : undefined; + return message; + }, +}; + +function createBaseFieldMapping(): FieldMapping { + return { identifier: "", displayName: "", email: "" }; +} + +export const FieldMapping: MessageFns = { + encode(message: FieldMapping, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + if (message.displayName !== "") { + writer.uint32(18).string(message.displayName); + } + if (message.email !== "") { + writer.uint32(26).string(message.email); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldMapping { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldMapping(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.identifier = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.displayName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.email = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldMapping { + return FieldMapping.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FieldMapping { + const message = createBaseFieldMapping(); + message.identifier = object.identifier ?? ""; + message.displayName = object.displayName ?? ""; + message.email = object.email ?? ""; + return message; + }, +}; + +function createBaseOAuth2Config(): OAuth2Config { + return { + clientId: "", + clientSecret: "", + authUrl: "", + tokenUrl: "", + userInfoUrl: "", + scopes: [], + fieldMapping: undefined, + }; +} + +export const OAuth2Config: MessageFns = { + encode(message: OAuth2Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientSecret !== "") { + writer.uint32(18).string(message.clientSecret); + } + if (message.authUrl !== "") { + writer.uint32(26).string(message.authUrl); + } + if (message.tokenUrl !== "") { + writer.uint32(34).string(message.tokenUrl); + } + if (message.userInfoUrl !== "") { + writer.uint32(42).string(message.userInfoUrl); + } + for (const v of message.scopes) { + writer.uint32(50).string(v!); + } + if (message.fieldMapping !== undefined) { + FieldMapping.encode(message.fieldMapping, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OAuth2Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOAuth2Config(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.clientId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.clientSecret = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.authUrl = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.tokenUrl = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.userInfoUrl = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.scopes.push(reader.string()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.fieldMapping = FieldMapping.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): OAuth2Config { + return OAuth2Config.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): OAuth2Config { + const message = createBaseOAuth2Config(); + message.clientId = object.clientId ?? ""; + message.clientSecret = object.clientSecret ?? ""; + message.authUrl = object.authUrl ?? ""; + message.tokenUrl = object.tokenUrl ?? ""; + message.userInfoUrl = object.userInfoUrl ?? ""; + message.scopes = object.scopes?.map((e) => e) || []; + message.fieldMapping = (object.fieldMapping !== undefined && object.fieldMapping !== null) + ? FieldMapping.fromPartial(object.fieldMapping) + : undefined; + return message; + }, +}; + +function createBaseListIdentityProvidersRequest(): ListIdentityProvidersRequest { + return {}; +} + +export const ListIdentityProvidersRequest: MessageFns = { + encode(_: ListIdentityProvidersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListIdentityProvidersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListIdentityProvidersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListIdentityProvidersRequest { + return ListIdentityProvidersRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): ListIdentityProvidersRequest { + const message = createBaseListIdentityProvidersRequest(); + return message; + }, +}; + +function createBaseListIdentityProvidersResponse(): ListIdentityProvidersResponse { + return { identityProviders: [] }; +} + +export const ListIdentityProvidersResponse: MessageFns = { + encode(message: ListIdentityProvidersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.identityProviders) { + IdentityProvider.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListIdentityProvidersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListIdentityProvidersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.identityProviders.push(IdentityProvider.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListIdentityProvidersResponse { + return ListIdentityProvidersResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListIdentityProvidersResponse { + const message = createBaseListIdentityProvidersResponse(); + message.identityProviders = object.identityProviders?.map((e) => IdentityProvider.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetIdentityProviderRequest(): GetIdentityProviderRequest { + return { name: "" }; +} + +export const GetIdentityProviderRequest: MessageFns = { + encode(message: GetIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetIdentityProviderRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetIdentityProviderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetIdentityProviderRequest { + return GetIdentityProviderRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetIdentityProviderRequest { + const message = createBaseGetIdentityProviderRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseCreateIdentityProviderRequest(): CreateIdentityProviderRequest { + return { identityProvider: undefined }; +} + +export const CreateIdentityProviderRequest: MessageFns = { + encode(message: CreateIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identityProvider !== undefined) { + IdentityProvider.encode(message.identityProvider, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateIdentityProviderRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateIdentityProviderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.identityProvider = IdentityProvider.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateIdentityProviderRequest { + return CreateIdentityProviderRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateIdentityProviderRequest { + const message = createBaseCreateIdentityProviderRequest(); + message.identityProvider = (object.identityProvider !== undefined && object.identityProvider !== null) + ? IdentityProvider.fromPartial(object.identityProvider) + : undefined; + return message; + }, +}; + +function createBaseUpdateIdentityProviderRequest(): UpdateIdentityProviderRequest { + return { identityProvider: undefined, updateMask: undefined }; +} + +export const UpdateIdentityProviderRequest: MessageFns = { + encode(message: UpdateIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.identityProvider !== undefined) { + IdentityProvider.encode(message.identityProvider, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateIdentityProviderRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateIdentityProviderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.identityProvider = IdentityProvider.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateIdentityProviderRequest { + return UpdateIdentityProviderRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateIdentityProviderRequest { + const message = createBaseUpdateIdentityProviderRequest(); + message.identityProvider = (object.identityProvider !== undefined && object.identityProvider !== null) + ? IdentityProvider.fromPartial(object.identityProvider) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteIdentityProviderRequest(): DeleteIdentityProviderRequest { + return { name: "" }; +} + +export const DeleteIdentityProviderRequest: MessageFns = { + encode(message: DeleteIdentityProviderRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteIdentityProviderRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteIdentityProviderRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteIdentityProviderRequest { + return DeleteIdentityProviderRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteIdentityProviderRequest { + const message = createBaseDeleteIdentityProviderRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +export type IdentityProviderServiceDefinition = typeof IdentityProviderServiceDefinition; +export const IdentityProviderServiceDefinition = { + name: "IdentityProviderService", + fullName: "memos.api.v1.IdentityProviderService", + methods: { + /** ListIdentityProviders lists identity providers. */ + listIdentityProviders: { + name: "ListIdentityProviders", + requestType: ListIdentityProvidersRequest, + requestStream: false, + responseType: ListIdentityProvidersResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 27, + 18, + 25, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 80, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 115, + ]), + ], + }, + }, + }, + /** GetIdentityProvider gets an identity provider. */ + getIdentityProvider: { + name: "GetIdentityProvider", + requestType: GetIdentityProviderRequest, + requestStream: false, + responseType: IdentityProvider, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 36, + 18, + 34, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 80, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** CreateIdentityProvider creates an identity provider. */ + createIdentityProvider: { + name: "CreateIdentityProvider", + requestType: CreateIdentityProviderRequest, + requestStream: false, + responseType: IdentityProvider, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 46, + 58, + 17, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 95, + 112, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 34, + 25, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 80, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 115, + ]), + ], + }, + }, + }, + /** UpdateIdentityProvider updates an identity provider. */ + updateIdentityProvider: { + name: "UpdateIdentityProvider", + requestType: UpdateIdentityProviderRequest, + requestStream: false, + responseType: IdentityProvider, + responseStream: false, + options: { + _unknownFields: { + 8410: [ + new Uint8Array([ + 29, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 95, + 112, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 44, + 117, + 112, + 100, + 97, + 116, + 101, + 95, + 109, + 97, + 115, + 107, + ]), + ], + 578365826: [ + new Uint8Array([ + 73, + 58, + 17, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 95, + 112, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 50, + 52, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 95, + 112, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 46, + 110, + 97, + 109, + 101, + 61, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 80, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** DeleteIdentityProvider deletes an identity provider. */ + deleteIdentityProvider: { + name: "DeleteIdentityProvider", + requestType: DeleteIdentityProviderRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 36, + 42, + 34, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 105, + 100, + 101, + 110, + 116, + 105, + 116, + 121, + 80, + 114, + 111, + 118, + 105, + 100, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/inbox_service.ts b/web/src/types/proto/api/v1/inbox_service.ts new file mode 100644 index 00000000..040f84d4 --- /dev/null +++ b/web/src/types/proto/api/v1/inbox_service.ts @@ -0,0 +1,644 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/inbox_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Empty } from "../../google/protobuf/empty"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "memos.api.v1"; + +export interface Inbox { + /** + * The name of the inbox. + * Format: inboxes/{id}, id is the system generated auto-incremented id. + */ + name: string; + /** Format: users/{user} */ + sender: string; + /** Format: users/{user} */ + receiver: string; + status: Inbox_Status; + createTime?: Date | undefined; + type: Inbox_Type; + activityId?: number | undefined; +} + +export enum Inbox_Status { + STATUS_UNSPECIFIED = "STATUS_UNSPECIFIED", + UNREAD = "UNREAD", + ARCHIVED = "ARCHIVED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function inbox_StatusFromJSON(object: any): Inbox_Status { + switch (object) { + case 0: + case "STATUS_UNSPECIFIED": + return Inbox_Status.STATUS_UNSPECIFIED; + case 1: + case "UNREAD": + return Inbox_Status.UNREAD; + case 2: + case "ARCHIVED": + return Inbox_Status.ARCHIVED; + case -1: + case "UNRECOGNIZED": + default: + return Inbox_Status.UNRECOGNIZED; + } +} + +export function inbox_StatusToNumber(object: Inbox_Status): number { + switch (object) { + case Inbox_Status.STATUS_UNSPECIFIED: + return 0; + case Inbox_Status.UNREAD: + return 1; + case Inbox_Status.ARCHIVED: + return 2; + case Inbox_Status.UNRECOGNIZED: + default: + return -1; + } +} + +export enum Inbox_Type { + TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", + MEMO_COMMENT = "MEMO_COMMENT", + VERSION_UPDATE = "VERSION_UPDATE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function inbox_TypeFromJSON(object: any): Inbox_Type { + switch (object) { + case 0: + case "TYPE_UNSPECIFIED": + return Inbox_Type.TYPE_UNSPECIFIED; + case 1: + case "MEMO_COMMENT": + return Inbox_Type.MEMO_COMMENT; + case 2: + case "VERSION_UPDATE": + return Inbox_Type.VERSION_UPDATE; + case -1: + case "UNRECOGNIZED": + default: + return Inbox_Type.UNRECOGNIZED; + } +} + +export function inbox_TypeToNumber(object: Inbox_Type): number { + switch (object) { + case Inbox_Type.TYPE_UNSPECIFIED: + return 0; + case Inbox_Type.MEMO_COMMENT: + return 1; + case Inbox_Type.VERSION_UPDATE: + return 2; + case Inbox_Type.UNRECOGNIZED: + default: + return -1; + } +} + +export interface ListInboxesRequest { + /** Format: users/{user} */ + user: string; + /** The maximum number of inbox to return. */ + pageSize: number; + /** Provide this to retrieve the subsequent page. */ + pageToken: string; +} + +export interface ListInboxesResponse { + inboxes: Inbox[]; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + */ + nextPageToken: string; +} + +export interface UpdateInboxRequest { + inbox?: Inbox | undefined; + updateMask?: string[] | undefined; +} + +export interface DeleteInboxRequest { + /** The name of the inbox to delete. */ + name: string; +} + +function createBaseInbox(): Inbox { + return { + name: "", + sender: "", + receiver: "", + status: Inbox_Status.STATUS_UNSPECIFIED, + createTime: undefined, + type: Inbox_Type.TYPE_UNSPECIFIED, + activityId: undefined, + }; +} + +export const Inbox: MessageFns = { + encode(message: Inbox, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.sender !== "") { + writer.uint32(18).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(26).string(message.receiver); + } + if (message.status !== Inbox_Status.STATUS_UNSPECIFIED) { + writer.uint32(32).int32(inbox_StatusToNumber(message.status)); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join(); + } + if (message.type !== Inbox_Type.TYPE_UNSPECIFIED) { + writer.uint32(48).int32(inbox_TypeToNumber(message.type)); + } + if (message.activityId !== undefined) { + writer.uint32(56).int32(message.activityId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Inbox { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInbox(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sender = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.receiver = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.status = inbox_StatusFromJSON(reader.int32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.type = inbox_TypeFromJSON(reader.int32()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.activityId = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Inbox { + return Inbox.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Inbox { + const message = createBaseInbox(); + message.name = object.name ?? ""; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + message.status = object.status ?? Inbox_Status.STATUS_UNSPECIFIED; + message.createTime = object.createTime ?? undefined; + message.type = object.type ?? Inbox_Type.TYPE_UNSPECIFIED; + message.activityId = object.activityId ?? undefined; + return message; + }, +}; + +function createBaseListInboxesRequest(): ListInboxesRequest { + return { user: "", pageSize: 0, pageToken: "" }; +} + +export const ListInboxesRequest: MessageFns = { + encode(message: ListInboxesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.user !== "") { + writer.uint32(10).string(message.user); + } + if (message.pageSize !== 0) { + writer.uint32(16).int32(message.pageSize); + } + if (message.pageToken !== "") { + writer.uint32(26).string(message.pageToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListInboxesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListInboxesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.user = 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; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListInboxesRequest { + return ListInboxesRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListInboxesRequest { + const message = createBaseListInboxesRequest(); + message.user = object.user ?? ""; + message.pageSize = object.pageSize ?? 0; + message.pageToken = object.pageToken ?? ""; + return message; + }, +}; + +function createBaseListInboxesResponse(): ListInboxesResponse { + return { inboxes: [], nextPageToken: "" }; +} + +export const ListInboxesResponse: MessageFns = { + encode(message: ListInboxesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inboxes) { + Inbox.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.nextPageToken !== "") { + writer.uint32(18).string(message.nextPageToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListInboxesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListInboxesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.inboxes.push(Inbox.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.nextPageToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListInboxesResponse { + return ListInboxesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListInboxesResponse { + const message = createBaseListInboxesResponse(); + message.inboxes = object.inboxes?.map((e) => Inbox.fromPartial(e)) || []; + message.nextPageToken = object.nextPageToken ?? ""; + return message; + }, +}; + +function createBaseUpdateInboxRequest(): UpdateInboxRequest { + return { inbox: undefined, updateMask: undefined }; +} + +export const UpdateInboxRequest: MessageFns = { + encode(message: UpdateInboxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inbox !== undefined) { + Inbox.encode(message.inbox, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateInboxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateInboxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.inbox = Inbox.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateInboxRequest { + return UpdateInboxRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateInboxRequest { + const message = createBaseUpdateInboxRequest(); + message.inbox = (object.inbox !== undefined && object.inbox !== null) ? Inbox.fromPartial(object.inbox) : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteInboxRequest(): DeleteInboxRequest { + return { name: "" }; +} + +export const DeleteInboxRequest: MessageFns = { + encode(message: DeleteInboxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteInboxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteInboxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteInboxRequest { + return DeleteInboxRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteInboxRequest { + const message = createBaseDeleteInboxRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +export type InboxServiceDefinition = typeof InboxServiceDefinition; +export const InboxServiceDefinition = { + name: "InboxService", + fullName: "memos.api.v1.InboxService", + methods: { + /** ListInboxes lists inboxes for a user. */ + listInboxes: { + name: "ListInboxes", + requestType: ListInboxesRequest, + requestStream: false, + responseType: ListInboxesResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([17, 18, 15, 47, 97, 112, 105, 47, 118, 49, 47, 105, 110, 98, 111, 120, 101, 115]), + ], + }, + }, + }, + /** UpdateInbox updates an inbox. */ + updateInbox: { + name: "UpdateInbox", + requestType: UpdateInboxRequest, + requestStream: false, + responseType: Inbox, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([17, 105, 110, 98, 111, 120, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])], + 578365826: [ + new Uint8Array([ + 39, + 58, + 5, + 105, + 110, + 98, + 111, + 120, + 50, + 30, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 105, + 110, + 98, + 111, + 120, + 46, + 110, + 97, + 109, + 101, + 61, + 105, + 110, + 98, + 111, + 120, + 101, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** DeleteInbox deletes an inbox. */ + deleteInbox: { + name: "DeleteInbox", + requestType: DeleteInboxRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 26, + 42, + 24, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 105, + 110, + 98, + 111, + 120, + 101, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/markdown_service.ts b/web/src/types/proto/api/v1/markdown_service.ts new file mode 100644 index 00000000..cca70c12 --- /dev/null +++ b/web/src/types/proto/api/v1/markdown_service.ts @@ -0,0 +1,3418 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/markdown_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "memos.api.v1"; + +export enum NodeType { + NODE_UNSPECIFIED = "NODE_UNSPECIFIED", + /** LINE_BREAK - Block nodes. */ + LINE_BREAK = "LINE_BREAK", + PARAGRAPH = "PARAGRAPH", + CODE_BLOCK = "CODE_BLOCK", + HEADING = "HEADING", + HORIZONTAL_RULE = "HORIZONTAL_RULE", + BLOCKQUOTE = "BLOCKQUOTE", + LIST = "LIST", + ORDERED_LIST_ITEM = "ORDERED_LIST_ITEM", + UNORDERED_LIST_ITEM = "UNORDERED_LIST_ITEM", + TASK_LIST_ITEM = "TASK_LIST_ITEM", + MATH_BLOCK = "MATH_BLOCK", + TABLE = "TABLE", + EMBEDDED_CONTENT = "EMBEDDED_CONTENT", + /** TEXT - Inline nodes. */ + TEXT = "TEXT", + BOLD = "BOLD", + ITALIC = "ITALIC", + BOLD_ITALIC = "BOLD_ITALIC", + CODE = "CODE", + IMAGE = "IMAGE", + LINK = "LINK", + AUTO_LINK = "AUTO_LINK", + TAG = "TAG", + STRIKETHROUGH = "STRIKETHROUGH", + ESCAPING_CHARACTER = "ESCAPING_CHARACTER", + MATH = "MATH", + HIGHLIGHT = "HIGHLIGHT", + SUBSCRIPT = "SUBSCRIPT", + SUPERSCRIPT = "SUPERSCRIPT", + REFERENCED_CONTENT = "REFERENCED_CONTENT", + SPOILER = "SPOILER", + HTML_ELEMENT = "HTML_ELEMENT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function nodeTypeFromJSON(object: any): NodeType { + switch (object) { + case 0: + case "NODE_UNSPECIFIED": + return NodeType.NODE_UNSPECIFIED; + case 1: + case "LINE_BREAK": + return NodeType.LINE_BREAK; + case 2: + case "PARAGRAPH": + return NodeType.PARAGRAPH; + case 3: + case "CODE_BLOCK": + return NodeType.CODE_BLOCK; + case 4: + case "HEADING": + return NodeType.HEADING; + case 5: + case "HORIZONTAL_RULE": + return NodeType.HORIZONTAL_RULE; + case 6: + case "BLOCKQUOTE": + return NodeType.BLOCKQUOTE; + case 7: + case "LIST": + return NodeType.LIST; + case 8: + case "ORDERED_LIST_ITEM": + return NodeType.ORDERED_LIST_ITEM; + case 9: + case "UNORDERED_LIST_ITEM": + return NodeType.UNORDERED_LIST_ITEM; + case 10: + case "TASK_LIST_ITEM": + return NodeType.TASK_LIST_ITEM; + case 11: + case "MATH_BLOCK": + return NodeType.MATH_BLOCK; + case 12: + case "TABLE": + return NodeType.TABLE; + case 13: + case "EMBEDDED_CONTENT": + return NodeType.EMBEDDED_CONTENT; + case 51: + case "TEXT": + return NodeType.TEXT; + case 52: + case "BOLD": + return NodeType.BOLD; + case 53: + case "ITALIC": + return NodeType.ITALIC; + case 54: + case "BOLD_ITALIC": + return NodeType.BOLD_ITALIC; + case 55: + case "CODE": + return NodeType.CODE; + case 56: + case "IMAGE": + return NodeType.IMAGE; + case 57: + case "LINK": + return NodeType.LINK; + case 58: + case "AUTO_LINK": + return NodeType.AUTO_LINK; + case 59: + case "TAG": + return NodeType.TAG; + case 60: + case "STRIKETHROUGH": + return NodeType.STRIKETHROUGH; + case 61: + case "ESCAPING_CHARACTER": + return NodeType.ESCAPING_CHARACTER; + case 62: + case "MATH": + return NodeType.MATH; + case 63: + case "HIGHLIGHT": + return NodeType.HIGHLIGHT; + case 64: + case "SUBSCRIPT": + return NodeType.SUBSCRIPT; + case 65: + case "SUPERSCRIPT": + return NodeType.SUPERSCRIPT; + case 66: + case "REFERENCED_CONTENT": + return NodeType.REFERENCED_CONTENT; + case 67: + case "SPOILER": + return NodeType.SPOILER; + case 68: + case "HTML_ELEMENT": + return NodeType.HTML_ELEMENT; + case -1: + case "UNRECOGNIZED": + default: + return NodeType.UNRECOGNIZED; + } +} + +export function nodeTypeToNumber(object: NodeType): number { + switch (object) { + case NodeType.NODE_UNSPECIFIED: + return 0; + case NodeType.LINE_BREAK: + return 1; + case NodeType.PARAGRAPH: + return 2; + case NodeType.CODE_BLOCK: + return 3; + case NodeType.HEADING: + return 4; + case NodeType.HORIZONTAL_RULE: + return 5; + case NodeType.BLOCKQUOTE: + return 6; + case NodeType.LIST: + return 7; + case NodeType.ORDERED_LIST_ITEM: + return 8; + case NodeType.UNORDERED_LIST_ITEM: + return 9; + case NodeType.TASK_LIST_ITEM: + return 10; + case NodeType.MATH_BLOCK: + return 11; + case NodeType.TABLE: + return 12; + case NodeType.EMBEDDED_CONTENT: + return 13; + case NodeType.TEXT: + return 51; + case NodeType.BOLD: + return 52; + case NodeType.ITALIC: + return 53; + case NodeType.BOLD_ITALIC: + return 54; + case NodeType.CODE: + return 55; + case NodeType.IMAGE: + return 56; + case NodeType.LINK: + return 57; + case NodeType.AUTO_LINK: + return 58; + case NodeType.TAG: + return 59; + case NodeType.STRIKETHROUGH: + return 60; + case NodeType.ESCAPING_CHARACTER: + return 61; + case NodeType.MATH: + return 62; + case NodeType.HIGHLIGHT: + return 63; + case NodeType.SUBSCRIPT: + return 64; + case NodeType.SUPERSCRIPT: + return 65; + case NodeType.REFERENCED_CONTENT: + return 66; + case NodeType.SPOILER: + return 67; + case NodeType.HTML_ELEMENT: + return 68; + case NodeType.UNRECOGNIZED: + default: + return -1; + } +} + +export interface ParseMarkdownRequest { + markdown: string; +} + +export interface ParseMarkdownResponse { + nodes: Node[]; +} + +export interface RestoreMarkdownNodesRequest { + nodes: Node[]; +} + +export interface RestoreMarkdownNodesResponse { + markdown: string; +} + +export interface StringifyMarkdownNodesRequest { + nodes: Node[]; +} + +export interface StringifyMarkdownNodesResponse { + plainText: string; +} + +export interface GetLinkMetadataRequest { + link: string; +} + +export interface LinkMetadata { + title: string; + description: string; + image: string; +} + +export interface Node { + type: NodeType; + /** Block nodes. */ + lineBreakNode?: LineBreakNode | undefined; + paragraphNode?: ParagraphNode | undefined; + codeBlockNode?: CodeBlockNode | undefined; + headingNode?: HeadingNode | undefined; + horizontalRuleNode?: HorizontalRuleNode | undefined; + blockquoteNode?: BlockquoteNode | undefined; + listNode?: ListNode | undefined; + orderedListItemNode?: OrderedListItemNode | undefined; + unorderedListItemNode?: UnorderedListItemNode | undefined; + taskListItemNode?: TaskListItemNode | undefined; + mathBlockNode?: MathBlockNode | undefined; + tableNode?: TableNode | undefined; + embeddedContentNode?: + | EmbeddedContentNode + | undefined; + /** Inline nodes. */ + textNode?: TextNode | undefined; + boldNode?: BoldNode | undefined; + italicNode?: ItalicNode | undefined; + boldItalicNode?: BoldItalicNode | undefined; + codeNode?: CodeNode | undefined; + imageNode?: ImageNode | undefined; + linkNode?: LinkNode | undefined; + autoLinkNode?: AutoLinkNode | undefined; + tagNode?: TagNode | undefined; + strikethroughNode?: StrikethroughNode | undefined; + escapingCharacterNode?: EscapingCharacterNode | undefined; + mathNode?: MathNode | undefined; + highlightNode?: HighlightNode | undefined; + subscriptNode?: SubscriptNode | undefined; + superscriptNode?: SuperscriptNode | undefined; + referencedContentNode?: ReferencedContentNode | undefined; + spoilerNode?: SpoilerNode | undefined; + htmlElementNode?: HTMLElementNode | undefined; +} + +export interface LineBreakNode { +} + +export interface ParagraphNode { + children: Node[]; +} + +export interface CodeBlockNode { + language: string; + content: string; +} + +export interface HeadingNode { + level: number; + children: Node[]; +} + +export interface HorizontalRuleNode { + symbol: string; +} + +export interface BlockquoteNode { + children: Node[]; +} + +export interface ListNode { + kind: ListNode_Kind; + indent: number; + children: Node[]; +} + +export enum ListNode_Kind { + KIND_UNSPECIFIED = "KIND_UNSPECIFIED", + ORDERED = "ORDERED", + UNORDERED = "UNORDERED", + DESCRIPTION = "DESCRIPTION", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function listNode_KindFromJSON(object: any): ListNode_Kind { + switch (object) { + case 0: + case "KIND_UNSPECIFIED": + return ListNode_Kind.KIND_UNSPECIFIED; + case 1: + case "ORDERED": + return ListNode_Kind.ORDERED; + case 2: + case "UNORDERED": + return ListNode_Kind.UNORDERED; + case 3: + case "DESCRIPTION": + return ListNode_Kind.DESCRIPTION; + case -1: + case "UNRECOGNIZED": + default: + return ListNode_Kind.UNRECOGNIZED; + } +} + +export function listNode_KindToNumber(object: ListNode_Kind): number { + switch (object) { + case ListNode_Kind.KIND_UNSPECIFIED: + return 0; + case ListNode_Kind.ORDERED: + return 1; + case ListNode_Kind.UNORDERED: + return 2; + case ListNode_Kind.DESCRIPTION: + return 3; + case ListNode_Kind.UNRECOGNIZED: + default: + return -1; + } +} + +export interface OrderedListItemNode { + number: string; + indent: number; + children: Node[]; +} + +export interface UnorderedListItemNode { + symbol: string; + indent: number; + children: Node[]; +} + +export interface TaskListItemNode { + symbol: string; + indent: number; + complete: boolean; + children: Node[]; +} + +export interface MathBlockNode { + content: string; +} + +export interface TableNode { + header: Node[]; + delimiter: string[]; + rows: TableNode_Row[]; +} + +export interface TableNode_Row { + cells: Node[]; +} + +export interface EmbeddedContentNode { + resourceName: string; + params: string; +} + +export interface TextNode { + content: string; +} + +export interface BoldNode { + symbol: string; + children: Node[]; +} + +export interface ItalicNode { + symbol: string; + children: Node[]; +} + +export interface BoldItalicNode { + symbol: string; + content: string; +} + +export interface CodeNode { + content: string; +} + +export interface ImageNode { + altText: string; + url: string; +} + +export interface LinkNode { + content: Node[]; + url: string; +} + +export interface AutoLinkNode { + url: string; + isRawText: boolean; +} + +export interface TagNode { + content: string; +} + +export interface StrikethroughNode { + content: string; +} + +export interface EscapingCharacterNode { + symbol: string; +} + +export interface MathNode { + content: string; +} + +export interface HighlightNode { + content: string; +} + +export interface SubscriptNode { + content: string; +} + +export interface SuperscriptNode { + content: string; +} + +export interface ReferencedContentNode { + resourceName: string; + params: string; +} + +export interface SpoilerNode { + content: string; +} + +export interface HTMLElementNode { + tagName: string; + attributes: { [key: string]: string }; +} + +export interface HTMLElementNode_AttributesEntry { + key: string; + value: string; +} + +function createBaseParseMarkdownRequest(): ParseMarkdownRequest { + return { markdown: "" }; +} + +export const ParseMarkdownRequest: MessageFns = { + encode(message: ParseMarkdownRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.markdown !== "") { + writer.uint32(10).string(message.markdown); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParseMarkdownRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParseMarkdownRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.markdown = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ParseMarkdownRequest { + return ParseMarkdownRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ParseMarkdownRequest { + const message = createBaseParseMarkdownRequest(); + message.markdown = object.markdown ?? ""; + return message; + }, +}; + +function createBaseParseMarkdownResponse(): ParseMarkdownResponse { + return { nodes: [] }; +} + +export const ParseMarkdownResponse: MessageFns = { + encode(message: ParseMarkdownResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nodes) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParseMarkdownResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParseMarkdownResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.nodes.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ParseMarkdownResponse { + return ParseMarkdownResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ParseMarkdownResponse { + const message = createBaseParseMarkdownResponse(); + message.nodes = object.nodes?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRestoreMarkdownNodesRequest(): RestoreMarkdownNodesRequest { + return { nodes: [] }; +} + +export const RestoreMarkdownNodesRequest: MessageFns = { + encode(message: RestoreMarkdownNodesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nodes) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RestoreMarkdownNodesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRestoreMarkdownNodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.nodes.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): RestoreMarkdownNodesRequest { + return RestoreMarkdownNodesRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RestoreMarkdownNodesRequest { + const message = createBaseRestoreMarkdownNodesRequest(); + message.nodes = object.nodes?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseRestoreMarkdownNodesResponse(): RestoreMarkdownNodesResponse { + return { markdown: "" }; +} + +export const RestoreMarkdownNodesResponse: MessageFns = { + encode(message: RestoreMarkdownNodesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.markdown !== "") { + writer.uint32(10).string(message.markdown); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RestoreMarkdownNodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRestoreMarkdownNodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.markdown = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): RestoreMarkdownNodesResponse { + return RestoreMarkdownNodesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RestoreMarkdownNodesResponse { + const message = createBaseRestoreMarkdownNodesResponse(); + message.markdown = object.markdown ?? ""; + return message; + }, +}; + +function createBaseStringifyMarkdownNodesRequest(): StringifyMarkdownNodesRequest { + return { nodes: [] }; +} + +export const StringifyMarkdownNodesRequest: MessageFns = { + encode(message: StringifyMarkdownNodesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.nodes) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringifyMarkdownNodesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringifyMarkdownNodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.nodes.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): StringifyMarkdownNodesRequest { + return StringifyMarkdownNodesRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StringifyMarkdownNodesRequest { + const message = createBaseStringifyMarkdownNodesRequest(); + message.nodes = object.nodes?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseStringifyMarkdownNodesResponse(): StringifyMarkdownNodesResponse { + return { plainText: "" }; +} + +export const StringifyMarkdownNodesResponse: MessageFns = { + encode(message: StringifyMarkdownNodesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.plainText !== "") { + writer.uint32(10).string(message.plainText); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringifyMarkdownNodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringifyMarkdownNodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.plainText = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): StringifyMarkdownNodesResponse { + return StringifyMarkdownNodesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StringifyMarkdownNodesResponse { + const message = createBaseStringifyMarkdownNodesResponse(); + message.plainText = object.plainText ?? ""; + return message; + }, +}; + +function createBaseGetLinkMetadataRequest(): GetLinkMetadataRequest { + return { link: "" }; +} + +export const GetLinkMetadataRequest: MessageFns = { + encode(message: GetLinkMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.link !== "") { + writer.uint32(10).string(message.link); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLinkMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLinkMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.link = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetLinkMetadataRequest { + return GetLinkMetadataRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetLinkMetadataRequest { + const message = createBaseGetLinkMetadataRequest(); + message.link = object.link ?? ""; + return message; + }, +}; + +function createBaseLinkMetadata(): LinkMetadata { + return { title: "", description: "", image: "" }; +} + +export const LinkMetadata: MessageFns = { + encode(message: LinkMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.image !== "") { + writer.uint32(26).string(message.image); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LinkMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLinkMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.image = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): LinkMetadata { + return LinkMetadata.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LinkMetadata { + const message = createBaseLinkMetadata(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.image = object.image ?? ""; + return message; + }, +}; + +function createBaseNode(): Node { + return { + type: NodeType.NODE_UNSPECIFIED, + lineBreakNode: undefined, + paragraphNode: undefined, + codeBlockNode: undefined, + headingNode: undefined, + horizontalRuleNode: undefined, + blockquoteNode: undefined, + listNode: undefined, + orderedListItemNode: undefined, + unorderedListItemNode: undefined, + taskListItemNode: undefined, + mathBlockNode: undefined, + tableNode: undefined, + embeddedContentNode: undefined, + textNode: undefined, + boldNode: undefined, + italicNode: undefined, + boldItalicNode: undefined, + codeNode: undefined, + imageNode: undefined, + linkNode: undefined, + autoLinkNode: undefined, + tagNode: undefined, + strikethroughNode: undefined, + escapingCharacterNode: undefined, + mathNode: undefined, + highlightNode: undefined, + subscriptNode: undefined, + superscriptNode: undefined, + referencedContentNode: undefined, + spoilerNode: undefined, + htmlElementNode: undefined, + }; +} + +export const Node: MessageFns = { + encode(message: Node, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== NodeType.NODE_UNSPECIFIED) { + writer.uint32(8).int32(nodeTypeToNumber(message.type)); + } + if (message.lineBreakNode !== undefined) { + LineBreakNode.encode(message.lineBreakNode, writer.uint32(90).fork()).join(); + } + if (message.paragraphNode !== undefined) { + ParagraphNode.encode(message.paragraphNode, writer.uint32(98).fork()).join(); + } + if (message.codeBlockNode !== undefined) { + CodeBlockNode.encode(message.codeBlockNode, writer.uint32(106).fork()).join(); + } + if (message.headingNode !== undefined) { + HeadingNode.encode(message.headingNode, writer.uint32(114).fork()).join(); + } + if (message.horizontalRuleNode !== undefined) { + HorizontalRuleNode.encode(message.horizontalRuleNode, writer.uint32(122).fork()).join(); + } + if (message.blockquoteNode !== undefined) { + BlockquoteNode.encode(message.blockquoteNode, writer.uint32(130).fork()).join(); + } + if (message.listNode !== undefined) { + ListNode.encode(message.listNode, writer.uint32(138).fork()).join(); + } + if (message.orderedListItemNode !== undefined) { + OrderedListItemNode.encode(message.orderedListItemNode, writer.uint32(146).fork()).join(); + } + if (message.unorderedListItemNode !== undefined) { + UnorderedListItemNode.encode(message.unorderedListItemNode, writer.uint32(154).fork()).join(); + } + if (message.taskListItemNode !== undefined) { + TaskListItemNode.encode(message.taskListItemNode, writer.uint32(162).fork()).join(); + } + if (message.mathBlockNode !== undefined) { + MathBlockNode.encode(message.mathBlockNode, writer.uint32(170).fork()).join(); + } + if (message.tableNode !== undefined) { + TableNode.encode(message.tableNode, writer.uint32(178).fork()).join(); + } + if (message.embeddedContentNode !== undefined) { + EmbeddedContentNode.encode(message.embeddedContentNode, writer.uint32(186).fork()).join(); + } + if (message.textNode !== undefined) { + TextNode.encode(message.textNode, writer.uint32(410).fork()).join(); + } + if (message.boldNode !== undefined) { + BoldNode.encode(message.boldNode, writer.uint32(418).fork()).join(); + } + if (message.italicNode !== undefined) { + ItalicNode.encode(message.italicNode, writer.uint32(426).fork()).join(); + } + if (message.boldItalicNode !== undefined) { + BoldItalicNode.encode(message.boldItalicNode, writer.uint32(434).fork()).join(); + } + if (message.codeNode !== undefined) { + CodeNode.encode(message.codeNode, writer.uint32(442).fork()).join(); + } + if (message.imageNode !== undefined) { + ImageNode.encode(message.imageNode, writer.uint32(450).fork()).join(); + } + if (message.linkNode !== undefined) { + LinkNode.encode(message.linkNode, writer.uint32(458).fork()).join(); + } + if (message.autoLinkNode !== undefined) { + AutoLinkNode.encode(message.autoLinkNode, writer.uint32(466).fork()).join(); + } + if (message.tagNode !== undefined) { + TagNode.encode(message.tagNode, writer.uint32(474).fork()).join(); + } + if (message.strikethroughNode !== undefined) { + StrikethroughNode.encode(message.strikethroughNode, writer.uint32(482).fork()).join(); + } + if (message.escapingCharacterNode !== undefined) { + EscapingCharacterNode.encode(message.escapingCharacterNode, writer.uint32(490).fork()).join(); + } + if (message.mathNode !== undefined) { + MathNode.encode(message.mathNode, writer.uint32(498).fork()).join(); + } + if (message.highlightNode !== undefined) { + HighlightNode.encode(message.highlightNode, writer.uint32(506).fork()).join(); + } + if (message.subscriptNode !== undefined) { + SubscriptNode.encode(message.subscriptNode, writer.uint32(514).fork()).join(); + } + if (message.superscriptNode !== undefined) { + SuperscriptNode.encode(message.superscriptNode, writer.uint32(522).fork()).join(); + } + if (message.referencedContentNode !== undefined) { + ReferencedContentNode.encode(message.referencedContentNode, writer.uint32(530).fork()).join(); + } + if (message.spoilerNode !== undefined) { + SpoilerNode.encode(message.spoilerNode, writer.uint32(538).fork()).join(); + } + if (message.htmlElementNode !== undefined) { + HTMLElementNode.encode(message.htmlElementNode, writer.uint32(546).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Node { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.type = nodeTypeFromJSON(reader.int32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.lineBreakNode = LineBreakNode.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.paragraphNode = ParagraphNode.decode(reader, reader.uint32()); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.codeBlockNode = CodeBlockNode.decode(reader, reader.uint32()); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.headingNode = HeadingNode.decode(reader, reader.uint32()); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.horizontalRuleNode = HorizontalRuleNode.decode(reader, reader.uint32()); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.blockquoteNode = BlockquoteNode.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.listNode = ListNode.decode(reader, reader.uint32()); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.orderedListItemNode = OrderedListItemNode.decode(reader, reader.uint32()); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.unorderedListItemNode = UnorderedListItemNode.decode(reader, reader.uint32()); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.taskListItemNode = TaskListItemNode.decode(reader, reader.uint32()); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.mathBlockNode = MathBlockNode.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.tableNode = TableNode.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.embeddedContentNode = EmbeddedContentNode.decode(reader, reader.uint32()); + continue; + } + case 51: { + if (tag !== 410) { + break; + } + + message.textNode = TextNode.decode(reader, reader.uint32()); + continue; + } + case 52: { + if (tag !== 418) { + break; + } + + message.boldNode = BoldNode.decode(reader, reader.uint32()); + continue; + } + case 53: { + if (tag !== 426) { + break; + } + + message.italicNode = ItalicNode.decode(reader, reader.uint32()); + continue; + } + case 54: { + if (tag !== 434) { + break; + } + + message.boldItalicNode = BoldItalicNode.decode(reader, reader.uint32()); + continue; + } + case 55: { + if (tag !== 442) { + break; + } + + message.codeNode = CodeNode.decode(reader, reader.uint32()); + continue; + } + case 56: { + if (tag !== 450) { + break; + } + + message.imageNode = ImageNode.decode(reader, reader.uint32()); + continue; + } + case 57: { + if (tag !== 458) { + break; + } + + message.linkNode = LinkNode.decode(reader, reader.uint32()); + continue; + } + case 58: { + if (tag !== 466) { + break; + } + + message.autoLinkNode = AutoLinkNode.decode(reader, reader.uint32()); + continue; + } + case 59: { + if (tag !== 474) { + break; + } + + message.tagNode = TagNode.decode(reader, reader.uint32()); + continue; + } + case 60: { + if (tag !== 482) { + break; + } + + message.strikethroughNode = StrikethroughNode.decode(reader, reader.uint32()); + continue; + } + case 61: { + if (tag !== 490) { + break; + } + + message.escapingCharacterNode = EscapingCharacterNode.decode(reader, reader.uint32()); + continue; + } + case 62: { + if (tag !== 498) { + break; + } + + message.mathNode = MathNode.decode(reader, reader.uint32()); + continue; + } + case 63: { + if (tag !== 506) { + break; + } + + message.highlightNode = HighlightNode.decode(reader, reader.uint32()); + continue; + } + case 64: { + if (tag !== 514) { + break; + } + + message.subscriptNode = SubscriptNode.decode(reader, reader.uint32()); + continue; + } + case 65: { + if (tag !== 522) { + break; + } + + message.superscriptNode = SuperscriptNode.decode(reader, reader.uint32()); + continue; + } + case 66: { + if (tag !== 530) { + break; + } + + message.referencedContentNode = ReferencedContentNode.decode(reader, reader.uint32()); + continue; + } + case 67: { + if (tag !== 538) { + break; + } + + message.spoilerNode = SpoilerNode.decode(reader, reader.uint32()); + continue; + } + case 68: { + if (tag !== 546) { + break; + } + + message.htmlElementNode = HTMLElementNode.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Node { + return Node.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Node { + const message = createBaseNode(); + message.type = object.type ?? NodeType.NODE_UNSPECIFIED; + message.lineBreakNode = (object.lineBreakNode !== undefined && object.lineBreakNode !== null) + ? LineBreakNode.fromPartial(object.lineBreakNode) + : undefined; + message.paragraphNode = (object.paragraphNode !== undefined && object.paragraphNode !== null) + ? ParagraphNode.fromPartial(object.paragraphNode) + : undefined; + message.codeBlockNode = (object.codeBlockNode !== undefined && object.codeBlockNode !== null) + ? CodeBlockNode.fromPartial(object.codeBlockNode) + : undefined; + message.headingNode = (object.headingNode !== undefined && object.headingNode !== null) + ? HeadingNode.fromPartial(object.headingNode) + : undefined; + message.horizontalRuleNode = (object.horizontalRuleNode !== undefined && object.horizontalRuleNode !== null) + ? HorizontalRuleNode.fromPartial(object.horizontalRuleNode) + : undefined; + message.blockquoteNode = (object.blockquoteNode !== undefined && object.blockquoteNode !== null) + ? BlockquoteNode.fromPartial(object.blockquoteNode) + : undefined; + message.listNode = (object.listNode !== undefined && object.listNode !== null) + ? ListNode.fromPartial(object.listNode) + : undefined; + message.orderedListItemNode = (object.orderedListItemNode !== undefined && object.orderedListItemNode !== null) + ? OrderedListItemNode.fromPartial(object.orderedListItemNode) + : undefined; + message.unorderedListItemNode = + (object.unorderedListItemNode !== undefined && object.unorderedListItemNode !== null) + ? UnorderedListItemNode.fromPartial(object.unorderedListItemNode) + : undefined; + message.taskListItemNode = (object.taskListItemNode !== undefined && object.taskListItemNode !== null) + ? TaskListItemNode.fromPartial(object.taskListItemNode) + : undefined; + message.mathBlockNode = (object.mathBlockNode !== undefined && object.mathBlockNode !== null) + ? MathBlockNode.fromPartial(object.mathBlockNode) + : undefined; + message.tableNode = (object.tableNode !== undefined && object.tableNode !== null) + ? TableNode.fromPartial(object.tableNode) + : undefined; + message.embeddedContentNode = (object.embeddedContentNode !== undefined && object.embeddedContentNode !== null) + ? EmbeddedContentNode.fromPartial(object.embeddedContentNode) + : undefined; + message.textNode = (object.textNode !== undefined && object.textNode !== null) + ? TextNode.fromPartial(object.textNode) + : undefined; + message.boldNode = (object.boldNode !== undefined && object.boldNode !== null) + ? BoldNode.fromPartial(object.boldNode) + : undefined; + message.italicNode = (object.italicNode !== undefined && object.italicNode !== null) + ? ItalicNode.fromPartial(object.italicNode) + : undefined; + message.boldItalicNode = (object.boldItalicNode !== undefined && object.boldItalicNode !== null) + ? BoldItalicNode.fromPartial(object.boldItalicNode) + : undefined; + message.codeNode = (object.codeNode !== undefined && object.codeNode !== null) + ? CodeNode.fromPartial(object.codeNode) + : undefined; + message.imageNode = (object.imageNode !== undefined && object.imageNode !== null) + ? ImageNode.fromPartial(object.imageNode) + : undefined; + message.linkNode = (object.linkNode !== undefined && object.linkNode !== null) + ? LinkNode.fromPartial(object.linkNode) + : undefined; + message.autoLinkNode = (object.autoLinkNode !== undefined && object.autoLinkNode !== null) + ? AutoLinkNode.fromPartial(object.autoLinkNode) + : undefined; + message.tagNode = (object.tagNode !== undefined && object.tagNode !== null) + ? TagNode.fromPartial(object.tagNode) + : undefined; + message.strikethroughNode = (object.strikethroughNode !== undefined && object.strikethroughNode !== null) + ? StrikethroughNode.fromPartial(object.strikethroughNode) + : undefined; + message.escapingCharacterNode = + (object.escapingCharacterNode !== undefined && object.escapingCharacterNode !== null) + ? EscapingCharacterNode.fromPartial(object.escapingCharacterNode) + : undefined; + message.mathNode = (object.mathNode !== undefined && object.mathNode !== null) + ? MathNode.fromPartial(object.mathNode) + : undefined; + message.highlightNode = (object.highlightNode !== undefined && object.highlightNode !== null) + ? HighlightNode.fromPartial(object.highlightNode) + : undefined; + message.subscriptNode = (object.subscriptNode !== undefined && object.subscriptNode !== null) + ? SubscriptNode.fromPartial(object.subscriptNode) + : undefined; + message.superscriptNode = (object.superscriptNode !== undefined && object.superscriptNode !== null) + ? SuperscriptNode.fromPartial(object.superscriptNode) + : undefined; + message.referencedContentNode = + (object.referencedContentNode !== undefined && object.referencedContentNode !== null) + ? ReferencedContentNode.fromPartial(object.referencedContentNode) + : undefined; + message.spoilerNode = (object.spoilerNode !== undefined && object.spoilerNode !== null) + ? SpoilerNode.fromPartial(object.spoilerNode) + : undefined; + message.htmlElementNode = (object.htmlElementNode !== undefined && object.htmlElementNode !== null) + ? HTMLElementNode.fromPartial(object.htmlElementNode) + : undefined; + return message; + }, +}; + +function createBaseLineBreakNode(): LineBreakNode { + return {}; +} + +export const LineBreakNode: MessageFns = { + encode(_: LineBreakNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LineBreakNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLineBreakNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): LineBreakNode { + return LineBreakNode.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): LineBreakNode { + const message = createBaseLineBreakNode(); + return message; + }, +}; + +function createBaseParagraphNode(): ParagraphNode { + return { children: [] }; +} + +export const ParagraphNode: MessageFns = { + encode(message: ParagraphNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.children) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParagraphNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParagraphNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ParagraphNode { + return ParagraphNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ParagraphNode { + const message = createBaseParagraphNode(); + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCodeBlockNode(): CodeBlockNode { + return { language: "", content: "" }; +} + +export const CodeBlockNode: MessageFns = { + encode(message: CodeBlockNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.language !== "") { + writer.uint32(10).string(message.language); + } + if (message.content !== "") { + writer.uint32(18).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodeBlockNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeBlockNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.language = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CodeBlockNode { + return CodeBlockNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CodeBlockNode { + const message = createBaseCodeBlockNode(); + message.language = object.language ?? ""; + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseHeadingNode(): HeadingNode { + return { level: 0, children: [] }; +} + +export const HeadingNode: MessageFns = { + encode(message: HeadingNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.level !== 0) { + writer.uint32(8).int32(message.level); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HeadingNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeadingNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.level = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HeadingNode { + return HeadingNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HeadingNode { + const message = createBaseHeadingNode(); + message.level = object.level ?? 0; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHorizontalRuleNode(): HorizontalRuleNode { + return { symbol: "" }; +} + +export const HorizontalRuleNode: MessageFns = { + encode(message: HorizontalRuleNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HorizontalRuleNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHorizontalRuleNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HorizontalRuleNode { + return HorizontalRuleNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HorizontalRuleNode { + const message = createBaseHorizontalRuleNode(); + message.symbol = object.symbol ?? ""; + return message; + }, +}; + +function createBaseBlockquoteNode(): BlockquoteNode { + return { children: [] }; +} + +export const BlockquoteNode: MessageFns = { + encode(message: BlockquoteNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.children) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockquoteNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockquoteNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): BlockquoteNode { + return BlockquoteNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BlockquoteNode { + const message = createBaseBlockquoteNode(); + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListNode(): ListNode { + return { kind: ListNode_Kind.KIND_UNSPECIFIED, indent: 0, children: [] }; +} + +export const ListNode: MessageFns = { + encode(message: ListNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== ListNode_Kind.KIND_UNSPECIFIED) { + writer.uint32(8).int32(listNode_KindToNumber(message.kind)); + } + if (message.indent !== 0) { + writer.uint32(16).int32(message.indent); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.kind = listNode_KindFromJSON(reader.int32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.indent = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListNode { + return ListNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListNode { + const message = createBaseListNode(); + message.kind = object.kind ?? ListNode_Kind.KIND_UNSPECIFIED; + message.indent = object.indent ?? 0; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOrderedListItemNode(): OrderedListItemNode { + return { number: "", indent: 0, children: [] }; +} + +export const OrderedListItemNode: MessageFns = { + encode(message: OrderedListItemNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== "") { + writer.uint32(10).string(message.number); + } + if (message.indent !== 0) { + writer.uint32(16).int32(message.indent); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OrderedListItemNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOrderedListItemNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.number = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.indent = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): OrderedListItemNode { + return OrderedListItemNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): OrderedListItemNode { + const message = createBaseOrderedListItemNode(); + message.number = object.number ?? ""; + message.indent = object.indent ?? 0; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUnorderedListItemNode(): UnorderedListItemNode { + return { symbol: "", indent: 0, children: [] }; +} + +export const UnorderedListItemNode: MessageFns = { + encode(message: UnorderedListItemNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + if (message.indent !== 0) { + writer.uint32(16).int32(message.indent); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnorderedListItemNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnorderedListItemNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.indent = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UnorderedListItemNode { + return UnorderedListItemNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UnorderedListItemNode { + const message = createBaseUnorderedListItemNode(); + message.symbol = object.symbol ?? ""; + message.indent = object.indent ?? 0; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTaskListItemNode(): TaskListItemNode { + return { symbol: "", indent: 0, complete: false, children: [] }; +} + +export const TaskListItemNode: MessageFns = { + encode(message: TaskListItemNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + if (message.indent !== 0) { + writer.uint32(16).int32(message.indent); + } + if (message.complete !== false) { + writer.uint32(24).bool(message.complete); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TaskListItemNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTaskListItemNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.indent = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.complete = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): TaskListItemNode { + return TaskListItemNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TaskListItemNode { + const message = createBaseTaskListItemNode(); + message.symbol = object.symbol ?? ""; + message.indent = object.indent ?? 0; + message.complete = object.complete ?? false; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMathBlockNode(): MathBlockNode { + return { content: "" }; +} + +export const MathBlockNode: MessageFns = { + encode(message: MathBlockNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MathBlockNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMathBlockNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MathBlockNode { + return MathBlockNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MathBlockNode { + const message = createBaseMathBlockNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseTableNode(): TableNode { + return { header: [], delimiter: [], rows: [] }; +} + +export const TableNode: MessageFns = { + encode(message: TableNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.header) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.delimiter) { + writer.uint32(18).string(v!); + } + for (const v of message.rows) { + TableNode_Row.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTableNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.header.push(Node.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.delimiter.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.rows.push(TableNode_Row.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): TableNode { + return TableNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TableNode { + const message = createBaseTableNode(); + message.header = object.header?.map((e) => Node.fromPartial(e)) || []; + message.delimiter = object.delimiter?.map((e) => e) || []; + message.rows = object.rows?.map((e) => TableNode_Row.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTableNode_Row(): TableNode_Row { + return { cells: [] }; +} + +export const TableNode_Row: MessageFns = { + encode(message: TableNode_Row, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cells) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TableNode_Row { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTableNode_Row(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.cells.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): TableNode_Row { + return TableNode_Row.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TableNode_Row { + const message = createBaseTableNode_Row(); + message.cells = object.cells?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEmbeddedContentNode(): EmbeddedContentNode { + return { resourceName: "", params: "" }; +} + +export const EmbeddedContentNode: MessageFns = { + encode(message: EmbeddedContentNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceName !== "") { + writer.uint32(10).string(message.resourceName); + } + if (message.params !== "") { + writer.uint32(18).string(message.params); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EmbeddedContentNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmbeddedContentNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.params = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EmbeddedContentNode { + return EmbeddedContentNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EmbeddedContentNode { + const message = createBaseEmbeddedContentNode(); + message.resourceName = object.resourceName ?? ""; + message.params = object.params ?? ""; + return message; + }, +}; + +function createBaseTextNode(): TextNode { + return { content: "" }; +} + +export const TextNode: MessageFns = { + encode(message: TextNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): TextNode { + return TextNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TextNode { + const message = createBaseTextNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseBoldNode(): BoldNode { + return { symbol: "", children: [] }; +} + +export const BoldNode: MessageFns = { + encode(message: BoldNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BoldNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBoldNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): BoldNode { + return BoldNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BoldNode { + const message = createBaseBoldNode(); + message.symbol = object.symbol ?? ""; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseItalicNode(): ItalicNode { + return { symbol: "", children: [] }; +} + +export const ItalicNode: MessageFns = { + encode(message: ItalicNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + for (const v of message.children) { + Node.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ItalicNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseItalicNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.children.push(Node.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ItalicNode { + return ItalicNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ItalicNode { + const message = createBaseItalicNode(); + message.symbol = object.symbol ?? ""; + message.children = object.children?.map((e) => Node.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseBoldItalicNode(): BoldItalicNode { + return { symbol: "", content: "" }; +} + +export const BoldItalicNode: MessageFns = { + encode(message: BoldItalicNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + if (message.content !== "") { + writer.uint32(18).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BoldItalicNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBoldItalicNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): BoldItalicNode { + return BoldItalicNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BoldItalicNode { + const message = createBaseBoldItalicNode(); + message.symbol = object.symbol ?? ""; + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseCodeNode(): CodeNode { + return { content: "" }; +} + +export const CodeNode: MessageFns = { + encode(message: CodeNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodeNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CodeNode { + return CodeNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CodeNode { + const message = createBaseCodeNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseImageNode(): ImageNode { + return { altText: "", url: "" }; +} + +export const ImageNode: MessageFns = { + encode(message: ImageNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.altText !== "") { + writer.uint32(10).string(message.altText); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.altText = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ImageNode { + return ImageNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ImageNode { + const message = createBaseImageNode(); + message.altText = object.altText ?? ""; + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseLinkNode(): LinkNode { + return { content: [], url: "" }; +} + +export const LinkNode: MessageFns = { + encode(message: LinkNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.content) { + Node.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LinkNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLinkNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content.push(Node.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): LinkNode { + return LinkNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LinkNode { + const message = createBaseLinkNode(); + message.content = object.content?.map((e) => Node.fromPartial(e)) || []; + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseAutoLinkNode(): AutoLinkNode { + return { url: "", isRawText: false }; +} + +export const AutoLinkNode: MessageFns = { + encode(message: AutoLinkNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + if (message.isRawText !== false) { + writer.uint32(16).bool(message.isRawText); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AutoLinkNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAutoLinkNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.url = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.isRawText = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): AutoLinkNode { + return AutoLinkNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AutoLinkNode { + const message = createBaseAutoLinkNode(); + message.url = object.url ?? ""; + message.isRawText = object.isRawText ?? false; + return message; + }, +}; + +function createBaseTagNode(): TagNode { + return { content: "" }; +} + +export const TagNode: MessageFns = { + encode(message: TagNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TagNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTagNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): TagNode { + return TagNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TagNode { + const message = createBaseTagNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseStrikethroughNode(): StrikethroughNode { + return { content: "" }; +} + +export const StrikethroughNode: MessageFns = { + encode(message: StrikethroughNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StrikethroughNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStrikethroughNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): StrikethroughNode { + return StrikethroughNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StrikethroughNode { + const message = createBaseStrikethroughNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseEscapingCharacterNode(): EscapingCharacterNode { + return { symbol: "" }; +} + +export const EscapingCharacterNode: MessageFns = { + encode(message: EscapingCharacterNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.symbol !== "") { + writer.uint32(10).string(message.symbol); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EscapingCharacterNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEscapingCharacterNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.symbol = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EscapingCharacterNode { + return EscapingCharacterNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EscapingCharacterNode { + const message = createBaseEscapingCharacterNode(); + message.symbol = object.symbol ?? ""; + return message; + }, +}; + +function createBaseMathNode(): MathNode { + return { content: "" }; +} + +export const MathNode: MessageFns = { + encode(message: MathNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MathNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMathNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MathNode { + return MathNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MathNode { + const message = createBaseMathNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseHighlightNode(): HighlightNode { + return { content: "" }; +} + +export const HighlightNode: MessageFns = { + encode(message: HighlightNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HighlightNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHighlightNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HighlightNode { + return HighlightNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HighlightNode { + const message = createBaseHighlightNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseSubscriptNode(): SubscriptNode { + return { content: "" }; +} + +export const SubscriptNode: MessageFns = { + encode(message: SubscriptNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubscriptNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubscriptNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SubscriptNode { + return SubscriptNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SubscriptNode { + const message = createBaseSubscriptNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseSuperscriptNode(): SuperscriptNode { + return { content: "" }; +} + +export const SuperscriptNode: MessageFns = { + encode(message: SuperscriptNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SuperscriptNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSuperscriptNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SuperscriptNode { + return SuperscriptNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SuperscriptNode { + const message = createBaseSuperscriptNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseReferencedContentNode(): ReferencedContentNode { + return { resourceName: "", params: "" }; +} + +export const ReferencedContentNode: MessageFns = { + encode(message: ReferencedContentNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resourceName !== "") { + writer.uint32(10).string(message.resourceName); + } + if (message.params !== "") { + writer.uint32(18).string(message.params); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReferencedContentNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReferencedContentNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resourceName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.params = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ReferencedContentNode { + return ReferencedContentNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReferencedContentNode { + const message = createBaseReferencedContentNode(); + message.resourceName = object.resourceName ?? ""; + message.params = object.params ?? ""; + return message; + }, +}; + +function createBaseSpoilerNode(): SpoilerNode { + return { content: "" }; +} + +export const SpoilerNode: MessageFns = { + encode(message: SpoilerNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SpoilerNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSpoilerNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.content = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SpoilerNode { + return SpoilerNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SpoilerNode { + const message = createBaseSpoilerNode(); + message.content = object.content ?? ""; + return message; + }, +}; + +function createBaseHTMLElementNode(): HTMLElementNode { + return { tagName: "", attributes: {} }; +} + +export const HTMLElementNode: MessageFns = { + encode(message: HTMLElementNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tagName !== "") { + writer.uint32(10).string(message.tagName); + } + Object.entries(message.attributes).forEach(([key, value]) => { + HTMLElementNode_AttributesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTMLElementNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTMLElementNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.tagName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = HTMLElementNode_AttributesEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.attributes[entry2.key] = entry2.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HTMLElementNode { + return HTMLElementNode.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HTMLElementNode { + const message = createBaseHTMLElementNode(); + message.tagName = object.tagName ?? ""; + message.attributes = Object.entries(object.attributes ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseHTMLElementNode_AttributesEntry(): HTMLElementNode_AttributesEntry { + return { key: "", value: "" }; +} + +export const HTMLElementNode_AttributesEntry: MessageFns = { + encode(message: HTMLElementNode_AttributesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HTMLElementNode_AttributesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHTMLElementNode_AttributesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HTMLElementNode_AttributesEntry { + return HTMLElementNode_AttributesEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HTMLElementNode_AttributesEntry { + const message = createBaseHTMLElementNode_AttributesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +export type MarkdownServiceDefinition = typeof MarkdownServiceDefinition; +export const MarkdownServiceDefinition = { + name: "MarkdownService", + fullName: "memos.api.v1.MarkdownService", + methods: { + /** ParseMarkdown parses the given markdown content and returns a list of nodes. */ + parseMarkdown: { + name: "ParseMarkdown", + requestType: ParseMarkdownRequest, + requestStream: false, + responseType: ParseMarkdownResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 27, + 58, + 1, + 42, + 34, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 109, + 97, + 114, + 107, + 100, + 111, + 119, + 110, + 58, + 112, + 97, + 114, + 115, + 101, + ]), + ], + }, + }, + }, + /** RestoreMarkdownNodes restores the given nodes to markdown content. */ + restoreMarkdownNodes: { + name: "RestoreMarkdownNodes", + requestType: RestoreMarkdownNodesRequest, + requestStream: false, + responseType: RestoreMarkdownNodesResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 34, + 58, + 1, + 42, + 34, + 29, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 109, + 97, + 114, + 107, + 100, + 111, + 119, + 110, + 47, + 110, + 111, + 100, + 101, + 58, + 114, + 101, + 115, + 116, + 111, + 114, + 101, + ]), + ], + }, + }, + }, + /** StringifyMarkdownNodes stringify the given nodes to plain text content. */ + stringifyMarkdownNodes: { + name: "StringifyMarkdownNodes", + requestType: StringifyMarkdownNodesRequest, + requestStream: false, + responseType: StringifyMarkdownNodesResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 36, + 58, + 1, + 42, + 34, + 31, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 109, + 97, + 114, + 107, + 100, + 111, + 119, + 110, + 47, + 110, + 111, + 100, + 101, + 58, + 115, + 116, + 114, + 105, + 110, + 103, + 105, + 102, + 121, + ]), + ], + }, + }, + }, + /** GetLinkMetadata returns metadata for a given link. */ + getLinkMetadata: { + name: "GetLinkMetadata", + requestType: GetLinkMetadataRequest, + requestStream: false, + responseType: LinkMetadata, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 32, + 18, + 30, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 109, + 97, + 114, + 107, + 100, + 111, + 119, + 110, + 47, + 108, + 105, + 110, + 107, + 58, + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/memo_service.ts b/web/src/types/proto/api/v1/memo_service.ts new file mode 100644 index 00000000..740a2970 --- /dev/null +++ b/web/src/types/proto/api/v1/memo_service.ts @@ -0,0 +1,2946 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/memo_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Empty } from "../../google/protobuf/empty"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Direction, directionFromJSON, directionToNumber, State, stateFromJSON, stateToNumber } from "./common"; +import { Node } from "./markdown_service"; +import { Reaction } from "./reaction_service"; +import { Resource } from "./resource_service"; + +export const protobufPackage = "memos.api.v1"; + +export enum Visibility { + VISIBILITY_UNSPECIFIED = "VISIBILITY_UNSPECIFIED", + PRIVATE = "PRIVATE", + PROTECTED = "PROTECTED", + PUBLIC = "PUBLIC", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function visibilityFromJSON(object: any): Visibility { + switch (object) { + case 0: + case "VISIBILITY_UNSPECIFIED": + return Visibility.VISIBILITY_UNSPECIFIED; + case 1: + case "PRIVATE": + return Visibility.PRIVATE; + case 2: + case "PROTECTED": + return Visibility.PROTECTED; + case 3: + case "PUBLIC": + return Visibility.PUBLIC; + case -1: + case "UNRECOGNIZED": + default: + return Visibility.UNRECOGNIZED; + } +} + +export function visibilityToNumber(object: Visibility): number { + switch (object) { + case Visibility.VISIBILITY_UNSPECIFIED: + return 0; + case Visibility.PRIVATE: + return 1; + case Visibility.PROTECTED: + return 2; + case Visibility.PUBLIC: + return 3; + case Visibility.UNRECOGNIZED: + default: + return -1; + } +} + +export interface Memo { + /** + * The name of the memo. + * Format: memos/{memo}, memo is the user defined id or uuid. + */ + name: string; + state: State; + /** + * The name of the creator. + * Format: users/{user} + */ + creator: string; + createTime?: Date | undefined; + updateTime?: Date | undefined; + displayTime?: Date | undefined; + content: string; + nodes: Node[]; + visibility: Visibility; + tags: string[]; + pinned: boolean; + resources: Resource[]; + relations: MemoRelation[]; + reactions: Reaction[]; + property?: + | Memo_Property + | undefined; + /** + * The name of the parent memo. + * Format: memos/{id} + */ + parent?: + | string + | undefined; + /** The snippet of the memo content. Plain text only. */ + snippet: string; + /** The location of the memo. */ + location?: Location | undefined; +} + +export interface Memo_Property { + hasLink: boolean; + hasTaskList: boolean; + hasCode: boolean; + hasIncompleteTasks: boolean; +} + +export interface Location { + placeholder: string; + latitude: number; + longitude: number; +} + +export interface CreateMemoRequest { + /** The memo to create. */ + memo?: Memo | undefined; +} + +export interface ListMemosRequest { + /** + * The parent is the owner of the memos. + * If not specified or `users/-`, it will list all memos. + */ + parent: string; + /** The maximum number of memos to return. */ + pageSize: number; + /** + * A page token, received from a previous `ListMemos` call. + * Provide this to retrieve the subsequent page. + */ + pageToken: string; + /** + * The state of the memos to list. + * Default to `NORMAL`. Set to `ARCHIVED` to list archived memos. + */ + state: State; + /** + * What field to sort the results by. + * Default to display_time. + */ + sort: string; + /** + * The direction to sort the results by. + * Default to DESC. + */ + direction: Direction; + /** + * Filter is a CEL expression to filter memos. + * Refer to `Shortcut.filter`. + */ + filter: string; + /** + * [Deprecated] Old filter contains some specific conditions to filter memos. + * Format: "creator == 'users/{user}' && visibilities == ['PUBLIC', 'PROTECTED']" + */ + oldFilter: string; +} + +export interface ListMemosResponse { + memos: Memo[]; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + */ + nextPageToken: string; +} + +export interface GetMemoRequest { + /** The name of the memo. */ + name: string; +} + +export interface UpdateMemoRequest { + /** + * The memo to update. + * The `name` field is required. + */ + memo?: Memo | undefined; + updateMask?: string[] | undefined; +} + +export interface DeleteMemoRequest { + /** The name of the memo. */ + name: string; +} + +export interface RenameMemoTagRequest { + /** + * The parent, who owns the tags. + * Format: memos/{id}. Use "memos/-" to rename all tags. + */ + parent: string; + oldTag: string; + newTag: string; +} + +export interface DeleteMemoTagRequest { + /** + * The parent, who owns the tags. + * Format: memos/{id}. Use "memos/-" to delete all tags. + */ + parent: string; + tag: string; + deleteRelatedMemos: boolean; +} + +export interface SetMemoResourcesRequest { + /** The name of the memo. */ + name: string; + resources: Resource[]; +} + +export interface ListMemoResourcesRequest { + /** The name of the memo. */ + name: string; +} + +export interface ListMemoResourcesResponse { + resources: Resource[]; +} + +export interface MemoRelation { + memo?: MemoRelation_Memo | undefined; + relatedMemo?: MemoRelation_Memo | undefined; + type: MemoRelation_Type; +} + +export enum MemoRelation_Type { + TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED", + REFERENCE = "REFERENCE", + COMMENT = "COMMENT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function memoRelation_TypeFromJSON(object: any): MemoRelation_Type { + switch (object) { + case 0: + case "TYPE_UNSPECIFIED": + return MemoRelation_Type.TYPE_UNSPECIFIED; + case 1: + case "REFERENCE": + return MemoRelation_Type.REFERENCE; + case 2: + case "COMMENT": + return MemoRelation_Type.COMMENT; + case -1: + case "UNRECOGNIZED": + default: + return MemoRelation_Type.UNRECOGNIZED; + } +} + +export function memoRelation_TypeToNumber(object: MemoRelation_Type): number { + switch (object) { + case MemoRelation_Type.TYPE_UNSPECIFIED: + return 0; + case MemoRelation_Type.REFERENCE: + return 1; + case MemoRelation_Type.COMMENT: + return 2; + case MemoRelation_Type.UNRECOGNIZED: + default: + return -1; + } +} + +export interface MemoRelation_Memo { + /** + * The name of the memo. + * Format: memos/{id} + */ + name: string; + uid: string; + /** The snippet of the memo content. Plain text only. */ + snippet: string; +} + +export interface SetMemoRelationsRequest { + /** The name of the memo. */ + name: string; + relations: MemoRelation[]; +} + +export interface ListMemoRelationsRequest { + /** The name of the memo. */ + name: string; +} + +export interface ListMemoRelationsResponse { + relations: MemoRelation[]; +} + +export interface CreateMemoCommentRequest { + /** The name of the memo. */ + name: string; + /** The comment to create. */ + comment?: Memo | undefined; +} + +export interface ListMemoCommentsRequest { + /** The name of the memo. */ + name: string; +} + +export interface ListMemoCommentsResponse { + memos: Memo[]; +} + +export interface ListMemoReactionsRequest { + /** The name of the memo. */ + name: string; +} + +export interface ListMemoReactionsResponse { + reactions: Reaction[]; +} + +export interface UpsertMemoReactionRequest { + /** The name of the memo. */ + name: string; + reaction?: Reaction | undefined; +} + +export interface DeleteMemoReactionRequest { + /** + * The id of the reaction. + * Refer to the `Reaction.id`. + */ + id: number; +} + +function createBaseMemo(): Memo { + return { + name: "", + state: State.STATE_UNSPECIFIED, + creator: "", + createTime: undefined, + updateTime: undefined, + displayTime: undefined, + content: "", + nodes: [], + visibility: Visibility.VISIBILITY_UNSPECIFIED, + tags: [], + pinned: false, + resources: [], + relations: [], + reactions: [], + property: undefined, + parent: undefined, + snippet: "", + location: undefined, + }; +} + +export const Memo: MessageFns = { + encode(message: Memo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.state !== State.STATE_UNSPECIFIED) { + writer.uint32(24).int32(stateToNumber(message.state)); + } + if (message.creator !== "") { + writer.uint32(34).string(message.creator); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join(); + } + if (message.displayTime !== undefined) { + Timestamp.encode(toTimestamp(message.displayTime), writer.uint32(58).fork()).join(); + } + if (message.content !== "") { + writer.uint32(66).string(message.content); + } + for (const v of message.nodes) { + Node.encode(v!, writer.uint32(74).fork()).join(); + } + if (message.visibility !== Visibility.VISIBILITY_UNSPECIFIED) { + writer.uint32(80).int32(visibilityToNumber(message.visibility)); + } + for (const v of message.tags) { + writer.uint32(90).string(v!); + } + if (message.pinned !== false) { + writer.uint32(96).bool(message.pinned); + } + for (const v of message.resources) { + Resource.encode(v!, writer.uint32(114).fork()).join(); + } + for (const v of message.relations) { + MemoRelation.encode(v!, writer.uint32(122).fork()).join(); + } + for (const v of message.reactions) { + Reaction.encode(v!, writer.uint32(130).fork()).join(); + } + if (message.property !== undefined) { + Memo_Property.encode(message.property, writer.uint32(138).fork()).join(); + } + if (message.parent !== undefined) { + writer.uint32(146).string(message.parent); + } + if (message.snippet !== "") { + writer.uint32(154).string(message.snippet); + } + if (message.location !== undefined) { + Location.encode(message.location, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Memo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.state = stateFromJSON(reader.int32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.creator = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.displayTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.content = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.nodes.push(Node.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.visibility = visibilityFromJSON(reader.int32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.tags.push(reader.string()); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.pinned = reader.bool(); + continue; + } + case 14: { + if (tag !== 114) { + break; + } + + message.resources.push(Resource.decode(reader, reader.uint32())); + continue; + } + case 15: { + if (tag !== 122) { + break; + } + + message.relations.push(MemoRelation.decode(reader, reader.uint32())); + continue; + } + case 16: { + if (tag !== 130) { + break; + } + + message.reactions.push(Reaction.decode(reader, reader.uint32())); + continue; + } + case 17: { + if (tag !== 138) { + break; + } + + message.property = Memo_Property.decode(reader, reader.uint32()); + continue; + } + case 18: { + if (tag !== 146) { + break; + } + + message.parent = reader.string(); + continue; + } + case 19: { + if (tag !== 154) { + break; + } + + message.snippet = reader.string(); + continue; + } + case 20: { + if (tag !== 162) { + break; + } + + message.location = Location.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Memo { + return Memo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Memo { + const message = createBaseMemo(); + message.name = object.name ?? ""; + message.state = object.state ?? State.STATE_UNSPECIFIED; + message.creator = object.creator ?? ""; + message.createTime = object.createTime ?? undefined; + message.updateTime = object.updateTime ?? undefined; + message.displayTime = object.displayTime ?? undefined; + message.content = object.content ?? ""; + message.nodes = object.nodes?.map((e) => Node.fromPartial(e)) || []; + message.visibility = object.visibility ?? Visibility.VISIBILITY_UNSPECIFIED; + message.tags = object.tags?.map((e) => e) || []; + message.pinned = object.pinned ?? false; + message.resources = object.resources?.map((e) => Resource.fromPartial(e)) || []; + message.relations = object.relations?.map((e) => MemoRelation.fromPartial(e)) || []; + message.reactions = object.reactions?.map((e) => Reaction.fromPartial(e)) || []; + message.property = (object.property !== undefined && object.property !== null) + ? Memo_Property.fromPartial(object.property) + : undefined; + message.parent = object.parent ?? undefined; + message.snippet = object.snippet ?? ""; + message.location = (object.location !== undefined && object.location !== null) + ? Location.fromPartial(object.location) + : undefined; + return message; + }, +}; + +function createBaseMemo_Property(): Memo_Property { + return { hasLink: false, hasTaskList: false, hasCode: false, hasIncompleteTasks: false }; +} + +export const Memo_Property: MessageFns = { + encode(message: Memo_Property, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hasLink !== false) { + writer.uint32(8).bool(message.hasLink); + } + if (message.hasTaskList !== false) { + writer.uint32(16).bool(message.hasTaskList); + } + if (message.hasCode !== false) { + writer.uint32(24).bool(message.hasCode); + } + if (message.hasIncompleteTasks !== false) { + writer.uint32(32).bool(message.hasIncompleteTasks); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Memo_Property { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemo_Property(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.hasLink = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.hasTaskList = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.hasCode = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.hasIncompleteTasks = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Memo_Property { + return Memo_Property.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Memo_Property { + const message = createBaseMemo_Property(); + message.hasLink = object.hasLink ?? false; + message.hasTaskList = object.hasTaskList ?? false; + message.hasCode = object.hasCode ?? false; + message.hasIncompleteTasks = object.hasIncompleteTasks ?? false; + return message; + }, +}; + +function createBaseLocation(): Location { + return { placeholder: "", latitude: 0, longitude: 0 }; +} + +export const Location: MessageFns = { + encode(message: Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.placeholder !== "") { + writer.uint32(10).string(message.placeholder); + } + if (message.latitude !== 0) { + writer.uint32(17).double(message.latitude); + } + if (message.longitude !== 0) { + writer.uint32(25).double(message.longitude); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.placeholder = reader.string(); + continue; + } + case 2: { + if (tag !== 17) { + break; + } + + message.latitude = reader.double(); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + + message.longitude = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Location { + return Location.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Location { + const message = createBaseLocation(); + message.placeholder = object.placeholder ?? ""; + message.latitude = object.latitude ?? 0; + message.longitude = object.longitude ?? 0; + return message; + }, +}; + +function createBaseCreateMemoRequest(): CreateMemoRequest { + return { memo: undefined }; +} + +export const CreateMemoRequest: MessageFns = { + encode(message: CreateMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.memo !== undefined) { + Memo.encode(message.memo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateMemoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateMemoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memo = Memo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateMemoRequest { + return CreateMemoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateMemoRequest { + const message = createBaseCreateMemoRequest(); + message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; + return message; + }, +}; + +function createBaseListMemosRequest(): ListMemosRequest { + return { + parent: "", + pageSize: 0, + pageToken: "", + state: State.STATE_UNSPECIFIED, + sort: "", + direction: Direction.DIRECTION_UNSPECIFIED, + filter: "", + oldFilter: "", + }; +} + +export const ListMemosRequest: MessageFns = { + encode(message: ListMemosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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); + } + if (message.state !== State.STATE_UNSPECIFIED) { + writer.uint32(32).int32(stateToNumber(message.state)); + } + if (message.sort !== "") { + writer.uint32(42).string(message.sort); + } + if (message.direction !== Direction.DIRECTION_UNSPECIFIED) { + writer.uint32(48).int32(directionToNumber(message.direction)); + } + if (message.filter !== "") { + writer.uint32(58).string(message.filter); + } + if (message.oldFilter !== "") { + writer.uint32(66).string(message.oldFilter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemosRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + 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; + } + case 4: { + if (tag !== 32) { + break; + } + + message.state = stateFromJSON(reader.int32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.sort = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.direction = directionFromJSON(reader.int32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.filter = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.oldFilter = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemosRequest { + return ListMemosRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemosRequest { + const message = createBaseListMemosRequest(); + message.parent = object.parent ?? ""; + message.pageSize = object.pageSize ?? 0; + message.pageToken = object.pageToken ?? ""; + message.state = object.state ?? State.STATE_UNSPECIFIED; + message.sort = object.sort ?? ""; + message.direction = object.direction ?? Direction.DIRECTION_UNSPECIFIED; + message.filter = object.filter ?? ""; + message.oldFilter = object.oldFilter ?? ""; + return message; + }, +}; + +function createBaseListMemosResponse(): ListMemosResponse { + return { memos: [], nextPageToken: "" }; +} + +export const ListMemosResponse: MessageFns = { + encode(message: ListMemosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.memos) { + Memo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.nextPageToken !== "") { + writer.uint32(18).string(message.nextPageToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memos.push(Memo.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.nextPageToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemosResponse { + return ListMemosResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemosResponse { + const message = createBaseListMemosResponse(); + message.memos = object.memos?.map((e) => Memo.fromPartial(e)) || []; + message.nextPageToken = object.nextPageToken ?? ""; + return message; + }, +}; + +function createBaseGetMemoRequest(): GetMemoRequest { + return { name: "" }; +} + +export const GetMemoRequest: MessageFns = { + encode(message: GetMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetMemoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetMemoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetMemoRequest { + return GetMemoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetMemoRequest { + const message = createBaseGetMemoRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseUpdateMemoRequest(): UpdateMemoRequest { + return { memo: undefined, updateMask: undefined }; +} + +export const UpdateMemoRequest: MessageFns = { + encode(message: UpdateMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.memo !== undefined) { + Memo.encode(message.memo, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateMemoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateMemoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memo = Memo.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateMemoRequest { + return UpdateMemoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateMemoRequest { + const message = createBaseUpdateMemoRequest(); + message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteMemoRequest(): DeleteMemoRequest { + return { name: "" }; +} + +export const DeleteMemoRequest: MessageFns = { + encode(message: DeleteMemoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteMemoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteMemoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteMemoRequest { + return DeleteMemoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteMemoRequest { + const message = createBaseDeleteMemoRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseRenameMemoTagRequest(): RenameMemoTagRequest { + return { parent: "", oldTag: "", newTag: "" }; +} + +export const RenameMemoTagRequest: MessageFns = { + encode(message: RenameMemoTagRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parent !== "") { + writer.uint32(10).string(message.parent); + } + if (message.oldTag !== "") { + writer.uint32(18).string(message.oldTag); + } + if (message.newTag !== "") { + writer.uint32(26).string(message.newTag); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RenameMemoTagRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRenameMemoTagRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parent = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.oldTag = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.newTag = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): RenameMemoTagRequest { + return RenameMemoTagRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RenameMemoTagRequest { + const message = createBaseRenameMemoTagRequest(); + message.parent = object.parent ?? ""; + message.oldTag = object.oldTag ?? ""; + message.newTag = object.newTag ?? ""; + return message; + }, +}; + +function createBaseDeleteMemoTagRequest(): DeleteMemoTagRequest { + return { parent: "", tag: "", deleteRelatedMemos: false }; +} + +export const DeleteMemoTagRequest: MessageFns = { + encode(message: DeleteMemoTagRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parent !== "") { + writer.uint32(10).string(message.parent); + } + if (message.tag !== "") { + writer.uint32(18).string(message.tag); + } + if (message.deleteRelatedMemos !== false) { + writer.uint32(24).bool(message.deleteRelatedMemos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteMemoTagRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteMemoTagRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parent = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.tag = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deleteRelatedMemos = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteMemoTagRequest { + return DeleteMemoTagRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteMemoTagRequest { + const message = createBaseDeleteMemoTagRequest(); + message.parent = object.parent ?? ""; + message.tag = object.tag ?? ""; + message.deleteRelatedMemos = object.deleteRelatedMemos ?? false; + return message; + }, +}; + +function createBaseSetMemoResourcesRequest(): SetMemoResourcesRequest { + return { name: "", resources: [] }; +} + +export const SetMemoResourcesRequest: MessageFns = { + encode(message: SetMemoResourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.resources) { + Resource.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetMemoResourcesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetMemoResourcesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resources.push(Resource.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SetMemoResourcesRequest { + return SetMemoResourcesRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetMemoResourcesRequest { + const message = createBaseSetMemoResourcesRequest(); + message.name = object.name ?? ""; + message.resources = object.resources?.map((e) => Resource.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListMemoResourcesRequest(): ListMemoResourcesRequest { + return { name: "" }; +} + +export const ListMemoResourcesRequest: MessageFns = { + encode(message: ListMemoResourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoResourcesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoResourcesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoResourcesRequest { + return ListMemoResourcesRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoResourcesRequest { + const message = createBaseListMemoResourcesRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseListMemoResourcesResponse(): ListMemoResourcesResponse { + return { resources: [] }; +} + +export const ListMemoResourcesResponse: MessageFns = { + encode(message: ListMemoResourcesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.resources) { + Resource.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoResourcesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoResourcesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resources.push(Resource.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoResourcesResponse { + return ListMemoResourcesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoResourcesResponse { + const message = createBaseListMemoResourcesResponse(); + message.resources = object.resources?.map((e) => Resource.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMemoRelation(): MemoRelation { + return { memo: undefined, relatedMemo: undefined, type: MemoRelation_Type.TYPE_UNSPECIFIED }; +} + +export const MemoRelation: MessageFns = { + encode(message: MemoRelation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.memo !== undefined) { + MemoRelation_Memo.encode(message.memo, writer.uint32(10).fork()).join(); + } + if (message.relatedMemo !== undefined) { + MemoRelation_Memo.encode(message.relatedMemo, writer.uint32(18).fork()).join(); + } + if (message.type !== MemoRelation_Type.TYPE_UNSPECIFIED) { + writer.uint32(24).int32(memoRelation_TypeToNumber(message.type)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemoRelation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemoRelation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memo = MemoRelation_Memo.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.relatedMemo = MemoRelation_Memo.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.type = memoRelation_TypeFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MemoRelation { + return MemoRelation.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MemoRelation { + const message = createBaseMemoRelation(); + message.memo = (object.memo !== undefined && object.memo !== null) + ? MemoRelation_Memo.fromPartial(object.memo) + : undefined; + message.relatedMemo = (object.relatedMemo !== undefined && object.relatedMemo !== null) + ? MemoRelation_Memo.fromPartial(object.relatedMemo) + : undefined; + message.type = object.type ?? MemoRelation_Type.TYPE_UNSPECIFIED; + return message; + }, +}; + +function createBaseMemoRelation_Memo(): MemoRelation_Memo { + return { name: "", uid: "", snippet: "" }; +} + +export const MemoRelation_Memo: MessageFns = { + encode(message: MemoRelation_Memo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.uid !== "") { + writer.uint32(18).string(message.uid); + } + if (message.snippet !== "") { + writer.uint32(26).string(message.snippet); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MemoRelation_Memo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemoRelation_Memo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.uid = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.snippet = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MemoRelation_Memo { + return MemoRelation_Memo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MemoRelation_Memo { + const message = createBaseMemoRelation_Memo(); + message.name = object.name ?? ""; + message.uid = object.uid ?? ""; + message.snippet = object.snippet ?? ""; + return message; + }, +}; + +function createBaseSetMemoRelationsRequest(): SetMemoRelationsRequest { + return { name: "", relations: [] }; +} + +export const SetMemoRelationsRequest: MessageFns = { + encode(message: SetMemoRelationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.relations) { + MemoRelation.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetMemoRelationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetMemoRelationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.relations.push(MemoRelation.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SetMemoRelationsRequest { + return SetMemoRelationsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetMemoRelationsRequest { + const message = createBaseSetMemoRelationsRequest(); + message.name = object.name ?? ""; + message.relations = object.relations?.map((e) => MemoRelation.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListMemoRelationsRequest(): ListMemoRelationsRequest { + return { name: "" }; +} + +export const ListMemoRelationsRequest: MessageFns = { + encode(message: ListMemoRelationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoRelationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoRelationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoRelationsRequest { + return ListMemoRelationsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoRelationsRequest { + const message = createBaseListMemoRelationsRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseListMemoRelationsResponse(): ListMemoRelationsResponse { + return { relations: [] }; +} + +export const ListMemoRelationsResponse: MessageFns = { + encode(message: ListMemoRelationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.relations) { + MemoRelation.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoRelationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoRelationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.relations.push(MemoRelation.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoRelationsResponse { + return ListMemoRelationsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoRelationsResponse { + const message = createBaseListMemoRelationsResponse(); + message.relations = object.relations?.map((e) => MemoRelation.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCreateMemoCommentRequest(): CreateMemoCommentRequest { + return { name: "", comment: undefined }; +} + +export const CreateMemoCommentRequest: MessageFns = { + encode(message: CreateMemoCommentRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.comment !== undefined) { + Memo.encode(message.comment, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateMemoCommentRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateMemoCommentRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.comment = Memo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateMemoCommentRequest { + return CreateMemoCommentRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateMemoCommentRequest { + const message = createBaseCreateMemoCommentRequest(); + message.name = object.name ?? ""; + message.comment = (object.comment !== undefined && object.comment !== null) + ? Memo.fromPartial(object.comment) + : undefined; + return message; + }, +}; + +function createBaseListMemoCommentsRequest(): ListMemoCommentsRequest { + return { name: "" }; +} + +export const ListMemoCommentsRequest: MessageFns = { + encode(message: ListMemoCommentsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoCommentsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoCommentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoCommentsRequest { + return ListMemoCommentsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoCommentsRequest { + const message = createBaseListMemoCommentsRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseListMemoCommentsResponse(): ListMemoCommentsResponse { + return { memos: [] }; +} + +export const ListMemoCommentsResponse: MessageFns = { + encode(message: ListMemoCommentsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.memos) { + Memo.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoCommentsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoCommentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.memos.push(Memo.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoCommentsResponse { + return ListMemoCommentsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoCommentsResponse { + const message = createBaseListMemoCommentsResponse(); + message.memos = object.memos?.map((e) => Memo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListMemoReactionsRequest(): ListMemoReactionsRequest { + return { name: "" }; +} + +export const ListMemoReactionsRequest: MessageFns = { + encode(message: ListMemoReactionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoReactionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoReactionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoReactionsRequest { + return ListMemoReactionsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoReactionsRequest { + const message = createBaseListMemoReactionsRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseListMemoReactionsResponse(): ListMemoReactionsResponse { + return { reactions: [] }; +} + +export const ListMemoReactionsResponse: MessageFns = { + encode(message: ListMemoReactionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.reactions) { + Reaction.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListMemoReactionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListMemoReactionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.reactions.push(Reaction.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoReactionsResponse { + return ListMemoReactionsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListMemoReactionsResponse { + const message = createBaseListMemoReactionsResponse(); + message.reactions = object.reactions?.map((e) => Reaction.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUpsertMemoReactionRequest(): UpsertMemoReactionRequest { + return { name: "", reaction: undefined }; +} + +export const UpsertMemoReactionRequest: MessageFns = { + encode(message: UpsertMemoReactionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.reaction !== undefined) { + Reaction.encode(message.reaction, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpsertMemoReactionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpsertMemoReactionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.reaction = Reaction.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpsertMemoReactionRequest { + return UpsertMemoReactionRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpsertMemoReactionRequest { + const message = createBaseUpsertMemoReactionRequest(); + message.name = object.name ?? ""; + message.reaction = (object.reaction !== undefined && object.reaction !== null) + ? Reaction.fromPartial(object.reaction) + : undefined; + return message; + }, +}; + +function createBaseDeleteMemoReactionRequest(): DeleteMemoReactionRequest { + return { id: 0 }; +} + +export const DeleteMemoReactionRequest: MessageFns = { + encode(message: DeleteMemoReactionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteMemoReactionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteMemoReactionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteMemoReactionRequest { + return DeleteMemoReactionRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteMemoReactionRequest { + const message = createBaseDeleteMemoReactionRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +export type MemoServiceDefinition = typeof MemoServiceDefinition; +export const MemoServiceDefinition = { + name: "MemoService", + fullName: "memos.api.v1.MemoService", + methods: { + /** CreateMemo creates a memo. */ + createMemo: { + name: "CreateMemo", + requestType: CreateMemoRequest, + requestStream: false, + responseType: Memo, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 21, + 58, + 4, + 109, + 101, + 109, + 111, + 34, + 13, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 109, + 101, + 109, + 111, + 115, + ]), + ], + }, + }, + }, + /** ListMemos lists memos with pagination and filter. */ + listMemos: { + name: "ListMemos", + requestType: ListMemosRequest, + requestStream: false, + responseType: ListMemosResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 49, + 90, + 32, + 18, + 30, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 109, + 101, + 109, + 111, + 115, + 18, + 13, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 109, + 101, + 109, + 111, + 115, + ]), + ], + }, + }, + }, + /** GetMemo gets a memo. */ + getMemo: { + name: "GetMemo", + requestType: GetMemoRequest, + requestStream: false, + responseType: Memo, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 24, + 18, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** UpdateMemo updates a memo. */ + updateMemo: { + name: "UpdateMemo", + requestType: UpdateMemoRequest, + requestStream: false, + responseType: Memo, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([16, 109, 101, 109, 111, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])], + 578365826: [ + new Uint8Array([ + 35, + 58, + 4, + 109, + 101, + 109, + 111, + 50, + 27, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 109, + 101, + 109, + 111, + 46, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** DeleteMemo deletes a memo. */ + deleteMemo: { + name: "DeleteMemo", + requestType: DeleteMemoRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 24, + 42, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** RenameMemoTag renames a tag for a memo. */ + renameMemoTag: { + name: "RenameMemoTag", + requestType: RenameMemoTagRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 41, + 58, + 1, + 42, + 50, + 36, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 116, + 97, + 103, + 115, + 58, + 114, + 101, + 110, + 97, + 109, + 101, + ]), + ], + }, + }, + }, + /** DeleteMemoTag deletes a tag for a memo. */ + deleteMemoTag: { + name: "DeleteMemoTag", + requestType: DeleteMemoTagRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 37, + 42, + 35, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 116, + 97, + 103, + 115, + 47, + 123, + 116, + 97, + 103, + 125, + ]), + ], + }, + }, + }, + /** SetMemoResources sets resources for a memo. */ + setMemoResources: { + name: "SetMemoResources", + requestType: SetMemoResourcesRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 37, + 58, + 1, + 42, + 50, + 32, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + ]), + ], + }, + }, + }, + /** ListMemoResources lists resources for a memo. */ + listMemoResources: { + name: "ListMemoResources", + requestType: ListMemoResourcesRequest, + requestStream: false, + responseType: ListMemoResourcesResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 34, + 18, + 32, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + ]), + ], + }, + }, + }, + /** SetMemoRelations sets relations for a memo. */ + setMemoRelations: { + name: "SetMemoRelations", + requestType: SetMemoRelationsRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 37, + 58, + 1, + 42, + 50, + 32, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 114, + 101, + 108, + 97, + 116, + 105, + 111, + 110, + 115, + ]), + ], + }, + }, + }, + /** ListMemoRelations lists relations for a memo. */ + listMemoRelations: { + name: "ListMemoRelations", + requestType: ListMemoRelationsRequest, + requestStream: false, + responseType: ListMemoRelationsResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 34, + 18, + 32, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 114, + 101, + 108, + 97, + 116, + 105, + 111, + 110, + 115, + ]), + ], + }, + }, + }, + /** CreateMemoComment creates a comment for a memo. */ + createMemoComment: { + name: "CreateMemoComment", + requestType: CreateMemoCommentRequest, + requestStream: false, + responseType: Memo, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 42, + 58, + 7, + 99, + 111, + 109, + 109, + 101, + 110, + 116, + 34, + 31, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 99, + 111, + 109, + 109, + 101, + 110, + 116, + 115, + ]), + ], + }, + }, + }, + /** ListMemoComments lists comments for a memo. */ + listMemoComments: { + name: "ListMemoComments", + requestType: ListMemoCommentsRequest, + requestStream: false, + responseType: ListMemoCommentsResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 33, + 18, + 31, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 99, + 111, + 109, + 109, + 101, + 110, + 116, + 115, + ]), + ], + }, + }, + }, + /** ListMemoReactions lists reactions for a memo. */ + listMemoReactions: { + name: "ListMemoReactions", + requestType: ListMemoReactionsRequest, + requestStream: false, + responseType: ListMemoReactionsResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 34, + 18, + 32, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 114, + 101, + 97, + 99, + 116, + 105, + 111, + 110, + 115, + ]), + ], + }, + }, + }, + /** UpsertMemoReaction upserts a reaction for a memo. */ + upsertMemoReaction: { + name: "UpsertMemoReaction", + requestType: UpsertMemoReactionRequest, + requestStream: false, + responseType: Reaction, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 37, + 58, + 1, + 42, + 34, + 32, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 109, + 101, + 109, + 111, + 115, + 47, + 42, + 125, + 47, + 114, + 101, + 97, + 99, + 116, + 105, + 111, + 110, + 115, + ]), + ], + }, + }, + }, + /** DeleteMemoReaction deletes a reaction for a memo. */ + deleteMemoReaction: { + name: "DeleteMemoReaction", + requestType: DeleteMemoReactionRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 24, + 42, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 114, + 101, + 97, + 99, + 116, + 105, + 111, + 110, + 115, + 47, + 123, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/reaction_service.ts b/web/src/types/proto/api/v1/reaction_service.ts new file mode 100644 index 00000000..0b26a661 --- /dev/null +++ b/web/src/types/proto/api/v1/reaction_service.ts @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/reaction_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "memos.api.v1"; + +export interface Reaction { + id: number; + /** + * The name of the creator. + * Format: users/{user} + */ + creator: string; + /** + * The content identifier. + * For memo, it should be the `Memo.name`. + */ + contentId: string; + reactionType: string; +} + +function createBaseReaction(): Reaction { + return { id: 0, creator: "", contentId: "", reactionType: "" }; +} + +export const Reaction: MessageFns = { + encode(message: Reaction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.contentId !== "") { + writer.uint32(26).string(message.contentId); + } + if (message.reactionType !== "") { + writer.uint32(34).string(message.reactionType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Reaction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReaction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.contentId = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reactionType = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Reaction { + return Reaction.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Reaction { + const message = createBaseReaction(); + message.id = object.id ?? 0; + message.creator = object.creator ?? ""; + message.contentId = object.contentId ?? ""; + message.reactionType = object.reactionType ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/resource_service.ts b/web/src/types/proto/api/v1/resource_service.ts new file mode 100644 index 00000000..662582ba --- /dev/null +++ b/web/src/types/proto/api/v1/resource_service.ts @@ -0,0 +1,897 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/resource_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { HttpBody } from "../../google/api/httpbody"; +import { Empty } from "../../google/protobuf/empty"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "memos.api.v1"; + +export interface Resource { + /** + * The name of the resource. + * Format: resources/{resource}, resource is the user defined if or uuid. + */ + name: string; + createTime?: Date | undefined; + filename: string; + content: Uint8Array; + externalLink: string; + type: string; + size: number; + /** The related memo. Refer to `Memo.name`. */ + memo?: string | undefined; +} + +export interface CreateResourceRequest { + resource?: Resource | undefined; +} + +export interface ListResourcesRequest { +} + +export interface ListResourcesResponse { + resources: Resource[]; +} + +export interface GetResourceRequest { + /** The name of the resource. */ + name: string; +} + +export interface GetResourceBinaryRequest { + /** The name of the resource. */ + name: string; + /** The filename of the resource. Mainly used for downloading. */ + filename: string; + /** A flag indicating if the thumbnail version of the resource should be returned */ + thumbnail: boolean; +} + +export interface UpdateResourceRequest { + resource?: Resource | undefined; + updateMask?: string[] | undefined; +} + +export interface DeleteResourceRequest { + /** The name of the resource. */ + name: string; +} + +function createBaseResource(): Resource { + return { + name: "", + createTime: undefined, + filename: "", + content: new Uint8Array(0), + externalLink: "", + type: "", + size: 0, + memo: undefined, + }; +} + +export const Resource: MessageFns = { + encode(message: Resource, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).join(); + } + if (message.filename !== "") { + writer.uint32(34).string(message.filename); + } + if (message.content.length !== 0) { + writer.uint32(42).bytes(message.content); + } + if (message.externalLink !== "") { + writer.uint32(50).string(message.externalLink); + } + if (message.type !== "") { + writer.uint32(58).string(message.type); + } + if (message.size !== 0) { + writer.uint32(64).int64(message.size); + } + if (message.memo !== undefined) { + writer.uint32(74).string(message.memo); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Resource { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResource(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.filename = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.content = reader.bytes(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.externalLink = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.type = reader.string(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.size = longToNumber(reader.int64()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.memo = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Resource { + return Resource.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Resource { + const message = createBaseResource(); + message.name = object.name ?? ""; + message.createTime = object.createTime ?? undefined; + message.filename = object.filename ?? ""; + message.content = object.content ?? new Uint8Array(0); + message.externalLink = object.externalLink ?? ""; + message.type = object.type ?? ""; + message.size = object.size ?? 0; + message.memo = object.memo ?? undefined; + return message; + }, +}; + +function createBaseCreateResourceRequest(): CreateResourceRequest { + return { resource: undefined }; +} + +export const CreateResourceRequest: MessageFns = { + encode(message: CreateResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resource !== undefined) { + Resource.encode(message.resource, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateResourceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateResourceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resource = Resource.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateResourceRequest { + return CreateResourceRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateResourceRequest { + const message = createBaseCreateResourceRequest(); + message.resource = (object.resource !== undefined && object.resource !== null) + ? Resource.fromPartial(object.resource) + : undefined; + return message; + }, +}; + +function createBaseListResourcesRequest(): ListResourcesRequest { + return {}; +} + +export const ListResourcesRequest: MessageFns = { + encode(_: ListResourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResourcesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResourcesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListResourcesRequest { + return ListResourcesRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): ListResourcesRequest { + const message = createBaseListResourcesRequest(); + return message; + }, +}; + +function createBaseListResourcesResponse(): ListResourcesResponse { + return { resources: [] }; +} + +export const ListResourcesResponse: MessageFns = { + encode(message: ListResourcesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.resources) { + Resource.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResourcesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResourcesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resources.push(Resource.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListResourcesResponse { + return ListResourcesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListResourcesResponse { + const message = createBaseListResourcesResponse(); + message.resources = object.resources?.map((e) => Resource.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetResourceRequest(): GetResourceRequest { + return { name: "" }; +} + +export const GetResourceRequest: MessageFns = { + encode(message: GetResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResourceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResourceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetResourceRequest { + return GetResourceRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetResourceRequest { + const message = createBaseGetResourceRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseGetResourceBinaryRequest(): GetResourceBinaryRequest { + return { name: "", filename: "", thumbnail: false }; +} + +export const GetResourceBinaryRequest: MessageFns = { + encode(message: GetResourceBinaryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.filename !== "") { + writer.uint32(18).string(message.filename); + } + if (message.thumbnail !== false) { + writer.uint32(24).bool(message.thumbnail); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetResourceBinaryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetResourceBinaryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.filename = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.thumbnail = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetResourceBinaryRequest { + return GetResourceBinaryRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetResourceBinaryRequest { + const message = createBaseGetResourceBinaryRequest(); + message.name = object.name ?? ""; + message.filename = object.filename ?? ""; + message.thumbnail = object.thumbnail ?? false; + return message; + }, +}; + +function createBaseUpdateResourceRequest(): UpdateResourceRequest { + return { resource: undefined, updateMask: undefined }; +} + +export const UpdateResourceRequest: MessageFns = { + encode(message: UpdateResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.resource !== undefined) { + Resource.encode(message.resource, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateResourceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateResourceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.resource = Resource.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateResourceRequest { + return UpdateResourceRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateResourceRequest { + const message = createBaseUpdateResourceRequest(); + message.resource = (object.resource !== undefined && object.resource !== null) + ? Resource.fromPartial(object.resource) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteResourceRequest(): DeleteResourceRequest { + return { name: "" }; +} + +export const DeleteResourceRequest: MessageFns = { + encode(message: DeleteResourceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteResourceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteResourceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteResourceRequest { + return DeleteResourceRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteResourceRequest { + const message = createBaseDeleteResourceRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +export type ResourceServiceDefinition = typeof ResourceServiceDefinition; +export const ResourceServiceDefinition = { + name: "ResourceService", + fullName: "memos.api.v1.ResourceService", + methods: { + /** CreateResource creates a new resource. */ + createResource: { + name: "CreateResource", + requestType: CreateResourceRequest, + requestStream: false, + responseType: Resource, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 29, + 58, + 8, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 34, + 17, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + ]), + ], + }, + }, + }, + /** ListResources lists all resources. */ + listResources: { + name: "ListResources", + requestType: ListResourcesRequest, + requestStream: false, + responseType: ListResourcesResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([19, 18, 17, 47, 97, 112, 105, 47, 118, 49, 47, 114, 101, 115, 111, 117, 114, 99, 101, 115]), + ], + }, + }, + }, + /** GetResource returns a resource by name. */ + getResource: { + name: "GetResource", + requestType: GetResourceRequest, + requestStream: false, + responseType: Resource, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 28, + 18, + 26, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** GetResourceBinary returns a resource binary by name. */ + getResourceBinary: { + name: "GetResourceBinary", + requestType: GetResourceBinaryRequest, + requestStream: false, + responseType: HttpBody, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([13, 110, 97, 109, 101, 44, 102, 105, 108, 101, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 37, + 18, + 35, + 47, + 102, + 105, + 108, + 101, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + 47, + 42, + 125, + 47, + 123, + 102, + 105, + 108, + 101, + 110, + 97, + 109, + 101, + 125, + ]), + ], + }, + }, + }, + /** UpdateResource updates a resource. */ + updateResource: { + name: "UpdateResource", + requestType: UpdateResourceRequest, + requestStream: false, + responseType: Resource, + responseStream: false, + options: { + _unknownFields: { + 8410: [ + new Uint8Array([ + 20, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 44, + 117, + 112, + 100, + 97, + 116, + 101, + 95, + 109, + 97, + 115, + 107, + ]), + ], + 578365826: [ + new Uint8Array([ + 47, + 58, + 8, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 50, + 35, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 46, + 110, + 97, + 109, + 101, + 61, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** DeleteResource deletes a resource by name. */ + deleteResource: { + name: "DeleteResource", + requestType: DeleteResourceRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 28, + 42, + 26, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/user_service.ts b/web/src/types/proto/api/v1/user_service.ts new file mode 100644 index 00000000..8a2d5dd6 --- /dev/null +++ b/web/src/types/proto/api/v1/user_service.ts @@ -0,0 +1,3065 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/user_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { HttpBody } from "../../google/api/httpbody"; +import { Empty } from "../../google/protobuf/empty"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { State, stateFromJSON, stateToNumber } from "./common"; + +export const protobufPackage = "memos.api.v1"; + +export interface User { + /** + * The name of the user. + * Format: users/{id}, id is the system generated auto-incremented id. + */ + name: string; + role: User_Role; + username: string; + email: string; + nickname: string; + avatarUrl: string; + description: string; + password: string; + state: State; + createTime?: Date | undefined; + updateTime?: Date | undefined; +} + +export enum User_Role { + ROLE_UNSPECIFIED = "ROLE_UNSPECIFIED", + HOST = "HOST", + ADMIN = "ADMIN", + USER = "USER", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function user_RoleFromJSON(object: any): User_Role { + switch (object) { + case 0: + case "ROLE_UNSPECIFIED": + return User_Role.ROLE_UNSPECIFIED; + case 1: + case "HOST": + return User_Role.HOST; + case 2: + case "ADMIN": + return User_Role.ADMIN; + case 3: + case "USER": + return User_Role.USER; + case -1: + case "UNRECOGNIZED": + default: + return User_Role.UNRECOGNIZED; + } +} + +export function user_RoleToNumber(object: User_Role): number { + switch (object) { + case User_Role.ROLE_UNSPECIFIED: + return 0; + case User_Role.HOST: + return 1; + case User_Role.ADMIN: + return 2; + case User_Role.USER: + return 3; + case User_Role.UNRECOGNIZED: + default: + return -1; + } +} + +export interface ListUsersRequest { +} + +export interface ListUsersResponse { + users: User[]; +} + +export interface GetUserRequest { + /** The name of the user. */ + name: string; +} + +export interface GetUserByUsernameRequest { + /** The username of the user. */ + username: string; +} + +export interface GetUserAvatarBinaryRequest { + /** The name of the user. */ + name: string; + /** The raw HTTP body is bound to this field. */ + httpBody?: HttpBody | undefined; +} + +export interface CreateUserRequest { + user?: User | undefined; +} + +export interface UpdateUserRequest { + user?: User | undefined; + updateMask?: string[] | undefined; +} + +export interface DeleteUserRequest { + /** The name of the user. */ + name: string; +} + +export interface UserStats { + /** The name of the user. */ + name: string; + /** + * The timestamps when the memos were displayed. + * We should return raw data to the client, and let the client format the data with the user's timezone. + */ + memoDisplayTimestamps: Date[]; + /** The stats of memo types. */ + memoTypeStats?: + | UserStats_MemoTypeStats + | undefined; + /** + * The count of tags. + * Format: "tag1": 1, "tag2": 2 + */ + tagCount: { [key: string]: number }; + /** The pinned memos of the user. */ + pinnedMemos: string[]; + totalMemoCount: number; +} + +export interface UserStats_TagCountEntry { + key: string; + value: number; +} + +export interface UserStats_MemoTypeStats { + linkCount: number; + codeCount: number; + todoCount: number; + undoCount: number; +} + +export interface ListAllUserStatsRequest { +} + +export interface ListAllUserStatsResponse { + userStats: UserStats[]; +} + +export interface GetUserStatsRequest { + /** The name of the user. */ + name: string; +} + +export interface UserSetting { + /** The name of the user. */ + name: string; + /** The preferred locale of the user. */ + locale: string; + /** The preferred appearance of the user. */ + appearance: string; + /** The default visibility of the memo. */ + memoVisibility: string; +} + +export interface GetUserSettingRequest { + /** The name of the user. */ + name: string; +} + +export interface UpdateUserSettingRequest { + setting?: UserSetting | undefined; + updateMask?: string[] | undefined; +} + +export interface UserAccessToken { + accessToken: string; + description: string; + issuedAt?: Date | undefined; + expiresAt?: Date | undefined; +} + +export interface ListUserAccessTokensRequest { + /** The name of the user. */ + name: string; +} + +export interface ListUserAccessTokensResponse { + accessTokens: UserAccessToken[]; +} + +export interface CreateUserAccessTokenRequest { + /** The name of the user. */ + name: string; + description: string; + expiresAt?: Date | undefined; +} + +export interface DeleteUserAccessTokenRequest { + /** The name of the user. */ + name: string; + /** access_token is the access token to delete. */ + accessToken: string; +} + +export interface Shortcut { + id: string; + title: string; + filter: string; +} + +export interface ListShortcutsRequest { + /** The name of the user. */ + parent: string; +} + +export interface ListShortcutsResponse { + shortcuts: Shortcut[]; +} + +export interface CreateShortcutRequest { + /** The name of the user. */ + parent: string; + shortcut?: Shortcut | undefined; + validateOnly: boolean; +} + +export interface UpdateShortcutRequest { + /** The name of the user. */ + parent: string; + shortcut?: Shortcut | undefined; + updateMask?: string[] | undefined; +} + +export interface DeleteShortcutRequest { + /** The name of the user. */ + parent: string; + /** The id of the shortcut. */ + id: string; +} + +function createBaseUser(): User { + return { + name: "", + role: User_Role.ROLE_UNSPECIFIED, + username: "", + email: "", + nickname: "", + avatarUrl: "", + description: "", + password: "", + state: State.STATE_UNSPECIFIED, + createTime: undefined, + updateTime: undefined, + }; +} + +export const User: MessageFns = { + encode(message: User, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.role !== User_Role.ROLE_UNSPECIFIED) { + writer.uint32(24).int32(user_RoleToNumber(message.role)); + } + if (message.username !== "") { + writer.uint32(34).string(message.username); + } + if (message.email !== "") { + writer.uint32(42).string(message.email); + } + if (message.nickname !== "") { + writer.uint32(50).string(message.nickname); + } + if (message.avatarUrl !== "") { + writer.uint32(58).string(message.avatarUrl); + } + if (message.description !== "") { + writer.uint32(66).string(message.description); + } + if (message.password !== "") { + writer.uint32(74).string(message.password); + } + if (message.state !== State.STATE_UNSPECIFIED) { + writer.uint32(80).int32(stateToNumber(message.state)); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(90).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(98).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): User { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUser(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.role = user_RoleFromJSON(reader.int32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.username = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.email = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.nickname = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.avatarUrl = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.description = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.password = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.state = stateFromJSON(reader.int32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): User { + return User.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): User { + const message = createBaseUser(); + message.name = object.name ?? ""; + message.role = object.role ?? User_Role.ROLE_UNSPECIFIED; + message.username = object.username ?? ""; + message.email = object.email ?? ""; + message.nickname = object.nickname ?? ""; + message.avatarUrl = object.avatarUrl ?? ""; + message.description = object.description ?? ""; + message.password = object.password ?? ""; + message.state = object.state ?? State.STATE_UNSPECIFIED; + message.createTime = object.createTime ?? undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseListUsersRequest(): ListUsersRequest { + return {}; +} + +export const ListUsersRequest: MessageFns = { + encode(_: ListUsersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListUsersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUsersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListUsersRequest { + return ListUsersRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): ListUsersRequest { + const message = createBaseListUsersRequest(); + return message; + }, +}; + +function createBaseListUsersResponse(): ListUsersResponse { + return { users: [] }; +} + +export const ListUsersResponse: MessageFns = { + encode(message: ListUsersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.users) { + User.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListUsersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUsersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.users.push(User.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListUsersResponse { + return ListUsersResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListUsersResponse { + const message = createBaseListUsersResponse(); + message.users = object.users?.map((e) => User.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetUserRequest(): GetUserRequest { + return { name: "" }; +} + +export const GetUserRequest: MessageFns = { + encode(message: GetUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetUserRequest { + return GetUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserRequest { + const message = createBaseGetUserRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseGetUserByUsernameRequest(): GetUserByUsernameRequest { + return { username: "" }; +} + +export const GetUserByUsernameRequest: MessageFns = { + encode(message: GetUserByUsernameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.username !== "") { + writer.uint32(10).string(message.username); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserByUsernameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserByUsernameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.username = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetUserByUsernameRequest { + return GetUserByUsernameRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserByUsernameRequest { + const message = createBaseGetUserByUsernameRequest(); + message.username = object.username ?? ""; + return message; + }, +}; + +function createBaseGetUserAvatarBinaryRequest(): GetUserAvatarBinaryRequest { + return { name: "", httpBody: undefined }; +} + +export const GetUserAvatarBinaryRequest: MessageFns = { + encode(message: GetUserAvatarBinaryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.httpBody !== undefined) { + HttpBody.encode(message.httpBody, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserAvatarBinaryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserAvatarBinaryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.httpBody = HttpBody.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetUserAvatarBinaryRequest { + return GetUserAvatarBinaryRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserAvatarBinaryRequest { + const message = createBaseGetUserAvatarBinaryRequest(); + message.name = object.name ?? ""; + message.httpBody = (object.httpBody !== undefined && object.httpBody !== null) + ? HttpBody.fromPartial(object.httpBody) + : undefined; + return message; + }, +}; + +function createBaseCreateUserRequest(): CreateUserRequest { + return { user: undefined }; +} + +export const CreateUserRequest: MessageFns = { + encode(message: CreateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateUserRequest { + return CreateUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateUserRequest { + const message = createBaseCreateUserRequest(); + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +function createBaseUpdateUserRequest(): UpdateUserRequest { + return { user: undefined, updateMask: undefined }; +} + +export const UpdateUserRequest: MessageFns = { + encode(message: UpdateUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.user = User.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateUserRequest { + return UpdateUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateUserRequest { + const message = createBaseUpdateUserRequest(); + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteUserRequest(): DeleteUserRequest { + return { name: "" }; +} + +export const DeleteUserRequest: MessageFns = { + encode(message: DeleteUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteUserRequest { + return DeleteUserRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteUserRequest { + const message = createBaseDeleteUserRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseUserStats(): UserStats { + return { + name: "", + memoDisplayTimestamps: [], + memoTypeStats: undefined, + tagCount: {}, + pinnedMemos: [], + totalMemoCount: 0, + }; +} + +export const UserStats: MessageFns = { + encode(message: UserStats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.memoDisplayTimestamps) { + Timestamp.encode(toTimestamp(v!), writer.uint32(18).fork()).join(); + } + if (message.memoTypeStats !== undefined) { + UserStats_MemoTypeStats.encode(message.memoTypeStats, writer.uint32(26).fork()).join(); + } + Object.entries(message.tagCount).forEach(([key, value]) => { + UserStats_TagCountEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); + for (const v of message.pinnedMemos) { + writer.uint32(42).string(v!); + } + if (message.totalMemoCount !== 0) { + writer.uint32(48).int32(message.totalMemoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserStats { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.memoDisplayTimestamps.push(fromTimestamp(Timestamp.decode(reader, reader.uint32()))); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.memoTypeStats = UserStats_MemoTypeStats.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + const entry4 = UserStats_TagCountEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.tagCount[entry4.key] = entry4.value; + } + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.pinnedMemos.push(reader.string()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.totalMemoCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UserStats { + return UserStats.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserStats { + const message = createBaseUserStats(); + message.name = object.name ?? ""; + message.memoDisplayTimestamps = object.memoDisplayTimestamps?.map((e) => e) || []; + message.memoTypeStats = (object.memoTypeStats !== undefined && object.memoTypeStats !== null) + ? UserStats_MemoTypeStats.fromPartial(object.memoTypeStats) + : undefined; + message.tagCount = Object.entries(object.tagCount ?? {}).reduce<{ [key: string]: number }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.Number(value); + } + return acc; + }, {}); + message.pinnedMemos = object.pinnedMemos?.map((e) => e) || []; + message.totalMemoCount = object.totalMemoCount ?? 0; + return message; + }, +}; + +function createBaseUserStats_TagCountEntry(): UserStats_TagCountEntry { + return { key: "", value: 0 }; +} + +export const UserStats_TagCountEntry: MessageFns = { + encode(message: UserStats_TagCountEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== 0) { + writer.uint32(16).int32(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserStats_TagCountEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserStats_TagCountEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.value = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UserStats_TagCountEntry { + return UserStats_TagCountEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserStats_TagCountEntry { + const message = createBaseUserStats_TagCountEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? 0; + return message; + }, +}; + +function createBaseUserStats_MemoTypeStats(): UserStats_MemoTypeStats { + return { linkCount: 0, codeCount: 0, todoCount: 0, undoCount: 0 }; +} + +export const UserStats_MemoTypeStats: MessageFns = { + encode(message: UserStats_MemoTypeStats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.linkCount !== 0) { + writer.uint32(8).int32(message.linkCount); + } + if (message.codeCount !== 0) { + writer.uint32(16).int32(message.codeCount); + } + if (message.todoCount !== 0) { + writer.uint32(24).int32(message.todoCount); + } + if (message.undoCount !== 0) { + writer.uint32(32).int32(message.undoCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserStats_MemoTypeStats { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserStats_MemoTypeStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.linkCount = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.codeCount = reader.int32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.todoCount = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.undoCount = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UserStats_MemoTypeStats { + return UserStats_MemoTypeStats.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserStats_MemoTypeStats { + const message = createBaseUserStats_MemoTypeStats(); + message.linkCount = object.linkCount ?? 0; + message.codeCount = object.codeCount ?? 0; + message.todoCount = object.todoCount ?? 0; + message.undoCount = object.undoCount ?? 0; + return message; + }, +}; + +function createBaseListAllUserStatsRequest(): ListAllUserStatsRequest { + return {}; +} + +export const ListAllUserStatsRequest: MessageFns = { + encode(_: ListAllUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllUserStatsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListAllUserStatsRequest { + return ListAllUserStatsRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): ListAllUserStatsRequest { + const message = createBaseListAllUserStatsRequest(); + return message; + }, +}; + +function createBaseListAllUserStatsResponse(): ListAllUserStatsResponse { + return { userStats: [] }; +} + +export const ListAllUserStatsResponse: MessageFns = { + encode(message: ListAllUserStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.userStats) { + UserStats.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllUserStatsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllUserStatsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.userStats.push(UserStats.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListAllUserStatsResponse { + return ListAllUserStatsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListAllUserStatsResponse { + const message = createBaseListAllUserStatsResponse(); + message.userStats = object.userStats?.map((e) => UserStats.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetUserStatsRequest(): GetUserStatsRequest { + return { name: "" }; +} + +export const GetUserStatsRequest: MessageFns = { + encode(message: GetUserStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserStatsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserStatsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetUserStatsRequest { + return GetUserStatsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserStatsRequest { + const message = createBaseGetUserStatsRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseUserSetting(): UserSetting { + return { name: "", locale: "", appearance: "", memoVisibility: "" }; +} + +export const UserSetting: MessageFns = { + encode(message: UserSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.locale !== "") { + writer.uint32(18).string(message.locale); + } + if (message.appearance !== "") { + writer.uint32(26).string(message.appearance); + } + if (message.memoVisibility !== "") { + writer.uint32(34).string(message.memoVisibility); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserSetting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.locale = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.appearance = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.memoVisibility = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UserSetting { + return UserSetting.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserSetting { + const message = createBaseUserSetting(); + message.name = object.name ?? ""; + message.locale = object.locale ?? ""; + message.appearance = object.appearance ?? ""; + message.memoVisibility = object.memoVisibility ?? ""; + return message; + }, +}; + +function createBaseGetUserSettingRequest(): GetUserSettingRequest { + return { name: "" }; +} + +export const GetUserSettingRequest: MessageFns = { + encode(message: GetUserSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetUserSettingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserSettingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetUserSettingRequest { + return GetUserSettingRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetUserSettingRequest { + const message = createBaseGetUserSettingRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseUpdateUserSettingRequest(): UpdateUserSettingRequest { + return { setting: undefined, updateMask: undefined }; +} + +export const UpdateUserSettingRequest: MessageFns = { + encode(message: UpdateUserSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.setting !== undefined) { + UserSetting.encode(message.setting, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateUserSettingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserSettingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.setting = UserSetting.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateUserSettingRequest { + return UpdateUserSettingRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateUserSettingRequest { + const message = createBaseUpdateUserSettingRequest(); + message.setting = (object.setting !== undefined && object.setting !== null) + ? UserSetting.fromPartial(object.setting) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseUserAccessToken(): UserAccessToken { + return { accessToken: "", description: "", issuedAt: undefined, expiresAt: undefined }; +} + +export const UserAccessToken: MessageFns = { + encode(message: UserAccessToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accessToken !== "") { + writer.uint32(10).string(message.accessToken); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.issuedAt !== undefined) { + Timestamp.encode(toTimestamp(message.issuedAt), writer.uint32(26).fork()).join(); + } + if (message.expiresAt !== undefined) { + Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserAccessToken { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserAccessToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.accessToken = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.issuedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UserAccessToken { + return UserAccessToken.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UserAccessToken { + const message = createBaseUserAccessToken(); + message.accessToken = object.accessToken ?? ""; + message.description = object.description ?? ""; + message.issuedAt = object.issuedAt ?? undefined; + message.expiresAt = object.expiresAt ?? undefined; + return message; + }, +}; + +function createBaseListUserAccessTokensRequest(): ListUserAccessTokensRequest { + return { name: "" }; +} + +export const ListUserAccessTokensRequest: MessageFns = { + encode(message: ListUserAccessTokensRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListUserAccessTokensRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUserAccessTokensRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListUserAccessTokensRequest { + return ListUserAccessTokensRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListUserAccessTokensRequest { + const message = createBaseListUserAccessTokensRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseListUserAccessTokensResponse(): ListUserAccessTokensResponse { + return { accessTokens: [] }; +} + +export const ListUserAccessTokensResponse: MessageFns = { + encode(message: ListUserAccessTokensResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accessTokens) { + UserAccessToken.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListUserAccessTokensResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUserAccessTokensResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.accessTokens.push(UserAccessToken.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListUserAccessTokensResponse { + return ListUserAccessTokensResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListUserAccessTokensResponse { + const message = createBaseListUserAccessTokensResponse(); + message.accessTokens = object.accessTokens?.map((e) => UserAccessToken.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCreateUserAccessTokenRequest(): CreateUserAccessTokenRequest { + return { name: "", description: "", expiresAt: undefined }; +} + +export const CreateUserAccessTokenRequest: MessageFns = { + encode(message: CreateUserAccessTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.expiresAt !== undefined) { + Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateUserAccessTokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateUserAccessTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.expiresAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateUserAccessTokenRequest { + return CreateUserAccessTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateUserAccessTokenRequest { + const message = createBaseCreateUserAccessTokenRequest(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.expiresAt = object.expiresAt ?? undefined; + return message; + }, +}; + +function createBaseDeleteUserAccessTokenRequest(): DeleteUserAccessTokenRequest { + return { name: "", accessToken: "" }; +} + +export const DeleteUserAccessTokenRequest: MessageFns = { + encode(message: DeleteUserAccessTokenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.accessToken !== "") { + writer.uint32(18).string(message.accessToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteUserAccessTokenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteUserAccessTokenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.accessToken = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteUserAccessTokenRequest { + return DeleteUserAccessTokenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteUserAccessTokenRequest { + const message = createBaseDeleteUserAccessTokenRequest(); + message.name = object.name ?? ""; + message.accessToken = object.accessToken ?? ""; + return message; + }, +}; + +function createBaseShortcut(): Shortcut { + return { id: "", title: "", filter: "" }; +} + +export const Shortcut: MessageFns = { + encode(message: Shortcut, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.filter !== "") { + writer.uint32(26).string(message.filter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Shortcut { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShortcut(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.filter = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Shortcut { + return Shortcut.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Shortcut { + const message = createBaseShortcut(); + message.id = object.id ?? ""; + message.title = object.title ?? ""; + message.filter = object.filter ?? ""; + return message; + }, +}; + +function createBaseListShortcutsRequest(): ListShortcutsRequest { + return { parent: "" }; +} + +export const ListShortcutsRequest: MessageFns = { + encode(message: ListShortcutsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parent !== "") { + writer.uint32(10).string(message.parent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListShortcutsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parent = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListShortcutsRequest { + return ListShortcutsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListShortcutsRequest { + const message = createBaseListShortcutsRequest(); + message.parent = object.parent ?? ""; + return message; + }, +}; + +function createBaseListShortcutsResponse(): ListShortcutsResponse { + return { shortcuts: [] }; +} + +export const ListShortcutsResponse: MessageFns = { + encode(message: ListShortcutsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.shortcuts) { + Shortcut.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListShortcutsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListShortcutsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.shortcuts.push(Shortcut.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListShortcutsResponse { + return ListShortcutsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListShortcutsResponse { + const message = createBaseListShortcutsResponse(); + message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCreateShortcutRequest(): CreateShortcutRequest { + return { parent: "", shortcut: undefined, validateOnly: false }; +} + +export const CreateShortcutRequest: MessageFns = { + encode(message: CreateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parent !== "") { + writer.uint32(10).string(message.parent); + } + if (message.shortcut !== undefined) { + Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join(); + } + if (message.validateOnly !== false) { + writer.uint32(24).bool(message.validateOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateShortcutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateShortcutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parent = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.shortcut = Shortcut.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.validateOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateShortcutRequest { + return CreateShortcutRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateShortcutRequest { + const message = createBaseCreateShortcutRequest(); + message.parent = object.parent ?? ""; + message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) + ? Shortcut.fromPartial(object.shortcut) + : undefined; + message.validateOnly = object.validateOnly ?? false; + return message; + }, +}; + +function createBaseUpdateShortcutRequest(): UpdateShortcutRequest { + return { parent: "", shortcut: undefined, updateMask: undefined }; +} + +export const UpdateShortcutRequest: MessageFns = { + encode(message: UpdateShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parent !== "") { + writer.uint32(10).string(message.parent); + } + if (message.shortcut !== undefined) { + Shortcut.encode(message.shortcut, writer.uint32(18).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateShortcutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateShortcutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parent = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.shortcut = Shortcut.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateShortcutRequest { + return UpdateShortcutRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateShortcutRequest { + const message = createBaseUpdateShortcutRequest(); + message.parent = object.parent ?? ""; + message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) + ? Shortcut.fromPartial(object.shortcut) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteShortcutRequest(): DeleteShortcutRequest { + return { parent: "", id: "" }; +} + +export const DeleteShortcutRequest: MessageFns = { + encode(message: DeleteShortcutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.parent !== "") { + writer.uint32(10).string(message.parent); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteShortcutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteShortcutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.parent = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteShortcutRequest { + return DeleteShortcutRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteShortcutRequest { + const message = createBaseDeleteShortcutRequest(); + message.parent = object.parent ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +export type UserServiceDefinition = typeof UserServiceDefinition; +export const UserServiceDefinition = { + name: "UserService", + fullName: "memos.api.v1.UserService", + methods: { + /** ListUsers returns a list of users. */ + listUsers: { + name: "ListUsers", + requestType: ListUsersRequest, + requestStream: false, + responseType: ListUsersResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([15, 18, 13, 47, 97, 112, 105, 47, 118, 49, 47, 117, 115, 101, 114, 115])], + }, + }, + }, + /** GetUser gets a user by name. */ + getUser: { + name: "GetUser", + requestType: GetUserRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 24, + 18, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** GetUserByUsername gets a user by username. */ + getUserByUsername: { + name: "GetUserByUsername", + requestType: GetUserByUsernameRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([8, 117, 115, 101, 114, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 24, + 18, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 117, + 115, + 101, + 114, + 115, + 58, + 117, + 115, + 101, + 114, + 110, + 97, + 109, + 101, + ]), + ], + }, + }, + }, + /** GetUserAvatarBinary gets the avatar of a user. */ + getUserAvatarBinary: { + name: "GetUserAvatarBinary", + requestType: GetUserAvatarBinaryRequest, + requestStream: false, + responseType: HttpBody, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 29, + 18, + 27, + 47, + 102, + 105, + 108, + 101, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 97, + 118, + 97, + 116, + 97, + 114, + ]), + ], + }, + }, + }, + /** CreateUser creates a new user. */ + createUser: { + name: "CreateUser", + requestType: CreateUserRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 117, 115, 101, 114])], + 578365826: [ + new Uint8Array([ + 21, + 58, + 4, + 117, + 115, + 101, + 114, + 34, + 13, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 117, + 115, + 101, + 114, + 115, + ]), + ], + }, + }, + }, + /** UpdateUser updates a user. */ + updateUser: { + name: "UpdateUser", + requestType: UpdateUserRequest, + requestStream: false, + responseType: User, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([16, 117, 115, 101, 114, 44, 117, 112, 100, 97, 116, 101, 95, 109, 97, 115, 107])], + 578365826: [ + new Uint8Array([ + 35, + 58, + 4, + 117, + 115, + 101, + 114, + 50, + 27, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 117, + 115, + 101, + 114, + 46, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** DeleteUser deletes a user. */ + deleteUser: { + name: "DeleteUser", + requestType: DeleteUserRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 24, + 42, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** ListAllUserStats returns all user stats. */ + listAllUserStats: { + name: "ListAllUserStats", + requestType: ListAllUserStatsRequest, + requestStream: false, + responseType: ListAllUserStatsResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 23, + 34, + 21, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 117, + 115, + 101, + 114, + 115, + 47, + 45, + 47, + 115, + 116, + 97, + 116, + 115, + ]), + ], + }, + }, + }, + /** GetUserStats returns the stats of a user. */ + getUserStats: { + name: "GetUserStats", + requestType: GetUserStatsRequest, + requestStream: false, + responseType: UserStats, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 30, + 18, + 28, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 115, + 116, + 97, + 116, + 115, + ]), + ], + }, + }, + }, + /** GetUserSetting gets the setting of a user. */ + getUserSetting: { + name: "GetUserSetting", + requestType: GetUserSettingRequest, + requestStream: false, + responseType: UserSetting, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 32, + 18, + 30, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + ]), + ], + }, + }, + }, + /** UpdateUserSetting updates the setting of a user. */ + updateUserSetting: { + name: "UpdateUserSetting", + requestType: UpdateUserSettingRequest, + requestStream: false, + responseType: UserSetting, + responseStream: false, + options: { + _unknownFields: { + 8410: [ + new Uint8Array([ + 19, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 44, + 117, + 112, + 100, + 97, + 116, + 101, + 95, + 109, + 97, + 115, + 107, + ]), + ], + 578365826: [ + new Uint8Array([ + 49, + 58, + 7, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 50, + 38, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 46, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 47, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 125, + ]), + ], + }, + }, + }, + /** ListUserAccessTokens returns a list of access tokens for a user. */ + listUserAccessTokens: { + name: "ListUserAccessTokens", + requestType: ListUserAccessTokensRequest, + requestStream: false, + responseType: ListUserAccessTokensResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 38, + 18, + 36, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 97, + 99, + 99, + 101, + 115, + 115, + 95, + 116, + 111, + 107, + 101, + 110, + 115, + ]), + ], + }, + }, + }, + /** CreateUserAccessToken creates a new access token for a user. */ + createUserAccessToken: { + name: "CreateUserAccessToken", + requestType: CreateUserAccessTokenRequest, + requestStream: false, + responseType: UserAccessToken, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 41, + 58, + 1, + 42, + 34, + 36, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 97, + 99, + 99, + 101, + 115, + 115, + 95, + 116, + 111, + 107, + 101, + 110, + 115, + ]), + ], + }, + }, + }, + /** DeleteUserAccessToken deletes an access token for a user. */ + deleteUserAccessToken: { + name: "DeleteUserAccessToken", + requestType: DeleteUserAccessTokenRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([17, 110, 97, 109, 101, 44, 97, 99, 99, 101, 115, 115, 95, 116, 111, 107, 101, 110])], + 578365826: [ + new Uint8Array([ + 53, + 42, + 51, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 97, + 99, + 99, + 101, + 115, + 115, + 95, + 116, + 111, + 107, + 101, + 110, + 115, + 47, + 123, + 97, + 99, + 99, + 101, + 115, + 115, + 95, + 116, + 111, + 107, + 101, + 110, + 125, + ]), + ], + }, + }, + }, + /** ListShortcuts returns a list of shortcuts for a user. */ + listShortcuts: { + name: "ListShortcuts", + requestType: ListShortcutsRequest, + requestStream: false, + responseType: ListShortcutsResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])], + 578365826: [ + new Uint8Array([ + 36, + 18, + 34, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 115, + ]), + ], + }, + }, + }, + /** CreateShortcut creates a new shortcut for a user. */ + createShortcut: { + name: "CreateShortcut", + requestType: CreateShortcutRequest, + requestStream: false, + responseType: Shortcut, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([15, 112, 97, 114, 101, 110, 116, 44, 115, 104, 111, 114, 116, 99, 117, 116])], + 578365826: [ + new Uint8Array([ + 46, + 58, + 8, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 34, + 34, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 115, + ]), + ], + }, + }, + }, + /** UpdateShortcut updates a shortcut for a user. */ + updateShortcut: { + name: "UpdateShortcut", + requestType: UpdateShortcutRequest, + requestStream: false, + responseType: Shortcut, + responseStream: false, + options: { + _unknownFields: { + 8410: [ + new Uint8Array([ + 27, + 112, + 97, + 114, + 101, + 110, + 116, + 44, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 44, + 117, + 112, + 100, + 97, + 116, + 101, + 95, + 109, + 97, + 115, + 107, + ]), + ], + 578365826: [ + new Uint8Array([ + 60, + 58, + 8, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 50, + 48, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 115, + 47, + 123, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 46, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + /** DeleteShortcut deletes a shortcut for a user. */ + deleteShortcut: { + name: "DeleteShortcut", + requestType: DeleteShortcutRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([9, 112, 97, 114, 101, 110, 116, 44, 105, 100])], + 578365826: [ + new Uint8Array([ + 41, + 42, + 39, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 123, + 112, + 97, + 114, + 101, + 110, + 116, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + 47, + 115, + 104, + 111, + 114, + 116, + 99, + 117, + 116, + 115, + 47, + 123, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/webhook_service.ts b/web/src/types/proto/api/v1/webhook_service.ts new file mode 100644 index 00000000..ee917493 --- /dev/null +++ b/web/src/types/proto/api/v1/webhook_service.ts @@ -0,0 +1,816 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/webhook_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Empty } from "../../google/protobuf/empty"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Memo } from "./memo_service"; + +export const protobufPackage = "memos.api.v1"; + +export interface Webhook { + id: number; + /** The name of the creator. */ + creator: string; + createTime?: Date | undefined; + updateTime?: Date | undefined; + name: string; + url: string; +} + +export interface CreateWebhookRequest { + name: string; + url: string; +} + +export interface GetWebhookRequest { + id: number; +} + +export interface ListWebhooksRequest { + /** The name of the creator. */ + creator: string; +} + +export interface ListWebhooksResponse { + webhooks: Webhook[]; +} + +export interface UpdateWebhookRequest { + webhook?: Webhook | undefined; + updateMask?: string[] | undefined; +} + +export interface DeleteWebhookRequest { + id: number; +} + +export interface WebhookRequestPayload { + url: string; + activityType: string; + /** + * The name of the creator. + * Format: users/{user} + */ + creator: string; + createTime?: Date | undefined; + memo?: Memo | undefined; +} + +function createBaseWebhook(): Webhook { + return { id: 0, creator: "", createTime: undefined, updateTime: undefined, name: "", url: "" }; +} + +export const Webhook: MessageFns = { + encode(message: Webhook, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(26).fork()).join(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(34).fork()).join(); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.url !== "") { + writer.uint32(50).string(message.url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Webhook { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWebhook(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Webhook { + return Webhook.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Webhook { + const message = createBaseWebhook(); + message.id = object.id ?? 0; + message.creator = object.creator ?? ""; + message.createTime = object.createTime ?? undefined; + message.updateTime = object.updateTime ?? undefined; + message.name = object.name ?? ""; + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseCreateWebhookRequest(): CreateWebhookRequest { + return { name: "", url: "" }; +} + +export const CreateWebhookRequest: MessageFns = { + encode(message: CreateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateWebhookRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateWebhookRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.url = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateWebhookRequest { + return CreateWebhookRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateWebhookRequest { + const message = createBaseCreateWebhookRequest(); + message.name = object.name ?? ""; + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseGetWebhookRequest(): GetWebhookRequest { + return { id: 0 }; +} + +export const GetWebhookRequest: MessageFns = { + encode(message: GetWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetWebhookRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetWebhookRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetWebhookRequest { + return GetWebhookRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetWebhookRequest { + const message = createBaseGetWebhookRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseListWebhooksRequest(): ListWebhooksRequest { + return { creator: "" }; +} + +export const ListWebhooksRequest: MessageFns = { + encode(message: ListWebhooksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListWebhooksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.creator = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListWebhooksRequest { + return ListWebhooksRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListWebhooksRequest { + const message = createBaseListWebhooksRequest(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseListWebhooksResponse(): ListWebhooksResponse { + return { webhooks: [] }; +} + +export const ListWebhooksResponse: MessageFns = { + encode(message: ListWebhooksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.webhooks) { + Webhook.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListWebhooksResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListWebhooksResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.webhooks.push(Webhook.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListWebhooksResponse { + return ListWebhooksResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListWebhooksResponse { + const message = createBaseListWebhooksResponse(); + message.webhooks = object.webhooks?.map((e) => Webhook.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUpdateWebhookRequest(): UpdateWebhookRequest { + return { webhook: undefined, updateMask: undefined }; +} + +export const UpdateWebhookRequest: MessageFns = { + encode(message: UpdateWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.webhook !== undefined) { + Webhook.encode(message.webhook, writer.uint32(10).fork()).join(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateWebhookRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateWebhookRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.webhook = Webhook.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateWebhookRequest { + return UpdateWebhookRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateWebhookRequest { + const message = createBaseUpdateWebhookRequest(); + message.webhook = (object.webhook !== undefined && object.webhook !== null) + ? Webhook.fromPartial(object.webhook) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseDeleteWebhookRequest(): DeleteWebhookRequest { + return { id: 0 }; +} + +export const DeleteWebhookRequest: MessageFns = { + encode(message: DeleteWebhookRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteWebhookRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteWebhookRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteWebhookRequest { + return DeleteWebhookRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteWebhookRequest { + const message = createBaseDeleteWebhookRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseWebhookRequestPayload(): WebhookRequestPayload { + return { url: "", activityType: "", creator: "", createTime: undefined, memo: undefined }; +} + +export const WebhookRequestPayload: MessageFns = { + encode(message: WebhookRequestPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + if (message.activityType !== "") { + writer.uint32(18).string(message.activityType); + } + if (message.creator !== "") { + writer.uint32(26).string(message.creator); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join(); + } + if (message.memo !== undefined) { + Memo.encode(message.memo, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WebhookRequestPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWebhookRequestPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.url = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.activityType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.creator = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.memo = Memo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WebhookRequestPayload { + return WebhookRequestPayload.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WebhookRequestPayload { + const message = createBaseWebhookRequestPayload(); + message.url = object.url ?? ""; + message.activityType = object.activityType ?? ""; + message.creator = object.creator ?? ""; + message.createTime = object.createTime ?? undefined; + message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; + return message; + }, +}; + +export type WebhookServiceDefinition = typeof WebhookServiceDefinition; +export const WebhookServiceDefinition = { + name: "WebhookService", + fullName: "memos.api.v1.WebhookService", + methods: { + /** CreateWebhook creates a new webhook. */ + createWebhook: { + name: "CreateWebhook", + requestType: CreateWebhookRequest, + requestStream: false, + responseType: Webhook, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 21, + 58, + 1, + 42, + 34, + 16, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 115, + ]), + ], + }, + }, + }, + /** GetWebhook returns a webhook by id. */ + getWebhook: { + name: "GetWebhook", + requestType: GetWebhookRequest, + requestStream: false, + responseType: Webhook, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 23, + 18, + 21, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 115, + 47, + 123, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + /** ListWebhooks returns a list of webhooks. */ + listWebhooks: { + name: "ListWebhooks", + requestType: ListWebhooksRequest, + requestStream: false, + responseType: ListWebhooksResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([18, 18, 16, 47, 97, 112, 105, 47, 118, 49, 47, 119, 101, 98, 104, 111, 111, 107, 115]), + ], + }, + }, + }, + /** UpdateWebhook updates a webhook. */ + updateWebhook: { + name: "UpdateWebhook", + requestType: UpdateWebhookRequest, + requestStream: false, + responseType: Webhook, + responseStream: false, + options: { + _unknownFields: { + 8410: [ + new Uint8Array([ + 19, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 44, + 117, + 112, + 100, + 97, + 116, + 101, + 95, + 109, + 97, + 115, + 107, + ]), + ], + 578365826: [ + new Uint8Array([ + 40, + 58, + 7, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 50, + 29, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 115, + 47, + 123, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 46, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + /** DeleteWebhook deletes a webhook by id. */ + deleteWebhook: { + name: "DeleteWebhook", + requestType: DeleteWebhookRequest, + requestStream: false, + responseType: Empty, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 23, + 42, + 21, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 101, + 98, + 104, + 111, + 111, + 107, + 115, + 47, + 123, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/workspace_service.ts b/web/src/types/proto/api/v1/workspace_service.ts new file mode 100644 index 00000000..3f3dfbae --- /dev/null +++ b/web/src/types/proto/api/v1/workspace_service.ts @@ -0,0 +1,210 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/workspace_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "memos.api.v1"; + +export interface WorkspaceProfile { + /** + * The name of instance owner. + * Format: users/{user} + */ + owner: string; + /** version is the current version of instance */ + version: string; + /** mode is the instance mode (e.g. "prod", "dev" or "demo"). */ + mode: string; + /** instance_url is the URL of the instance. */ + instanceUrl: string; +} + +export interface GetWorkspaceProfileRequest { +} + +function createBaseWorkspaceProfile(): WorkspaceProfile { + return { owner: "", version: "", mode: "", instanceUrl: "" }; +} + +export const WorkspaceProfile: MessageFns = { + encode(message: WorkspaceProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.owner !== "") { + writer.uint32(10).string(message.owner); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.mode !== "") { + writer.uint32(26).string(message.mode); + } + if (message.instanceUrl !== "") { + writer.uint32(50).string(message.instanceUrl); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceProfile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceProfile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.owner = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.mode = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.instanceUrl = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceProfile { + return WorkspaceProfile.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceProfile { + const message = createBaseWorkspaceProfile(); + message.owner = object.owner ?? ""; + message.version = object.version ?? ""; + message.mode = object.mode ?? ""; + message.instanceUrl = object.instanceUrl ?? ""; + return message; + }, +}; + +function createBaseGetWorkspaceProfileRequest(): GetWorkspaceProfileRequest { + return {}; +} + +export const GetWorkspaceProfileRequest: MessageFns = { + encode(_: GetWorkspaceProfileRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetWorkspaceProfileRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetWorkspaceProfileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetWorkspaceProfileRequest { + return GetWorkspaceProfileRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): GetWorkspaceProfileRequest { + const message = createBaseGetWorkspaceProfileRequest(); + return message; + }, +}; + +export type WorkspaceServiceDefinition = typeof WorkspaceServiceDefinition; +export const WorkspaceServiceDefinition = { + name: "WorkspaceService", + fullName: "memos.api.v1.WorkspaceService", + methods: { + /** GetWorkspaceProfile returns the workspace profile. */ + getWorkspaceProfile: { + name: "GetWorkspaceProfile", + requestType: GetWorkspaceProfileRequest, + requestStream: false, + responseType: WorkspaceProfile, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 27, + 18, + 25, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 111, + 114, + 107, + 115, + 112, + 97, + 99, + 101, + 47, + 112, + 114, + 111, + 102, + 105, + 108, + 101, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/api/v1/workspace_setting_service.ts b/web/src/types/proto/api/v1/workspace_setting_service.ts new file mode 100644 index 00000000..4477d8ad --- /dev/null +++ b/web/src/types/proto/api/v1/workspace_setting_service.ts @@ -0,0 +1,1115 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: api/v1/workspace_setting_service.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "memos.api.v1"; + +export interface WorkspaceSetting { + /** + * name is the name of the setting. + * Format: settings/{setting} + */ + name: string; + generalSetting?: WorkspaceGeneralSetting | undefined; + storageSetting?: WorkspaceStorageSetting | undefined; + memoRelatedSetting?: WorkspaceMemoRelatedSetting | undefined; +} + +export interface WorkspaceGeneralSetting { + /** disallow_user_registration disallows user registration. */ + disallowUserRegistration: boolean; + /** disallow_password_auth disallows password authentication. */ + disallowPasswordAuth: boolean; + /** additional_script is the additional script. */ + additionalScript: string; + /** additional_style is the additional style. */ + additionalStyle: string; + /** custom_profile is the custom profile. */ + customProfile?: + | WorkspaceCustomProfile + | undefined; + /** + * week_start_day_offset is the week start day offset from Sunday. + * 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + * Default is Sunday. + */ + weekStartDayOffset: number; + /** disallow_change_username disallows changing username. */ + disallowChangeUsername: boolean; + /** disallow_change_nickname disallows changing nickname. */ + disallowChangeNickname: boolean; +} + +export interface WorkspaceCustomProfile { + title: string; + description: string; + logoUrl: string; + locale: string; + appearance: string; +} + +export interface WorkspaceStorageSetting { + /** storage_type is the storage type. */ + storageType: WorkspaceStorageSetting_StorageType; + /** + * The template of file path. + * e.g. assets/{timestamp}_{filename} + */ + filepathTemplate: string; + /** The max upload size in megabytes. */ + uploadSizeLimitMb: number; + /** The S3 config. */ + s3Config?: WorkspaceStorageSetting_S3Config | undefined; +} + +export enum WorkspaceStorageSetting_StorageType { + STORAGE_TYPE_UNSPECIFIED = "STORAGE_TYPE_UNSPECIFIED", + /** DATABASE - DATABASE is the database storage type. */ + DATABASE = "DATABASE", + /** LOCAL - LOCAL is the local storage type. */ + LOCAL = "LOCAL", + /** S3 - S3 is the S3 storage type. */ + S3 = "S3", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function workspaceStorageSetting_StorageTypeFromJSON(object: any): WorkspaceStorageSetting_StorageType { + switch (object) { + case 0: + case "STORAGE_TYPE_UNSPECIFIED": + return WorkspaceStorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED; + case 1: + case "DATABASE": + return WorkspaceStorageSetting_StorageType.DATABASE; + case 2: + case "LOCAL": + return WorkspaceStorageSetting_StorageType.LOCAL; + case 3: + case "S3": + return WorkspaceStorageSetting_StorageType.S3; + case -1: + case "UNRECOGNIZED": + default: + return WorkspaceStorageSetting_StorageType.UNRECOGNIZED; + } +} + +export function workspaceStorageSetting_StorageTypeToNumber(object: WorkspaceStorageSetting_StorageType): number { + switch (object) { + case WorkspaceStorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED: + return 0; + case WorkspaceStorageSetting_StorageType.DATABASE: + return 1; + case WorkspaceStorageSetting_StorageType.LOCAL: + return 2; + case WorkspaceStorageSetting_StorageType.S3: + return 3; + case WorkspaceStorageSetting_StorageType.UNRECOGNIZED: + default: + return -1; + } +} + +/** Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/ */ +export interface WorkspaceStorageSetting_S3Config { + accessKeyId: string; + accessKeySecret: string; + endpoint: string; + region: string; + bucket: string; + usePathStyle: boolean; +} + +export interface WorkspaceMemoRelatedSetting { + /** disallow_public_visibility disallows set memo as public visibility. */ + disallowPublicVisibility: boolean; + /** display_with_update_time orders and displays memo with update time. */ + displayWithUpdateTime: boolean; + /** content_length_limit is the limit of content length. Unit is byte. */ + contentLengthLimit: number; + /** enable_double_click_edit enables editing on double click. */ + enableDoubleClickEdit: boolean; + /** enable_link_preview enables links preview. */ + enableLinkPreview: boolean; + /** enable_comment enables comment. */ + enableComment: boolean; + /** enable_location enables setting location for memo. */ + enableLocation: boolean; + /** reactions is the list of reactions. */ + reactions: string[]; + /** disable_markdown_shortcuts disallow the registration of markdown shortcuts. */ + disableMarkdownShortcuts: boolean; + /** enable_blur_nsfw_content enables blurring of content marked as not safe for work (NSFW). */ + enableBlurNsfwContent: boolean; + /** nsfw_tags is the list of tags that mark content as NSFW for blurring. */ + nsfwTags: string[]; +} + +export interface GetWorkspaceSettingRequest { + /** + * The resource name of the workspace setting. + * Format: settings/{setting} + */ + name: string; +} + +export interface SetWorkspaceSettingRequest { + /** setting is the setting to update. */ + setting?: WorkspaceSetting | undefined; +} + +function createBaseWorkspaceSetting(): WorkspaceSetting { + return { name: "", generalSetting: undefined, storageSetting: undefined, memoRelatedSetting: undefined }; +} + +export const WorkspaceSetting: MessageFns = { + encode(message: WorkspaceSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.generalSetting !== undefined) { + WorkspaceGeneralSetting.encode(message.generalSetting, writer.uint32(18).fork()).join(); + } + if (message.storageSetting !== undefined) { + WorkspaceStorageSetting.encode(message.storageSetting, writer.uint32(26).fork()).join(); + } + if (message.memoRelatedSetting !== undefined) { + WorkspaceMemoRelatedSetting.encode(message.memoRelatedSetting, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceSetting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.generalSetting = WorkspaceGeneralSetting.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.storageSetting = WorkspaceStorageSetting.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.memoRelatedSetting = WorkspaceMemoRelatedSetting.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceSetting { + return WorkspaceSetting.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceSetting { + const message = createBaseWorkspaceSetting(); + message.name = object.name ?? ""; + message.generalSetting = (object.generalSetting !== undefined && object.generalSetting !== null) + ? WorkspaceGeneralSetting.fromPartial(object.generalSetting) + : undefined; + message.storageSetting = (object.storageSetting !== undefined && object.storageSetting !== null) + ? WorkspaceStorageSetting.fromPartial(object.storageSetting) + : undefined; + message.memoRelatedSetting = (object.memoRelatedSetting !== undefined && object.memoRelatedSetting !== null) + ? WorkspaceMemoRelatedSetting.fromPartial(object.memoRelatedSetting) + : undefined; + return message; + }, +}; + +function createBaseWorkspaceGeneralSetting(): WorkspaceGeneralSetting { + return { + disallowUserRegistration: false, + disallowPasswordAuth: false, + additionalScript: "", + additionalStyle: "", + customProfile: undefined, + weekStartDayOffset: 0, + disallowChangeUsername: false, + disallowChangeNickname: false, + }; +} + +export const WorkspaceGeneralSetting: MessageFns = { + encode(message: WorkspaceGeneralSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.disallowUserRegistration !== false) { + writer.uint32(8).bool(message.disallowUserRegistration); + } + if (message.disallowPasswordAuth !== false) { + writer.uint32(16).bool(message.disallowPasswordAuth); + } + if (message.additionalScript !== "") { + writer.uint32(26).string(message.additionalScript); + } + if (message.additionalStyle !== "") { + writer.uint32(34).string(message.additionalStyle); + } + if (message.customProfile !== undefined) { + WorkspaceCustomProfile.encode(message.customProfile, writer.uint32(42).fork()).join(); + } + if (message.weekStartDayOffset !== 0) { + writer.uint32(48).int32(message.weekStartDayOffset); + } + if (message.disallowChangeUsername !== false) { + writer.uint32(56).bool(message.disallowChangeUsername); + } + if (message.disallowChangeNickname !== false) { + writer.uint32(64).bool(message.disallowChangeNickname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceGeneralSetting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceGeneralSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.disallowUserRegistration = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.disallowPasswordAuth = reader.bool(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.additionalScript = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.additionalStyle = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.customProfile = WorkspaceCustomProfile.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.weekStartDayOffset = reader.int32(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.disallowChangeUsername = reader.bool(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.disallowChangeNickname = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceGeneralSetting { + return WorkspaceGeneralSetting.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceGeneralSetting { + const message = createBaseWorkspaceGeneralSetting(); + message.disallowUserRegistration = object.disallowUserRegistration ?? false; + message.disallowPasswordAuth = object.disallowPasswordAuth ?? false; + message.additionalScript = object.additionalScript ?? ""; + message.additionalStyle = object.additionalStyle ?? ""; + message.customProfile = (object.customProfile !== undefined && object.customProfile !== null) + ? WorkspaceCustomProfile.fromPartial(object.customProfile) + : undefined; + message.weekStartDayOffset = object.weekStartDayOffset ?? 0; + message.disallowChangeUsername = object.disallowChangeUsername ?? false; + message.disallowChangeNickname = object.disallowChangeNickname ?? false; + return message; + }, +}; + +function createBaseWorkspaceCustomProfile(): WorkspaceCustomProfile { + return { title: "", description: "", logoUrl: "", locale: "", appearance: "" }; +} + +export const WorkspaceCustomProfile: MessageFns = { + encode(message: WorkspaceCustomProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.logoUrl !== "") { + writer.uint32(26).string(message.logoUrl); + } + if (message.locale !== "") { + writer.uint32(34).string(message.locale); + } + if (message.appearance !== "") { + writer.uint32(42).string(message.appearance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceCustomProfile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceCustomProfile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.logoUrl = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.locale = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.appearance = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceCustomProfile { + return WorkspaceCustomProfile.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceCustomProfile { + const message = createBaseWorkspaceCustomProfile(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.logoUrl = object.logoUrl ?? ""; + message.locale = object.locale ?? ""; + message.appearance = object.appearance ?? ""; + return message; + }, +}; + +function createBaseWorkspaceStorageSetting(): WorkspaceStorageSetting { + return { + storageType: WorkspaceStorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED, + filepathTemplate: "", + uploadSizeLimitMb: 0, + s3Config: undefined, + }; +} + +export const WorkspaceStorageSetting: MessageFns = { + encode(message: WorkspaceStorageSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.storageType !== WorkspaceStorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED) { + writer.uint32(8).int32(workspaceStorageSetting_StorageTypeToNumber(message.storageType)); + } + if (message.filepathTemplate !== "") { + writer.uint32(18).string(message.filepathTemplate); + } + if (message.uploadSizeLimitMb !== 0) { + writer.uint32(24).int64(message.uploadSizeLimitMb); + } + if (message.s3Config !== undefined) { + WorkspaceStorageSetting_S3Config.encode(message.s3Config, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceStorageSetting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceStorageSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.storageType = workspaceStorageSetting_StorageTypeFromJSON(reader.int32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.filepathTemplate = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.uploadSizeLimitMb = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.s3Config = WorkspaceStorageSetting_S3Config.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceStorageSetting { + return WorkspaceStorageSetting.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceStorageSetting { + const message = createBaseWorkspaceStorageSetting(); + message.storageType = object.storageType ?? WorkspaceStorageSetting_StorageType.STORAGE_TYPE_UNSPECIFIED; + message.filepathTemplate = object.filepathTemplate ?? ""; + message.uploadSizeLimitMb = object.uploadSizeLimitMb ?? 0; + message.s3Config = (object.s3Config !== undefined && object.s3Config !== null) + ? WorkspaceStorageSetting_S3Config.fromPartial(object.s3Config) + : undefined; + return message; + }, +}; + +function createBaseWorkspaceStorageSetting_S3Config(): WorkspaceStorageSetting_S3Config { + return { accessKeyId: "", accessKeySecret: "", endpoint: "", region: "", bucket: "", usePathStyle: false }; +} + +export const WorkspaceStorageSetting_S3Config: MessageFns = { + encode(message: WorkspaceStorageSetting_S3Config, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accessKeyId !== "") { + writer.uint32(10).string(message.accessKeyId); + } + if (message.accessKeySecret !== "") { + writer.uint32(18).string(message.accessKeySecret); + } + if (message.endpoint !== "") { + writer.uint32(26).string(message.endpoint); + } + if (message.region !== "") { + writer.uint32(34).string(message.region); + } + if (message.bucket !== "") { + writer.uint32(42).string(message.bucket); + } + if (message.usePathStyle !== false) { + writer.uint32(48).bool(message.usePathStyle); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceStorageSetting_S3Config { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceStorageSetting_S3Config(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.accessKeyId = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.accessKeySecret = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.endpoint = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.region = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.usePathStyle = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceStorageSetting_S3Config { + return WorkspaceStorageSetting_S3Config.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceStorageSetting_S3Config { + const message = createBaseWorkspaceStorageSetting_S3Config(); + message.accessKeyId = object.accessKeyId ?? ""; + message.accessKeySecret = object.accessKeySecret ?? ""; + message.endpoint = object.endpoint ?? ""; + message.region = object.region ?? ""; + message.bucket = object.bucket ?? ""; + message.usePathStyle = object.usePathStyle ?? false; + return message; + }, +}; + +function createBaseWorkspaceMemoRelatedSetting(): WorkspaceMemoRelatedSetting { + return { + disallowPublicVisibility: false, + displayWithUpdateTime: false, + contentLengthLimit: 0, + enableDoubleClickEdit: false, + enableLinkPreview: false, + enableComment: false, + enableLocation: false, + reactions: [], + disableMarkdownShortcuts: false, + enableBlurNsfwContent: false, + nsfwTags: [], + }; +} + +export const WorkspaceMemoRelatedSetting: MessageFns = { + encode(message: WorkspaceMemoRelatedSetting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.disallowPublicVisibility !== false) { + writer.uint32(8).bool(message.disallowPublicVisibility); + } + if (message.displayWithUpdateTime !== false) { + writer.uint32(16).bool(message.displayWithUpdateTime); + } + if (message.contentLengthLimit !== 0) { + writer.uint32(24).int32(message.contentLengthLimit); + } + if (message.enableDoubleClickEdit !== false) { + writer.uint32(40).bool(message.enableDoubleClickEdit); + } + if (message.enableLinkPreview !== false) { + writer.uint32(48).bool(message.enableLinkPreview); + } + if (message.enableComment !== false) { + writer.uint32(56).bool(message.enableComment); + } + if (message.enableLocation !== false) { + writer.uint32(64).bool(message.enableLocation); + } + for (const v of message.reactions) { + writer.uint32(82).string(v!); + } + if (message.disableMarkdownShortcuts !== false) { + writer.uint32(88).bool(message.disableMarkdownShortcuts); + } + if (message.enableBlurNsfwContent !== false) { + writer.uint32(96).bool(message.enableBlurNsfwContent); + } + for (const v of message.nsfwTags) { + writer.uint32(106).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkspaceMemoRelatedSetting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceMemoRelatedSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.disallowPublicVisibility = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.displayWithUpdateTime = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.contentLengthLimit = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.enableDoubleClickEdit = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.enableLinkPreview = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.enableComment = reader.bool(); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.enableLocation = reader.bool(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.reactions.push(reader.string()); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.disableMarkdownShortcuts = reader.bool(); + continue; + } + case 12: { + if (tag !== 96) { + break; + } + + message.enableBlurNsfwContent = reader.bool(); + continue; + } + case 13: { + if (tag !== 106) { + break; + } + + message.nsfwTags.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): WorkspaceMemoRelatedSetting { + return WorkspaceMemoRelatedSetting.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WorkspaceMemoRelatedSetting { + const message = createBaseWorkspaceMemoRelatedSetting(); + message.disallowPublicVisibility = object.disallowPublicVisibility ?? false; + message.displayWithUpdateTime = object.displayWithUpdateTime ?? false; + message.contentLengthLimit = object.contentLengthLimit ?? 0; + message.enableDoubleClickEdit = object.enableDoubleClickEdit ?? false; + message.enableLinkPreview = object.enableLinkPreview ?? false; + message.enableComment = object.enableComment ?? false; + message.enableLocation = object.enableLocation ?? false; + message.reactions = object.reactions?.map((e) => e) || []; + message.disableMarkdownShortcuts = object.disableMarkdownShortcuts ?? false; + message.enableBlurNsfwContent = object.enableBlurNsfwContent ?? false; + message.nsfwTags = object.nsfwTags?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGetWorkspaceSettingRequest(): GetWorkspaceSettingRequest { + return { name: "" }; +} + +export const GetWorkspaceSettingRequest: MessageFns = { + encode(message: GetWorkspaceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetWorkspaceSettingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetWorkspaceSettingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetWorkspaceSettingRequest { + return GetWorkspaceSettingRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetWorkspaceSettingRequest { + const message = createBaseGetWorkspaceSettingRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseSetWorkspaceSettingRequest(): SetWorkspaceSettingRequest { + return { setting: undefined }; +} + +export const SetWorkspaceSettingRequest: MessageFns = { + encode(message: SetWorkspaceSettingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.setting !== undefined) { + WorkspaceSetting.encode(message.setting, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetWorkspaceSettingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetWorkspaceSettingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.setting = WorkspaceSetting.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SetWorkspaceSettingRequest { + return SetWorkspaceSettingRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetWorkspaceSettingRequest { + const message = createBaseSetWorkspaceSettingRequest(); + message.setting = (object.setting !== undefined && object.setting !== null) + ? WorkspaceSetting.fromPartial(object.setting) + : undefined; + return message; + }, +}; + +export type WorkspaceSettingServiceDefinition = typeof WorkspaceSettingServiceDefinition; +export const WorkspaceSettingServiceDefinition = { + name: "WorkspaceSettingService", + fullName: "memos.api.v1.WorkspaceSettingService", + methods: { + /** GetWorkspaceSetting returns the setting by name. */ + getWorkspaceSetting: { + name: "GetWorkspaceSetting", + requestType: GetWorkspaceSettingRequest, + requestStream: false, + responseType: WorkspaceSetting, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 37, + 18, + 35, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 111, + 114, + 107, + 115, + 112, + 97, + 99, + 101, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + /** SetWorkspaceSetting updates the setting. */ + setWorkspaceSetting: { + name: "SetWorkspaceSetting", + requestType: SetWorkspaceSettingRequest, + requestStream: false, + responseType: WorkspaceSetting, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([7, 115, 101, 116, 116, 105, 110, 103])], + 578365826: [ + new Uint8Array([ + 54, + 58, + 7, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 50, + 43, + 47, + 97, + 112, + 105, + 47, + 118, + 49, + 47, + 119, + 111, + 114, + 107, + 115, + 112, + 97, + 99, + 101, + 47, + 123, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 46, + 110, + 97, + 109, + 101, + 61, + 115, + 101, + 116, + 116, + 105, + 110, + 103, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/api/annotations.ts b/web/src/types/proto/google/api/annotations.ts new file mode 100644 index 00000000..60211996 --- /dev/null +++ b/web/src/types/proto/google/api/annotations.ts @@ -0,0 +1,9 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/api/annotations.proto + +/* eslint-disable */ + +export const protobufPackage = "google.api"; diff --git a/web/src/types/proto/google/api/client.ts b/web/src/types/proto/google/api/client.ts new file mode 100644 index 00000000..a6cd5398 --- /dev/null +++ b/web/src/types/proto/google/api/client.ts @@ -0,0 +1,2087 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/api/client.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Duration } from "../protobuf/duration"; +import { LaunchStage, launchStageFromJSON, launchStageToNumber } from "./launch_stage"; + +export const protobufPackage = "google.api"; + +/** + * The organization for which the client libraries are being published. + * Affects the url where generated docs are published, etc. + */ +export enum ClientLibraryOrganization { + /** CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED - Not useful. */ + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED", + /** CLOUD - Google Cloud Platform Org. */ + CLOUD = "CLOUD", + /** ADS - Ads (Advertising) Org. */ + ADS = "ADS", + /** PHOTOS - Photos Org. */ + PHOTOS = "PHOTOS", + /** STREET_VIEW - Street View Org. */ + STREET_VIEW = "STREET_VIEW", + /** SHOPPING - Shopping Org. */ + SHOPPING = "SHOPPING", + /** GEO - Geo Org. */ + GEO = "GEO", + /** GENERATIVE_AI - Generative AI - https://developers.generativeai.google */ + GENERATIVE_AI = "GENERATIVE_AI", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function clientLibraryOrganizationFromJSON(object: any): ClientLibraryOrganization { + switch (object) { + case 0: + case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": + return ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED; + case 1: + case "CLOUD": + return ClientLibraryOrganization.CLOUD; + case 2: + case "ADS": + return ClientLibraryOrganization.ADS; + case 3: + case "PHOTOS": + return ClientLibraryOrganization.PHOTOS; + case 4: + case "STREET_VIEW": + return ClientLibraryOrganization.STREET_VIEW; + case 5: + case "SHOPPING": + return ClientLibraryOrganization.SHOPPING; + case 6: + case "GEO": + return ClientLibraryOrganization.GEO; + case 7: + case "GENERATIVE_AI": + return ClientLibraryOrganization.GENERATIVE_AI; + case -1: + case "UNRECOGNIZED": + default: + return ClientLibraryOrganization.UNRECOGNIZED; + } +} + +export function clientLibraryOrganizationToNumber(object: ClientLibraryOrganization): number { + switch (object) { + case ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED: + return 0; + case ClientLibraryOrganization.CLOUD: + return 1; + case ClientLibraryOrganization.ADS: + return 2; + case ClientLibraryOrganization.PHOTOS: + return 3; + case ClientLibraryOrganization.STREET_VIEW: + return 4; + case ClientLibraryOrganization.SHOPPING: + return 5; + case ClientLibraryOrganization.GEO: + return 6; + case ClientLibraryOrganization.GENERATIVE_AI: + return 7; + case ClientLibraryOrganization.UNRECOGNIZED: + default: + return -1; + } +} + +/** To where should client libraries be published? */ +export enum ClientLibraryDestination { + /** + * CLIENT_LIBRARY_DESTINATION_UNSPECIFIED - Client libraries will neither be generated nor published to package + * managers. + */ + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED", + /** + * GITHUB - Generate the client library in a repo under github.com/googleapis, + * but don't publish it to package managers. + */ + GITHUB = "GITHUB", + /** PACKAGE_MANAGER - Publish the library to package managers like nuget.org and npmjs.com. */ + PACKAGE_MANAGER = "PACKAGE_MANAGER", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function clientLibraryDestinationFromJSON(object: any): ClientLibraryDestination { + switch (object) { + case 0: + case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": + return ClientLibraryDestination.CLIENT_LIBRARY_DESTINATION_UNSPECIFIED; + case 10: + case "GITHUB": + return ClientLibraryDestination.GITHUB; + case 20: + case "PACKAGE_MANAGER": + return ClientLibraryDestination.PACKAGE_MANAGER; + case -1: + case "UNRECOGNIZED": + default: + return ClientLibraryDestination.UNRECOGNIZED; + } +} + +export function clientLibraryDestinationToNumber(object: ClientLibraryDestination): number { + switch (object) { + case ClientLibraryDestination.CLIENT_LIBRARY_DESTINATION_UNSPECIFIED: + return 0; + case ClientLibraryDestination.GITHUB: + return 10; + case ClientLibraryDestination.PACKAGE_MANAGER: + return 20; + case ClientLibraryDestination.UNRECOGNIZED: + default: + return -1; + } +} + +/** Required information for every language. */ +export interface CommonLanguageSettings { + /** + * Link to automatically generated reference documentation. Example: + * https://cloud.google.com/nodejs/docs/reference/asset/latest + * + * @deprecated + */ + referenceDocsUri: string; + /** The destination where API teams want this client library to be published. */ + destinations: ClientLibraryDestination[]; + /** Configuration for which RPCs should be generated in the GAPIC client. */ + selectiveGapicGeneration?: SelectiveGapicGeneration | undefined; +} + +/** Details about how and where to publish client libraries. */ +export interface ClientLibrarySettings { + /** + * Version of the API to apply these settings to. This is the full protobuf + * package for the API, ending in the version element. + * Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + */ + version: string; + /** Launch stage of this version of the API. */ + launchStage: LaunchStage; + /** + * When using transport=rest, the client request will encode enums as + * numbers rather than strings. + */ + restNumericEnums: boolean; + /** Settings for legacy Java features, supported in the Service YAML. */ + javaSettings?: + | JavaSettings + | undefined; + /** Settings for C++ client libraries. */ + cppSettings?: + | CppSettings + | undefined; + /** Settings for PHP client libraries. */ + phpSettings?: + | PhpSettings + | undefined; + /** Settings for Python client libraries. */ + pythonSettings?: + | PythonSettings + | undefined; + /** Settings for Node client libraries. */ + nodeSettings?: + | NodeSettings + | undefined; + /** Settings for .NET client libraries. */ + dotnetSettings?: + | DotnetSettings + | undefined; + /** Settings for Ruby client libraries. */ + rubySettings?: + | RubySettings + | undefined; + /** Settings for Go client libraries. */ + goSettings?: GoSettings | undefined; +} + +/** + * This message configures the settings for publishing [Google Cloud Client + * libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + * generated from the service config. + */ +export interface Publishing { + /** + * A list of API method settings, e.g. the behavior for methods that use the + * long-running operation pattern. + */ + methodSettings: MethodSettings[]; + /** + * Link to a *public* URI where users can report issues. Example: + * https://issuetracker.google.com/issues/new?component=190865&template=1161103 + */ + newIssueUri: string; + /** + * Link to product home page. Example: + * https://cloud.google.com/asset-inventory/docs/overview + */ + documentationUri: string; + /** + * Used as a tracking tag when collecting data about the APIs developer + * relations artifacts like docs, packages delivered to package managers, + * etc. Example: "speech". + */ + apiShortName: string; + /** GitHub label to apply to issues and pull requests opened for this API. */ + githubLabel: string; + /** + * GitHub teams to be added to CODEOWNERS in the directory in GitHub + * containing source code for the client libraries for this API. + */ + codeownerGithubTeams: string[]; + /** + * A prefix used in sample code when demarking regions to be included in + * documentation. + */ + docTagPrefix: string; + /** For whom the client library is being published. */ + organization: ClientLibraryOrganization; + /** + * Client library settings. If the same version string appears multiple + * times in this list, then the last one wins. Settings from earlier + * settings with the same version string are discarded. + */ + librarySettings: ClientLibrarySettings[]; + /** + * Optional link to proto reference documentation. Example: + * https://cloud.google.com/pubsub/lite/docs/reference/rpc + */ + protoReferenceDocumentationUri: string; + /** + * Optional link to REST reference documentation. Example: + * https://cloud.google.com/pubsub/lite/docs/reference/rest + */ + restReferenceDocumentationUri: string; +} + +/** Settings for Java client libraries. */ +export interface JavaSettings { + /** + * The package name to use in Java. Clobbers the java_package option + * set in the protobuf. This should be used **only** by APIs + * who have already set the language_settings.java.package_name" field + * in gapic.yaml. API teams should use the protobuf java_package option + * where possible. + * + * Example of a YAML configuration:: + * + * publishing: + * java_settings: + * library_package: com.google.cloud.pubsub.v1 + */ + libraryPackage: string; + /** + * Configure the Java class name to use instead of the service's for its + * corresponding generated GAPIC client. Keys are fully-qualified + * service names as they appear in the protobuf (including the full + * the language_settings.java.interface_names" field in gapic.yaml. API + * teams should otherwise use the service name as it appears in the + * protobuf. + * + * Example of a YAML configuration:: + * + * publishing: + * java_settings: + * service_class_names: + * - google.pubsub.v1.Publisher: TopicAdmin + * - google.pubsub.v1.Subscriber: SubscriptionAdmin + */ + serviceClassNames: { [key: string]: string }; + /** Some settings. */ + common?: CommonLanguageSettings | undefined; +} + +export interface JavaSettings_ServiceClassNamesEntry { + key: string; + value: string; +} + +/** Settings for C++ client libraries. */ +export interface CppSettings { + /** Some settings. */ + common?: CommonLanguageSettings | undefined; +} + +/** Settings for Php client libraries. */ +export interface PhpSettings { + /** Some settings. */ + common?: CommonLanguageSettings | undefined; +} + +/** Settings for Python client libraries. */ +export interface PythonSettings { + /** Some settings. */ + common?: + | CommonLanguageSettings + | undefined; + /** Experimental features to be included during client library generation. */ + experimentalFeatures?: PythonSettings_ExperimentalFeatures | undefined; +} + +/** + * Experimental features to be included during client library generation. + * These fields will be deprecated once the feature graduates and is enabled + * by default. + */ +export interface PythonSettings_ExperimentalFeatures { + /** + * Enables generation of asynchronous REST clients if `rest` transport is + * enabled. By default, asynchronous REST clients will not be generated. + * This feature will be enabled by default 1 month after launching the + * feature in preview packages. + */ + restAsyncIoEnabled: boolean; + /** + * Enables generation of protobuf code using new types that are more + * Pythonic which are included in `protobuf>=5.29.x`. This feature will be + * enabled by default 1 month after launching the feature in preview + * packages. + */ + protobufPythonicTypesEnabled: boolean; + /** + * Disables generation of an unversioned Python package for this client + * library. This means that the module names will need to be versioned in + * import statements. For example `import google.cloud.library_v2` instead + * of `import google.cloud.library`. + */ + unversionedPackageDisabled: boolean; +} + +/** Settings for Node client libraries. */ +export interface NodeSettings { + /** Some settings. */ + common?: CommonLanguageSettings | undefined; +} + +/** Settings for Dotnet client libraries. */ +export interface DotnetSettings { + /** Some settings. */ + common?: + | CommonLanguageSettings + | undefined; + /** + * Map from original service names to renamed versions. + * This is used when the default generated types + * would cause a naming conflict. (Neither name is + * fully-qualified.) + * Example: Subscriber to SubscriberServiceApi. + */ + renamedServices: { [key: string]: string }; + /** + * Map from full resource types to the effective short name + * for the resource. This is used when otherwise resource + * named from different services would cause naming collisions. + * Example entry: + * "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + */ + renamedResources: { [key: string]: string }; + /** + * List of full resource types to ignore during generation. + * This is typically used for API-specific Location resources, + * which should be handled by the generator as if they were actually + * the common Location resources. + * Example entry: "documentai.googleapis.com/Location" + */ + ignoredResources: string[]; + /** + * Namespaces which must be aliased in snippets due to + * a known (but non-generator-predictable) naming collision + */ + forcedNamespaceAliases: string[]; + /** + * Method signatures (in the form "service.method(signature)") + * which are provided separately, so shouldn't be generated. + * Snippets *calling* these methods are still generated, however. + */ + handwrittenSignatures: string[]; +} + +export interface DotnetSettings_RenamedServicesEntry { + key: string; + value: string; +} + +export interface DotnetSettings_RenamedResourcesEntry { + key: string; + value: string; +} + +/** Settings for Ruby client libraries. */ +export interface RubySettings { + /** Some settings. */ + common?: CommonLanguageSettings | undefined; +} + +/** Settings for Go client libraries. */ +export interface GoSettings { + /** Some settings. */ + common?: + | CommonLanguageSettings + | undefined; + /** + * Map of service names to renamed services. Keys are the package relative + * service names and values are the name to be used for the service client + * and call options. + * + * publishing: + * go_settings: + * renamed_services: + * Publisher: TopicAdmin + */ + renamedServices: { [key: string]: string }; +} + +export interface GoSettings_RenamedServicesEntry { + key: string; + value: string; +} + +/** Describes the generator configuration for a method. */ +export interface MethodSettings { + /** + * The fully qualified name of the method, for which the options below apply. + * This is used to find the method to apply the options. + * + * Example: + * + * publishing: + * method_settings: + * - selector: google.storage.control.v2.StorageControl.CreateFolder + * # method settings for CreateFolder... + */ + selector: string; + /** + * Describes settings to use for long-running operations when generating + * API methods for RPCs. Complements RPCs that use the annotations in + * google/longrunning/operations.proto. + * + * Example of a YAML configuration:: + * + * publishing: + * method_settings: + * - selector: google.cloud.speech.v2.Speech.BatchRecognize + * long_running: + * initial_poll_delay: 60s # 1 minute + * poll_delay_multiplier: 1.5 + * max_poll_delay: 360s # 6 minutes + * total_poll_timeout: 54000s # 90 minutes + */ + longRunning?: + | MethodSettings_LongRunning + | undefined; + /** + * List of top-level fields of the request message, that should be + * automatically populated by the client libraries based on their + * (google.api.field_info).format. Currently supported format: UUID4. + * + * Example of a YAML configuration: + * + * publishing: + * method_settings: + * - selector: google.example.v1.ExampleService.CreateExample + * auto_populated_fields: + * - request_id + */ + autoPopulatedFields: string[]; +} + +/** + * Describes settings to use when generating API methods that use the + * long-running operation pattern. + * All default values below are from those used in the client library + * generators (e.g. + * [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + */ +export interface MethodSettings_LongRunning { + /** + * Initial delay after which the first poll request will be made. + * Default value: 5 seconds. + */ + initialPollDelay?: + | Duration + | undefined; + /** + * Multiplier to gradually increase delay between subsequent polls until it + * reaches max_poll_delay. + * Default value: 1.5. + */ + pollDelayMultiplier: number; + /** + * Maximum time between two subsequent poll requests. + * Default value: 45 seconds. + */ + maxPollDelay?: + | Duration + | undefined; + /** + * Total polling timeout. + * Default value: 5 minutes. + */ + totalPollTimeout?: Duration | undefined; +} + +/** + * This message is used to configure the generation of a subset of the RPCs in + * a service for client libraries. + */ +export interface SelectiveGapicGeneration { + /** + * An allowlist of the fully qualified names of RPCs that should be included + * on public client surfaces. + */ + methods: string[]; + /** + * Setting this to true indicates to the client generators that methods + * that would be excluded from the generation should instead be generated + * in a way that indicates these methods should not be consumed by + * end users. How this is expressed is up to individual language + * implementations to decide. Some examples may be: added annotations, + * obfuscated identifiers, or other language idiomatic patterns. + */ + generateOmittedAsInternal: boolean; +} + +function createBaseCommonLanguageSettings(): CommonLanguageSettings { + return { referenceDocsUri: "", destinations: [], selectiveGapicGeneration: undefined }; +} + +export const CommonLanguageSettings: MessageFns = { + encode(message: CommonLanguageSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.referenceDocsUri !== "") { + writer.uint32(10).string(message.referenceDocsUri); + } + writer.uint32(18).fork(); + for (const v of message.destinations) { + writer.int32(clientLibraryDestinationToNumber(v)); + } + writer.join(); + if (message.selectiveGapicGeneration !== undefined) { + SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommonLanguageSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommonLanguageSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.referenceDocsUri = reader.string(); + continue; + } + case 2: { + if (tag === 16) { + message.destinations.push(clientLibraryDestinationFromJSON(reader.int32())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.destinations.push(clientLibraryDestinationFromJSON(reader.int32())); + } + + continue; + } + + break; + } + case 3: { + if (tag !== 26) { + break; + } + + message.selectiveGapicGeneration = SelectiveGapicGeneration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CommonLanguageSettings { + return CommonLanguageSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CommonLanguageSettings { + const message = createBaseCommonLanguageSettings(); + message.referenceDocsUri = object.referenceDocsUri ?? ""; + message.destinations = object.destinations?.map((e) => e) || []; + message.selectiveGapicGeneration = + (object.selectiveGapicGeneration !== undefined && object.selectiveGapicGeneration !== null) + ? SelectiveGapicGeneration.fromPartial(object.selectiveGapicGeneration) + : undefined; + return message; + }, +}; + +function createBaseClientLibrarySettings(): ClientLibrarySettings { + return { + version: "", + launchStage: LaunchStage.LAUNCH_STAGE_UNSPECIFIED, + restNumericEnums: false, + javaSettings: undefined, + cppSettings: undefined, + phpSettings: undefined, + pythonSettings: undefined, + nodeSettings: undefined, + dotnetSettings: undefined, + rubySettings: undefined, + goSettings: undefined, + }; +} + +export const ClientLibrarySettings: MessageFns = { + encode(message: ClientLibrarySettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.launchStage !== LaunchStage.LAUNCH_STAGE_UNSPECIFIED) { + writer.uint32(16).int32(launchStageToNumber(message.launchStage)); + } + if (message.restNumericEnums !== false) { + writer.uint32(24).bool(message.restNumericEnums); + } + if (message.javaSettings !== undefined) { + JavaSettings.encode(message.javaSettings, writer.uint32(170).fork()).join(); + } + if (message.cppSettings !== undefined) { + CppSettings.encode(message.cppSettings, writer.uint32(178).fork()).join(); + } + if (message.phpSettings !== undefined) { + PhpSettings.encode(message.phpSettings, writer.uint32(186).fork()).join(); + } + if (message.pythonSettings !== undefined) { + PythonSettings.encode(message.pythonSettings, writer.uint32(194).fork()).join(); + } + if (message.nodeSettings !== undefined) { + NodeSettings.encode(message.nodeSettings, writer.uint32(202).fork()).join(); + } + if (message.dotnetSettings !== undefined) { + DotnetSettings.encode(message.dotnetSettings, writer.uint32(210).fork()).join(); + } + if (message.rubySettings !== undefined) { + RubySettings.encode(message.rubySettings, writer.uint32(218).fork()).join(); + } + if (message.goSettings !== undefined) { + GoSettings.encode(message.goSettings, writer.uint32(226).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientLibrarySettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientLibrarySettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.launchStage = launchStageFromJSON(reader.int32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.restNumericEnums = reader.bool(); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.javaSettings = JavaSettings.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.cppSettings = CppSettings.decode(reader, reader.uint32()); + continue; + } + case 23: { + if (tag !== 186) { + break; + } + + message.phpSettings = PhpSettings.decode(reader, reader.uint32()); + continue; + } + case 24: { + if (tag !== 194) { + break; + } + + message.pythonSettings = PythonSettings.decode(reader, reader.uint32()); + continue; + } + case 25: { + if (tag !== 202) { + break; + } + + message.nodeSettings = NodeSettings.decode(reader, reader.uint32()); + continue; + } + case 26: { + if (tag !== 210) { + break; + } + + message.dotnetSettings = DotnetSettings.decode(reader, reader.uint32()); + continue; + } + case 27: { + if (tag !== 218) { + break; + } + + message.rubySettings = RubySettings.decode(reader, reader.uint32()); + continue; + } + case 28: { + if (tag !== 226) { + break; + } + + message.goSettings = GoSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ClientLibrarySettings { + return ClientLibrarySettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ClientLibrarySettings { + const message = createBaseClientLibrarySettings(); + message.version = object.version ?? ""; + message.launchStage = object.launchStage ?? LaunchStage.LAUNCH_STAGE_UNSPECIFIED; + message.restNumericEnums = object.restNumericEnums ?? false; + message.javaSettings = (object.javaSettings !== undefined && object.javaSettings !== null) + ? JavaSettings.fromPartial(object.javaSettings) + : undefined; + message.cppSettings = (object.cppSettings !== undefined && object.cppSettings !== null) + ? CppSettings.fromPartial(object.cppSettings) + : undefined; + message.phpSettings = (object.phpSettings !== undefined && object.phpSettings !== null) + ? PhpSettings.fromPartial(object.phpSettings) + : undefined; + message.pythonSettings = (object.pythonSettings !== undefined && object.pythonSettings !== null) + ? PythonSettings.fromPartial(object.pythonSettings) + : undefined; + message.nodeSettings = (object.nodeSettings !== undefined && object.nodeSettings !== null) + ? NodeSettings.fromPartial(object.nodeSettings) + : undefined; + message.dotnetSettings = (object.dotnetSettings !== undefined && object.dotnetSettings !== null) + ? DotnetSettings.fromPartial(object.dotnetSettings) + : undefined; + message.rubySettings = (object.rubySettings !== undefined && object.rubySettings !== null) + ? RubySettings.fromPartial(object.rubySettings) + : undefined; + message.goSettings = (object.goSettings !== undefined && object.goSettings !== null) + ? GoSettings.fromPartial(object.goSettings) + : undefined; + return message; + }, +}; + +function createBasePublishing(): Publishing { + return { + methodSettings: [], + newIssueUri: "", + documentationUri: "", + apiShortName: "", + githubLabel: "", + codeownerGithubTeams: [], + docTagPrefix: "", + organization: ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED, + librarySettings: [], + protoReferenceDocumentationUri: "", + restReferenceDocumentationUri: "", + }; +} + +export const Publishing: MessageFns = { + encode(message: Publishing, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.methodSettings) { + MethodSettings.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.newIssueUri !== "") { + writer.uint32(810).string(message.newIssueUri); + } + if (message.documentationUri !== "") { + writer.uint32(818).string(message.documentationUri); + } + if (message.apiShortName !== "") { + writer.uint32(826).string(message.apiShortName); + } + if (message.githubLabel !== "") { + writer.uint32(834).string(message.githubLabel); + } + for (const v of message.codeownerGithubTeams) { + writer.uint32(842).string(v!); + } + if (message.docTagPrefix !== "") { + writer.uint32(850).string(message.docTagPrefix); + } + if (message.organization !== ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED) { + writer.uint32(856).int32(clientLibraryOrganizationToNumber(message.organization)); + } + for (const v of message.librarySettings) { + ClientLibrarySettings.encode(v!, writer.uint32(874).fork()).join(); + } + if (message.protoReferenceDocumentationUri !== "") { + writer.uint32(882).string(message.protoReferenceDocumentationUri); + } + if (message.restReferenceDocumentationUri !== "") { + writer.uint32(890).string(message.restReferenceDocumentationUri); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Publishing { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublishing(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.methodSettings.push(MethodSettings.decode(reader, reader.uint32())); + continue; + } + case 101: { + if (tag !== 810) { + break; + } + + message.newIssueUri = reader.string(); + continue; + } + case 102: { + if (tag !== 818) { + break; + } + + message.documentationUri = reader.string(); + continue; + } + case 103: { + if (tag !== 826) { + break; + } + + message.apiShortName = reader.string(); + continue; + } + case 104: { + if (tag !== 834) { + break; + } + + message.githubLabel = reader.string(); + continue; + } + case 105: { + if (tag !== 842) { + break; + } + + message.codeownerGithubTeams.push(reader.string()); + continue; + } + case 106: { + if (tag !== 850) { + break; + } + + message.docTagPrefix = reader.string(); + continue; + } + case 107: { + if (tag !== 856) { + break; + } + + message.organization = clientLibraryOrganizationFromJSON(reader.int32()); + continue; + } + case 109: { + if (tag !== 874) { + break; + } + + message.librarySettings.push(ClientLibrarySettings.decode(reader, reader.uint32())); + continue; + } + case 110: { + if (tag !== 882) { + break; + } + + message.protoReferenceDocumentationUri = reader.string(); + continue; + } + case 111: { + if (tag !== 890) { + break; + } + + message.restReferenceDocumentationUri = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Publishing { + return Publishing.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Publishing { + const message = createBasePublishing(); + message.methodSettings = object.methodSettings?.map((e) => MethodSettings.fromPartial(e)) || []; + message.newIssueUri = object.newIssueUri ?? ""; + message.documentationUri = object.documentationUri ?? ""; + message.apiShortName = object.apiShortName ?? ""; + message.githubLabel = object.githubLabel ?? ""; + message.codeownerGithubTeams = object.codeownerGithubTeams?.map((e) => e) || []; + message.docTagPrefix = object.docTagPrefix ?? ""; + message.organization = object.organization ?? ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED; + message.librarySettings = object.librarySettings?.map((e) => ClientLibrarySettings.fromPartial(e)) || []; + message.protoReferenceDocumentationUri = object.protoReferenceDocumentationUri ?? ""; + message.restReferenceDocumentationUri = object.restReferenceDocumentationUri ?? ""; + return message; + }, +}; + +function createBaseJavaSettings(): JavaSettings { + return { libraryPackage: "", serviceClassNames: {}, common: undefined }; +} + +export const JavaSettings: MessageFns = { + encode(message: JavaSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.libraryPackage !== "") { + writer.uint32(10).string(message.libraryPackage); + } + Object.entries(message.serviceClassNames).forEach(([key, value]) => { + JavaSettings_ServiceClassNamesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JavaSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJavaSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.libraryPackage = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = JavaSettings_ServiceClassNamesEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.serviceClassNames[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): JavaSettings { + return JavaSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): JavaSettings { + const message = createBaseJavaSettings(); + message.libraryPackage = object.libraryPackage ?? ""; + message.serviceClassNames = Object.entries(object.serviceClassNames ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + return message; + }, +}; + +function createBaseJavaSettings_ServiceClassNamesEntry(): JavaSettings_ServiceClassNamesEntry { + return { key: "", value: "" }; +} + +export const JavaSettings_ServiceClassNamesEntry: MessageFns = { + encode(message: JavaSettings_ServiceClassNamesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): JavaSettings_ServiceClassNamesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseJavaSettings_ServiceClassNamesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): JavaSettings_ServiceClassNamesEntry { + return JavaSettings_ServiceClassNamesEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): JavaSettings_ServiceClassNamesEntry { + const message = createBaseJavaSettings_ServiceClassNamesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseCppSettings(): CppSettings { + return { common: undefined }; +} + +export const CppSettings: MessageFns = { + encode(message: CppSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CppSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCppSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CppSettings { + return CppSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CppSettings { + const message = createBaseCppSettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + return message; + }, +}; + +function createBasePhpSettings(): PhpSettings { + return { common: undefined }; +} + +export const PhpSettings: MessageFns = { + encode(message: PhpSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PhpSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePhpSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): PhpSettings { + return PhpSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PhpSettings { + const message = createBasePhpSettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + return message; + }, +}; + +function createBasePythonSettings(): PythonSettings { + return { common: undefined, experimentalFeatures: undefined }; +} + +export const PythonSettings: MessageFns = { + encode(message: PythonSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + if (message.experimentalFeatures !== undefined) { + PythonSettings_ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PythonSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePythonSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.experimentalFeatures = PythonSettings_ExperimentalFeatures.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): PythonSettings { + return PythonSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PythonSettings { + const message = createBasePythonSettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + message.experimentalFeatures = (object.experimentalFeatures !== undefined && object.experimentalFeatures !== null) + ? PythonSettings_ExperimentalFeatures.fromPartial(object.experimentalFeatures) + : undefined; + return message; + }, +}; + +function createBasePythonSettings_ExperimentalFeatures(): PythonSettings_ExperimentalFeatures { + return { restAsyncIoEnabled: false, protobufPythonicTypesEnabled: false, unversionedPackageDisabled: false }; +} + +export const PythonSettings_ExperimentalFeatures: MessageFns = { + encode(message: PythonSettings_ExperimentalFeatures, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.restAsyncIoEnabled !== false) { + writer.uint32(8).bool(message.restAsyncIoEnabled); + } + if (message.protobufPythonicTypesEnabled !== false) { + writer.uint32(16).bool(message.protobufPythonicTypesEnabled); + } + if (message.unversionedPackageDisabled !== false) { + writer.uint32(24).bool(message.unversionedPackageDisabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PythonSettings_ExperimentalFeatures { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePythonSettings_ExperimentalFeatures(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.restAsyncIoEnabled = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.protobufPythonicTypesEnabled = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.unversionedPackageDisabled = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): PythonSettings_ExperimentalFeatures { + return PythonSettings_ExperimentalFeatures.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PythonSettings_ExperimentalFeatures { + const message = createBasePythonSettings_ExperimentalFeatures(); + message.restAsyncIoEnabled = object.restAsyncIoEnabled ?? false; + message.protobufPythonicTypesEnabled = object.protobufPythonicTypesEnabled ?? false; + message.unversionedPackageDisabled = object.unversionedPackageDisabled ?? false; + return message; + }, +}; + +function createBaseNodeSettings(): NodeSettings { + return { common: undefined }; +} + +export const NodeSettings: MessageFns = { + encode(message: NodeSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): NodeSettings { + return NodeSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): NodeSettings { + const message = createBaseNodeSettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + return message; + }, +}; + +function createBaseDotnetSettings(): DotnetSettings { + return { + common: undefined, + renamedServices: {}, + renamedResources: {}, + ignoredResources: [], + forcedNamespaceAliases: [], + handwrittenSignatures: [], + }; +} + +export const DotnetSettings: MessageFns = { + encode(message: DotnetSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + Object.entries(message.renamedServices).forEach(([key, value]) => { + DotnetSettings_RenamedServicesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + Object.entries(message.renamedResources).forEach(([key, value]) => { + DotnetSettings_RenamedResourcesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + for (const v of message.ignoredResources) { + writer.uint32(34).string(v!); + } + for (const v of message.forcedNamespaceAliases) { + writer.uint32(42).string(v!); + } + for (const v of message.handwrittenSignatures) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DotnetSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDotnetSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = DotnetSettings_RenamedServicesEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.renamedServices[entry2.key] = entry2.value; + } + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = DotnetSettings_RenamedResourcesEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.renamedResources[entry3.key] = entry3.value; + } + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.ignoredResources.push(reader.string()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.forcedNamespaceAliases.push(reader.string()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.handwrittenSignatures.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DotnetSettings { + return DotnetSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DotnetSettings { + const message = createBaseDotnetSettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + message.renamedServices = Object.entries(object.renamedServices ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.renamedResources = Object.entries(object.renamedResources ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.ignoredResources = object.ignoredResources?.map((e) => e) || []; + message.forcedNamespaceAliases = object.forcedNamespaceAliases?.map((e) => e) || []; + message.handwrittenSignatures = object.handwrittenSignatures?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDotnetSettings_RenamedServicesEntry(): DotnetSettings_RenamedServicesEntry { + return { key: "", value: "" }; +} + +export const DotnetSettings_RenamedServicesEntry: MessageFns = { + encode(message: DotnetSettings_RenamedServicesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DotnetSettings_RenamedServicesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDotnetSettings_RenamedServicesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DotnetSettings_RenamedServicesEntry { + return DotnetSettings_RenamedServicesEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DotnetSettings_RenamedServicesEntry { + const message = createBaseDotnetSettings_RenamedServicesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseDotnetSettings_RenamedResourcesEntry(): DotnetSettings_RenamedResourcesEntry { + return { key: "", value: "" }; +} + +export const DotnetSettings_RenamedResourcesEntry: MessageFns = { + encode(message: DotnetSettings_RenamedResourcesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DotnetSettings_RenamedResourcesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDotnetSettings_RenamedResourcesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DotnetSettings_RenamedResourcesEntry { + return DotnetSettings_RenamedResourcesEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DotnetSettings_RenamedResourcesEntry { + const message = createBaseDotnetSettings_RenamedResourcesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseRubySettings(): RubySettings { + return { common: undefined }; +} + +export const RubySettings: MessageFns = { + encode(message: RubySettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RubySettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRubySettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): RubySettings { + return RubySettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RubySettings { + const message = createBaseRubySettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + return message; + }, +}; + +function createBaseGoSettings(): GoSettings { + return { common: undefined, renamedServices: {} }; +} + +export const GoSettings: MessageFns = { + encode(message: GoSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).join(); + } + Object.entries(message.renamedServices).forEach(([key, value]) => { + GoSettings_RenamedServicesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GoSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGoSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.common = CommonLanguageSettings.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + const entry2 = GoSettings_RenamedServicesEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.renamedServices[entry2.key] = entry2.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GoSettings { + return GoSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GoSettings { + const message = createBaseGoSettings(); + message.common = (object.common !== undefined && object.common !== null) + ? CommonLanguageSettings.fromPartial(object.common) + : undefined; + message.renamedServices = Object.entries(object.renamedServices ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseGoSettings_RenamedServicesEntry(): GoSettings_RenamedServicesEntry { + return { key: "", value: "" }; +} + +export const GoSettings_RenamedServicesEntry: MessageFns = { + encode(message: GoSettings_RenamedServicesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GoSettings_RenamedServicesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGoSettings_RenamedServicesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GoSettings_RenamedServicesEntry { + return GoSettings_RenamedServicesEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GoSettings_RenamedServicesEntry { + const message = createBaseGoSettings_RenamedServicesEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseMethodSettings(): MethodSettings { + return { selector: "", longRunning: undefined, autoPopulatedFields: [] }; +} + +export const MethodSettings: MessageFns = { + encode(message: MethodSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.longRunning !== undefined) { + MethodSettings_LongRunning.encode(message.longRunning, writer.uint32(18).fork()).join(); + } + for (const v of message.autoPopulatedFields) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.longRunning = MethodSettings_LongRunning.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.autoPopulatedFields.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MethodSettings { + return MethodSettings.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MethodSettings { + const message = createBaseMethodSettings(); + message.selector = object.selector ?? ""; + message.longRunning = (object.longRunning !== undefined && object.longRunning !== null) + ? MethodSettings_LongRunning.fromPartial(object.longRunning) + : undefined; + message.autoPopulatedFields = object.autoPopulatedFields?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMethodSettings_LongRunning(): MethodSettings_LongRunning { + return { initialPollDelay: undefined, pollDelayMultiplier: 0, maxPollDelay: undefined, totalPollTimeout: undefined }; +} + +export const MethodSettings_LongRunning: MessageFns = { + encode(message: MethodSettings_LongRunning, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.initialPollDelay !== undefined) { + Duration.encode(message.initialPollDelay, writer.uint32(10).fork()).join(); + } + if (message.pollDelayMultiplier !== 0) { + writer.uint32(21).float(message.pollDelayMultiplier); + } + if (message.maxPollDelay !== undefined) { + Duration.encode(message.maxPollDelay, writer.uint32(26).fork()).join(); + } + if (message.totalPollTimeout !== undefined) { + Duration.encode(message.totalPollTimeout, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodSettings_LongRunning { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodSettings_LongRunning(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.initialPollDelay = Duration.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 21) { + break; + } + + message.pollDelayMultiplier = reader.float(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.maxPollDelay = Duration.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.totalPollTimeout = Duration.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MethodSettings_LongRunning { + return MethodSettings_LongRunning.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MethodSettings_LongRunning { + const message = createBaseMethodSettings_LongRunning(); + message.initialPollDelay = (object.initialPollDelay !== undefined && object.initialPollDelay !== null) + ? Duration.fromPartial(object.initialPollDelay) + : undefined; + message.pollDelayMultiplier = object.pollDelayMultiplier ?? 0; + message.maxPollDelay = (object.maxPollDelay !== undefined && object.maxPollDelay !== null) + ? Duration.fromPartial(object.maxPollDelay) + : undefined; + message.totalPollTimeout = (object.totalPollTimeout !== undefined && object.totalPollTimeout !== null) + ? Duration.fromPartial(object.totalPollTimeout) + : undefined; + return message; + }, +}; + +function createBaseSelectiveGapicGeneration(): SelectiveGapicGeneration { + return { methods: [], generateOmittedAsInternal: false }; +} + +export const SelectiveGapicGeneration: MessageFns = { + encode(message: SelectiveGapicGeneration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.methods) { + writer.uint32(10).string(v!); + } + if (message.generateOmittedAsInternal !== false) { + writer.uint32(16).bool(message.generateOmittedAsInternal); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SelectiveGapicGeneration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSelectiveGapicGeneration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.methods.push(reader.string()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.generateOmittedAsInternal = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SelectiveGapicGeneration { + return SelectiveGapicGeneration.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SelectiveGapicGeneration { + const message = createBaseSelectiveGapicGeneration(); + message.methods = object.methods?.map((e) => e) || []; + message.generateOmittedAsInternal = object.generateOmittedAsInternal ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/api/field_behavior.ts b/web/src/types/proto/google/api/field_behavior.ts new file mode 100644 index 00000000..2a624a7c --- /dev/null +++ b/web/src/types/proto/google/api/field_behavior.ts @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/api/field_behavior.proto + +/* eslint-disable */ + +export const protobufPackage = "google.api"; + +/** + * An indicator of the behavior of a given field (for example, that a field + * is required in requests, or given as output but ignored as input). + * This **does not** change the behavior in protocol buffers itself; it only + * denotes the behavior and may affect how API tooling handles the field. + * + * Note: This enum **may** receive new values in the future. + */ +export enum FieldBehavior { + /** FIELD_BEHAVIOR_UNSPECIFIED - Conventional default for enums. Do not use this. */ + FIELD_BEHAVIOR_UNSPECIFIED = "FIELD_BEHAVIOR_UNSPECIFIED", + /** + * OPTIONAL - Specifically denotes a field as optional. + * While all fields in protocol buffers are optional, this may be specified + * for emphasis if appropriate. + */ + OPTIONAL = "OPTIONAL", + /** + * REQUIRED - Denotes a field as required. + * This indicates that the field **must** be provided as part of the request, + * and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + */ + REQUIRED = "REQUIRED", + /** + * OUTPUT_ONLY - Denotes a field as output only. + * This indicates that the field is provided in responses, but including the + * field in a request does nothing (the server *must* ignore it and + * *must not* throw an error as a result of the field's presence). + */ + OUTPUT_ONLY = "OUTPUT_ONLY", + /** + * INPUT_ONLY - Denotes a field as input only. + * This indicates that the field is provided in requests, and the + * corresponding field is not included in output. + */ + INPUT_ONLY = "INPUT_ONLY", + /** + * IMMUTABLE - Denotes a field as immutable. + * This indicates that the field may be set once in a request to create a + * resource, but may not be changed thereafter. + */ + IMMUTABLE = "IMMUTABLE", + /** + * UNORDERED_LIST - Denotes that a (repeated) field is an unordered list. + * This indicates that the service may provide the elements of the list + * in any arbitrary order, rather than the order the user originally + * provided. Additionally, the list's order may or may not be stable. + */ + UNORDERED_LIST = "UNORDERED_LIST", + /** + * NON_EMPTY_DEFAULT - Denotes that this field returns a non-empty default value if not set. + * This indicates that if the user provides the empty value in a request, + * a non-empty value will be returned. The user will not be aware of what + * non-empty value to expect. + */ + NON_EMPTY_DEFAULT = "NON_EMPTY_DEFAULT", + /** + * IDENTIFIER - Denotes that the field in a resource (a message annotated with + * google.api.resource) is used in the resource name to uniquely identify the + * resource. For AIP-compliant APIs, this should only be applied to the + * `name` field on the resource. + * + * This behavior should not be applied to references to other resources within + * the message. + * + * The identifier field of resources often have different field behavior + * depending on the request it is embedded in (e.g. for Create methods name + * is optional and unused, while for Update methods it is required). Instead + * of method-specific annotations, only `IDENTIFIER` is required. + */ + IDENTIFIER = "IDENTIFIER", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldBehaviorFromJSON(object: any): FieldBehavior { + switch (object) { + case 0: + case "FIELD_BEHAVIOR_UNSPECIFIED": + return FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED; + case 1: + case "OPTIONAL": + return FieldBehavior.OPTIONAL; + case 2: + case "REQUIRED": + return FieldBehavior.REQUIRED; + case 3: + case "OUTPUT_ONLY": + return FieldBehavior.OUTPUT_ONLY; + case 4: + case "INPUT_ONLY": + return FieldBehavior.INPUT_ONLY; + case 5: + case "IMMUTABLE": + return FieldBehavior.IMMUTABLE; + case 6: + case "UNORDERED_LIST": + return FieldBehavior.UNORDERED_LIST; + case 7: + case "NON_EMPTY_DEFAULT": + return FieldBehavior.NON_EMPTY_DEFAULT; + case 8: + case "IDENTIFIER": + return FieldBehavior.IDENTIFIER; + case -1: + case "UNRECOGNIZED": + default: + return FieldBehavior.UNRECOGNIZED; + } +} + +export function fieldBehaviorToNumber(object: FieldBehavior): number { + switch (object) { + case FieldBehavior.FIELD_BEHAVIOR_UNSPECIFIED: + return 0; + case FieldBehavior.OPTIONAL: + return 1; + case FieldBehavior.REQUIRED: + return 2; + case FieldBehavior.OUTPUT_ONLY: + return 3; + case FieldBehavior.INPUT_ONLY: + return 4; + case FieldBehavior.IMMUTABLE: + return 5; + case FieldBehavior.UNORDERED_LIST: + return 6; + case FieldBehavior.NON_EMPTY_DEFAULT: + return 7; + case FieldBehavior.IDENTIFIER: + return 8; + case FieldBehavior.UNRECOGNIZED: + default: + return -1; + } +} diff --git a/web/src/types/proto/google/api/http.ts b/web/src/types/proto/google/api/http.ts new file mode 100644 index 00000000..4901d767 --- /dev/null +++ b/web/src/types/proto/google/api/http.ts @@ -0,0 +1,670 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/api/http.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.api"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} + +/** + * gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo` + * - gRPC: `GetMessage(message_id: "123456" revision: 2 sub: + * SubMessage(subfield: "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * The following HTTP JSON to RPC mapping is enabled: + * + * - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }` + * - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * - HTTP: `GET /v1/messages/123456` + * - gRPC: `GetMessage(message_id: "123456")` + * + * - HTTP: `GET /v1/users/me/messages/123456` + * - gRPC: `GetMessage(user_id: "me" message_id: "123456")` + * + * Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * The following example selects a gRPC method and applies an `HttpRule` to it: + * + * http: + * rules: + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: + | string + | undefined; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: + | string + | undefined; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: + | string + | undefined; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: + | string + | undefined; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: + | string + | undefined; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: + | CustomHttpPattern + | undefined; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} + +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} + +function createBaseHttp(): Http { + return { rules: [], fullyDecodeReservedExpansion: false }; +} + +export const Http: MessageFns = { + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fullyDecodeReservedExpansion !== false) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fullyDecodeReservedExpansion = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Http { + return Http.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, +}; + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [], + }; +} + +export const HttpRule: MessageFns = { + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).join(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.get = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.put = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.post = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.delete = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.patch = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.body = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.responseBody = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HttpRule { + return HttpRule.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HttpRule { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = (object.custom !== undefined && object.custom !== null) + ? CustomHttpPattern.fromPartial(object.custom) + : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +export const CustomHttpPattern: MessageFns = { + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CustomHttpPattern { + return CustomHttpPattern.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/api/httpbody.ts b/web/src/types/proto/google/api/httpbody.ts new file mode 100644 index 00000000..1c4ac74b --- /dev/null +++ b/web/src/types/proto/google/api/httpbody.ts @@ -0,0 +1,152 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/api/httpbody.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../protobuf/any"; + +export const protobufPackage = "google.api"; + +/** + * Message that represents an arbitrary HTTP body. It should only be used for + * payload formats that can't be represented as JSON, such as raw binary or + * an HTML page. + * + * This message can be used both in streaming and non-streaming API methods in + * the request as well as the response. + * + * It can be used as a top-level request field, which is convenient if one + * wants to extract parameters from either the URL or HTTP template into the + * request fields and also want access to the raw HTTP body. + * + * Example: + * + * message GetResourceRequest { + * // A unique request id. + * string request_id = 1; + * + * // The raw HTTP body is bound to this field. + * google.api.HttpBody http_body = 2; + * + * } + * + * service ResourceService { + * rpc GetResource(GetResourceRequest) + * returns (google.api.HttpBody); + * rpc UpdateResource(google.api.HttpBody) + * returns (google.protobuf.Empty); + * + * } + * + * Example with streaming methods: + * + * service CaldavService { + * rpc GetCalendar(stream google.api.HttpBody) + * returns (stream google.api.HttpBody); + * rpc UpdateCalendar(stream google.api.HttpBody) + * returns (stream google.api.HttpBody); + * + * } + * + * Use of this type only changes how the request and response bodies are + * handled, all other features will continue to work unchanged. + */ +export interface HttpBody { + /** The HTTP Content-Type header value specifying the content type of the body. */ + contentType: string; + /** The HTTP request/response body as raw binary. */ + data: Uint8Array; + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + extensions: Any[]; +} + +function createBaseHttpBody(): HttpBody { + return { contentType: "", data: new Uint8Array(0), extensions: [] }; +} + +export const HttpBody: MessageFns = { + encode(message: HttpBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.contentType !== "") { + writer.uint32(10).string(message.contentType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + for (const v of message.extensions) { + Any.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.contentType = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.extensions.push(Any.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): HttpBody { + return HttpBody.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HttpBody { + const message = createBaseHttpBody(); + message.contentType = object.contentType ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.extensions = object.extensions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/api/launch_stage.ts b/web/src/types/proto/google/api/launch_stage.ts new file mode 100644 index 00000000..0c905fd2 --- /dev/null +++ b/web/src/types/proto/google/api/launch_stage.ts @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/api/launch_stage.proto + +/* eslint-disable */ + +export const protobufPackage = "google.api"; + +/** + * The launch stage as defined by [Google Cloud Platform + * Launch Stages](https://cloud.google.com/terms/launch-stages). + */ +export enum LaunchStage { + /** LAUNCH_STAGE_UNSPECIFIED - Do not use this default value. */ + LAUNCH_STAGE_UNSPECIFIED = "LAUNCH_STAGE_UNSPECIFIED", + /** UNIMPLEMENTED - The feature is not yet implemented. Users can not use it. */ + UNIMPLEMENTED = "UNIMPLEMENTED", + /** PRELAUNCH - Prelaunch features are hidden from users and are only visible internally. */ + PRELAUNCH = "PRELAUNCH", + /** + * EARLY_ACCESS - Early Access features are limited to a closed group of testers. To use + * these features, you must sign up in advance and sign a Trusted Tester + * agreement (which includes confidentiality provisions). These features may + * be unstable, changed in backward-incompatible ways, and are not + * guaranteed to be released. + */ + EARLY_ACCESS = "EARLY_ACCESS", + /** + * ALPHA - Alpha is a limited availability test for releases before they are cleared + * for widespread use. By Alpha, all significant design issues are resolved + * and we are in the process of verifying functionality. Alpha customers + * need to apply for access, agree to applicable terms, and have their + * projects allowlisted. Alpha releases don't have to be feature complete, + * no SLAs are provided, and there are no technical support obligations, but + * they will be far enough along that customers can actually use them in + * test environments or for limited-use tests -- just like they would in + * normal production cases. + */ + ALPHA = "ALPHA", + /** + * BETA - Beta is the point at which we are ready to open a release for any + * customer to use. There are no SLA or technical support obligations in a + * Beta release. Products will be complete from a feature perspective, but + * may have some open outstanding issues. Beta releases are suitable for + * limited production use cases. + */ + BETA = "BETA", + /** + * GA - GA features are open to all developers and are considered stable and + * fully qualified for production use. + */ + GA = "GA", + /** + * DEPRECATED - Deprecated features are scheduled to be shut down and removed. For more + * information, see the "Deprecation Policy" section of our [Terms of + * Service](https://cloud.google.com/terms/) + * and the [Google Cloud Platform Subject to the Deprecation + * Policy](https://cloud.google.com/terms/deprecation) documentation. + */ + DEPRECATED = "DEPRECATED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function launchStageFromJSON(object: any): LaunchStage { + switch (object) { + case 0: + case "LAUNCH_STAGE_UNSPECIFIED": + return LaunchStage.LAUNCH_STAGE_UNSPECIFIED; + case 6: + case "UNIMPLEMENTED": + return LaunchStage.UNIMPLEMENTED; + case 7: + case "PRELAUNCH": + return LaunchStage.PRELAUNCH; + case 1: + case "EARLY_ACCESS": + return LaunchStage.EARLY_ACCESS; + case 2: + case "ALPHA": + return LaunchStage.ALPHA; + case 3: + case "BETA": + return LaunchStage.BETA; + case 4: + case "GA": + return LaunchStage.GA; + case 5: + case "DEPRECATED": + return LaunchStage.DEPRECATED; + case -1: + case "UNRECOGNIZED": + default: + return LaunchStage.UNRECOGNIZED; + } +} + +export function launchStageToNumber(object: LaunchStage): number { + switch (object) { + case LaunchStage.LAUNCH_STAGE_UNSPECIFIED: + return 0; + case LaunchStage.UNIMPLEMENTED: + return 6; + case LaunchStage.PRELAUNCH: + return 7; + case LaunchStage.EARLY_ACCESS: + return 1; + case LaunchStage.ALPHA: + return 2; + case LaunchStage.BETA: + return 3; + case LaunchStage.GA: + return 4; + case LaunchStage.DEPRECATED: + return 5; + case LaunchStage.UNRECOGNIZED: + default: + return -1; + } +} diff --git a/web/src/types/proto/google/protobuf/any.ts b/web/src/types/proto/google/protobuf/any.ts new file mode 100644 index 00000000..278afc8f --- /dev/null +++ b/web/src/types/proto/google/protobuf/any.ts @@ -0,0 +1,206 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/protobuf/any.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { typeUrl: "", value: new Uint8Array(0) }; +} + +export const Any: MessageFns = { + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.typeUrl = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Any { + return Any.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Any { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/protobuf/descriptor.ts b/web/src/types/proto/google/protobuf/descriptor.ts new file mode 100644 index 00000000..89514564 --- /dev/null +++ b/web/src/types/proto/google/protobuf/descriptor.ts @@ -0,0 +1,5624 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/protobuf/descriptor.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = "EDITION_UNKNOWN", + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = "EDITION_LEGACY", + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = "EDITION_PROTO2", + EDITION_PROTO3 = "EDITION_PROTO3", + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = "EDITION_2023", + EDITION_2024 = "EDITION_2024", + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relied on outside of tests. + */ + EDITION_1_TEST_ONLY = "EDITION_1_TEST_ONLY", + EDITION_2_TEST_ONLY = "EDITION_2_TEST_ONLY", + EDITION_99997_TEST_ONLY = "EDITION_99997_TEST_ONLY", + EDITION_99998_TEST_ONLY = "EDITION_99998_TEST_ONLY", + EDITION_99999_TEST_ONLY = "EDITION_99999_TEST_ONLY", + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = "EDITION_MAX", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToNumber(object: Edition): number { + switch (object) { + case Edition.EDITION_UNKNOWN: + return 0; + case Edition.EDITION_LEGACY: + return 900; + case Edition.EDITION_PROTO2: + return 998; + case Edition.EDITION_PROTO3: + return 999; + case Edition.EDITION_2023: + return 1000; + case Edition.EDITION_2024: + return 1001; + case Edition.EDITION_1_TEST_ONLY: + return 1; + case Edition.EDITION_2_TEST_ONLY: + return 2; + case Edition.EDITION_99997_TEST_ONLY: + return 99997; + case Edition.EDITION_99998_TEST_ONLY: + return 99998; + case Edition.EDITION_99999_TEST_ONLY: + return 99999; + case Edition.EDITION_MAX: + return 2147483647; + case Edition.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name?: + | string + | undefined; + /** e.g. "foo", "foo.bar", etc. */ + package?: + | string + | undefined; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: + | FileOptions + | undefined; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + sourceCodeInfo?: + | SourceCodeInfo + | undefined; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + syntax?: + | string + | undefined; + /** + * The edition of the proto file. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + edition?: Edition | undefined; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name?: string | undefined; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions | undefined; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; +} + +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Exclusive. */ + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; +} + +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Exclusive. */ + end?: number | undefined; +} + +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: + | FeatureSet + | undefined; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptions_VerificationState | undefined; +} + +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = "DECLARATION", + UNVERIFIED = "UNVERIFIED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptions_VerificationStateToNumber( + object: ExtensionRangeOptions_VerificationState, +): number { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return 0; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return 1; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return -1; + } +} + +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number?: + | number + | undefined; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName?: + | string + | undefined; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: + | string + | undefined; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: + | boolean + | undefined; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean | undefined; +} + +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type?: + | FieldDescriptorProto_Type + | undefined; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName?: + | string + | undefined; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee?: + | string + | undefined; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + */ + defaultValue?: + | string + | undefined; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex?: + | number + | undefined; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName?: string | undefined; + options?: + | FieldOptions + | undefined; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3Optional?: boolean | undefined; +} + +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = "TYPE_DOUBLE", + TYPE_FLOAT = "TYPE_FLOAT", + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = "TYPE_INT64", + TYPE_UINT64 = "TYPE_UINT64", + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = "TYPE_INT32", + TYPE_FIXED64 = "TYPE_FIXED64", + TYPE_FIXED32 = "TYPE_FIXED32", + TYPE_BOOL = "TYPE_BOOL", + TYPE_STRING = "TYPE_STRING", + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + TYPE_GROUP = "TYPE_GROUP", + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = "TYPE_MESSAGE", + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = "TYPE_BYTES", + TYPE_UINT32 = "TYPE_UINT32", + TYPE_ENUM = "TYPE_ENUM", + TYPE_SFIXED32 = "TYPE_SFIXED32", + TYPE_SFIXED64 = "TYPE_SFIXED64", + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = "TYPE_SINT32", + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = "TYPE_SINT64", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_TypeToNumber(object: FieldDescriptorProto_Type): number { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return 1; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return 2; + case FieldDescriptorProto_Type.TYPE_INT64: + return 3; + case FieldDescriptorProto_Type.TYPE_UINT64: + return 4; + case FieldDescriptorProto_Type.TYPE_INT32: + return 5; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return 6; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return 7; + case FieldDescriptorProto_Type.TYPE_BOOL: + return 8; + case FieldDescriptorProto_Type.TYPE_STRING: + return 9; + case FieldDescriptorProto_Type.TYPE_GROUP: + return 10; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return 11; + case FieldDescriptorProto_Type.TYPE_BYTES: + return 12; + case FieldDescriptorProto_Type.TYPE_UINT32: + return 13; + case FieldDescriptorProto_Type.TYPE_ENUM: + return 14; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return 15; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return 16; + case FieldDescriptorProto_Type.TYPE_SINT32: + return 17; + case FieldDescriptorProto_Type.TYPE_SINT64: + return 18; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = "LABEL_OPTIONAL", + LABEL_REPEATED = "LABEL_REPEATED", + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = "LABEL_REQUIRED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_LabelToNumber(object: FieldDescriptorProto_Label): number { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return 1; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return 3; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return 2; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return -1; + } +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name?: string | undefined; + options?: OneofOptions | undefined; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name?: string | undefined; + value: EnumValueDescriptorProto[]; + options?: + | EnumOptions + | undefined; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} + +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Inclusive. */ + end?: number | undefined; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name?: string | undefined; + method: MethodDescriptorProto[]; + options?: ServiceOptions | undefined; +} + +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name?: + | string + | undefined; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType?: string | undefined; + outputType?: string | undefined; + options?: + | MethodOptions + | undefined; + /** Identifies if client streams multiple client messages */ + clientStreaming?: + | boolean + | undefined; + /** Identifies if server streams multiple server messages */ + serverStreaming?: boolean | undefined; +} + +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage?: + | string + | undefined; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + javaOuterClassname?: + | string + | undefined; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles?: + | boolean + | undefined; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash?: + | boolean + | undefined; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage?: + | string + | undefined; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: + | boolean + | undefined; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated?: + | boolean + | undefined; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas?: + | boolean + | undefined; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix?: + | string + | undefined; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace?: + | string + | undefined; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix?: + | string + | undefined; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix?: + | string + | undefined; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace?: + | string + | undefined; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace?: + | string + | undefined; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage?: + | string + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = "SPEED", + /** CODE_SIZE - etc. */ + CODE_SIZE = "CODE_SIZE", + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = "LITE_RUNTIME", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} + +export function fileOptions_OptimizeModeToNumber(object: FileOptions_OptimizeMode): number { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return 1; + case FileOptions_OptimizeMode.CODE_SIZE: + return 2; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return 3; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return -1; + } +} + +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat?: + | boolean + | undefined; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor?: + | boolean + | undefined; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated?: + | boolean + | undefined; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead. + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release. + * TODO: make ctype actually deprecated. + */ + ctype?: + | FieldOptions_CType + | undefined; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + packed?: + | boolean + | undefined; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype?: + | FieldOptions_JSType + | undefined; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: + | boolean + | undefined; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy?: + | boolean + | undefined; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated?: + | boolean + | undefined; + /** For Google-internal migration only. Do not use. */ + weak?: + | boolean + | undefined; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact?: boolean | undefined; + retention?: FieldOptions_OptionRetention | undefined; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: FeatureSet | undefined; + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = "STRING", + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + CORD = "CORD", + STRING_PIECE = "STRING_PIECE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} + +export function fieldOptions_CTypeToNumber(object: FieldOptions_CType): number { + switch (object) { + case FieldOptions_CType.STRING: + return 0; + case FieldOptions_CType.CORD: + return 1; + case FieldOptions_CType.STRING_PIECE: + return 2; + case FieldOptions_CType.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = "JS_NORMAL", + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = "JS_STRING", + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = "JS_NUMBER", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} + +export function fieldOptions_JSTypeToNumber(object: FieldOptions_JSType): number { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return 0; + case FieldOptions_JSType.JS_STRING: + return 1; + case FieldOptions_JSType.JS_NUMBER: + return 2; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return -1; + } +} + +/** If set to RETENTION_SOURCE, the option will be omitted from the binary. */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = "RETENTION_UNKNOWN", + RETENTION_RUNTIME = "RETENTION_RUNTIME", + RETENTION_SOURCE = "RETENTION_SOURCE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToNumber(object: FieldOptions_OptionRetention): number { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return 0; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return 1; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return 2; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = "TARGET_TYPE_UNKNOWN", + TARGET_TYPE_FILE = "TARGET_TYPE_FILE", + TARGET_TYPE_EXTENSION_RANGE = "TARGET_TYPE_EXTENSION_RANGE", + TARGET_TYPE_MESSAGE = "TARGET_TYPE_MESSAGE", + TARGET_TYPE_FIELD = "TARGET_TYPE_FIELD", + TARGET_TYPE_ONEOF = "TARGET_TYPE_ONEOF", + TARGET_TYPE_ENUM = "TARGET_TYPE_ENUM", + TARGET_TYPE_ENUM_ENTRY = "TARGET_TYPE_ENUM_ENTRY", + TARGET_TYPE_SERVICE = "TARGET_TYPE_SERVICE", + TARGET_TYPE_METHOD = "TARGET_TYPE_METHOD", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToNumber(object: FieldOptions_OptionTargetType): number { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return 0; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return 1; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return 2; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return 3; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return 4; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return 5; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return 6; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return 7; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return 8; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return 9; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return -1; + } +} + +export interface FieldOptions_EditionDefault { + edition?: + | Edition + | undefined; + /** Textproto value. */ + value?: string | undefined; +} + +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced?: + | Edition + | undefined; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated?: + | Edition + | undefined; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning?: + | string + | undefined; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved?: Edition | undefined; +} + +export interface OneofOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias?: + | boolean + | undefined; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated?: + | boolean + | undefined; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts?: + | boolean + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated?: + | boolean + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact?: + | boolean + | undefined; + /** Information about the support window of a feature value. */ + featureSupport?: + | FieldOptions_FeatureSupport + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** + * Any features defined in the specific edition. + * WARNING: This field should only be used by protobuf plugins or special + * cases like the proto compiler. Other uses are discouraged and + * developers should rely on the protoreflect APIs for their client language. + */ + features?: + | FeatureSet + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = "IDEMPOTENCY_UNKNOWN", + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = "NO_SIDE_EFFECTS", + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = "IDEMPOTENT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} + +export function methodOptions_IdempotencyLevelToNumber(object: MethodOptions_IdempotencyLevel): number { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return 0; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return 1; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return 2; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; +} + +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} + +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + */ +export interface FeatureSet { + fieldPresence?: FeatureSet_FieldPresence | undefined; + enumType?: FeatureSet_EnumType | undefined; + repeatedFieldEncoding?: FeatureSet_RepeatedFieldEncoding | undefined; + utf8Validation?: FeatureSet_Utf8Validation | undefined; + messageEncoding?: FeatureSet_MessageEncoding | undefined; + jsonFormat?: FeatureSet_JsonFormat | undefined; + enforceNamingStyle?: FeatureSet_EnforceNamingStyle | undefined; +} + +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = "FIELD_PRESENCE_UNKNOWN", + EXPLICIT = "EXPLICIT", + IMPLICIT = "IMPLICIT", + LEGACY_REQUIRED = "LEGACY_REQUIRED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} + +export function featureSet_FieldPresenceToNumber(object: FeatureSet_FieldPresence): number { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return 0; + case FeatureSet_FieldPresence.EXPLICIT: + return 1; + case FeatureSet_FieldPresence.IMPLICIT: + return 2; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return 3; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = "ENUM_TYPE_UNKNOWN", + OPEN = "OPEN", + CLOSED = "CLOSED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} + +export function featureSet_EnumTypeToNumber(object: FeatureSet_EnumType): number { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return 0; + case FeatureSet_EnumType.OPEN: + return 1; + case FeatureSet_EnumType.CLOSED: + return 2; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = "REPEATED_FIELD_ENCODING_UNKNOWN", + PACKED = "PACKED", + EXPANDED = "EXPANDED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSet_RepeatedFieldEncodingToNumber(object: FeatureSet_RepeatedFieldEncoding): number { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return 0; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return 1; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return 2; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = "UTF8_VALIDATION_UNKNOWN", + VERIFY = "VERIFY", + NONE = "NONE", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} + +export function featureSet_Utf8ValidationToNumber(object: FeatureSet_Utf8Validation): number { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return 0; + case FeatureSet_Utf8Validation.VERIFY: + return 2; + case FeatureSet_Utf8Validation.NONE: + return 3; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = "MESSAGE_ENCODING_UNKNOWN", + LENGTH_PREFIXED = "LENGTH_PREFIXED", + DELIMITED = "DELIMITED", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} + +export function featureSet_MessageEncodingToNumber(object: FeatureSet_MessageEncoding): number { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return 0; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return 1; + case FeatureSet_MessageEncoding.DELIMITED: + return 2; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = "JSON_FORMAT_UNKNOWN", + ALLOW = "ALLOW", + LEGACY_BEST_EFFORT = "LEGACY_BEST_EFFORT", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} + +export function featureSet_JsonFormatToNumber(object: FeatureSet_JsonFormat): number { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return 0; + case FeatureSet_JsonFormat.ALLOW: + return 1; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return 2; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return -1; + } +} + +export enum FeatureSet_EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = "ENFORCE_NAMING_STYLE_UNKNOWN", + STYLE2024 = "STYLE2024", + STYLE_LEGACY = "STYLE_LEGACY", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function featureSet_EnforceNamingStyleFromJSON(object: any): FeatureSet_EnforceNamingStyle { + switch (object) { + case 0: + case "ENFORCE_NAMING_STYLE_UNKNOWN": + return FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + case 1: + case "STYLE2024": + return FeatureSet_EnforceNamingStyle.STYLE2024; + case 2: + case "STYLE_LEGACY": + return FeatureSet_EnforceNamingStyle.STYLE_LEGACY; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnforceNamingStyle.UNRECOGNIZED; + } +} + +export function featureSet_EnforceNamingStyleToNumber(object: FeatureSet_EnforceNamingStyle): number { + switch (object) { + case FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN: + return 0; + case FeatureSet_EnforceNamingStyle.STYLE2024: + return 1; + case FeatureSet_EnforceNamingStyle.STYLE_LEGACY: + return 2; + case FeatureSet_EnforceNamingStyle.UNRECOGNIZED: + default: + return -1; + } +} + +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition?: + | Edition + | undefined; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition?: Edition | undefined; +} + +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition?: + | Edition + | undefined; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: + | FeatureSet + | undefined; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet | undefined; +} + +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} + +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. * / + * /* Block comment attached to + * * grault. * / + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments?: string | undefined; + trailingComments?: string | undefined; + leadingDetachedComments: string[]; +} + +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} + +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile?: + | string + | undefined; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin?: + | number + | undefined; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number | undefined; + semantic?: GeneratedCodeInfo_Annotation_Semantic | undefined; +} + +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = "NONE", + /** SET - The element is set or otherwise mutated. */ + SET = "SET", + /** ALIAS - An alias to the element is returned. */ + ALIAS = "ALIAS", + UNRECOGNIZED = "UNRECOGNIZED", +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToNumber(object: GeneratedCodeInfo_Annotation_Semantic): number { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return 0; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return 1; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return 2; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return -1; + } +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +export const FileDescriptorSet: MessageFns = { + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FileDescriptorSet { + return FileDescriptorSet.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + edition: Edition.EDITION_UNKNOWN, + }; +} + +export const FileDescriptorProto: MessageFns = { + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== undefined && message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v!); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.join(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.join(); + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).join(); + } + if (message.syntax !== undefined && message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== undefined && message.edition !== Edition.EDITION_UNKNOWN) { + writer.uint32(112).int32(editionToNumber(message.edition)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.package = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.dependency.push(reader.string()); + continue; + } + case 10: { + if (tag === 80) { + message.publicDependency.push(reader.int32()); + + continue; + } + + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + + continue; + } + + break; + } + case 11: { + if (tag === 88) { + message.weakDependency.push(reader.int32()); + + continue; + } + + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + + continue; + } + + break; + } + case 4: { + if (tag !== 34) { + break; + } + + message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.options = FileOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.syntax = reader.string(); + continue; + } + case 14: { + if (tag !== 112) { + break; + } + + message.edition = editionFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FileDescriptorProto { + return FileDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.publicDependency = object.publicDependency?.map((e) => e) || []; + message.weakDependency = object.weakDependency?.map((e) => e) || []; + message.messageType = object.messageType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? FileOptions.fromPartial(object.options) + : undefined; + message.sourceCodeInfo = (object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null) + ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) + : undefined; + message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? Edition.EDITION_UNKNOWN; + return message; + }, +}; + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + }; +} + +export const DescriptorProto: MessageFns = { + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.options = MessageOptions.decode(reader, reader.uint32()); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.reservedName.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DescriptorProto { + return DescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DescriptorProto { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map((e) => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? MessageOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map((e) => e) || []; + return message; + }, +}; + +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { start: 0, end: 0, options: undefined }; +} + +export const DescriptorProto_ExtensionRange: MessageFns = { + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? ExtensionRangeOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { start: 0, end: 0 }; +} + +export const DescriptorProto_ReservedRange: MessageFns = { + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { + uninterpretedOption: [], + declaration: [], + features: undefined, + verification: ExtensionRangeOptions_VerificationState.UNVERIFIED, + }; +} + +export const ExtensionRangeOptions: MessageFns = { + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if ( + message.verification !== undefined && message.verification !== ExtensionRangeOptions_VerificationState.DECLARATION + ) { + writer.uint32(24).int32(extensionRangeOptions_VerificationStateToNumber(message.verification)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.verification = extensionRangeOptions_VerificationStateFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ExtensionRangeOptions { + return ExtensionRangeOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.verification = object.verification ?? ExtensionRangeOptions_VerificationState.UNVERIFIED; + return message; + }, +}; + +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; +} + +export const ExtensionRangeOptions_Declaration: MessageFns = { + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== undefined && message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.fullName = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: FieldDescriptorProto_Label.LABEL_OPTIONAL, + type: FieldDescriptorProto_Type.TYPE_DOUBLE, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto: MessageFns = { + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== FieldDescriptorProto_Label.LABEL_OPTIONAL) { + writer.uint32(32).int32(fieldDescriptorProto_LabelToNumber(message.label)); + } + if (message.type !== undefined && message.type !== FieldDescriptorProto_Type.TYPE_DOUBLE) { + writer.uint32(40).int32(fieldDescriptorProto_TypeToNumber(message.type)); + } + if (message.typeName !== undefined && message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== undefined && message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== undefined && message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== undefined && message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.proto3Optional !== undefined && message.proto3Optional !== false) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.number = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.label = fieldDescriptorProto_LabelFromJSON(reader.int32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.type = fieldDescriptorProto_TypeFromJSON(reader.int32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.typeName = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.extendee = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.defaultValue = reader.string(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.oneofIndex = reader.int32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.jsonName = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.options = FieldOptions.decode(reader, reader.uint32()); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.proto3Optional = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldDescriptorProto { + return FieldDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? FieldDescriptorProto_Label.LABEL_OPTIONAL; + message.type = object.type ?? FieldDescriptorProto_Type.TYPE_DOUBLE; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? FieldOptions.fromPartial(object.options) + : undefined; + message.proto3Optional = object.proto3Optional ?? false; + return message; + }, +}; + +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { name: "", options: undefined }; +} + +export const OneofDescriptorProto: MessageFns = { + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.options = OneofOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): OneofDescriptorProto { + return OneofDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? OneofOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { name: "", value: [], options: undefined, reservedRange: [], reservedName: [] }; +} + +export const EnumDescriptorProto: MessageFns = { + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = EnumOptions.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.reservedName.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EnumDescriptorProto { + return EnumDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map((e) => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? EnumOptions.fromPartial(object.options) + : undefined; + message.reservedRange = object.reservedRange?.map((e) => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || + []; + message.reservedName = object.reservedName?.map((e) => e) || []; + return message; + }, +}; + +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { start: 0, end: 0 }; +} + +export const EnumDescriptorProto_EnumReservedRange: MessageFns = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { name: "", number: 0, options: undefined }; +} + +export const EnumValueDescriptorProto: MessageFns = { + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = EnumValueOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = (object.options !== undefined && object.options !== null) + ? EnumValueOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { name: "", method: [], options: undefined }; +} + +export const ServiceDescriptorProto: MessageFns = { + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.options = ServiceOptions.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ServiceDescriptorProto { + return ServiceDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map((e) => MethodDescriptorProto.fromPartial(e)) || []; + message.options = (object.options !== undefined && object.options !== null) + ? ServiceOptions.fromPartial(object.options) + : undefined; + return message; + }, +}; + +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false, + }; +} + +export const MethodDescriptorProto: MessageFns = { + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== undefined && message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== undefined && message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); + } + if (message.clientStreaming !== undefined && message.clientStreaming !== false) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming !== undefined && message.serverStreaming !== false) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.inputType = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.outputType = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.options = MethodOptions.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.clientStreaming = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.serverStreaming = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MethodDescriptorProto { + return MethodDescriptorProto.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = (object.options !== undefined && object.options !== null) + ? MethodOptions.fromPartial(object.options) + : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, +}; + +function createBaseFileOptions(): FileOptions { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: FileOptions_OptimizeMode.SPEED, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + deprecated: false, + ccEnableArenas: true, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + features: undefined, + uninterpretedOption: [], + }; +} + +export const FileOptions: MessageFns = { + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.javaPackage !== undefined && message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== undefined && message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles !== undefined && message.javaMultipleFiles !== false) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash !== undefined && message.javaGenerateEqualsAndHash !== false) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 !== undefined && message.javaStringCheckUtf8 !== false) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== undefined && message.optimizeFor !== FileOptions_OptimizeMode.SPEED) { + writer.uint32(72).int32(fileOptions_OptimizeModeToNumber(message.optimizeFor)); + } + if (message.goPackage !== undefined && message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices !== undefined && message.ccGenericServices !== false) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices !== undefined && message.javaGenericServices !== false) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices !== undefined && message.pyGenericServices !== false) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas !== undefined && message.ccEnableArenas !== true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== undefined && message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== undefined && message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== undefined && message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== undefined && message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== undefined && message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== undefined && message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== undefined && message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.javaPackage = reader.string(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.javaOuterClassname = reader.string(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.javaMultipleFiles = reader.bool(); + continue; + } + case 20: { + if (tag !== 160) { + break; + } + + message.javaGenerateEqualsAndHash = reader.bool(); + continue; + } + case 27: { + if (tag !== 216) { + break; + } + + message.javaStringCheckUtf8 = reader.bool(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.optimizeFor = fileOptions_OptimizeModeFromJSON(reader.int32()); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.goPackage = reader.string(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.ccGenericServices = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.javaGenericServices = reader.bool(); + continue; + } + case 18: { + if (tag !== 144) { + break; + } + + message.pyGenericServices = reader.bool(); + continue; + } + case 23: { + if (tag !== 184) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 31: { + if (tag !== 248) { + break; + } + + message.ccEnableArenas = reader.bool(); + continue; + } + case 36: { + if (tag !== 290) { + break; + } + + message.objcClassPrefix = reader.string(); + continue; + } + case 37: { + if (tag !== 298) { + break; + } + + message.csharpNamespace = reader.string(); + continue; + } + case 39: { + if (tag !== 314) { + break; + } + + message.swiftPrefix = reader.string(); + continue; + } + case 40: { + if (tag !== 322) { + break; + } + + message.phpClassPrefix = reader.string(); + continue; + } + case 41: { + if (tag !== 330) { + break; + } + + message.phpNamespace = reader.string(); + continue; + } + case 44: { + if (tag !== 354) { + break; + } + + message.phpMetadataNamespace = reader.string(); + continue; + } + case 45: { + if (tag !== 362) { + break; + } + + message.rubyPackage = reader.string(); + continue; + } + case 50: { + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FileOptions { + return FileOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FileOptions { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? FileOptions_OptimizeMode.SPEED; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? true; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const MessageOptions: MessageFns = { + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.messageSetWireFormat !== undefined && message.messageSetWireFormat !== false) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor !== undefined && message.noStandardDescriptorAccessor !== false) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry !== undefined && message.mapEntry !== false) { + writer.uint32(56).bool(message.mapEntry); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.messageSetWireFormat = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.noStandardDescriptorAccessor = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.mapEntry = reader.bool(); + continue; + } + case 11: { + if (tag !== 88) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MessageOptions { + return MessageOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MessageOptions { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions(): FieldOptions { + return { + ctype: FieldOptions_CType.STRING, + packed: false, + jstype: FieldOptions_JSType.JS_NORMAL, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: FieldOptions_OptionRetention.RETENTION_UNKNOWN, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [], + }; +} + +export const FieldOptions: MessageFns = { + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== FieldOptions_CType.STRING) { + writer.uint32(8).int32(fieldOptions_CTypeToNumber(message.ctype)); + } + if (message.packed !== undefined && message.packed !== false) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== undefined && message.jstype !== FieldOptions_JSType.JS_NORMAL) { + writer.uint32(48).int32(fieldOptions_JSTypeToNumber(message.jstype)); + } + if (message.lazy !== undefined && message.lazy !== false) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy !== undefined && message.unverifiedLazy !== false) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak !== undefined && message.weak !== false) { + writer.uint32(80).bool(message.weak); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== undefined && message.retention !== FieldOptions_OptionRetention.RETENTION_UNKNOWN) { + writer.uint32(136).int32(fieldOptions_OptionRetentionToNumber(message.retention)); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(fieldOptions_OptionTargetTypeToNumber(v)); + } + writer.join(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.ctype = fieldOptions_CTypeFromJSON(reader.int32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.packed = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.jstype = fieldOptions_JSTypeFromJSON(reader.int32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.lazy = reader.bool(); + continue; + } + case 15: { + if (tag !== 120) { + break; + } + + message.unverifiedLazy = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.weak = reader.bool(); + continue; + } + case 16: { + if (tag !== 128) { + break; + } + + message.debugRedact = reader.bool(); + continue; + } + case 17: { + if (tag !== 136) { + break; + } + + message.retention = fieldOptions_OptionRetentionFromJSON(reader.int32()); + continue; + } + case 19: { + if (tag === 152) { + message.targets.push(fieldOptions_OptionTargetTypeFromJSON(reader.int32())); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(fieldOptions_OptionTargetTypeFromJSON(reader.int32())); + } + + continue; + } + + break; + } + case 20: { + if (tag !== 162) { + break; + } + + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + continue; + } + case 21: { + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 22: { + if (tag !== 178) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldOptions { + return FieldOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? FieldOptions_CType.STRING; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? FieldOptions_JSType.JS_NORMAL; + message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? FieldOptions_OptionRetention.RETENTION_UNKNOWN; + message.targets = object.targets?.map((e) => e) || []; + message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { edition: Edition.EDITION_UNKNOWN, value: "" }; +} + +export const FieldOptions_EditionDefault: MessageFns = { + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== Edition.EDITION_UNKNOWN) { + writer.uint32(24).int32(editionToNumber(message.edition)); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + + message.edition = editionFromJSON(reader.int32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? Edition.EDITION_UNKNOWN; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { + editionIntroduced: Edition.EDITION_UNKNOWN, + editionDeprecated: Edition.EDITION_UNKNOWN, + deprecationWarning: "", + editionRemoved: Edition.EDITION_UNKNOWN, + }; +} + +export const FieldOptions_FeatureSupport: MessageFns = { + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.editionIntroduced !== undefined && message.editionIntroduced !== Edition.EDITION_UNKNOWN) { + writer.uint32(8).int32(editionToNumber(message.editionIntroduced)); + } + if (message.editionDeprecated !== undefined && message.editionDeprecated !== Edition.EDITION_UNKNOWN) { + writer.uint32(16).int32(editionToNumber(message.editionDeprecated)); + } + if (message.deprecationWarning !== undefined && message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== undefined && message.editionRemoved !== Edition.EDITION_UNKNOWN) { + writer.uint32(32).int32(editionToNumber(message.editionRemoved)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_FeatureSupport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.editionIntroduced = editionFromJSON(reader.int32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.editionDeprecated = editionFromJSON(reader.int32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.deprecationWarning = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.editionRemoved = editionFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? Edition.EDITION_UNKNOWN; + message.editionDeprecated = object.editionDeprecated ?? Edition.EDITION_UNKNOWN; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? Edition.EDITION_UNKNOWN; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpretedOption: [] }; +} + +export const OneofOptions: MessageFns = { + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): OneofOptions { + return OneofOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): OneofOptions { + const message = createBaseOneofOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [], + }; +} + +export const EnumOptions: MessageFns = { + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowAlias !== undefined && message.allowAlias !== false) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if ( + message.deprecatedLegacyJsonFieldConflicts !== undefined && message.deprecatedLegacyJsonFieldConflicts !== false + ) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 16) { + break; + } + + message.allowAlias = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EnumOptions { + return EnumOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EnumOptions { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumValueOptions(): EnumValueOptions { + return { + deprecated: false, + features: undefined, + debugRedact: false, + featureSupport: undefined, + uninterpretedOption: [], + }; +} + +export const EnumValueOptions: MessageFns = { + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(8).bool(message.deprecated); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debugRedact !== undefined && message.debugRedact !== false) { + writer.uint32(24).bool(message.debugRedact); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(34).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.debugRedact = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): EnumValueOptions { + return EnumValueOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.debugRedact = object.debugRedact ?? false; + message.featureSupport = (object.featureSupport !== undefined && object.featureSupport !== null) + ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceOptions(): ServiceOptions { + return { features: undefined, deprecated: false, uninterpretedOption: [] }; +} + +export const ServiceOptions: MessageFns = { + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 34: { + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 33: { + if (tag !== 264) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ServiceOptions { + return ServiceOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ServiceOptions { + const message = createBaseServiceOptions(); + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMethodOptions(): MethodOptions { + return { + deprecated: false, + idempotencyLevel: MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN, + features: undefined, + uninterpretedOption: [], + }; +} + +export const MethodOptions: MessageFns = { + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + if ( + message.idempotencyLevel !== undefined && + message.idempotencyLevel !== MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN + ) { + writer.uint32(272).int32(methodOptions_IdempotencyLevelToNumber(message.idempotencyLevel)); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: { + if (tag !== 264) { + break; + } + + message.deprecated = reader.bool(); + continue; + } + case 34: { + if (tag !== 272) { + break; + } + + message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(reader.int32()); + continue; + } + case 35: { + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 999: { + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): MethodOptions { + return MethodOptions.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + message.features = (object.features !== undefined && object.features !== null) + ? FeatureSet.fromPartial(object.features) + : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifierValue: "", + positiveIntValue: 0, + negativeIntValue: 0, + doubleValue: 0, + stringValue: new Uint8Array(0), + aggregateValue: "", + }; +} + +export const UninterpretedOption: MessageFns = { + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.identifierValue !== undefined && message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== undefined && message.positiveIntValue !== 0) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== undefined && message.negativeIntValue !== 0) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== undefined && message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue !== undefined && message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== undefined && message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (tag !== 18) { + break; + } + + message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.identifierValue = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.positiveIntValue = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.negativeIntValue = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 49) { + break; + } + + message.doubleValue = reader.double(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.stringValue = reader.bytes(); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.aggregateValue = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UninterpretedOption { + return UninterpretedOption.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = object.positiveIntValue ?? 0; + message.negativeIntValue = object.negativeIntValue ?? 0; + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(0); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, +}; + +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { namePart: "", isExtension: false }; +} + +export const UninterpretedOption_NamePart: MessageFns = { + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension !== false) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.namePart = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.isExtension = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, +}; + +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN, + enumType: FeatureSet_EnumType.ENUM_TYPE_UNKNOWN, + repeatedFieldEncoding: FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN, + utf8Validation: FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN, + messageEncoding: FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN, + jsonFormat: FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN, + enforceNamingStyle: FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN, + }; +} + +export const FeatureSet: MessageFns = { + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if ( + message.fieldPresence !== undefined && message.fieldPresence !== FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN + ) { + writer.uint32(8).int32(featureSet_FieldPresenceToNumber(message.fieldPresence)); + } + if (message.enumType !== undefined && message.enumType !== FeatureSet_EnumType.ENUM_TYPE_UNKNOWN) { + writer.uint32(16).int32(featureSet_EnumTypeToNumber(message.enumType)); + } + if ( + message.repeatedFieldEncoding !== undefined && + message.repeatedFieldEncoding !== FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN + ) { + writer.uint32(24).int32(featureSet_RepeatedFieldEncodingToNumber(message.repeatedFieldEncoding)); + } + if ( + message.utf8Validation !== undefined && + message.utf8Validation !== FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN + ) { + writer.uint32(32).int32(featureSet_Utf8ValidationToNumber(message.utf8Validation)); + } + if ( + message.messageEncoding !== undefined && + message.messageEncoding !== FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN + ) { + writer.uint32(40).int32(featureSet_MessageEncodingToNumber(message.messageEncoding)); + } + if (message.jsonFormat !== undefined && message.jsonFormat !== FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN) { + writer.uint32(48).int32(featureSet_JsonFormatToNumber(message.jsonFormat)); + } + if ( + message.enforceNamingStyle !== undefined && + message.enforceNamingStyle !== FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN + ) { + writer.uint32(56).int32(featureSet_EnforceNamingStyleToNumber(message.enforceNamingStyle)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.fieldPresence = featureSet_FieldPresenceFromJSON(reader.int32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.enumType = featureSet_EnumTypeFromJSON(reader.int32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingFromJSON(reader.int32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.utf8Validation = featureSet_Utf8ValidationFromJSON(reader.int32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.messageEncoding = featureSet_MessageEncodingFromJSON(reader.int32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.jsonFormat = featureSet_JsonFormatFromJSON(reader.int32()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.enforceNamingStyle = featureSet_EnforceNamingStyleFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FeatureSet { + return FeatureSet.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + message.enumType = object.enumType ?? FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? + FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + message.utf8Validation = object.utf8Validation ?? FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + message.messageEncoding = object.messageEncoding ?? FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + message.jsonFormat = object.jsonFormat ?? FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + message.enforceNamingStyle = object.enforceNamingStyle ?? + FeatureSet_EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN; + return message; + }, +}; + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimumEdition: Edition.EDITION_UNKNOWN, maximumEdition: Edition.EDITION_UNKNOWN }; +} + +export const FeatureSetDefaults: MessageFns = { + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimumEdition !== undefined && message.minimumEdition !== Edition.EDITION_UNKNOWN) { + writer.uint32(32).int32(editionToNumber(message.minimumEdition)); + } + if (message.maximumEdition !== undefined && message.maximumEdition !== Edition.EDITION_UNKNOWN) { + writer.uint32(40).int32(editionToNumber(message.maximumEdition)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.minimumEdition = editionFromJSON(reader.int32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maximumEdition = editionFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? Edition.EDITION_UNKNOWN; + message.maximumEdition = object.maximumEdition ?? Edition.EDITION_UNKNOWN; + return message; + }, +}; + +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { edition: Edition.EDITION_UNKNOWN, overridableFeatures: undefined, fixedFeatures: undefined }; +} + +export const FeatureSetDefaults_FeatureSetEditionDefault: MessageFns = { + encode( + message: FeatureSetDefaults_FeatureSetEditionDefault, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.edition !== undefined && message.edition !== Edition.EDITION_UNKNOWN) { + writer.uint32(24).int32(editionToNumber(message.edition)); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).join(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (tag !== 24) { + break; + } + + message.edition = editionFromJSON(reader.int32()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? {}); + }, + fromPartial( + object: DeepPartial, + ): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? Edition.EDITION_UNKNOWN; + message.overridableFeatures = (object.overridableFeatures !== undefined && object.overridableFeatures !== null) + ? FeatureSet.fromPartial(object.overridableFeatures) + : undefined; + message.fixedFeatures = (object.fixedFeatures !== undefined && object.fixedFeatures !== null) + ? FeatureSet.fromPartial(object.fixedFeatures) + : undefined; + return message; + }, +}; + +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +export const SourceCodeInfo: MessageFns = { + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SourceCodeInfo { + return SourceCodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { path: [], span: [], leadingComments: "", trailingComments: "", leadingDetachedComments: [] }; +} + +export const SourceCodeInfo_Location: MessageFns = { + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.join(); + if (message.leadingComments !== undefined && message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== undefined && message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + } + case 2: { + if (tag === 16) { + message.span.push(reader.int32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + + continue; + } + + break; + } + case 3: { + if (tag !== 26) { + break; + } + + message.leadingComments = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.trailingComments = reader.string(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.leadingDetachedComments.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { annotation: [] }; +} + +export const GeneratedCodeInfo: MessageFns = { + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GeneratedCodeInfo { + return GeneratedCodeInfo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { path: [], sourceFile: "", begin: 0, end: 0, semantic: GeneratedCodeInfo_Annotation_Semantic.NONE }; +} + +export const GeneratedCodeInfo_Annotation: MessageFns = { + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + if (message.sourceFile !== undefined && message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== undefined && message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== undefined && message.semantic !== GeneratedCodeInfo_Annotation_Semantic.NONE) { + writer.uint32(40).int32(generatedCodeInfo_Annotation_SemanticToNumber(message.semantic)); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag === 8) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sourceFile = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.begin = reader.int32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.end = reader.int32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.semantic = generatedCodeInfo_Annotation_SemanticFromJSON(reader.int32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map((e) => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + message.semantic = object.semantic ?? GeneratedCodeInfo_Annotation_Semantic.NONE; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/protobuf/duration.ts b/web/src/types/proto/google/protobuf/duration.ts new file mode 100644 index 00000000..8ad3d741 --- /dev/null +++ b/web/src/types/proto/google/protobuf/duration.ts @@ -0,0 +1,172 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/protobuf/duration.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +export const Duration: MessageFns = { + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Duration { + return Duration.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/protobuf/empty.ts b/web/src/types/proto/google/protobuf/empty.ts new file mode 100644 index 00000000..bf1bfaab --- /dev/null +++ b/web/src/types/proto/google/protobuf/empty.ts @@ -0,0 +1,71 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/protobuf/empty.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + */ +export interface Empty { +} + +function createBaseEmpty(): Empty { + return {}; +} + +export const Empty: MessageFns = { + encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Empty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEmpty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Empty { + return Empty.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): Empty { + const message = createBaseEmpty(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/web/src/types/proto/google/protobuf/field_mask.ts b/web/src/types/proto/google/protobuf/field_mask.ts new file mode 100644 index 00000000..82f80a73 --- /dev/null +++ b/web/src/types/proto/google/protobuf/field_mask.ts @@ -0,0 +1,291 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/protobuf/field_mask.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * `FieldMask` represents a set of symbolic field paths, for example: + * + * paths: "f.a" + * paths: "f.b.d" + * + * Here `f` represents a field in some root message, `a` and `b` + * fields in the message found in `f`, and `d` a field found in the + * message in `f.b`. + * + * Field masks are used to specify a subset of fields that should be + * returned by a get operation or modified by an update operation. + * Field masks also have a custom JSON encoding (see below). + * + * # Field Masks in Projections + * + * When used in the context of a projection, a response message or + * sub-message is filtered by the API to only contain those fields as + * specified in the mask. For example, if the mask in the previous + * example is applied to a response message as follows: + * + * f { + * a : 22 + * b { + * d : 1 + * x : 2 + * } + * y : 13 + * } + * z: 8 + * + * The result will not contain specific values for fields x,y and z + * (their value will be set to the default, and omitted in proto text + * output): + * + * f { + * a : 22 + * b { + * d : 1 + * } + * } + * + * A repeated field is not allowed except at the last position of a + * paths string. + * + * If a FieldMask object is not present in a get operation, the + * operation applies to all fields (as if a FieldMask of all fields + * had been specified). + * + * Note that a field mask does not necessarily apply to the + * top-level response message. In case of a REST get operation, the + * field mask applies directly to the response, but in case of a REST + * list operation, the mask instead applies to each individual message + * in the returned resource list. In case of a REST custom method, + * other definitions may be used. Where the mask applies will be + * clearly documented together with its declaration in the API. In + * any case, the effect on the returned resource/resources is required + * behavior for APIs. + * + * # Field Masks in Update Operations + * + * A field mask in update operations specifies which fields of the + * targeted resource are going to be updated. The API is required + * to only change the values of the fields as specified in the mask + * and leave the others untouched. If a resource is passed in to + * describe the updated values, the API ignores the values of all + * fields not covered by the mask. + * + * If a repeated field is specified for an update operation, new values will + * be appended to the existing repeated field in the target resource. Note that + * a repeated field is only allowed in the last position of a `paths` string. + * + * If a sub-message is specified in the last position of the field mask for an + * update operation, then new value will be merged into the existing sub-message + * in the target resource. + * + * For example, given the target message: + * + * f { + * b { + * d: 1 + * x: 2 + * } + * c: [1] + * } + * + * And an update message: + * + * f { + * b { + * d: 10 + * } + * c: [2] + * } + * + * then if the field mask is: + * + * paths: ["f.b", "f.c"] + * + * then the result will be: + * + * f { + * b { + * d: 10 + * x: 2 + * } + * c: [1, 2] + * } + * + * An implementation may provide options to override this default behavior for + * repeated and message fields. + * + * In order to reset a field's value to the default, the field must + * be in the mask and set to the default value in the provided resource. + * Hence, in order to reset all fields of a resource, provide a default + * instance of the resource and set all fields in the mask, or do + * not provide a mask as described below. + * + * If a field mask is not present on update, the operation applies to + * all fields (as if a field mask of all fields has been specified). + * Note that in the presence of schema evolution, this may mean that + * fields the client does not know and has therefore not filled into + * the request will be reset to their default. If this is unwanted + * behavior, a specific service may require a client to always specify + * a field mask, producing an error if not. + * + * As with get operations, the location of the resource which + * describes the updated values in the request message depends on the + * operation kind. In any case, the effect of the field mask is + * required to be honored by the API. + * + * ## Considerations for HTTP REST + * + * The HTTP kind of an update operation which uses a field mask must + * be set to PATCH instead of PUT in order to satisfy HTTP semantics + * (PUT must only be used for full updates). + * + * # JSON Encoding of Field Masks + * + * In JSON, a field mask is encoded as a single string where paths are + * separated by a comma. Fields name in each path are converted + * to/from lower-camel naming conventions. + * + * As an example, consider the following message declarations: + * + * message Profile { + * User user = 1; + * Photo photo = 2; + * } + * message User { + * string display_name = 1; + * string address = 2; + * } + * + * In proto a field mask for `Profile` may look as such: + * + * mask { + * paths: "user.display_name" + * paths: "photo" + * } + * + * In JSON, the same mask is represented as below: + * + * { + * mask: "user.displayName,photo" + * } + * + * # Field Masks and Oneof Fields + * + * Field masks treat fields in oneofs just as regular fields. Consider the + * following message: + * + * message SampleMessage { + * oneof test_oneof { + * string name = 4; + * SubMessage sub_message = 9; + * } + * } + * + * The field mask can be: + * + * mask { + * paths: "name" + * } + * + * Or: + * + * mask { + * paths: "sub_message" + * } + * + * Note that oneof type names ("test_oneof" in this case) cannot be used in + * paths. + * + * ## Field Mask Verification + * + * The implementation of any API method which has a FieldMask type field in the + * request should verify the included field paths, and return an + * `INVALID_ARGUMENT` error if any path is unmappable. + */ +export interface FieldMask { + /** The set of field mask paths. */ + paths: string[]; +} + +function createBaseFieldMask(): FieldMask { + return { paths: [] }; +} + +export const FieldMask: MessageFns & FieldMaskWrapperFns = { + encode(message: FieldMask, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.paths) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldMask { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldMask(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.paths.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldMask { + return FieldMask.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FieldMask { + const message = createBaseFieldMask(); + message.paths = object.paths?.map((e) => e) || []; + return message; + }, + + wrap(paths: string[]): FieldMask { + const result = createBaseFieldMask(); + result.paths = paths; + return result; + }, + + unwrap(message: FieldMask): string[] { + return message.paths; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} + +export interface FieldMaskWrapperFns { + wrap(paths: string[]): FieldMask; + unwrap(message: FieldMask): string[]; +} diff --git a/web/src/types/proto/google/protobuf/timestamp.ts b/web/src/types/proto/google/protobuf/timestamp.ts new file mode 100644 index 00000000..76c6bcbb --- /dev/null +++ b/web/src/types/proto/google/protobuf/timestamp.ts @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.6.1 +// protoc unknown +// source: google/protobuf/timestamp.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "google.protobuf"; + +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} + +function createBaseTimestamp(): Timestamp { + return { seconds: 0, nanos: 0 }; +} + +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Timestamp { + return Timestamp.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +}