From 64d4db81cab99af9c0b1866b40a952b5aa095cac Mon Sep 17 00:00:00 2001 From: boojack Date: Mon, 6 Nov 2023 21:00:42 +0800 Subject: [PATCH] chore: add frontend type definitions (#2482) chore: update --- web/.gitignore | 1 - .../types/proto/api/v2/activity_service.ts | 372 ++ web/src/types/proto/api/v2/common.ts | 10 + web/src/types/proto/api/v2/inbox_service.ts | 569 +++ web/src/types/proto/api/v2/memo_service.ts | 911 +++++ .../types/proto/api/v2/resource_service.ts | 770 ++++ web/src/types/proto/api/v2/system_service.ts | 504 +++ web/src/types/proto/api/v2/tag_service.ts | 413 ++ web/src/types/proto/api/v2/user_service.ts | 1248 ++++++ web/src/types/proto/google/api/annotations.ts | 3 + web/src/types/proto/google/api/client.ts | 1588 ++++++++ .../types/proto/google/api/field_behavior.ts | 62 + web/src/types/proto/google/api/http.ts | 653 +++ .../types/proto/google/api/launch_stage.ts | 58 + .../types/proto/google/protobuf/descriptor.ts | 3573 +++++++++++++++++ .../types/proto/google/protobuf/duration.ts | 178 + .../types/proto/google/protobuf/field_mask.ts | 272 ++ .../types/proto/google/protobuf/timestamp.ts | 207 + web/src/types/proto/store/activity.ts | 189 + web/src/types/proto/store/common.ts | 3 + web/src/types/proto/store/inbox.ts | 80 + web/src/types/proto/store/system_setting.ts | 95 + web/src/types/proto/store/user_setting.ts | 211 + 23 files changed, 11969 insertions(+), 1 deletion(-) create mode 100644 web/src/types/proto/api/v2/activity_service.ts create mode 100644 web/src/types/proto/api/v2/common.ts create mode 100644 web/src/types/proto/api/v2/inbox_service.ts create mode 100644 web/src/types/proto/api/v2/memo_service.ts create mode 100644 web/src/types/proto/api/v2/resource_service.ts create mode 100644 web/src/types/proto/api/v2/system_service.ts create mode 100644 web/src/types/proto/api/v2/tag_service.ts create mode 100644 web/src/types/proto/api/v2/user_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/launch_stage.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/field_mask.ts create mode 100644 web/src/types/proto/google/protobuf/timestamp.ts create mode 100644 web/src/types/proto/store/activity.ts create mode 100644 web/src/types/proto/store/common.ts create mode 100644 web/src/types/proto/store/inbox.ts create mode 100644 web/src/types/proto/store/system_setting.ts create mode 100644 web/src/types/proto/store/user_setting.ts diff --git a/web/.gitignore b/web/.gitignore index f4e178b9..d451ff16 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -3,4 +3,3 @@ node_modules dist dist-ssr *.local -src/types/proto diff --git a/web/src/types/proto/api/v2/activity_service.ts b/web/src/types/proto/api/v2/activity_service.ts new file mode 100644 index 00000000..603ab818 --- /dev/null +++ b/web/src/types/proto/api/v2/activity_service.ts @@ -0,0 +1,372 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "memos.api.v2"; + +export interface Activity { + id: number; + creatorId: number; + type: string; + level: string; + createTime?: Date | undefined; + payload?: ActivityPayload | undefined; +} + +export interface ActivityMemoCommentPayload { + memoId: number; + relatedMemoId: number; +} + +export interface ActivityPayload { + memoComment?: ActivityMemoCommentPayload | undefined; +} + +export interface GetActivityRequest { + id: number; +} + +export interface GetActivityResponse { + activity?: Activity | undefined; +} + +function createBaseActivity(): Activity { + return { id: 0, creatorId: 0, type: "", level: "", createTime: undefined, payload: undefined }; +} + +export const Activity = { + encode(message: Activity, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.creatorId !== 0) { + writer.uint32(16).int32(message.creatorId); + } + 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()).ldelim(); + } + if (message.payload !== undefined) { + ActivityPayload.encode(message.payload, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Activity { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.creatorId = reader.int32(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Activity { + return Activity.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): Activity { + const message = createBaseActivity(); + message.id = object.id ?? 0; + message.creatorId = object.creatorId ?? 0; + 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 createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload { + return { memoId: 0, relatedMemoId: 0 }; +} + +export const ActivityMemoCommentPayload = { + encode(message: ActivityMemoCommentPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memoId !== 0) { + writer.uint32(8).int32(message.memoId); + } + if (message.relatedMemoId !== 0) { + writer.uint32(16).int32(message.relatedMemoId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActivityMemoCommentPayload { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.memoId = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.relatedMemoId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ActivityMemoCommentPayload { + return ActivityMemoCommentPayload.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ActivityMemoCommentPayload { + const message = createBaseActivityMemoCommentPayload(); + message.memoId = object.memoId ?? 0; + message.relatedMemoId = object.relatedMemoId ?? 0; + return message; + }, +}; + +function createBaseActivityPayload(): ActivityPayload { + return { memoComment: undefined }; +} + +export const ActivityPayload = { + encode(message: ActivityPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memoComment !== undefined) { + ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActivityPayload { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseGetActivityRequest(): GetActivityRequest { + return { id: 0 }; +} + +export const GetActivityRequest = { + encode(message: GetActivityRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetActivityRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetActivityRequest { + return GetActivityRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetActivityRequest { + const message = createBaseGetActivityRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseGetActivityResponse(): GetActivityResponse { + return { activity: undefined }; +} + +export const GetActivityResponse = { + encode(message: GetActivityResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.activity !== undefined) { + Activity.encode(message.activity, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetActivityResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetActivityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.activity = Activity.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetActivityResponse { + return GetActivityResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetActivityResponse { + const message = createBaseGetActivityResponse(); + message.activity = (object.activity !== undefined && object.activity !== null) + ? Activity.fromPartial(object.activity) + : undefined; + return message; + }, +}; + +export type ActivityServiceDefinition = typeof ActivityServiceDefinition; +export const ActivityServiceDefinition = { + name: "ActivityService", + fullName: "memos.api.v2.ActivityService", + methods: { + getActivity: { + name: "GetActivity", + requestType: GetActivityRequest, + requestStream: false, + responseType: GetActivityResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([16, 18, 14, 47, 118, 50, 47, 97, 99, 116, 105, 118, 105, 116, 105, 101, 115])], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = 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 Date(millis); +} diff --git a/web/src/types/proto/api/v2/common.ts b/web/src/types/proto/api/v2/common.ts new file mode 100644 index 00000000..81f0bf16 --- /dev/null +++ b/web/src/types/proto/api/v2/common.ts @@ -0,0 +1,10 @@ +/* eslint-disable */ + +export const protobufPackage = "memos.api.v2"; + +export enum RowStatus { + ROW_STATUS_UNSPECIFIED = 0, + ACTIVE = 1, + ARCHIVED = 2, + UNRECOGNIZED = -1, +} diff --git a/web/src/types/proto/api/v2/inbox_service.ts b/web/src/types/proto/api/v2/inbox_service.ts new file mode 100644 index 00000000..03e92ea1 --- /dev/null +++ b/web/src/types/proto/api/v2/inbox_service.ts @@ -0,0 +1,569 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "memos.api.v2"; + +export interface Inbox { + /** + * The name of the inbox. + * Format: inboxes/{id} + */ + name: string; + /** Format: users/{username} */ + sender: string; + /** Format: users/{username} */ + receiver: string; + status: Inbox_Status; + createTime?: Date | undefined; + type: Inbox_Type; + activityId?: number | undefined; +} + +export enum Inbox_Status { + STATUS_UNSPECIFIED = 0, + UNREAD = 1, + ARCHIVED = 2, + UNRECOGNIZED = -1, +} + +export enum Inbox_Type { + TYPE_UNSPECIFIED = 0, + TYPE_MEMO_COMMENT = 1, + UNRECOGNIZED = -1, +} + +export interface ListInboxesRequest { + /** Format: users/{username} */ + user: string; +} + +export interface ListInboxesResponse { + inboxes: Inbox[]; +} + +export interface UpdateInboxRequest { + inbox?: Inbox | undefined; + updateMask?: string[] | undefined; +} + +export interface UpdateInboxResponse { + inbox?: Inbox | undefined; +} + +export interface DeleteInboxRequest { + /** + * The name of the inbox to delete. + * Format: inboxes/{inbox} + */ + name: string; +} + +export interface DeleteInboxResponse { +} + +function createBaseInbox(): Inbox { + return { name: "", sender: "", receiver: "", status: 0, createTime: undefined, type: 0, activityId: undefined }; +} + +export const Inbox = { + encode(message: Inbox, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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 !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).ldelim(); + } + if (message.type !== 0) { + writer.uint32(48).int32(message.type); + } + if (message.activityId !== undefined) { + writer.uint32(56).int32(message.activityId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Inbox { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.type = reader.int32() as any; + continue; + case 7: + if (tag !== 56) { + break; + } + + message.activityId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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 ?? 0; + message.createTime = object.createTime ?? undefined; + message.type = object.type ?? 0; + message.activityId = object.activityId ?? undefined; + return message; + }, +}; + +function createBaseListInboxesRequest(): ListInboxesRequest { + return { user: "" }; +} + +export const ListInboxesRequest = { + encode(message: ListInboxesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.user !== "") { + writer.uint32(10).string(message.user); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListInboxesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListInboxesRequest { + return ListInboxesRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListInboxesRequest { + const message = createBaseListInboxesRequest(); + message.user = object.user ?? ""; + return message; + }, +}; + +function createBaseListInboxesResponse(): ListInboxesResponse { + return { inboxes: [] }; +} + +export const ListInboxesResponse = { + encode(message: ListInboxesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.inboxes) { + Inbox.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListInboxesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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)) || []; + return message; + }, +}; + +function createBaseUpdateInboxRequest(): UpdateInboxRequest { + return { inbox: undefined, updateMask: undefined }; +} + +export const UpdateInboxRequest = { + encode(message: UpdateInboxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inbox !== undefined) { + Inbox.encode(message.inbox, writer.uint32(10).fork()).ldelim(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateInboxRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseUpdateInboxResponse(): UpdateInboxResponse { + return { inbox: undefined }; +} + +export const UpdateInboxResponse = { + encode(message: UpdateInboxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.inbox !== undefined) { + Inbox.encode(message.inbox, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateInboxResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateInboxResponse(); + 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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateInboxResponse { + return UpdateInboxResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateInboxResponse { + const message = createBaseUpdateInboxResponse(); + message.inbox = (object.inbox !== undefined && object.inbox !== null) ? Inbox.fromPartial(object.inbox) : undefined; + return message; + }, +}; + +function createBaseDeleteInboxRequest(): DeleteInboxRequest { + return { name: "" }; +} + +export const DeleteInboxRequest = { + encode(message: DeleteInboxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteInboxRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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; + }, +}; + +function createBaseDeleteInboxResponse(): DeleteInboxResponse { + return {}; +} + +export const DeleteInboxResponse = { + encode(_: DeleteInboxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteInboxResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteInboxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteInboxResponse { + return DeleteInboxResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteInboxResponse { + const message = createBaseDeleteInboxResponse(); + return message; + }, +}; + +export type InboxServiceDefinition = typeof InboxServiceDefinition; +export const InboxServiceDefinition = { + name: "InboxService", + fullName: "memos.api.v2.InboxService", + methods: { + 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, 50, 47, 105, 110, 98, 111, 120, 101, 115]), + ], + }, + }, + }, + updateInbox: { + name: "UpdateInbox", + requestType: UpdateInboxRequest, + requestStream: false, + responseType: UpdateInboxResponse, + 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([ + 20, + 58, + 5, + 105, + 110, + 98, + 111, + 120, + 50, + 11, + 47, + 118, + 50, + 47, + 105, + 110, + 98, + 111, + 120, + 101, + 115, + ]), + ], + }, + }, + }, + deleteInbox: { + name: "DeleteInbox", + requestType: DeleteInboxRequest, + requestStream: false, + responseType: DeleteInboxResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 22, + 42, + 20, + 47, + 118, + 50, + 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 Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = 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 Date(millis); +} diff --git a/web/src/types/proto/api/v2/memo_service.ts b/web/src/types/proto/api/v2/memo_service.ts new file mode 100644 index 00000000..f60d18c2 --- /dev/null +++ b/web/src/types/proto/api/v2/memo_service.ts @@ -0,0 +1,911 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { RowStatus } from "./common"; + +export const protobufPackage = "memos.api.v2"; + +export enum Visibility { + VISIBILITY_UNSPECIFIED = 0, + PRIVATE = 1, + PROTECTED = 2, + PUBLIC = 3, + UNRECOGNIZED = -1, +} + +export interface Memo { + id: number; + rowStatus: RowStatus; + creatorId: number; + createdTs: number; + updatedTs: number; + content: string; + visibility: Visibility; + pinned: boolean; +} + +export interface CreateMemoRequest { + content: string; + visibility: Visibility; +} + +export interface CreateMemoResponse { + memo?: Memo | undefined; +} + +export interface ListMemosRequest { + page: number; + pageSize: number; + /** Filter is used to filter memos returned in the list. */ + filter: string; + creatorId?: number | undefined; +} + +export interface ListMemosResponse { + memos: Memo[]; +} + +export interface GetMemoRequest { + id: number; +} + +export interface GetMemoResponse { + memo?: Memo | undefined; +} + +export interface CreateMemoCommentRequest { + /** id is the memo id to create comment for. */ + id: number; + create?: CreateMemoRequest | undefined; +} + +export interface CreateMemoCommentResponse { + memo?: Memo | undefined; +} + +export interface ListMemoCommentsRequest { + id: number; +} + +export interface ListMemoCommentsResponse { + memos: Memo[]; +} + +function createBaseMemo(): Memo { + return { id: 0, rowStatus: 0, creatorId: 0, createdTs: 0, updatedTs: 0, content: "", visibility: 0, pinned: false }; +} + +export const Memo = { + encode(message: Memo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.rowStatus !== 0) { + writer.uint32(16).int32(message.rowStatus); + } + if (message.creatorId !== 0) { + writer.uint32(24).int32(message.creatorId); + } + if (message.createdTs !== 0) { + writer.uint32(32).int64(message.createdTs); + } + if (message.updatedTs !== 0) { + writer.uint32(40).int64(message.updatedTs); + } + if (message.content !== "") { + writer.uint32(50).string(message.content); + } + if (message.visibility !== 0) { + writer.uint32(56).int32(message.visibility); + } + if (message.pinned === true) { + writer.uint32(64).bool(message.pinned); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Memo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.rowStatus = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.creatorId = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.createdTs = longToNumber(reader.int64() as Long); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.updatedTs = longToNumber(reader.int64() as Long); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.content = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.visibility = reader.int32() as any; + continue; + case 8: + if (tag !== 64) { + break; + } + + message.pinned = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Memo { + return Memo.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): Memo { + const message = createBaseMemo(); + message.id = object.id ?? 0; + message.rowStatus = object.rowStatus ?? 0; + message.creatorId = object.creatorId ?? 0; + message.createdTs = object.createdTs ?? 0; + message.updatedTs = object.updatedTs ?? 0; + message.content = object.content ?? ""; + message.visibility = object.visibility ?? 0; + message.pinned = object.pinned ?? false; + return message; + }, +}; + +function createBaseCreateMemoRequest(): CreateMemoRequest { + return { content: "", visibility: 0 }; +} + +export const CreateMemoRequest = { + encode(message: CreateMemoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.content !== "") { + writer.uint32(10).string(message.content); + } + if (message.visibility !== 0) { + writer.uint32(16).int32(message.visibility); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.content = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.visibility = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateMemoRequest { + return CreateMemoRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateMemoRequest { + const message = createBaseCreateMemoRequest(); + message.content = object.content ?? ""; + message.visibility = object.visibility ?? 0; + return message; + }, +}; + +function createBaseCreateMemoResponse(): CreateMemoResponse { + return { memo: undefined }; +} + +export const CreateMemoResponse = { + encode(message: CreateMemoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memo !== undefined) { + Memo.encode(message.memo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateMemoResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateMemoResponse { + return CreateMemoResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateMemoResponse { + const message = createBaseCreateMemoResponse(); + message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; + return message; + }, +}; + +function createBaseListMemosRequest(): ListMemosRequest { + return { page: 0, pageSize: 0, filter: "", creatorId: undefined }; +} + +export const ListMemosRequest = { + encode(message: ListMemosRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.page !== 0) { + writer.uint32(8).int32(message.page); + } + if (message.pageSize !== 0) { + writer.uint32(16).int32(message.pageSize); + } + if (message.filter !== "") { + writer.uint32(26).string(message.filter); + } + if (message.creatorId !== undefined) { + writer.uint32(32).int32(message.creatorId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListMemosRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.page = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.pageSize = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.filter = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.creatorId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemosRequest { + return ListMemosRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListMemosRequest { + const message = createBaseListMemosRequest(); + message.page = object.page ?? 0; + message.pageSize = object.pageSize ?? 0; + message.filter = object.filter ?? ""; + message.creatorId = object.creatorId ?? undefined; + return message; + }, +}; + +function createBaseListMemosResponse(): ListMemosResponse { + return { memos: [] }; +} + +export const ListMemosResponse = { + encode(message: ListMemosResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.memos) { + Memo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListMemosResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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)) || []; + return message; + }, +}; + +function createBaseGetMemoRequest(): GetMemoRequest { + return { id: 0 }; +} + +export const GetMemoRequest = { + encode(message: GetMemoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetMemoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetMemoRequest { + return GetMemoRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetMemoRequest { + const message = createBaseGetMemoRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseGetMemoResponse(): GetMemoResponse { + return { memo: undefined }; +} + +export const GetMemoResponse = { + encode(message: GetMemoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memo !== undefined) { + Memo.encode(message.memo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetMemoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetMemoResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetMemoResponse { + return GetMemoResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetMemoResponse { + const message = createBaseGetMemoResponse(); + message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; + return message; + }, +}; + +function createBaseCreateMemoCommentRequest(): CreateMemoCommentRequest { + return { id: 0, create: undefined }; +} + +export const CreateMemoCommentRequest = { + encode(message: CreateMemoCommentRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.create !== undefined) { + CreateMemoRequest.encode(message.create, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoCommentRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.create = CreateMemoRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateMemoCommentRequest { + return CreateMemoCommentRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateMemoCommentRequest { + const message = createBaseCreateMemoCommentRequest(); + message.id = object.id ?? 0; + message.create = (object.create !== undefined && object.create !== null) + ? CreateMemoRequest.fromPartial(object.create) + : undefined; + return message; + }, +}; + +function createBaseCreateMemoCommentResponse(): CreateMemoCommentResponse { + return { memo: undefined }; +} + +export const CreateMemoCommentResponse = { + encode(message: CreateMemoCommentResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memo !== undefined) { + Memo.encode(message.memo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateMemoCommentResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateMemoCommentResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateMemoCommentResponse { + return CreateMemoCommentResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateMemoCommentResponse { + const message = createBaseCreateMemoCommentResponse(); + message.memo = (object.memo !== undefined && object.memo !== null) ? Memo.fromPartial(object.memo) : undefined; + return message; + }, +}; + +function createBaseListMemoCommentsRequest(): ListMemoCommentsRequest { + return { id: 0 }; +} + +export const ListMemoCommentsRequest = { + encode(message: ListMemoCommentsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListMemoCommentsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListMemoCommentsRequest { + return ListMemoCommentsRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListMemoCommentsRequest { + const message = createBaseListMemoCommentsRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseListMemoCommentsResponse(): ListMemoCommentsResponse { + return { memos: [] }; +} + +export const ListMemoCommentsResponse = { + encode(message: ListMemoCommentsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.memos) { + Memo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListMemoCommentsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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; + }, +}; + +export type MemoServiceDefinition = typeof MemoServiceDefinition; +export const MemoServiceDefinition = { + name: "MemoService", + fullName: "memos.api.v2.MemoService", + methods: { + createMemo: { + name: "CreateMemo", + requestType: CreateMemoRequest, + requestStream: false, + responseType: CreateMemoResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([15, 34, 13, 47, 97, 112, 105, 47, 118, 50, 47, 109, 101, 109, 111, 115])], + }, + }, + }, + listMemos: { + name: "ListMemos", + requestType: ListMemosRequest, + requestStream: false, + responseType: ListMemosResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([15, 18, 13, 47, 97, 112, 105, 47, 118, 50, 47, 109, 101, 109, 111, 115])], + }, + }, + }, + getMemo: { + name: "GetMemo", + requestType: GetMemoRequest, + requestStream: false, + responseType: GetMemoResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 20, + 18, + 18, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 109, + 101, + 109, + 111, + 115, + 47, + 123, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + createMemoComment: { + name: "CreateMemoComment", + requestType: CreateMemoCommentRequest, + requestStream: false, + responseType: CreateMemoCommentResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 29, + 34, + 27, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 109, + 101, + 109, + 111, + 115, + 47, + 123, + 105, + 100, + 125, + 47, + 99, + 111, + 109, + 109, + 101, + 110, + 116, + 115, + ]), + ], + }, + }, + }, + listMemoComments: { + name: "ListMemoComments", + requestType: ListMemoCommentsRequest, + requestStream: false, + responseType: ListMemoCommentsResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 29, + 18, + 27, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 109, + 101, + 109, + 111, + 115, + 47, + 123, + 105, + 100, + 125, + 47, + 99, + 111, + 109, + 109, + 101, + 110, + 116, + 115, + ]), + ], + }, + }, + }, + }, +} as const; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/web/src/types/proto/api/v2/resource_service.ts b/web/src/types/proto/api/v2/resource_service.ts new file mode 100644 index 00000000..f96b9f0e --- /dev/null +++ b/web/src/types/proto/api/v2/resource_service.ts @@ -0,0 +1,770 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; + +export const protobufPackage = "memos.api.v2"; + +export interface Resource { + id: number; + createdTs?: Date | undefined; + filename: string; + externalLink: string; + type: string; + size: number; + memoId?: number | undefined; +} + +export interface CreateResourceRequest { + filename: string; + externalLink: string; + type: string; + memoId?: number | undefined; +} + +export interface CreateResourceResponse { + resource?: Resource | undefined; +} + +export interface ListResourcesRequest { +} + +export interface ListResourcesResponse { + resources: Resource[]; +} + +export interface UpdateResourceRequest { + resource?: Resource | undefined; + updateMask?: string[] | undefined; +} + +export interface UpdateResourceResponse { + resource?: Resource | undefined; +} + +export interface DeleteResourceRequest { + id: number; +} + +export interface DeleteResourceResponse { +} + +function createBaseResource(): Resource { + return { id: 0, createdTs: undefined, filename: "", externalLink: "", type: "", size: 0, memoId: undefined }; +} + +export const Resource = { + encode(message: Resource, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.createdTs !== undefined) { + Timestamp.encode(toTimestamp(message.createdTs), writer.uint32(18).fork()).ldelim(); + } + if (message.filename !== "") { + writer.uint32(26).string(message.filename); + } + if (message.externalLink !== "") { + writer.uint32(34).string(message.externalLink); + } + if (message.type !== "") { + writer.uint32(42).string(message.type); + } + if (message.size !== 0) { + writer.uint32(48).int64(message.size); + } + if (message.memoId !== undefined) { + writer.uint32(56).int32(message.memoId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Resource { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.createdTs = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.filename = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.externalLink = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.type = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.size = longToNumber(reader.int64() as Long); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.memoId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Resource { + return Resource.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): Resource { + const message = createBaseResource(); + message.id = object.id ?? 0; + message.createdTs = object.createdTs ?? undefined; + message.filename = object.filename ?? ""; + message.externalLink = object.externalLink ?? ""; + message.type = object.type ?? ""; + message.size = object.size ?? 0; + message.memoId = object.memoId ?? undefined; + return message; + }, +}; + +function createBaseCreateResourceRequest(): CreateResourceRequest { + return { filename: "", externalLink: "", type: "", memoId: undefined }; +} + +export const CreateResourceRequest = { + encode(message: CreateResourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.filename !== "") { + writer.uint32(10).string(message.filename); + } + if (message.externalLink !== "") { + writer.uint32(18).string(message.externalLink); + } + if (message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.memoId !== undefined) { + writer.uint32(32).int32(message.memoId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateResourceRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.filename = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.externalLink = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.memoId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateResourceRequest { + return CreateResourceRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateResourceRequest { + const message = createBaseCreateResourceRequest(); + message.filename = object.filename ?? ""; + message.externalLink = object.externalLink ?? ""; + message.type = object.type ?? ""; + message.memoId = object.memoId ?? undefined; + return message; + }, +}; + +function createBaseCreateResourceResponse(): CreateResourceResponse { + return { resource: undefined }; +} + +export const CreateResourceResponse = { + encode(message: CreateResourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.resource !== undefined) { + Resource.encode(message.resource, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateResourceResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateResourceResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateResourceResponse { + return CreateResourceResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateResourceResponse { + const message = createBaseCreateResourceResponse(); + message.resource = (object.resource !== undefined && object.resource !== null) + ? Resource.fromPartial(object.resource) + : undefined; + return message; + }, +}; + +function createBaseListResourcesRequest(): ListResourcesRequest { + return {}; +} + +export const ListResourcesRequest = { + encode(_: ListResourcesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListResourcesRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: ListResourcesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.resources) { + Resource.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListResourcesResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseUpdateResourceRequest(): UpdateResourceRequest { + return { resource: undefined, updateMask: undefined }; +} + +export const UpdateResourceRequest = { + encode(message: UpdateResourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.resource !== undefined) { + Resource.encode(message.resource, writer.uint32(10).fork()).ldelim(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateResourceRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseUpdateResourceResponse(): UpdateResourceResponse { + return { resource: undefined }; +} + +export const UpdateResourceResponse = { + encode(message: UpdateResourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.resource !== undefined) { + Resource.encode(message.resource, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateResourceResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateResourceResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateResourceResponse { + return UpdateResourceResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateResourceResponse { + const message = createBaseUpdateResourceResponse(); + message.resource = (object.resource !== undefined && object.resource !== null) + ? Resource.fromPartial(object.resource) + : undefined; + return message; + }, +}; + +function createBaseDeleteResourceRequest(): DeleteResourceRequest { + return { id: 0 }; +} + +export const DeleteResourceRequest = { + encode(message: DeleteResourceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteResourceRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteResourceRequest { + return DeleteResourceRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): DeleteResourceRequest { + const message = createBaseDeleteResourceRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseDeleteResourceResponse(): DeleteResourceResponse { + return {}; +} + +export const DeleteResourceResponse = { + encode(_: DeleteResourceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteResourceResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteResourceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteResourceResponse { + return DeleteResourceResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteResourceResponse { + const message = createBaseDeleteResourceResponse(); + return message; + }, +}; + +export type ResourceServiceDefinition = typeof ResourceServiceDefinition; +export const ResourceServiceDefinition = { + name: "ResourceService", + fullName: "memos.api.v2.ResourceService", + methods: { + createResource: { + name: "CreateResource", + requestType: CreateResourceRequest, + requestStream: false, + responseType: CreateResourceResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([19, 34, 17, 47, 97, 112, 105, 47, 118, 50, 47, 114, 101, 115, 111, 117, 114, 99, 101, 115]), + ], + }, + }, + }, + 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, 50, 47, 114, 101, 115, 111, 117, 114, 99, 101, 115]), + ], + }, + }, + }, + updateResource: { + name: "UpdateResource", + requestType: UpdateResourceRequest, + requestStream: false, + responseType: UpdateResourceResponse, + 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([ + 43, + 58, + 8, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 50, + 31, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + 47, + 123, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 46, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + deleteResource: { + name: "DeleteResource", + requestType: DeleteResourceRequest, + requestStream: false, + responseType: DeleteResourceResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([2, 105, 100])], + 578365826: [ + new Uint8Array([ + 24, + 18, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 114, + 101, + 115, + 111, + 117, + 114, + 99, + 101, + 115, + 47, + 123, + 105, + 100, + 125, + ]), + ], + }, + }, + }, + }, +} as const; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = 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 Date(millis); +} + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/web/src/types/proto/api/v2/system_service.ts b/web/src/types/proto/api/v2/system_service.ts new file mode 100644 index 00000000..25d2b261 --- /dev/null +++ b/web/src/types/proto/api/v2/system_service.ts @@ -0,0 +1,504 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { FieldMask } from "../../google/protobuf/field_mask"; + +export const protobufPackage = "memos.api.v2"; + +export interface SystemInfo { + version: string; + mode: string; + allowRegistration: boolean; + disablePasswordLogin: boolean; + additionalScript: string; + additionalStyle: string; + dbSize: number; +} + +export interface GetSystemInfoRequest { +} + +export interface GetSystemInfoResponse { + systemInfo?: SystemInfo | undefined; +} + +export interface UpdateSystemInfoRequest { + /** System info is the updated data. */ + systemInfo?: SystemInfo | undefined; + updateMask?: string[] | undefined; +} + +export interface UpdateSystemInfoResponse { + systemInfo?: SystemInfo | undefined; +} + +function createBaseSystemInfo(): SystemInfo { + return { + version: "", + mode: "", + allowRegistration: false, + disablePasswordLogin: false, + additionalScript: "", + additionalStyle: "", + dbSize: 0, + }; +} + +export const SystemInfo = { + encode(message: SystemInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.mode !== "") { + writer.uint32(18).string(message.mode); + } + if (message.allowRegistration === true) { + writer.uint32(24).bool(message.allowRegistration); + } + if (message.disablePasswordLogin === true) { + writer.uint32(32).bool(message.disablePasswordLogin); + } + if (message.additionalScript !== "") { + writer.uint32(42).string(message.additionalScript); + } + if (message.additionalStyle !== "") { + writer.uint32(50).string(message.additionalStyle); + } + if (message.dbSize !== 0) { + writer.uint32(56).int64(message.dbSize); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SystemInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSystemInfo(); + 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 !== 18) { + break; + } + + message.mode = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.allowRegistration = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.disablePasswordLogin = reader.bool(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.additionalScript = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.additionalStyle = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.dbSize = longToNumber(reader.int64() as Long); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): SystemInfo { + return SystemInfo.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): SystemInfo { + const message = createBaseSystemInfo(); + message.version = object.version ?? ""; + message.mode = object.mode ?? ""; + message.allowRegistration = object.allowRegistration ?? false; + message.disablePasswordLogin = object.disablePasswordLogin ?? false; + message.additionalScript = object.additionalScript ?? ""; + message.additionalStyle = object.additionalStyle ?? ""; + message.dbSize = object.dbSize ?? 0; + return message; + }, +}; + +function createBaseGetSystemInfoRequest(): GetSystemInfoRequest { + return {}; +} + +export const GetSystemInfoRequest = { + encode(_: GetSystemInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetSystemInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSystemInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetSystemInfoRequest { + return GetSystemInfoRequest.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): GetSystemInfoRequest { + const message = createBaseGetSystemInfoRequest(); + return message; + }, +}; + +function createBaseGetSystemInfoResponse(): GetSystemInfoResponse { + return { systemInfo: undefined }; +} + +export const GetSystemInfoResponse = { + encode(message: GetSystemInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.systemInfo !== undefined) { + SystemInfo.encode(message.systemInfo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetSystemInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSystemInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.systemInfo = SystemInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetSystemInfoResponse { + return GetSystemInfoResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetSystemInfoResponse { + const message = createBaseGetSystemInfoResponse(); + message.systemInfo = (object.systemInfo !== undefined && object.systemInfo !== null) + ? SystemInfo.fromPartial(object.systemInfo) + : undefined; + return message; + }, +}; + +function createBaseUpdateSystemInfoRequest(): UpdateSystemInfoRequest { + return { systemInfo: undefined, updateMask: undefined }; +} + +export const UpdateSystemInfoRequest = { + encode(message: UpdateSystemInfoRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.systemInfo !== undefined) { + SystemInfo.encode(message.systemInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSystemInfoRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateSystemInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.systemInfo = SystemInfo.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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateSystemInfoRequest { + return UpdateSystemInfoRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateSystemInfoRequest { + const message = createBaseUpdateSystemInfoRequest(); + message.systemInfo = (object.systemInfo !== undefined && object.systemInfo !== null) + ? SystemInfo.fromPartial(object.systemInfo) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseUpdateSystemInfoResponse(): UpdateSystemInfoResponse { + return { systemInfo: undefined }; +} + +export const UpdateSystemInfoResponse = { + encode(message: UpdateSystemInfoResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.systemInfo !== undefined) { + SystemInfo.encode(message.systemInfo, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSystemInfoResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateSystemInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.systemInfo = SystemInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateSystemInfoResponse { + return UpdateSystemInfoResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateSystemInfoResponse { + const message = createBaseUpdateSystemInfoResponse(); + message.systemInfo = (object.systemInfo !== undefined && object.systemInfo !== null) + ? SystemInfo.fromPartial(object.systemInfo) + : undefined; + return message; + }, +}; + +export type SystemServiceDefinition = typeof SystemServiceDefinition; +export const SystemServiceDefinition = { + name: "SystemService", + fullName: "memos.api.v2.SystemService", + methods: { + getSystemInfo: { + name: "GetSystemInfo", + requestType: GetSystemInfoRequest, + requestStream: false, + responseType: GetSystemInfoResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [ + new Uint8Array([ + 21, + 18, + 19, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 115, + 121, + 115, + 116, + 101, + 109, + 47, + 105, + 110, + 102, + 111, + ]), + ], + }, + }, + }, + updateSystemInfo: { + name: "UpdateSystemInfo", + requestType: UpdateSystemInfoRequest, + requestStream: false, + responseType: UpdateSystemInfoResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [ + new Uint8Array([ + 23, + 115, + 121, + 115, + 116, + 101, + 109, + 95, + 105, + 110, + 102, + 111, + 44, + 117, + 112, + 100, + 97, + 116, + 101, + 95, + 109, + 97, + 115, + 107, + ]), + ], + 578365826: [ + new Uint8Array([ + 34, + 58, + 11, + 115, + 121, + 115, + 116, + 101, + 109, + 95, + 105, + 110, + 102, + 111, + 50, + 19, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 115, + 121, + 115, + 116, + 101, + 109, + 47, + 105, + 110, + 102, + 111, + ]), + ], + }, + }, + }, + }, +} as const; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/web/src/types/proto/api/v2/tag_service.ts b/web/src/types/proto/api/v2/tag_service.ts new file mode 100644 index 00000000..26d4aceb --- /dev/null +++ b/web/src/types/proto/api/v2/tag_service.ts @@ -0,0 +1,413 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "memos.api.v2"; + +export interface Tag { + name: string; + /** + * The creator of tags. + * Format: users/{username} + */ + creator: string; +} + +export interface UpsertTagRequest { + name: string; +} + +export interface UpsertTagResponse { + tag?: Tag | undefined; +} + +export interface ListTagsRequest { + /** + * The creator of tags. + * Format: users/{username} + */ + creator: string; +} + +export interface ListTagsResponse { + tags: Tag[]; +} + +export interface DeleteTagRequest { + tag?: Tag | undefined; +} + +export interface DeleteTagResponse { +} + +function createBaseTag(): Tag { + return { name: "", creator: "" }; +} + +export const Tag = { + encode(message: Tag, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Tag { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTag(); + 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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): Tag { + return Tag.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): Tag { + const message = createBaseTag(); + message.name = object.name ?? ""; + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseUpsertTagRequest(): UpsertTagRequest { + return { name: "" }; +} + +export const UpsertTagRequest = { + encode(message: UpsertTagRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpsertTagRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpsertTagRequest(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpsertTagRequest { + return UpsertTagRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpsertTagRequest { + const message = createBaseUpsertTagRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseUpsertTagResponse(): UpsertTagResponse { + return { tag: undefined }; +} + +export const UpsertTagResponse = { + encode(message: UpsertTagResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tag !== undefined) { + Tag.encode(message.tag, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpsertTagResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpsertTagResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tag = Tag.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpsertTagResponse { + return UpsertTagResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpsertTagResponse { + const message = createBaseUpsertTagResponse(); + message.tag = (object.tag !== undefined && object.tag !== null) ? Tag.fromPartial(object.tag) : undefined; + return message; + }, +}; + +function createBaseListTagsRequest(): ListTagsRequest { + return { creator: "" }; +} + +export const ListTagsRequest = { + encode(message: ListTagsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListTagsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListTagsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListTagsRequest { + return ListTagsRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListTagsRequest { + const message = createBaseListTagsRequest(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +function createBaseListTagsResponse(): ListTagsResponse { + return { tags: [] }; +} + +export const ListTagsResponse = { + encode(message: ListTagsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.tags) { + Tag.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListTagsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListTagsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tags.push(Tag.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ListTagsResponse { + return ListTagsResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListTagsResponse { + const message = createBaseListTagsResponse(); + message.tags = object.tags?.map((e) => Tag.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDeleteTagRequest(): DeleteTagRequest { + return { tag: undefined }; +} + +export const DeleteTagRequest = { + encode(message: DeleteTagRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.tag !== undefined) { + Tag.encode(message.tag, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteTagRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteTagRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tag = Tag.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteTagRequest { + return DeleteTagRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): DeleteTagRequest { + const message = createBaseDeleteTagRequest(); + message.tag = (object.tag !== undefined && object.tag !== null) ? Tag.fromPartial(object.tag) : undefined; + return message; + }, +}; + +function createBaseDeleteTagResponse(): DeleteTagResponse { + return {}; +} + +export const DeleteTagResponse = { + encode(_: DeleteTagResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteTagResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteTagResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteTagResponse { + return DeleteTagResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteTagResponse { + const message = createBaseDeleteTagResponse(); + return message; + }, +}; + +export type TagServiceDefinition = typeof TagServiceDefinition; +export const TagServiceDefinition = { + name: "TagService", + fullName: "memos.api.v2.TagService", + methods: { + upsertTag: { + name: "UpsertTag", + requestType: UpsertTagRequest, + requestStream: false, + responseType: UpsertTagResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([14, 34, 12, 47, 97, 112, 105, 47, 118, 50, 47, 116, 97, 103, 115])], + }, + }, + }, + listTags: { + name: "ListTags", + requestType: ListTagsRequest, + requestStream: false, + responseType: ListTagsResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([14, 18, 12, 47, 97, 112, 105, 47, 118, 50, 47, 116, 97, 103, 115])], + }, + }, + }, + deleteTag: { + name: "DeleteTag", + requestType: DeleteTagRequest, + requestStream: false, + responseType: DeleteTagResponse, + responseStream: false, + options: { + _unknownFields: { + 578365826: [new Uint8Array([14, 42, 12, 47, 97, 112, 105, 47, 118, 50, 47, 116, 97, 103, 115])], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/web/src/types/proto/api/v2/user_service.ts b/web/src/types/proto/api/v2/user_service.ts new file mode 100644 index 00000000..493f77e8 --- /dev/null +++ b/web/src/types/proto/api/v2/user_service.ts @@ -0,0 +1,1248 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { FieldMask } from "../../google/protobuf/field_mask"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { RowStatus } from "./common"; + +export const protobufPackage = "memos.api.v2"; + +export interface User { + /** + * The name of the user. + * Format: users/{username} + */ + name: string; + id: number; + role: User_Role; + email: string; + nickname: string; + avatarUrl: string; + password: string; + rowStatus: RowStatus; + createTime?: Date | undefined; + updateTime?: Date | undefined; +} + +export enum User_Role { + ROLE_UNSPECIFIED = 0, + HOST = 1, + ADMIN = 2, + USER = 3, + UNRECOGNIZED = -1, +} + +export interface GetUserRequest { + /** + * The name of the user. + * Format: users/{username} + */ + name: string; +} + +export interface GetUserResponse { + user?: User | undefined; +} + +export interface CreateUserRequest { + user?: User | undefined; +} + +export interface CreateUserResponse { + user?: User | undefined; +} + +export interface UpdateUserRequest { + user?: User | undefined; + updateMask?: string[] | undefined; +} + +export interface UpdateUserResponse { + user?: User | undefined; +} + +export interface UserAccessToken { + accessToken: string; + description: string; + issuedAt?: Date | undefined; + expiresAt?: Date | undefined; +} + +export interface ListUserAccessTokensRequest { + /** + * The name of the user. + * Format: users/{username} + */ + name: string; +} + +export interface ListUserAccessTokensResponse { + accessTokens: UserAccessToken[]; +} + +export interface CreateUserAccessTokenRequest { + /** + * The name of the user. + * Format: users/{username} + */ + name: string; + description: string; + expiresAt?: Date | undefined; +} + +export interface CreateUserAccessTokenResponse { + accessToken?: UserAccessToken | undefined; +} + +export interface DeleteUserAccessTokenRequest { + /** + * The name of the user. + * Format: users/{username} + */ + name: string; + /** access_token is the access token to delete. */ + accessToken: string; +} + +export interface DeleteUserAccessTokenResponse { +} + +function createBaseUser(): User { + return { + name: "", + id: 0, + role: 0, + email: "", + nickname: "", + avatarUrl: "", + password: "", + rowStatus: 0, + createTime: undefined, + updateTime: undefined, + }; +} + +export const User = { + encode(message: User, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.id !== 0) { + writer.uint32(16).int32(message.id); + } + if (message.role !== 0) { + writer.uint32(24).int32(message.role); + } + if (message.email !== "") { + writer.uint32(34).string(message.email); + } + if (message.nickname !== "") { + writer.uint32(42).string(message.nickname); + } + if (message.avatarUrl !== "") { + writer.uint32(50).string(message.avatarUrl); + } + if (message.password !== "") { + writer.uint32(58).string(message.password); + } + if (message.rowStatus !== 0) { + writer.uint32(64).int32(message.rowStatus); + } + if (message.createTime !== undefined) { + Timestamp.encode(toTimestamp(message.createTime), writer.uint32(74).fork()).ldelim(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(82).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): User { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 2: + if (tag !== 16) { + break; + } + + message.id = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.role = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.email = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.nickname = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.avatarUrl = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.password = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.rowStatus = reader.int32() as any; + continue; + case 9: + if (tag !== 74) { + break; + } + + message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): User { + return User.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): User { + const message = createBaseUser(); + message.name = object.name ?? ""; + message.id = object.id ?? 0; + message.role = object.role ?? 0; + message.email = object.email ?? ""; + message.nickname = object.nickname ?? ""; + message.avatarUrl = object.avatarUrl ?? ""; + message.password = object.password ?? ""; + message.rowStatus = object.rowStatus ?? 0; + message.createTime = object.createTime ?? undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, +}; + +function createBaseGetUserRequest(): GetUserRequest { + return { name: "" }; +} + +export const GetUserRequest = { + encode(message: GetUserRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetUserRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseGetUserResponse(): GetUserResponse { + return { user: undefined }; +} + +export const GetUserResponse = { + encode(message: GetUserResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetUserResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): GetUserResponse { + return GetUserResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetUserResponse { + const message = createBaseGetUserResponse(); + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +function createBaseCreateUserRequest(): CreateUserRequest { + return { user: undefined }; +} + +export const CreateUserRequest = { + encode(message: CreateUserRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateUserRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseCreateUserResponse(): CreateUserResponse { + return { user: undefined }; +} + +export const CreateUserResponse = { + encode(message: CreateUserResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateUserResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateUserResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateUserResponse { + return CreateUserResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateUserResponse { + const message = createBaseCreateUserResponse(); + 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 = { + encode(message: UpdateUserRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).ldelim(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateUserRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseUpdateUserResponse(): UpdateUserResponse { + return { user: undefined }; +} + +export const UpdateUserResponse = { + encode(message: UpdateUserResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.user !== undefined) { + User.encode(message.user, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateUserResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserResponse(); + 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UpdateUserResponse { + return UpdateUserResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateUserResponse { + const message = createBaseUpdateUserResponse(); + message.user = (object.user !== undefined && object.user !== null) ? User.fromPartial(object.user) : undefined; + return message; + }, +}; + +function createBaseUserAccessToken(): UserAccessToken { + return { accessToken: "", description: "", issuedAt: undefined, expiresAt: undefined }; +} + +export const UserAccessToken = { + encode(message: UserAccessToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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()).ldelim(); + } + if (message.expiresAt !== undefined) { + Timestamp.encode(toTimestamp(message.expiresAt), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UserAccessToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: ListUserAccessTokensRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListUserAccessTokensRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: ListUserAccessTokensResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accessTokens) { + UserAccessToken.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListUserAccessTokensResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: CreateUserAccessTokenRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateUserAccessTokenRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseCreateUserAccessTokenResponse(): CreateUserAccessTokenResponse { + return { accessToken: undefined }; +} + +export const CreateUserAccessTokenResponse = { + encode(message: CreateUserAccessTokenResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accessToken !== undefined) { + UserAccessToken.encode(message.accessToken, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateUserAccessTokenResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateUserAccessTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessToken = UserAccessToken.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): CreateUserAccessTokenResponse { + return CreateUserAccessTokenResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateUserAccessTokenResponse { + const message = createBaseCreateUserAccessTokenResponse(); + message.accessToken = (object.accessToken !== undefined && object.accessToken !== null) + ? UserAccessToken.fromPartial(object.accessToken) + : undefined; + return message; + }, +}; + +function createBaseDeleteUserAccessTokenRequest(): DeleteUserAccessTokenRequest { + return { name: "", accessToken: "" }; +} + +export const DeleteUserAccessTokenRequest = { + encode(message: DeleteUserAccessTokenRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.accessToken !== "") { + writer.uint32(18).string(message.accessToken); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteUserAccessTokenRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseDeleteUserAccessTokenResponse(): DeleteUserAccessTokenResponse { + return {}; +} + +export const DeleteUserAccessTokenResponse = { + encode(_: DeleteUserAccessTokenResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteUserAccessTokenResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteUserAccessTokenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): DeleteUserAccessTokenResponse { + return DeleteUserAccessTokenResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteUserAccessTokenResponse { + const message = createBaseDeleteUserAccessTokenResponse(); + return message; + }, +}; + +export type UserServiceDefinition = typeof UserServiceDefinition; +export const UserServiceDefinition = { + name: "UserService", + fullName: "memos.api.v2.UserService", + methods: { + getUser: { + name: "GetUser", + requestType: GetUserRequest, + requestStream: false, + responseType: GetUserResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 110, 97, 109, 101])], + 578365826: [ + new Uint8Array([ + 24, + 18, + 22, + 47, + 97, + 112, + 105, + 47, + 118, + 50, + 47, + 123, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 125, + ]), + ], + }, + }, + }, + createUser: { + name: "CreateUser", + requestType: CreateUserRequest, + requestStream: false, + responseType: CreateUserResponse, + responseStream: false, + options: { + _unknownFields: { + 8410: [new Uint8Array([4, 117, 115, 101, 114])], + 578365826: [new Uint8Array([17, 58, 4, 117, 115, 101, 114, 34, 9, 47, 118, 49, 47, 117, 115, 101, 114, 115])], + }, + }, + }, + updateUser: { + name: "UpdateUser", + requestType: UpdateUserRequest, + requestStream: false, + responseType: UpdateUserResponse, + 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, + 50, + 47, + 123, + 117, + 115, + 101, + 114, + 46, + 110, + 97, + 109, + 101, + 61, + 117, + 115, + 101, + 114, + 115, + 47, + 42, + 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, + 50, + 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: CreateUserAccessTokenResponse, + 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, + 50, + 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: DeleteUserAccessTokenResponse, + 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, + 50, + 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, + ]), + ], + }, + }, + }, + }, +} as const; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function toTimestamp(date: Date): Timestamp { + const seconds = 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 Date(millis); +} 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..c2161053 --- /dev/null +++ b/web/src/types/proto/google/api/annotations.ts @@ -0,0 +1,3 @@ +/* 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..ca455eba --- /dev/null +++ b/web/src/types/proto/google/api/client.ts @@ -0,0 +1,1588 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Duration } from "../protobuf/duration"; +import { LaunchStage } 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 = 0, + /** CLOUD - Google Cloud Platform Org. */ + CLOUD = 1, + /** ADS - Ads (Advertising) Org. */ + ADS = 2, + /** PHOTOS - Photos Org. */ + PHOTOS = 3, + /** STREET_VIEW - Street View Org. */ + STREET_VIEW = 4, + /** SHOPPING - Shopping Org. */ + SHOPPING = 5, + /** GEO - Geo Org. */ + GEO = 6, + /** GENERATIVE_AI - Generative AI - https://developers.generativeai.google */ + GENERATIVE_AI = 7, + UNRECOGNIZED = -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 = 0, + /** + * GITHUB - Generate the client library in a repo under github.com/googleapis, + * but don't publish it to package managers. + */ + GITHUB = 10, + /** PACKAGE_MANAGER - Publish the library to package managers like nuget.org and npmjs.com. */ + PACKAGE_MANAGER = 20, + UNRECOGNIZED = -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[]; +} + +/** 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; +} + +/** 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; +} + +/** 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; +} + +/** 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. + */ + 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: + * seconds: 60 # 1 minute + * poll_delay_multiplier: 1.5 + * max_poll_delay: + * seconds: 360 # 6 minutes + * total_poll_timeout: + * seconds: 54000 # 90 minutes + */ + longRunning?: MethodSettings_LongRunning | undefined; +} + +/** + * 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; +} + +function createBaseCommonLanguageSettings(): CommonLanguageSettings { + return { referenceDocsUri: "", destinations: [] }; +} + +export const CommonLanguageSettings = { + encode(message: CommonLanguageSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.referenceDocsUri !== "") { + writer.uint32(10).string(message.referenceDocsUri); + } + writer.uint32(18).fork(); + for (const v of message.destinations) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CommonLanguageSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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(reader.int32() as any); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.destinations.push(reader.int32() as any); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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) || []; + return message; + }, +}; + +function createBaseClientLibrarySettings(): ClientLibrarySettings { + return { + version: "", + launchStage: 0, + restNumericEnums: false, + javaSettings: undefined, + cppSettings: undefined, + phpSettings: undefined, + pythonSettings: undefined, + nodeSettings: undefined, + dotnetSettings: undefined, + rubySettings: undefined, + goSettings: undefined, + }; +} + +export const ClientLibrarySettings = { + encode(message: ClientLibrarySettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.launchStage !== 0) { + writer.uint32(16).int32(message.launchStage); + } + if (message.restNumericEnums === true) { + writer.uint32(24).bool(message.restNumericEnums); + } + if (message.javaSettings !== undefined) { + JavaSettings.encode(message.javaSettings, writer.uint32(170).fork()).ldelim(); + } + if (message.cppSettings !== undefined) { + CppSettings.encode(message.cppSettings, writer.uint32(178).fork()).ldelim(); + } + if (message.phpSettings !== undefined) { + PhpSettings.encode(message.phpSettings, writer.uint32(186).fork()).ldelim(); + } + if (message.pythonSettings !== undefined) { + PythonSettings.encode(message.pythonSettings, writer.uint32(194).fork()).ldelim(); + } + if (message.nodeSettings !== undefined) { + NodeSettings.encode(message.nodeSettings, writer.uint32(202).fork()).ldelim(); + } + if (message.dotnetSettings !== undefined) { + DotnetSettings.encode(message.dotnetSettings, writer.uint32(210).fork()).ldelim(); + } + if (message.rubySettings !== undefined) { + RubySettings.encode(message.rubySettings, writer.uint32(218).fork()).ldelim(); + } + if (message.goSettings !== undefined) { + GoSettings.encode(message.goSettings, writer.uint32(226).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ClientLibrarySettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + 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.skipType(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 ?? 0; + 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: 0, + librarySettings: [], + protoReferenceDocumentationUri: "", + }; +} + +export const Publishing = { + encode(message: Publishing, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.methodSettings) { + MethodSettings.encode(v!, writer.uint32(18).fork()).ldelim(); + } + 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 !== 0) { + writer.uint32(856).int32(message.organization); + } + for (const v of message.librarySettings) { + ClientLibrarySettings.encode(v!, writer.uint32(874).fork()).ldelim(); + } + if (message.protoReferenceDocumentationUri !== "") { + writer.uint32(882).string(message.protoReferenceDocumentationUri); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Publishing { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + 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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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 ?? 0; + message.librarySettings = object.librarySettings?.map((e) => ClientLibrarySettings.fromPartial(e)) || []; + message.protoReferenceDocumentationUri = object.protoReferenceDocumentationUri ?? ""; + return message; + }, +}; + +function createBaseJavaSettings(): JavaSettings { + return { libraryPackage: "", serviceClassNames: {}, common: undefined }; +} + +export const JavaSettings = { + encode(message: JavaSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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()).ldelim(); + }); + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): JavaSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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] = 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 = { + encode(message: JavaSettings_ServiceClassNamesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): JavaSettings_ServiceClassNamesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: CppSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CppSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: PhpSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PhpSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 }; +} + +export const PythonSettings = { + encode(message: PythonSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PythonSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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; + return message; + }, +}; + +function createBaseNodeSettings(): NodeSettings { + return { common: undefined }; +} + +export const NodeSettings = { + encode(message: NodeSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): NodeSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: DotnetSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + Object.entries(message.renamedServices).forEach(([key, value]) => { + DotnetSettings_RenamedServicesEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).ldelim(); + }); + Object.entries(message.renamedResources).forEach(([key, value]) => { + DotnetSettings_RenamedResourcesEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).ldelim(); + }); + 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: _m0.Reader | Uint8Array, length?: number): DotnetSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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] = String(value); + } + return acc; + }, + {}, + ); + message.renamedResources = Object.entries(object.renamedResources ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = 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 = { + encode(message: DotnetSettings_RenamedServicesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DotnetSettings_RenamedServicesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: DotnetSettings_RenamedResourcesEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DotnetSettings_RenamedResourcesEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: RubySettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RubySettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 }; +} + +export const GoSettings = { + encode(message: GoSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.common !== undefined) { + CommonLanguageSettings.encode(message.common, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GoSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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; + return message; + }, +}; + +function createBaseMethodSettings(): MethodSettings { + return { selector: "", longRunning: undefined }; +} + +export const MethodSettings = { + encode(message: MethodSettings, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.longRunning !== undefined) { + MethodSettings_LongRunning.encode(message.longRunning, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodSettings { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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; + return message; + }, +}; + +function createBaseMethodSettings_LongRunning(): MethodSettings_LongRunning { + return { initialPollDelay: undefined, pollDelayMultiplier: 0, maxPollDelay: undefined, totalPollTimeout: undefined }; +} + +export const MethodSettings_LongRunning = { + encode(message: MethodSettings_LongRunning, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.initialPollDelay !== undefined) { + Duration.encode(message.initialPollDelay, writer.uint32(10).fork()).ldelim(); + } + if (message.pollDelayMultiplier !== 0) { + writer.uint32(21).float(message.pollDelayMultiplier); + } + if (message.maxPollDelay !== undefined) { + Duration.encode(message.maxPollDelay, writer.uint32(26).fork()).ldelim(); + } + if (message.totalPollTimeout !== undefined) { + Duration.encode(message.totalPollTimeout, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodSettings_LongRunning { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; 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..0f52c7f0 --- /dev/null +++ b/web/src/types/proto/google/api/field_behavior.ts @@ -0,0 +1,62 @@ +/* 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 = 0, + /** + * OPTIONAL - Specifically denotes a field as optional. + * While all fields in protocol buffers are optional, this may be specified + * for emphasis if appropriate. + */ + OPTIONAL = 1, + /** + * 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 = 2, + /** + * 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 = 3, + /** + * 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 = 4, + /** + * 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 = 5, + /** + * 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 = 6, + /** + * 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 = 7, + UNRECOGNIZED = -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..50b5c5d8 --- /dev/null +++ b/web/src/types/proto/google/api/http.ts @@ -0,0 +1,653 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +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 | gRPC + * -----|----- + * `GET /v1/messages/123456` | `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 | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `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 | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `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 | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `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 | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `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. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - 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 = { + encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Http { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: HttpRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + 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()).ldelim(); + } + 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()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: CustomHttpPattern, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; 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..47b30ac2 --- /dev/null +++ b/web/src/types/proto/google/api/launch_stage.ts @@ -0,0 +1,58 @@ +/* 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 = 0, + /** UNIMPLEMENTED - The feature is not yet implemented. Users can not use it. */ + UNIMPLEMENTED = 6, + /** PRELAUNCH - Prelaunch features are hidden from users and are only visible internally. */ + PRELAUNCH = 7, + /** + * 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 = 1, + /** + * 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 = 2, + /** + * 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 = 3, + /** + * GA - GA features are open to all developers and are considered stable and + * fully qualified for production use. + */ + GA = 4, + /** + * 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 = 5, + UNRECOGNIZED = -1, +} 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..51796d26 --- /dev/null +++ b/web/src/types/proto/google/protobuf/descriptor.ts @@ -0,0 +1,3573 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * 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; + /** e.g. "foo", "foo.bar", etc. */ + package: string; + /** 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". + */ + syntax: string; + /** The edition of the proto file, which is an opaque string. */ + edition: string; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + 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; + /** Exclusive. */ + end: number; + 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; + /** Exclusive. */ + end: number; +} + +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * 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; + /** + * 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; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * 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; + /** + * 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; + /** + * 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; + 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 be 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; +} + +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions | undefined; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + 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; + /** Inclusive. */ + end: number; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions | undefined; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions | undefined; +} + +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name: string; + /** + * 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; + outputType: string; + options?: + | MethodOptions + | undefined; + /** Identifies if client streams multiple client messages */ + clientStreaming: boolean; + /** Identifies if server streams multiple server messages */ + serverStreaming: boolean; +} + +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; + /** + * 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; + /** + * 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; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + javaStringCheckUtf8: boolean; + optimizeFor: FileOptions_OptimizeMode; + /** + * 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; + /** + * 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; + javaGenericServices: boolean; + pyGenericServices: boolean; + phpGenericServices: boolean; + /** + * 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; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace: string; + /** + * 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; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix: string; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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 = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -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; + /** + * 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; + /** + * 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; + /** + * 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. + * + * 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. + */ + mapEntry: boolean; + /** + * 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(b/261750190) This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * 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 not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype: FieldOptions_CType; + /** + * 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. + */ + packed: boolean; + /** + * 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; + /** + * 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 implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + * + * As of May 2022, lazy verifies the contents of the byte stream during + * parsing. An invalid byte stream will cause the overall parsing to fail. + */ + lazy: boolean; + /** + * 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; + /** + * 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; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact: boolean; + retention: FieldOptions_OptionRetention; + target: FieldOptions_OptionTargetType; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} + +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -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. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export interface OneofOptions { + /** 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; + /** + * 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; + /** + * 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(b/261750190) Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecatedLegacyJsonFieldConflicts: boolean; + /** 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; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * 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; + /** 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; + idempotencyLevel: MethodOptions_IdempotencyLevel; + /** 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 = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -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; + positiveIntValue: number; + negativeIntValue: number; + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; +} + +/** + * 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; +} + +/** + * 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 occurs. + * 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; + trailingComments: string; + 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; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * 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; + semantic: GeneratedCodeInfo_Annotation_Semantic; +} + +/** + * 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 = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +export const FileDescriptorSet = { + encode(message: FileDescriptorSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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: "", + }; +} + +export const FileDescriptorProto = { + encode(message: FileDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (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.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== "") { + writer.uint32(106).string(message.edition); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 13: + if (tag !== 106) { + break; + } + + message.edition = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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 ?? ""; + return message; + }, +}; + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [], + }; +} + +export const DescriptorProto = { + encode(message: DescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: DescriptorProto_ExtensionRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: DescriptorProto_ReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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: [] }; +} + +export const ExtensionRangeOptions = { + encode(message: ExtensionRangeOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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)) || []; + return message; + }, +}; + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false, + }; +} + +export const FieldDescriptorProto = { + encode(message: FieldDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.proto3Optional === true) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.type = reader.int32() as any; + 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.skipType(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 ?? 1; + message.type = object.type ?? 1; + 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 = { + encode(message: OneofDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: EnumDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: EnumDescriptorProto_EnumReservedRange, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: EnumValueDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: ServiceDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: MethodDescriptorProto, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.clientStreaming === true) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming === true) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + phpGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + uninterpretedOption: [], + }; +} + +export const FileOptions = { + encode(message: FileOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles === true) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash === true) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 === true) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices === true) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices === true) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices === true) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.phpGenericServices === true) { + writer.uint32(336).bool(message.phpGenericServices); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas === true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + 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 42: + if (tag !== 336) { + break; + } + + message.phpGenericServices = 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 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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 ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.phpGenericServices = object.phpGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? false; + 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.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + uninterpretedOption: [], + }; +} + +export const MessageOptions = { + encode(message: MessageOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.messageSetWireFormat === true) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor === true) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry === true) { + writer.uint32(56).bool(message.mapEntry); + } + if (message.deprecatedLegacyJsonFieldConflicts === true) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 0, + target: 0, + uninterpretedOption: [], + }; +} + +export const FieldOptions = { + encode(message: FieldOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy === true) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } + if (message.debugRedact === true) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + if (message.target !== 0) { + writer.uint32(144).int32(message.target); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.packed = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jstype = reader.int32() as any; + 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 = reader.int32() as any; + continue; + case 18: + if (tag !== 144) { + break; + } + + message.target = reader.int32() as any; + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): FieldOptions { + return FieldOptions.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + 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 ?? 0; + message.target = object.target ?? 0; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOneofOptions(): OneofOptions { + return { uninterpretedOption: [] }; +} + +export const OneofOptions = { + encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): OneofOptions { + return OneofOptions.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumOptions(): EnumOptions { + return { allowAlias: false, deprecated: false, deprecatedLegacyJsonFieldConflicts: false, uninterpretedOption: [] }; +} + +export const EnumOptions = { + encode(message: EnumOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.allowAlias === true) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.deprecatedLegacyJsonFieldConflicts === true) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEnumValueOptions(): EnumValueOptions { + return { deprecated: false, uninterpretedOption: [] }; +} + +export const EnumValueOptions = { + encode(message: EnumValueOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseServiceOptions(): ServiceOptions { + return { deprecated: false, uninterpretedOption: [] }; +} + +export const ServiceOptions = { + encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 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.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ServiceOptions { + return ServiceOptions.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ServiceOptions { + const message = createBaseServiceOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMethodOptions(): MethodOptions { + return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; +} + +export const MethodOptions = { + encode(message: MethodOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== 0) { + writer.uint32(272).int32(message.idempotencyLevel); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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 ?? 0; + 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 = { + encode(message: UninterpretedOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== 0) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== 0) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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() as Long); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.negativeIntValue = longToNumber(reader.int64() as Long); + 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.skipType(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 = { + encode(message: UninterpretedOption_NamePart, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension === true) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +export const SourceCodeInfo = { + encode(message: SourceCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: SourceCodeInfo_Location, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.ldelim(); + if (message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 = { + encode(message: GeneratedCodeInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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: 0 }; +} + +export const GeneratedCodeInfo_Annotation = { + encode(message: GeneratedCodeInfo_Annotation, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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 ?? 0; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} 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..0d723a1e --- /dev/null +++ b/web/src/types/proto/google/protobuf/duration.ts @@ -0,0 +1,178 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +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 = { + encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Duration { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} 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..42e64470 --- /dev/null +++ b/web/src/types/proto/google/protobuf/field_mask.ts @@ -0,0 +1,272 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +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 = { + encode(message: FieldMask, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.paths) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): FieldMask { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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.skipType(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 Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; 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..cdf3e4d7 --- /dev/null +++ b/web/src/types/proto/google/protobuf/timestamp.ts @@ -0,0 +1,207 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +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://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) 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 = { + encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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() as Long); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} diff --git a/web/src/types/proto/store/activity.ts b/web/src/types/proto/store/activity.ts new file mode 100644 index 00000000..4248b389 --- /dev/null +++ b/web/src/types/proto/store/activity.ts @@ -0,0 +1,189 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "memos.store"; + +export interface ActivityMemoCommentPayload { + memoId: number; + relatedMemoId: number; +} + +export interface ActivityVersionUpdatePayload { + version: string; +} + +export interface ActivityPayload { + memoComment?: ActivityMemoCommentPayload | undefined; + versionUpdate?: ActivityVersionUpdatePayload | undefined; +} + +function createBaseActivityMemoCommentPayload(): ActivityMemoCommentPayload { + return { memoId: 0, relatedMemoId: 0 }; +} + +export const ActivityMemoCommentPayload = { + encode(message: ActivityMemoCommentPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memoId !== 0) { + writer.uint32(8).int32(message.memoId); + } + if (message.relatedMemoId !== 0) { + writer.uint32(16).int32(message.relatedMemoId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActivityMemoCommentPayload { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.memoId = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.relatedMemoId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ActivityMemoCommentPayload { + return ActivityMemoCommentPayload.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ActivityMemoCommentPayload { + const message = createBaseActivityMemoCommentPayload(); + message.memoId = object.memoId ?? 0; + message.relatedMemoId = object.relatedMemoId ?? 0; + return message; + }, +}; + +function createBaseActivityVersionUpdatePayload(): ActivityVersionUpdatePayload { + return { version: "" }; +} + +export const ActivityVersionUpdatePayload = { + encode(message: ActivityVersionUpdatePayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActivityVersionUpdatePayload { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivityVersionUpdatePayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): ActivityVersionUpdatePayload { + return ActivityVersionUpdatePayload.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ActivityVersionUpdatePayload { + const message = createBaseActivityVersionUpdatePayload(); + message.version = object.version ?? ""; + return message; + }, +}; + +function createBaseActivityPayload(): ActivityPayload { + return { memoComment: undefined, versionUpdate: undefined }; +} + +export const ActivityPayload = { + encode(message: ActivityPayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.memoComment !== undefined) { + ActivityMemoCommentPayload.encode(message.memoComment, writer.uint32(10).fork()).ldelim(); + } + if (message.versionUpdate !== undefined) { + ActivityVersionUpdatePayload.encode(message.versionUpdate, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActivityPayload { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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; + case 2: + if (tag !== 18) { + break; + } + + message.versionUpdate = ActivityVersionUpdatePayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(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; + message.versionUpdate = (object.versionUpdate !== undefined && object.versionUpdate !== null) + ? ActivityVersionUpdatePayload.fromPartial(object.versionUpdate) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/web/src/types/proto/store/common.ts b/web/src/types/proto/store/common.ts new file mode 100644 index 00000000..2b4af3af --- /dev/null +++ b/web/src/types/proto/store/common.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "memos.store"; diff --git a/web/src/types/proto/store/inbox.ts b/web/src/types/proto/store/inbox.ts new file mode 100644 index 00000000..e21b3c49 --- /dev/null +++ b/web/src/types/proto/store/inbox.ts @@ -0,0 +1,80 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "memos.store"; + +export interface InboxMessage { + type: InboxMessage_Type; + activityId?: number | undefined; +} + +export enum InboxMessage_Type { + TYPE_UNSPECIFIED = 0, + TYPE_MEMO_COMMENT = 1, + TYPE_VERSION_UPDATE = 2, + UNRECOGNIZED = -1, +} + +function createBaseInboxMessage(): InboxMessage { + return { type: 0, activityId: undefined }; +} + +export const InboxMessage = { + encode(message: InboxMessage, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.activityId !== undefined) { + writer.uint32(16).int32(message.activityId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InboxMessage { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInboxMessage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.activityId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): InboxMessage { + return InboxMessage.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): InboxMessage { + const message = createBaseInboxMessage(); + message.type = object.type ?? 0; + message.activityId = object.activityId ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/web/src/types/proto/store/system_setting.ts b/web/src/types/proto/store/system_setting.ts new file mode 100644 index 00000000..e853f9c5 --- /dev/null +++ b/web/src/types/proto/store/system_setting.ts @@ -0,0 +1,95 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "memos.store"; + +export enum SystemSettingKey { + SYSTEM_SETTING_KEY_UNSPECIFIED = 0, + /** BACKUP_CONFIG - BackupConfig is the key for auto-backup configuration. */ + BACKUP_CONFIG = 1, + UNRECOGNIZED = -1, +} + +export interface BackupConfig { + /** enabled indicates whether backup is enabled. */ + enabled: boolean; + /** cron is the cron expression for backup. See https://godoc.org/github.com/robfig/cron#hdr-CRON_Expression_Format */ + cron: string; + /** max_keep is the maximum number of backups to keep. */ + maxKeep: number; +} + +function createBaseBackupConfig(): BackupConfig { + return { enabled: false, cron: "", maxKeep: 0 }; +} + +export const BackupConfig = { + encode(message: BackupConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.enabled === true) { + writer.uint32(8).bool(message.enabled); + } + if (message.cron !== "") { + writer.uint32(18).string(message.cron); + } + if (message.maxKeep !== 0) { + writer.uint32(24).int32(message.maxKeep); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): BackupConfig { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBackupConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.enabled = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.cron = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.maxKeep = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): BackupConfig { + return BackupConfig.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): BackupConfig { + const message = createBaseBackupConfig(); + message.enabled = object.enabled ?? false; + message.cron = object.cron ?? ""; + message.maxKeep = object.maxKeep ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; diff --git a/web/src/types/proto/store/user_setting.ts b/web/src/types/proto/store/user_setting.ts new file mode 100644 index 00000000..b2dc6cc4 --- /dev/null +++ b/web/src/types/proto/store/user_setting.ts @@ -0,0 +1,211 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "memos.store"; + +export enum UserSettingKey { + USER_SETTING_KEY_UNSPECIFIED = 0, + /** USER_SETTING_ACCESS_TOKENS - Access tokens for the user. */ + USER_SETTING_ACCESS_TOKENS = 1, + UNRECOGNIZED = -1, +} + +export interface UserSetting { + userId: number; + key: UserSettingKey; + accessTokens?: AccessTokensUserSetting | undefined; +} + +export interface AccessTokensUserSetting { + accessTokens: AccessTokensUserSetting_AccessToken[]; +} + +export interface AccessTokensUserSetting_AccessToken { + /** + * The access token is a JWT token. + * Including expiration time, issuer, etc. + */ + accessToken: string; + /** A description for the access token. */ + description: string; +} + +function createBaseUserSetting(): UserSetting { + return { userId: 0, key: 0, accessTokens: undefined }; +} + +export const UserSetting = { + encode(message: UserSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.userId !== 0) { + writer.uint32(8).int32(message.userId); + } + if (message.key !== 0) { + writer.uint32(16).int32(message.key); + } + if (message.accessTokens !== undefined) { + AccessTokensUserSetting.encode(message.accessTokens, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UserSetting { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(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 !== 8) { + break; + } + + message.userId = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.key = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.accessTokens = AccessTokensUserSetting.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): UserSetting { + return UserSetting.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UserSetting { + const message = createBaseUserSetting(); + message.userId = object.userId ?? 0; + message.key = object.key ?? 0; + message.accessTokens = (object.accessTokens !== undefined && object.accessTokens !== null) + ? AccessTokensUserSetting.fromPartial(object.accessTokens) + : undefined; + return message; + }, +}; + +function createBaseAccessTokensUserSetting(): AccessTokensUserSetting { + return { accessTokens: [] }; +} + +export const AccessTokensUserSetting = { + encode(message: AccessTokensUserSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.accessTokens) { + AccessTokensUserSetting_AccessToken.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccessTokensUserSetting { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTokensUserSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessTokens.push(AccessTokensUserSetting_AccessToken.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): AccessTokensUserSetting { + return AccessTokensUserSetting.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): AccessTokensUserSetting { + const message = createBaseAccessTokensUserSetting(); + message.accessTokens = object.accessTokens?.map((e) => AccessTokensUserSetting_AccessToken.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAccessTokensUserSetting_AccessToken(): AccessTokensUserSetting_AccessToken { + return { accessToken: "", description: "" }; +} + +export const AccessTokensUserSetting_AccessToken = { + encode(message: AccessTokensUserSetting_AccessToken, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.accessToken !== "") { + writer.uint32(10).string(message.accessToken); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AccessTokensUserSetting_AccessToken { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTokensUserSetting_AccessToken(); + 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; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + create(base?: DeepPartial): AccessTokensUserSetting_AccessToken { + return AccessTokensUserSetting_AccessToken.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): AccessTokensUserSetting_AccessToken { + const message = createBaseAccessTokensUserSetting_AccessToken(); + message.accessToken = object.accessToken ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial;