diff --git a/api/v2/v2.go b/api/v2/v2.go index 8bb96e6..b712753 100644 --- a/api/v2/v2.go +++ b/api/v2/v2.go @@ -30,6 +30,7 @@ func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store ), ) apiv2pb.RegisterUserServiceServer(grpcServer, NewUserService(secret, store)) + apiv2pb.RegisterUserSettingServiceServer(grpcServer, NewUserSettingService(store)) apiv2pb.RegisterShortcutServiceServer(grpcServer, NewShortcutService(secret, store)) return &APIV2Service{ @@ -62,6 +63,9 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error if err := apiv2pb.RegisterUserServiceHandler(context.Background(), gwMux, conn); err != nil { return err } + if err := apiv2pb.RegisterUserSettingServiceHandler(context.Background(), gwMux, conn); err != nil { + return err + } if err := apiv2pb.RegisterShortcutServiceHandler(context.Background(), gwMux, conn); err != nil { return err } diff --git a/frontend/web/package.json b/frontend/web/package.json index 2f8db28..0a5e2fb 100644 --- a/frontend/web/package.json +++ b/frontend/web/package.json @@ -33,7 +33,6 @@ "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/lodash-es": "^4.17.8", - "@types/node": "^20.5.6", "@types/react": "^18.2.21", "@types/react-dom": "^18.2.7", "@typescript-eslint/eslint-plugin": "^6.4.1", @@ -44,9 +43,11 @@ "eslint-config-prettier": "^8.10.0", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-react": "^7.33.2", + "long": "^5.2.3", "postcss": "^8.4.28", "prettier": "2.6.2", + "protobufjs": "^7.2.5", "typescript": "^5.2.2", "vite": "^4.4.9" } -} +} \ No newline at end of file diff --git a/frontend/web/pnpm-lock.yaml b/frontend/web/pnpm-lock.yaml index a6d1f58..9cecb15 100644 --- a/frontend/web/pnpm-lock.yaml +++ b/frontend/web/pnpm-lock.yaml @@ -55,7 +55,7 @@ dependencies: version: 2.4.1(csstype@3.1.2)(react-dom@18.2.0)(react@18.2.0) react-i18next: specifier: ^13.2.0 - version: 13.2.1(i18next@23.4.6)(react-dom@18.2.0)(react@18.2.0) + version: 13.2.2(i18next@23.4.6)(react-dom@18.2.0)(react@18.2.0) react-redux: specifier: ^8.1.2 version: 8.1.2(@types/react-dom@18.2.7)(@types/react@18.2.21)(react-dom@18.2.0)(react@18.2.0)(redux@4.2.1) @@ -76,9 +76,6 @@ devDependencies: '@types/lodash-es': specifier: ^4.17.8 version: 4.17.9 - '@types/node': - specifier: ^20.5.6 - version: 20.5.8 '@types/react': specifier: ^18.2.21 version: 18.2.21 @@ -109,18 +106,24 @@ devDependencies: eslint-plugin-react: specifier: ^7.33.2 version: 7.33.2(eslint@8.48.0) + long: + specifier: ^5.2.3 + version: 5.2.3 postcss: specifier: ^8.4.28 version: 8.4.29 prettier: specifier: 2.6.2 version: 2.6.2 + protobufjs: + specifier: ^7.2.5 + version: 7.2.5 typescript: specifier: ^5.2.2 version: 5.2.2 vite: specifier: ^4.4.9 - version: 4.4.9(@types/node@20.5.8) + version: 4.4.9 packages: @@ -841,6 +844,49 @@ packages: resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} dev: false + /@protobufjs/aspromise@1.1.2: + resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} + dev: true + + /@protobufjs/base64@1.1.2: + resolution: {integrity: sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==} + dev: true + + /@protobufjs/codegen@2.0.4: + resolution: {integrity: sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==} + dev: true + + /@protobufjs/eventemitter@1.1.0: + resolution: {integrity: sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==} + dev: true + + /@protobufjs/fetch@1.1.0: + resolution: {integrity: sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==} + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/inquire': 1.1.0 + dev: true + + /@protobufjs/float@1.0.2: + resolution: {integrity: sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==} + dev: true + + /@protobufjs/inquire@1.1.0: + resolution: {integrity: sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==} + dev: true + + /@protobufjs/path@1.1.2: + resolution: {integrity: sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==} + dev: true + + /@protobufjs/pool@1.1.0: + resolution: {integrity: sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==} + dev: true + + /@protobufjs/utf8@1.1.0: + resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} + dev: true + /@reduxjs/toolkit@1.9.5(react-redux@8.1.2)(react@18.2.0): resolution: {integrity: sha512-Rt97jHmfTeaxL4swLRNPD/zV4OxTes4la07Xc4hetpUW/vc75t5m1ANyxG6ymnEQ2FsLQsoMlYB2vV1sO3m8tQ==} peerDependencies: @@ -1024,8 +1070,8 @@ packages: resolution: {integrity: sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==} dev: true - /@types/node@20.5.8: - resolution: {integrity: sha512-eajsR9aeljqNhK028VG0Wuw+OaY5LLxYmxeoXynIoE6jannr9/Ucd1LL0hSSoafk5LTYG+FfqsyGt81Q6Zkybw==} + /@types/node@20.5.9: + resolution: {integrity: sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==} dev: true /@types/parse-json@4.0.0: @@ -1201,7 +1247,7 @@ packages: vite: ^4 dependencies: '@swc/core': 1.3.82 - vite: 4.4.9(@types/node@20.5.8) + vite: 4.4.9 transitivePeerDependencies: - '@swc/helpers' dev: true @@ -2486,6 +2532,10 @@ packages: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: true + /long@5.2.3: + resolution: {integrity: sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==} + dev: true + /loose-envify@1.4.0: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true @@ -2810,6 +2860,25 @@ packages: object-assign: 4.1.1 react-is: 16.13.1 + /protobufjs@7.2.5: + resolution: {integrity: sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==} + engines: {node: '>=12.0.0'} + requiresBuild: true + dependencies: + '@protobufjs/aspromise': 1.1.2 + '@protobufjs/base64': 1.1.2 + '@protobufjs/codegen': 2.0.4 + '@protobufjs/eventemitter': 1.1.0 + '@protobufjs/fetch': 1.1.0 + '@protobufjs/float': 1.0.2 + '@protobufjs/inquire': 1.1.0 + '@protobufjs/path': 1.1.2 + '@protobufjs/pool': 1.1.0 + '@protobufjs/utf8': 1.1.0 + '@types/node': 20.5.9 + long: 5.2.3 + dev: true + /punycode@2.3.0: resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} engines: {node: '>=6'} @@ -2850,8 +2919,8 @@ packages: - csstype dev: false - /react-i18next@13.2.1(i18next@23.4.6)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-XhMsnGgJnytWfi2Q70HMYfm+zysPUu1Pz+It6I87WwaeclGY+W8W1c11uENEMNg+Xb+mNrGuo8GEDuQDOgO+oQ==} + /react-i18next@13.2.2(i18next@23.4.6)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-+nFUkbRByFwnrfDcYqvzBuaeZb+nACHx+fAWN/pZMddWOCJH5hoc21+Sa/N/Lqi6ne6/9wC/qRGOoQhJa6IkEQ==} peerDependencies: i18next: '>= 23.2.3' react: '>= 16.8.0' @@ -3367,7 +3436,7 @@ packages: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: false - /vite@4.4.9(@types/node@20.5.8): + /vite@4.4.9: resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -3395,7 +3464,6 @@ packages: terser: optional: true dependencies: - '@types/node': 20.5.8 esbuild: 0.18.20 postcss: 8.4.29 rollup: 3.28.1 diff --git a/frontend/web/src/components/setting/AccessTokenSection.tsx b/frontend/web/src/components/setting/AccessTokenSection.tsx index 28fc54d..e47ead6 100644 --- a/frontend/web/src/components/setting/AccessTokenSection.tsx +++ b/frontend/web/src/components/setting/AccessTokenSection.tsx @@ -1,9 +1,9 @@ import { Button, IconButton } from "@mui/joy"; -import { ListUserAccessTokensResponse, UserAccessToken } from "@pbtypes/proto/api/v2/user_service_pb"; import axios from "axios"; import copy from "copy-to-clipboard"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; +import { ListUserAccessTokensResponse, UserAccessToken } from "@/types/proto/api/v2/user_service"; import useUserStore from "../../stores/v1/user"; import { showCommonDialog } from "../Alert"; import CreateAccessTokenDialog from "../CreateAccessTokenDialog"; diff --git a/frontend/web/src/layouts/Root.tsx b/frontend/web/src/layouts/Root.tsx index 6cd385e..eb63fe1 100644 --- a/frontend/web/src/layouts/Root.tsx +++ b/frontend/web/src/layouts/Root.tsx @@ -1,20 +1,41 @@ import { useEffect } from "react"; +import { useTranslation } from "react-i18next"; import { Outlet, useNavigate } from "react-router-dom"; +import { UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service"; import Header from "../components/Header"; import useUserStore from "../stores/v1/user"; const Root: React.FC = () => { const navigate = useNavigate(); - const currentUser = useUserStore().getCurrentUser(); + const { i18n } = useTranslation(); + const userStore = useUserStore(); + const currentUser = userStore.getCurrentUser(); + const currentUserSetting = userStore.getCurrentUserSetting(); useEffect(() => { if (!currentUser) { navigate("/auth", { replace: true, }); + return; } + + // Prepare user setting. + userStore.fetchUserSetting(currentUser.id); }, []); + useEffect(() => { + if (!currentUserSetting) { + return; + } + + if (currentUserSetting.locale === UserSetting_Locale.LOCALE_EN) { + i18n.changeLanguage("en"); + } else if (currentUserSetting.locale === UserSetting_Locale.LOCALE_ZH) { + i18n.changeLanguage("zh"); + } + }, [currentUserSetting]); + return ( <> {currentUser && ( diff --git a/frontend/web/src/stores/v1/user.ts b/frontend/web/src/stores/v1/user.ts index 2fbc2b6..674ad1c 100644 --- a/frontend/web/src/stores/v1/user.ts +++ b/frontend/web/src/stores/v1/user.ts @@ -1,4 +1,6 @@ +import axios from "axios"; import { create } from "zustand"; +import { GetUserSettingResponse, UserSetting } from "@/types/proto/api/v2/user_setting_service"; import * as api from "../../helpers/api"; const convertResponseModelUser = (user: User): User => { @@ -11,7 +13,10 @@ const convertResponseModelUser = (user: User): User => { interface UserState { userMapById: Record; + userSettingMapById: Record; currentUserId?: UserId; + + // User related actions. fetchUserList: () => Promise; fetchCurrentUser: () => Promise; getOrFetchUserById: (id: UserId) => Promise; @@ -20,10 +25,15 @@ interface UserState { createUser: (userCreate: UserCreate) => Promise; patchUser: (userPatch: UserPatch) => Promise; deleteUser: (id: UserId) => Promise; + + // User setting related actions. + fetchUserSetting: (userId: UserId) => Promise; + getCurrentUserSetting: () => UserSetting; } const useUserStore = create()((set, get) => ({ userMapById: {}, + userSettingMapById: {}, fetchUserList: async () => { const { data: userList } = await api.getUserList(); const userMap = get().userMapById; @@ -83,6 +93,23 @@ const useUserStore = create()((set, get) => ({ const currentUserId = get().currentUserId; return userMap[currentUserId as UserId]; }, + fetchUserSetting: async (userId: UserId) => { + const { + data: { userSetting }, + } = await axios.get(`api/v2/users/${userId}/settings`); + if (!userSetting) { + throw new Error(`User setting not found for user ${userId}`); + } + const userSettingMap = get().userSettingMapById; + userSettingMap[userId] = userSetting; + set(userSettingMap); + return userSetting; + }, + getCurrentUserSetting: () => { + const userSettingMap = get().userSettingMapById; + const currentUserId = get().currentUserId; + return userSettingMap[currentUserId as UserId]; + }, })); export default useUserStore; diff --git a/frontend/web/src/types/proto/api/v2/common.ts b/frontend/web/src/types/proto/api/v2/common.ts new file mode 100644 index 0000000..4f7c520 --- /dev/null +++ b/frontend/web/src/types/proto/api/v2/common.ts @@ -0,0 +1,42 @@ +/* eslint-disable */ + +export const protobufPackage = "slash.api.v2"; + +export enum RowStatus { + ROW_STATUS_UNSPECIFIED = 0, + NORMAL = 1, + ARCHIVED = 2, + UNRECOGNIZED = -1, +} + +export function rowStatusFromJSON(object: any): RowStatus { + switch (object) { + case 0: + case "ROW_STATUS_UNSPECIFIED": + return RowStatus.ROW_STATUS_UNSPECIFIED; + case 1: + case "NORMAL": + return RowStatus.NORMAL; + case 2: + case "ARCHIVED": + return RowStatus.ARCHIVED; + case -1: + case "UNRECOGNIZED": + default: + return RowStatus.UNRECOGNIZED; + } +} + +export function rowStatusToJSON(object: RowStatus): string { + switch (object) { + case RowStatus.ROW_STATUS_UNSPECIFIED: + return "ROW_STATUS_UNSPECIFIED"; + case RowStatus.NORMAL: + return "NORMAL"; + case RowStatus.ARCHIVED: + return "ARCHIVED"; + case RowStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/frontend/web/src/types/proto/api/v2/shortcut_service.ts b/frontend/web/src/types/proto/api/v2/shortcut_service.ts new file mode 100644 index 0000000..7641675 --- /dev/null +++ b/frontend/web/src/types/proto/api/v2/shortcut_service.ts @@ -0,0 +1,885 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { RowStatus, rowStatusFromJSON, rowStatusToJSON } from "./common"; + +export const protobufPackage = "slash.api.v2"; + +export enum Visibility { + VISIBILITY_UNSPECIFIED = 0, + PRIVATE = 1, + WORKSPACE = 2, + PUBLIC = 3, + UNRECOGNIZED = -1, +} + +export function visibilityFromJSON(object: any): Visibility { + switch (object) { + case 0: + case "VISIBILITY_UNSPECIFIED": + return Visibility.VISIBILITY_UNSPECIFIED; + case 1: + case "PRIVATE": + return Visibility.PRIVATE; + case 2: + case "WORKSPACE": + return Visibility.WORKSPACE; + case 3: + case "PUBLIC": + return Visibility.PUBLIC; + case -1: + case "UNRECOGNIZED": + default: + return Visibility.UNRECOGNIZED; + } +} + +export function visibilityToJSON(object: Visibility): string { + switch (object) { + case Visibility.VISIBILITY_UNSPECIFIED: + return "VISIBILITY_UNSPECIFIED"; + case Visibility.PRIVATE: + return "PRIVATE"; + case Visibility.WORKSPACE: + return "WORKSPACE"; + case Visibility.PUBLIC: + return "PUBLIC"; + case Visibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Shortcut { + id: number; + creatorId: number; + createdTs: number; + updatedTs: number; + rowStatus: RowStatus; + name: string; + link: string; + title: string; + tags: string[]; + description: string; + visibility: Visibility; + ogMetadata?: OpenGraphMetadata | undefined; +} + +export interface OpenGraphMetadata { + title: string; + description: string; + image: string; +} + +export interface ListShortcutsRequest { +} + +export interface ListShortcutsResponse { + shortcuts: Shortcut[]; +} + +export interface GetShortcutRequest { + name: string; +} + +export interface GetShortcutResponse { + shortcut?: Shortcut | undefined; +} + +export interface CreateShortcutRequest { + shortcut?: Shortcut | undefined; +} + +export interface CreateShortcutResponse { + shortcut?: Shortcut | undefined; +} + +export interface DeleteShortcutRequest { + name: string; +} + +export interface DeleteShortcutResponse { +} + +function createBaseShortcut(): Shortcut { + return { + id: 0, + creatorId: 0, + createdTs: 0, + updatedTs: 0, + rowStatus: 0, + name: "", + link: "", + title: "", + tags: [], + description: "", + visibility: 0, + ogMetadata: undefined, + }; +} + +export const Shortcut = { + encode(message: Shortcut, 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.createdTs !== 0) { + writer.uint32(24).int64(message.createdTs); + } + if (message.updatedTs !== 0) { + writer.uint32(32).int64(message.updatedTs); + } + if (message.rowStatus !== 0) { + writer.uint32(40).int32(message.rowStatus); + } + if (message.name !== "") { + writer.uint32(50).string(message.name); + } + if (message.link !== "") { + writer.uint32(58).string(message.link); + } + if (message.title !== "") { + writer.uint32(66).string(message.title); + } + for (const v of message.tags) { + writer.uint32(74).string(v!); + } + if (message.description !== "") { + writer.uint32(82).string(message.description); + } + if (message.visibility !== 0) { + writer.uint32(88).int32(message.visibility); + } + if (message.ogMetadata !== undefined) { + OpenGraphMetadata.encode(message.ogMetadata, writer.uint32(98).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Shortcut { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShortcut(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.creatorId = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.createdTs = longToNumber(reader.int64() as Long); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.updatedTs = longToNumber(reader.int64() as Long); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.rowStatus = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.name = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.link = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.title = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.tags.push(reader.string()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.description = reader.string(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.visibility = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.ogMetadata = OpenGraphMetadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Shortcut { + return { + id: isSet(object.id) ? Number(object.id) : 0, + creatorId: isSet(object.creatorId) ? Number(object.creatorId) : 0, + createdTs: isSet(object.createdTs) ? Number(object.createdTs) : 0, + updatedTs: isSet(object.updatedTs) ? Number(object.updatedTs) : 0, + rowStatus: isSet(object.rowStatus) ? rowStatusFromJSON(object.rowStatus) : 0, + name: isSet(object.name) ? String(object.name) : "", + link: isSet(object.link) ? String(object.link) : "", + title: isSet(object.title) ? String(object.title) : "", + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => String(e)) : [], + description: isSet(object.description) ? String(object.description) : "", + visibility: isSet(object.visibility) ? visibilityFromJSON(object.visibility) : 0, + ogMetadata: isSet(object.ogMetadata) ? OpenGraphMetadata.fromJSON(object.ogMetadata) : undefined, + }; + }, + + toJSON(message: Shortcut): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.creatorId !== undefined && (obj.creatorId = Math.round(message.creatorId)); + message.createdTs !== undefined && (obj.createdTs = Math.round(message.createdTs)); + message.updatedTs !== undefined && (obj.updatedTs = Math.round(message.updatedTs)); + message.rowStatus !== undefined && (obj.rowStatus = rowStatusToJSON(message.rowStatus)); + message.name !== undefined && (obj.name = message.name); + message.link !== undefined && (obj.link = message.link); + message.title !== undefined && (obj.title = message.title); + if (message.tags) { + obj.tags = message.tags.map((e) => e); + } else { + obj.tags = []; + } + message.description !== undefined && (obj.description = message.description); + message.visibility !== undefined && (obj.visibility = visibilityToJSON(message.visibility)); + message.ogMetadata !== undefined && + (obj.ogMetadata = message.ogMetadata ? OpenGraphMetadata.toJSON(message.ogMetadata) : undefined); + return obj; + }, + + create(base?: DeepPartial): Shortcut { + return Shortcut.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): Shortcut { + const message = createBaseShortcut(); + message.id = object.id ?? 0; + message.creatorId = object.creatorId ?? 0; + message.createdTs = object.createdTs ?? 0; + message.updatedTs = object.updatedTs ?? 0; + message.rowStatus = object.rowStatus ?? 0; + message.name = object.name ?? ""; + message.link = object.link ?? ""; + message.title = object.title ?? ""; + message.tags = object.tags?.map((e) => e) || []; + message.description = object.description ?? ""; + message.visibility = object.visibility ?? 0; + message.ogMetadata = (object.ogMetadata !== undefined && object.ogMetadata !== null) + ? OpenGraphMetadata.fromPartial(object.ogMetadata) + : undefined; + return message; + }, +}; + +function createBaseOpenGraphMetadata(): OpenGraphMetadata { + return { title: "", description: "", image: "" }; +} + +export const OpenGraphMetadata = { + encode(message: OpenGraphMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.image !== "") { + writer.uint32(26).string(message.image); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OpenGraphMetadata { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOpenGraphMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.image = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): OpenGraphMetadata { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + image: isSet(object.image) ? String(object.image) : "", + }; + }, + + toJSON(message: OpenGraphMetadata): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.image !== undefined && (obj.image = message.image); + return obj; + }, + + create(base?: DeepPartial): OpenGraphMetadata { + return OpenGraphMetadata.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): OpenGraphMetadata { + const message = createBaseOpenGraphMetadata(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.image = object.image ?? ""; + return message; + }, +}; + +function createBaseListShortcutsRequest(): ListShortcutsRequest { + return {}; +} + +export const ListShortcutsRequest = { + encode(_: ListShortcutsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListShortcutsRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListShortcutsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListShortcutsRequest { + return {}; + }, + + toJSON(_: ListShortcutsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): ListShortcutsRequest { + return ListShortcutsRequest.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): ListShortcutsRequest { + const message = createBaseListShortcutsRequest(); + return message; + }, +}; + +function createBaseListShortcutsResponse(): ListShortcutsResponse { + return { shortcuts: [] }; +} + +export const ListShortcutsResponse = { + encode(message: ListShortcutsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.shortcuts) { + Shortcut.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListShortcutsResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListShortcutsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shortcuts.push(Shortcut.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListShortcutsResponse { + return { + shortcuts: Array.isArray(object?.shortcuts) ? object.shortcuts.map((e: any) => Shortcut.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListShortcutsResponse): unknown { + const obj: any = {}; + if (message.shortcuts) { + obj.shortcuts = message.shortcuts.map((e) => e ? Shortcut.toJSON(e) : undefined); + } else { + obj.shortcuts = []; + } + return obj; + }, + + create(base?: DeepPartial): ListShortcutsResponse { + return ListShortcutsResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListShortcutsResponse { + const message = createBaseListShortcutsResponse(); + message.shortcuts = object.shortcuts?.map((e) => Shortcut.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetShortcutRequest(): GetShortcutRequest { + return { name: "" }; +} + +export const GetShortcutRequest = { + encode(message: GetShortcutRequest, 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): GetShortcutRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetShortcutRequest(); + 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; + }, + + fromJSON(object: any): GetShortcutRequest { + return { name: isSet(object.name) ? String(object.name) : "" }; + }, + + toJSON(message: GetShortcutRequest): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + create(base?: DeepPartial): GetShortcutRequest { + return GetShortcutRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetShortcutRequest { + const message = createBaseGetShortcutRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseGetShortcutResponse(): GetShortcutResponse { + return { shortcut: undefined }; +} + +export const GetShortcutResponse = { + encode(message: GetShortcutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.shortcut !== undefined) { + Shortcut.encode(message.shortcut, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetShortcutResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetShortcutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shortcut = Shortcut.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetShortcutResponse { + return { shortcut: isSet(object.shortcut) ? Shortcut.fromJSON(object.shortcut) : undefined }; + }, + + toJSON(message: GetShortcutResponse): unknown { + const obj: any = {}; + message.shortcut !== undefined && (obj.shortcut = message.shortcut ? Shortcut.toJSON(message.shortcut) : undefined); + return obj; + }, + + create(base?: DeepPartial): GetShortcutResponse { + return GetShortcutResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetShortcutResponse { + const message = createBaseGetShortcutResponse(); + message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) + ? Shortcut.fromPartial(object.shortcut) + : undefined; + return message; + }, +}; + +function createBaseCreateShortcutRequest(): CreateShortcutRequest { + return { shortcut: undefined }; +} + +export const CreateShortcutRequest = { + encode(message: CreateShortcutRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.shortcut !== undefined) { + Shortcut.encode(message.shortcut, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateShortcutRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateShortcutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shortcut = Shortcut.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateShortcutRequest { + return { shortcut: isSet(object.shortcut) ? Shortcut.fromJSON(object.shortcut) : undefined }; + }, + + toJSON(message: CreateShortcutRequest): unknown { + const obj: any = {}; + message.shortcut !== undefined && (obj.shortcut = message.shortcut ? Shortcut.toJSON(message.shortcut) : undefined); + return obj; + }, + + create(base?: DeepPartial): CreateShortcutRequest { + return CreateShortcutRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateShortcutRequest { + const message = createBaseCreateShortcutRequest(); + message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) + ? Shortcut.fromPartial(object.shortcut) + : undefined; + return message; + }, +}; + +function createBaseCreateShortcutResponse(): CreateShortcutResponse { + return { shortcut: undefined }; +} + +export const CreateShortcutResponse = { + encode(message: CreateShortcutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.shortcut !== undefined) { + Shortcut.encode(message.shortcut, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CreateShortcutResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateShortcutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shortcut = Shortcut.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateShortcutResponse { + return { shortcut: isSet(object.shortcut) ? Shortcut.fromJSON(object.shortcut) : undefined }; + }, + + toJSON(message: CreateShortcutResponse): unknown { + const obj: any = {}; + message.shortcut !== undefined && (obj.shortcut = message.shortcut ? Shortcut.toJSON(message.shortcut) : undefined); + return obj; + }, + + create(base?: DeepPartial): CreateShortcutResponse { + return CreateShortcutResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateShortcutResponse { + const message = createBaseCreateShortcutResponse(); + message.shortcut = (object.shortcut !== undefined && object.shortcut !== null) + ? Shortcut.fromPartial(object.shortcut) + : undefined; + return message; + }, +}; + +function createBaseDeleteShortcutRequest(): DeleteShortcutRequest { + return { name: "" }; +} + +export const DeleteShortcutRequest = { + encode(message: DeleteShortcutRequest, 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): DeleteShortcutRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteShortcutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteShortcutRequest { + return { name: isSet(object.name) ? String(object.name) : "" }; + }, + + toJSON(message: DeleteShortcutRequest): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + return obj; + }, + + create(base?: DeepPartial): DeleteShortcutRequest { + return DeleteShortcutRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): DeleteShortcutRequest { + const message = createBaseDeleteShortcutRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteShortcutResponse(): DeleteShortcutResponse { + return {}; +} + +export const DeleteShortcutResponse = { + encode(_: DeleteShortcutResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteShortcutResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteShortcutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): DeleteShortcutResponse { + return {}; + }, + + toJSON(_: DeleteShortcutResponse): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): DeleteShortcutResponse { + return DeleteShortcutResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteShortcutResponse { + const message = createBaseDeleteShortcutResponse(); + 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(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/api/v2/user_service.ts b/frontend/web/src/types/proto/api/v2/user_service.ts new file mode 100644 index 0000000..556fd7b --- /dev/null +++ b/frontend/web/src/types/proto/api/v2/user_service.ts @@ -0,0 +1,1229 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { RowStatus, rowStatusFromJSON, rowStatusToJSON } from "./common"; + +export const protobufPackage = "slash.api.v2"; + +export enum Role { + ROLE_UNSPECIFIED = 0, + ADMIN = 1, + USER = 2, + UNRECOGNIZED = -1, +} + +export function roleFromJSON(object: any): Role { + switch (object) { + case 0: + case "ROLE_UNSPECIFIED": + return Role.ROLE_UNSPECIFIED; + case 1: + case "ADMIN": + return Role.ADMIN; + case 2: + case "USER": + return Role.USER; + case -1: + case "UNRECOGNIZED": + default: + return Role.UNRECOGNIZED; + } +} + +export function roleToJSON(object: Role): string { + switch (object) { + case Role.ROLE_UNSPECIFIED: + return "ROLE_UNSPECIFIED"; + case Role.ADMIN: + return "ADMIN"; + case Role.USER: + return "USER"; + case Role.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface User { + id: number; + rowStatus: RowStatus; + createdTs: number; + updatedTs: number; + role: Role; + email: string; + nickname: string; + password: string; +} + +export interface ListUsersRequest { +} + +export interface ListUsersResponse { + users: User[]; +} + +export interface GetUserRequest { + id: number; +} + +export interface GetUserResponse { + user?: User | undefined; +} + +export interface CreateUserRequest { + user?: User | undefined; +} + +export interface CreateUserResponse { + user?: User | undefined; +} + +export interface DeleteUserRequest { + id: number; +} + +export interface DeleteUserResponse { +} + +export interface ListUserAccessTokensRequest { + /** id is the user id. */ + id: number; +} + +export interface ListUserAccessTokensResponse { + accessTokens: UserAccessToken[]; +} + +export interface CreateUserAccessTokenRequest { + /** id is the user id. */ + id: number; + userAccessToken?: UserAccessToken | undefined; +} + +export interface CreateUserAccessTokenResponse { + accessToken?: UserAccessToken | undefined; +} + +export interface DeleteUserAccessTokenRequest { + /** id is the user id. */ + id: number; + /** access_token is the access token to delete. */ + accessToken: string; +} + +export interface DeleteUserAccessTokenResponse { +} + +export interface UserAccessToken { + accessToken: string; + description: string; + issuedAt?: Date | undefined; + expiresAt?: Date | undefined; +} + +function createBaseUser(): User { + return { id: 0, rowStatus: 0, createdTs: 0, updatedTs: 0, role: 0, email: "", nickname: "", password: "" }; +} + +export const User = { + encode(message: User, 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.createdTs !== 0) { + writer.uint32(24).int64(message.createdTs); + } + if (message.updatedTs !== 0) { + writer.uint32(32).int64(message.updatedTs); + } + if (message.role !== 0) { + writer.uint32(48).int32(message.role); + } + if (message.email !== "") { + writer.uint32(58).string(message.email); + } + if (message.nickname !== "") { + writer.uint32(66).string(message.nickname); + } + if (message.password !== "") { + writer.uint32(74).string(message.password); + } + 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 !== 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.createdTs = longToNumber(reader.int64() as Long); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.updatedTs = longToNumber(reader.int64() as Long); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.role = reader.int32() as any; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.email = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.nickname = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.password = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): User { + return { + id: isSet(object.id) ? Number(object.id) : 0, + rowStatus: isSet(object.rowStatus) ? rowStatusFromJSON(object.rowStatus) : 0, + createdTs: isSet(object.createdTs) ? Number(object.createdTs) : 0, + updatedTs: isSet(object.updatedTs) ? Number(object.updatedTs) : 0, + role: isSet(object.role) ? roleFromJSON(object.role) : 0, + email: isSet(object.email) ? String(object.email) : "", + nickname: isSet(object.nickname) ? String(object.nickname) : "", + password: isSet(object.password) ? String(object.password) : "", + }; + }, + + toJSON(message: User): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.rowStatus !== undefined && (obj.rowStatus = rowStatusToJSON(message.rowStatus)); + message.createdTs !== undefined && (obj.createdTs = Math.round(message.createdTs)); + message.updatedTs !== undefined && (obj.updatedTs = Math.round(message.updatedTs)); + message.role !== undefined && (obj.role = roleToJSON(message.role)); + message.email !== undefined && (obj.email = message.email); + message.nickname !== undefined && (obj.nickname = message.nickname); + message.password !== undefined && (obj.password = message.password); + return obj; + }, + + create(base?: DeepPartial): User { + return User.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): User { + const message = createBaseUser(); + message.id = object.id ?? 0; + message.rowStatus = object.rowStatus ?? 0; + message.createdTs = object.createdTs ?? 0; + message.updatedTs = object.updatedTs ?? 0; + message.role = object.role ?? 0; + message.email = object.email ?? ""; + message.nickname = object.nickname ?? ""; + message.password = object.password ?? ""; + return message; + }, +}; + +function createBaseListUsersRequest(): ListUsersRequest { + return {}; +} + +export const ListUsersRequest = { + encode(_: ListUsersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListUsersRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUsersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListUsersRequest { + return {}; + }, + + toJSON(_: ListUsersRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): ListUsersRequest { + return ListUsersRequest.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): ListUsersRequest { + const message = createBaseListUsersRequest(); + return message; + }, +}; + +function createBaseListUsersResponse(): ListUsersResponse { + return { users: [] }; +} + +export const ListUsersResponse = { + encode(message: ListUsersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.users) { + User.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ListUsersResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListUsersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.users.push(User.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListUsersResponse { + return { users: Array.isArray(object?.users) ? object.users.map((e: any) => User.fromJSON(e)) : [] }; + }, + + toJSON(message: ListUsersResponse): unknown { + const obj: any = {}; + if (message.users) { + obj.users = message.users.map((e) => e ? User.toJSON(e) : undefined); + } else { + obj.users = []; + } + return obj; + }, + + create(base?: DeepPartial): ListUsersResponse { + return ListUsersResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListUsersResponse { + const message = createBaseListUsersResponse(); + message.users = object.users?.map((e) => User.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetUserRequest(): GetUserRequest { + return { id: 0 }; +} + +export const GetUserRequest = { + encode(message: GetUserRequest, 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): 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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserRequest { + return { id: isSet(object.id) ? Number(object.id) : 0 }; + }, + + toJSON(message: GetUserRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + create(base?: DeepPartial): GetUserRequest { + return GetUserRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetUserRequest { + const message = createBaseGetUserRequest(); + message.id = object.id ?? 0; + 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; + }, + + fromJSON(object: any): GetUserResponse { + return { user: isSet(object.user) ? User.fromJSON(object.user) : undefined }; + }, + + toJSON(message: GetUserResponse): unknown { + const obj: any = {}; + message.user !== undefined && (obj.user = message.user ? User.toJSON(message.user) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): CreateUserRequest { + return { user: isSet(object.user) ? User.fromJSON(object.user) : undefined }; + }, + + toJSON(message: CreateUserRequest): unknown { + const obj: any = {}; + message.user !== undefined && (obj.user = message.user ? User.toJSON(message.user) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): CreateUserResponse { + return { user: isSet(object.user) ? User.fromJSON(object.user) : undefined }; + }, + + toJSON(message: CreateUserResponse): unknown { + const obj: any = {}; + message.user !== undefined && (obj.user = message.user ? User.toJSON(message.user) : undefined); + return obj; + }, + + 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 createBaseDeleteUserRequest(): DeleteUserRequest { + return { id: 0 }; +} + +export const DeleteUserRequest = { + encode(message: DeleteUserRequest, 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): DeleteUserRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteUserRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteUserRequest { + return { id: isSet(object.id) ? Number(object.id) : 0 }; + }, + + toJSON(message: DeleteUserRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + create(base?: DeepPartial): DeleteUserRequest { + return DeleteUserRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): DeleteUserRequest { + const message = createBaseDeleteUserRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseDeleteUserResponse(): DeleteUserResponse { + return {}; +} + +export const DeleteUserResponse = { + encode(_: DeleteUserResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): DeleteUserResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteUserResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(_: any): DeleteUserResponse { + return {}; + }, + + toJSON(_: DeleteUserResponse): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): DeleteUserResponse { + return DeleteUserResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteUserResponse { + const message = createBaseDeleteUserResponse(); + return message; + }, +}; + +function createBaseListUserAccessTokensRequest(): ListUserAccessTokensRequest { + return { id: 0 }; +} + +export const ListUserAccessTokensRequest = { + encode(message: ListUserAccessTokensRequest, 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): 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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListUserAccessTokensRequest { + return { id: isSet(object.id) ? Number(object.id) : 0 }; + }, + + toJSON(message: ListUserAccessTokensRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + create(base?: DeepPartial): ListUserAccessTokensRequest { + return ListUserAccessTokensRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ListUserAccessTokensRequest { + const message = createBaseListUserAccessTokensRequest(); + message.id = object.id ?? 0; + 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; + }, + + fromJSON(object: any): ListUserAccessTokensResponse { + return { + accessTokens: Array.isArray(object?.accessTokens) + ? object.accessTokens.map((e: any) => UserAccessToken.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListUserAccessTokensResponse): unknown { + const obj: any = {}; + if (message.accessTokens) { + obj.accessTokens = message.accessTokens.map((e) => e ? UserAccessToken.toJSON(e) : undefined); + } else { + obj.accessTokens = []; + } + return obj; + }, + + 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 { id: 0, userAccessToken: undefined }; +} + +export const CreateUserAccessTokenRequest = { + encode(message: CreateUserAccessTokenRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.userAccessToken !== undefined) { + UserAccessToken.encode(message.userAccessToken, writer.uint32(18).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 !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.userAccessToken = UserAccessToken.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateUserAccessTokenRequest { + return { + id: isSet(object.id) ? Number(object.id) : 0, + userAccessToken: isSet(object.userAccessToken) ? UserAccessToken.fromJSON(object.userAccessToken) : undefined, + }; + }, + + toJSON(message: CreateUserAccessTokenRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.userAccessToken !== undefined && + (obj.userAccessToken = message.userAccessToken ? UserAccessToken.toJSON(message.userAccessToken) : undefined); + return obj; + }, + + create(base?: DeepPartial): CreateUserAccessTokenRequest { + return CreateUserAccessTokenRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): CreateUserAccessTokenRequest { + const message = createBaseCreateUserAccessTokenRequest(); + message.id = object.id ?? 0; + message.userAccessToken = (object.userAccessToken !== undefined && object.userAccessToken !== null) + ? UserAccessToken.fromPartial(object.userAccessToken) + : 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; + }, + + fromJSON(object: any): CreateUserAccessTokenResponse { + return { accessToken: isSet(object.accessToken) ? UserAccessToken.fromJSON(object.accessToken) : undefined }; + }, + + toJSON(message: CreateUserAccessTokenResponse): unknown { + const obj: any = {}; + message.accessToken !== undefined && + (obj.accessToken = message.accessToken ? UserAccessToken.toJSON(message.accessToken) : undefined); + return obj; + }, + + 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 { id: 0, accessToken: "" }; +} + +export const DeleteUserAccessTokenRequest = { + encode(message: DeleteUserAccessTokenRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + 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 !== 8) { + break; + } + + message.id = reader.int32(); + 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; + }, + + fromJSON(object: any): DeleteUserAccessTokenRequest { + return { + id: isSet(object.id) ? Number(object.id) : 0, + accessToken: isSet(object.accessToken) ? String(object.accessToken) : "", + }; + }, + + toJSON(message: DeleteUserAccessTokenRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.accessToken !== undefined && (obj.accessToken = message.accessToken); + return obj; + }, + + create(base?: DeepPartial): DeleteUserAccessTokenRequest { + return DeleteUserAccessTokenRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): DeleteUserAccessTokenRequest { + const message = createBaseDeleteUserAccessTokenRequest(); + message.id = object.id ?? 0; + 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; + }, + + fromJSON(_: any): DeleteUserAccessTokenResponse { + return {}; + }, + + toJSON(_: DeleteUserAccessTokenResponse): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): DeleteUserAccessTokenResponse { + return DeleteUserAccessTokenResponse.fromPartial(base ?? {}); + }, + + fromPartial(_: DeepPartial): DeleteUserAccessTokenResponse { + const message = createBaseDeleteUserAccessTokenResponse(); + 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; + }, + + fromJSON(object: any): UserAccessToken { + return { + accessToken: isSet(object.accessToken) ? String(object.accessToken) : "", + description: isSet(object.description) ? String(object.description) : "", + issuedAt: isSet(object.issuedAt) ? fromJsonTimestamp(object.issuedAt) : undefined, + expiresAt: isSet(object.expiresAt) ? fromJsonTimestamp(object.expiresAt) : undefined, + }; + }, + + toJSON(message: UserAccessToken): unknown { + const obj: any = {}; + message.accessToken !== undefined && (obj.accessToken = message.accessToken); + message.description !== undefined && (obj.description = message.description); + message.issuedAt !== undefined && (obj.issuedAt = message.issuedAt.toISOString()); + message.expiresAt !== undefined && (obj.expiresAt = message.expiresAt.toISOString()); + return obj; + }, + + 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; + }, +}; + +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 fromJsonTimestamp(o: any): Date { + if (o instanceof Date) { + return o; + } else if (typeof o === "string") { + return new Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +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(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/api/v2/user_setting_service.ts b/frontend/web/src/types/proto/api/v2/user_setting_service.ts new file mode 100644 index 0000000..69bd13d --- /dev/null +++ b/frontend/web/src/types/proto/api/v2/user_setting_service.ts @@ -0,0 +1,418 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { FieldMask } from "../../google/protobuf/field_mask"; + +export const protobufPackage = "slash.api.v2"; + +export interface UserSetting { + /** id is the user id. */ + id: number; + /** locale is the user locale. */ + locale: UserSetting_Locale; +} + +export enum UserSetting_Locale { + LOCALE_UNSPECIFIED = 0, + LOCALE_EN = 1, + LOCALE_ZH = 2, + UNRECOGNIZED = -1, +} + +export function userSetting_LocaleFromJSON(object: any): UserSetting_Locale { + switch (object) { + case 0: + case "LOCALE_UNSPECIFIED": + return UserSetting_Locale.LOCALE_UNSPECIFIED; + case 1: + case "LOCALE_EN": + return UserSetting_Locale.LOCALE_EN; + case 2: + case "LOCALE_ZH": + return UserSetting_Locale.LOCALE_ZH; + case -1: + case "UNRECOGNIZED": + default: + return UserSetting_Locale.UNRECOGNIZED; + } +} + +export function userSetting_LocaleToJSON(object: UserSetting_Locale): string { + switch (object) { + case UserSetting_Locale.LOCALE_UNSPECIFIED: + return "LOCALE_UNSPECIFIED"; + case UserSetting_Locale.LOCALE_EN: + return "LOCALE_EN"; + case UserSetting_Locale.LOCALE_ZH: + return "LOCALE_ZH"; + case UserSetting_Locale.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface GetUserSettingRequest { + /** id is the user id. */ + id: number; +} + +export interface GetUserSettingResponse { + userSetting?: UserSetting | undefined; +} + +export interface UpdateUserSettingRequest { + /** id is the user id. */ + id: number; + /** user_setting is the user setting to update. */ + userSetting?: + | UserSetting + | undefined; + /** update_mask is the field mask to update the user setting. */ + updateMask?: string[] | undefined; +} + +export interface UpdateUserSettingResponse { + userSetting?: UserSetting | undefined; +} + +function createBaseUserSetting(): UserSetting { + return { id: 0, locale: 0 }; +} + +export const UserSetting = { + encode(message: UserSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.locale !== 0) { + writer.uint32(16).int32(message.locale); + } + 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.id = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.locale = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserSetting { + return { + id: isSet(object.id) ? Number(object.id) : 0, + locale: isSet(object.locale) ? userSetting_LocaleFromJSON(object.locale) : 0, + }; + }, + + toJSON(message: UserSetting): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.locale !== undefined && (obj.locale = userSetting_LocaleToJSON(message.locale)); + return obj; + }, + + create(base?: DeepPartial): UserSetting { + return UserSetting.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UserSetting { + const message = createBaseUserSetting(); + message.id = object.id ?? 0; + message.locale = object.locale ?? 0; + return message; + }, +}; + +function createBaseGetUserSettingRequest(): GetUserSettingRequest { + return { id: 0 }; +} + +export const GetUserSettingRequest = { + encode(message: GetUserSettingRequest, 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): GetUserSettingRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserSettingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserSettingRequest { + return { id: isSet(object.id) ? Number(object.id) : 0 }; + }, + + toJSON(message: GetUserSettingRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + + create(base?: DeepPartial): GetUserSettingRequest { + return GetUserSettingRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetUserSettingRequest { + const message = createBaseGetUserSettingRequest(); + message.id = object.id ?? 0; + return message; + }, +}; + +function createBaseGetUserSettingResponse(): GetUserSettingResponse { + return { userSetting: undefined }; +} + +export const GetUserSettingResponse = { + encode(message: GetUserSettingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.userSetting !== undefined) { + UserSetting.encode(message.userSetting, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GetUserSettingResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetUserSettingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.userSetting = UserSetting.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetUserSettingResponse { + return { userSetting: isSet(object.userSetting) ? UserSetting.fromJSON(object.userSetting) : undefined }; + }, + + toJSON(message: GetUserSettingResponse): unknown { + const obj: any = {}; + message.userSetting !== undefined && + (obj.userSetting = message.userSetting ? UserSetting.toJSON(message.userSetting) : undefined); + return obj; + }, + + create(base?: DeepPartial): GetUserSettingResponse { + return GetUserSettingResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): GetUserSettingResponse { + const message = createBaseGetUserSettingResponse(); + message.userSetting = (object.userSetting !== undefined && object.userSetting !== null) + ? UserSetting.fromPartial(object.userSetting) + : undefined; + return message; + }, +}; + +function createBaseUpdateUserSettingRequest(): UpdateUserSettingRequest { + return { id: 0, userSetting: undefined, updateMask: undefined }; +} + +export const UpdateUserSettingRequest = { + encode(message: UpdateUserSettingRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + if (message.userSetting !== undefined) { + UserSetting.encode(message.userSetting, writer.uint32(18).fork()).ldelim(); + } + if (message.updateMask !== undefined) { + FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateUserSettingRequest { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserSettingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.userSetting = UserSetting.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserSettingRequest { + return { + id: isSet(object.id) ? Number(object.id) : 0, + userSetting: isSet(object.userSetting) ? UserSetting.fromJSON(object.userSetting) : undefined, + updateMask: isSet(object.updateMask) ? FieldMask.unwrap(FieldMask.fromJSON(object.updateMask)) : undefined, + }; + }, + + toJSON(message: UpdateUserSettingRequest): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.userSetting !== undefined && + (obj.userSetting = message.userSetting ? UserSetting.toJSON(message.userSetting) : undefined); + message.updateMask !== undefined && (obj.updateMask = FieldMask.toJSON(FieldMask.wrap(message.updateMask))); + return obj; + }, + + create(base?: DeepPartial): UpdateUserSettingRequest { + return UpdateUserSettingRequest.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateUserSettingRequest { + const message = createBaseUpdateUserSettingRequest(); + message.id = object.id ?? 0; + message.userSetting = (object.userSetting !== undefined && object.userSetting !== null) + ? UserSetting.fromPartial(object.userSetting) + : undefined; + message.updateMask = object.updateMask ?? undefined; + return message; + }, +}; + +function createBaseUpdateUserSettingResponse(): UpdateUserSettingResponse { + return { userSetting: undefined }; +} + +export const UpdateUserSettingResponse = { + encode(message: UpdateUserSettingResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.userSetting !== undefined) { + UserSetting.encode(message.userSetting, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdateUserSettingResponse { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateUserSettingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.userSetting = UserSetting.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateUserSettingResponse { + return { userSetting: isSet(object.userSetting) ? UserSetting.fromJSON(object.userSetting) : undefined }; + }, + + toJSON(message: UpdateUserSettingResponse): unknown { + const obj: any = {}; + message.userSetting !== undefined && + (obj.userSetting = message.userSetting ? UserSetting.toJSON(message.userSetting) : undefined); + return obj; + }, + + create(base?: DeepPartial): UpdateUserSettingResponse { + return UpdateUserSettingResponse.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): UpdateUserSettingResponse { + const message = createBaseUpdateUserSettingResponse(); + message.userSetting = (object.userSetting !== undefined && object.userSetting !== null) + ? UserSetting.fromPartial(object.userSetting) + : 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; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/google/api/annotations.ts b/frontend/web/src/types/proto/google/api/annotations.ts new file mode 100644 index 0000000..c216105 --- /dev/null +++ b/frontend/web/src/types/proto/google/api/annotations.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ + +export const protobufPackage = "google.api"; diff --git a/frontend/web/src/types/proto/google/api/client.ts b/frontend/web/src/types/proto/google/api/client.ts new file mode 100644 index 0000000..950d983 --- /dev/null +++ b/frontend/web/src/types/proto/google/api/client.ts @@ -0,0 +1,2019 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; +import { Duration } from "../protobuf/duration"; +import { LaunchStage, launchStageFromJSON, launchStageToJSON } 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, +} + +export function clientLibraryOrganizationFromJSON(object: any): ClientLibraryOrganization { + switch (object) { + case 0: + case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": + return ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED; + case 1: + case "CLOUD": + return ClientLibraryOrganization.CLOUD; + case 2: + case "ADS": + return ClientLibraryOrganization.ADS; + case 3: + case "PHOTOS": + return ClientLibraryOrganization.PHOTOS; + case 4: + case "STREET_VIEW": + return ClientLibraryOrganization.STREET_VIEW; + case 5: + case "SHOPPING": + return ClientLibraryOrganization.SHOPPING; + case 6: + case "GEO": + return ClientLibraryOrganization.GEO; + case 7: + case "GENERATIVE_AI": + return ClientLibraryOrganization.GENERATIVE_AI; + case -1: + case "UNRECOGNIZED": + default: + return ClientLibraryOrganization.UNRECOGNIZED; + } +} + +export function clientLibraryOrganizationToJSON(object: ClientLibraryOrganization): string { + switch (object) { + case ClientLibraryOrganization.CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED: + return "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"; + case ClientLibraryOrganization.CLOUD: + return "CLOUD"; + case ClientLibraryOrganization.ADS: + return "ADS"; + case ClientLibraryOrganization.PHOTOS: + return "PHOTOS"; + case ClientLibraryOrganization.STREET_VIEW: + return "STREET_VIEW"; + case ClientLibraryOrganization.SHOPPING: + return "SHOPPING"; + case ClientLibraryOrganization.GEO: + return "GEO"; + case ClientLibraryOrganization.GENERATIVE_AI: + return "GENERATIVE_AI"; + case ClientLibraryOrganization.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** 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, +} + +export function clientLibraryDestinationFromJSON(object: any): ClientLibraryDestination { + switch (object) { + case 0: + case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": + return ClientLibraryDestination.CLIENT_LIBRARY_DESTINATION_UNSPECIFIED; + case 10: + case "GITHUB": + return ClientLibraryDestination.GITHUB; + case 20: + case "PACKAGE_MANAGER": + return ClientLibraryDestination.PACKAGE_MANAGER; + case -1: + case "UNRECOGNIZED": + default: + return ClientLibraryDestination.UNRECOGNIZED; + } +} + +export function clientLibraryDestinationToJSON(object: ClientLibraryDestination): string { + switch (object) { + case ClientLibraryDestination.CLIENT_LIBRARY_DESTINATION_UNSPECIFIED: + return "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"; + case ClientLibraryDestination.GITHUB: + return "GITHUB"; + case ClientLibraryDestination.PACKAGE_MANAGER: + return "PACKAGE_MANAGER"; + case ClientLibraryDestination.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** 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; + }, + + fromJSON(object: any): CommonLanguageSettings { + return { + referenceDocsUri: isSet(object.referenceDocsUri) ? String(object.referenceDocsUri) : "", + destinations: Array.isArray(object?.destinations) + ? object.destinations.map((e: any) => clientLibraryDestinationFromJSON(e)) + : [], + }; + }, + + toJSON(message: CommonLanguageSettings): unknown { + const obj: any = {}; + message.referenceDocsUri !== undefined && (obj.referenceDocsUri = message.referenceDocsUri); + if (message.destinations) { + obj.destinations = message.destinations.map((e) => clientLibraryDestinationToJSON(e)); + } else { + obj.destinations = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): ClientLibrarySettings { + return { + version: isSet(object.version) ? String(object.version) : "", + launchStage: isSet(object.launchStage) ? launchStageFromJSON(object.launchStage) : 0, + restNumericEnums: isSet(object.restNumericEnums) ? Boolean(object.restNumericEnums) : false, + javaSettings: isSet(object.javaSettings) ? JavaSettings.fromJSON(object.javaSettings) : undefined, + cppSettings: isSet(object.cppSettings) ? CppSettings.fromJSON(object.cppSettings) : undefined, + phpSettings: isSet(object.phpSettings) ? PhpSettings.fromJSON(object.phpSettings) : undefined, + pythonSettings: isSet(object.pythonSettings) ? PythonSettings.fromJSON(object.pythonSettings) : undefined, + nodeSettings: isSet(object.nodeSettings) ? NodeSettings.fromJSON(object.nodeSettings) : undefined, + dotnetSettings: isSet(object.dotnetSettings) ? DotnetSettings.fromJSON(object.dotnetSettings) : undefined, + rubySettings: isSet(object.rubySettings) ? RubySettings.fromJSON(object.rubySettings) : undefined, + goSettings: isSet(object.goSettings) ? GoSettings.fromJSON(object.goSettings) : undefined, + }; + }, + + toJSON(message: ClientLibrarySettings): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.launchStage !== undefined && (obj.launchStage = launchStageToJSON(message.launchStage)); + message.restNumericEnums !== undefined && (obj.restNumericEnums = message.restNumericEnums); + message.javaSettings !== undefined && + (obj.javaSettings = message.javaSettings ? JavaSettings.toJSON(message.javaSettings) : undefined); + message.cppSettings !== undefined && + (obj.cppSettings = message.cppSettings ? CppSettings.toJSON(message.cppSettings) : undefined); + message.phpSettings !== undefined && + (obj.phpSettings = message.phpSettings ? PhpSettings.toJSON(message.phpSettings) : undefined); + message.pythonSettings !== undefined && + (obj.pythonSettings = message.pythonSettings ? PythonSettings.toJSON(message.pythonSettings) : undefined); + message.nodeSettings !== undefined && + (obj.nodeSettings = message.nodeSettings ? NodeSettings.toJSON(message.nodeSettings) : undefined); + message.dotnetSettings !== undefined && + (obj.dotnetSettings = message.dotnetSettings ? DotnetSettings.toJSON(message.dotnetSettings) : undefined); + message.rubySettings !== undefined && + (obj.rubySettings = message.rubySettings ? RubySettings.toJSON(message.rubySettings) : undefined); + message.goSettings !== undefined && + (obj.goSettings = message.goSettings ? GoSettings.toJSON(message.goSettings) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): Publishing { + return { + methodSettings: Array.isArray(object?.methodSettings) + ? object.methodSettings.map((e: any) => MethodSettings.fromJSON(e)) + : [], + newIssueUri: isSet(object.newIssueUri) ? String(object.newIssueUri) : "", + documentationUri: isSet(object.documentationUri) ? String(object.documentationUri) : "", + apiShortName: isSet(object.apiShortName) ? String(object.apiShortName) : "", + githubLabel: isSet(object.githubLabel) ? String(object.githubLabel) : "", + codeownerGithubTeams: Array.isArray(object?.codeownerGithubTeams) + ? object.codeownerGithubTeams.map((e: any) => String(e)) + : [], + docTagPrefix: isSet(object.docTagPrefix) ? String(object.docTagPrefix) : "", + organization: isSet(object.organization) ? clientLibraryOrganizationFromJSON(object.organization) : 0, + librarySettings: Array.isArray(object?.librarySettings) + ? object.librarySettings.map((e: any) => ClientLibrarySettings.fromJSON(e)) + : [], + protoReferenceDocumentationUri: isSet(object.protoReferenceDocumentationUri) + ? String(object.protoReferenceDocumentationUri) + : "", + }; + }, + + toJSON(message: Publishing): unknown { + const obj: any = {}; + if (message.methodSettings) { + obj.methodSettings = message.methodSettings.map((e) => e ? MethodSettings.toJSON(e) : undefined); + } else { + obj.methodSettings = []; + } + message.newIssueUri !== undefined && (obj.newIssueUri = message.newIssueUri); + message.documentationUri !== undefined && (obj.documentationUri = message.documentationUri); + message.apiShortName !== undefined && (obj.apiShortName = message.apiShortName); + message.githubLabel !== undefined && (obj.githubLabel = message.githubLabel); + if (message.codeownerGithubTeams) { + obj.codeownerGithubTeams = message.codeownerGithubTeams.map((e) => e); + } else { + obj.codeownerGithubTeams = []; + } + message.docTagPrefix !== undefined && (obj.docTagPrefix = message.docTagPrefix); + message.organization !== undefined && (obj.organization = clientLibraryOrganizationToJSON(message.organization)); + if (message.librarySettings) { + obj.librarySettings = message.librarySettings.map((e) => e ? ClientLibrarySettings.toJSON(e) : undefined); + } else { + obj.librarySettings = []; + } + message.protoReferenceDocumentationUri !== undefined && + (obj.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri); + return obj; + }, + + 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; + }, + + fromJSON(object: any): JavaSettings { + return { + libraryPackage: isSet(object.libraryPackage) ? String(object.libraryPackage) : "", + serviceClassNames: isObject(object.serviceClassNames) + ? Object.entries(object.serviceClassNames).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined, + }; + }, + + toJSON(message: JavaSettings): unknown { + const obj: any = {}; + message.libraryPackage !== undefined && (obj.libraryPackage = message.libraryPackage); + obj.serviceClassNames = {}; + if (message.serviceClassNames) { + Object.entries(message.serviceClassNames).forEach(([k, v]) => { + obj.serviceClassNames[k] = v; + }); + } + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): JavaSettings_ServiceClassNamesEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: JavaSettings_ServiceClassNamesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + 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; + }, + + fromJSON(object: any): CppSettings { + return { common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined }; + }, + + toJSON(message: CppSettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): PhpSettings { + return { common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined }; + }, + + toJSON(message: PhpSettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): PythonSettings { + return { common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined }; + }, + + toJSON(message: PythonSettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): NodeSettings { + return { common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined }; + }, + + toJSON(message: NodeSettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): DotnetSettings { + return { + common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined, + renamedServices: isObject(object.renamedServices) + ? Object.entries(object.renamedServices).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + renamedResources: isObject(object.renamedResources) + ? Object.entries(object.renamedResources).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + ignoredResources: Array.isArray(object?.ignoredResources) + ? object.ignoredResources.map((e: any) => String(e)) + : [], + forcedNamespaceAliases: Array.isArray(object?.forcedNamespaceAliases) + ? object.forcedNamespaceAliases.map((e: any) => String(e)) + : [], + handwrittenSignatures: Array.isArray(object?.handwrittenSignatures) + ? object.handwrittenSignatures.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: DotnetSettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + obj.renamedServices = {}; + if (message.renamedServices) { + Object.entries(message.renamedServices).forEach(([k, v]) => { + obj.renamedServices[k] = v; + }); + } + obj.renamedResources = {}; + if (message.renamedResources) { + Object.entries(message.renamedResources).forEach(([k, v]) => { + obj.renamedResources[k] = v; + }); + } + if (message.ignoredResources) { + obj.ignoredResources = message.ignoredResources.map((e) => e); + } else { + obj.ignoredResources = []; + } + if (message.forcedNamespaceAliases) { + obj.forcedNamespaceAliases = message.forcedNamespaceAliases.map((e) => e); + } else { + obj.forcedNamespaceAliases = []; + } + if (message.handwrittenSignatures) { + obj.handwrittenSignatures = message.handwrittenSignatures.map((e) => e); + } else { + obj.handwrittenSignatures = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): DotnetSettings_RenamedServicesEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: DotnetSettings_RenamedServicesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + 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; + }, + + fromJSON(object: any): DotnetSettings_RenamedResourcesEntry { + return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; + }, + + toJSON(message: DotnetSettings_RenamedResourcesEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); + return obj; + }, + + 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; + }, + + fromJSON(object: any): RubySettings { + return { common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined }; + }, + + toJSON(message: RubySettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): GoSettings { + return { common: isSet(object.common) ? CommonLanguageSettings.fromJSON(object.common) : undefined }; + }, + + toJSON(message: GoSettings): unknown { + const obj: any = {}; + message.common !== undefined && + (obj.common = message.common ? CommonLanguageSettings.toJSON(message.common) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): MethodSettings { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + longRunning: isSet(object.longRunning) ? MethodSettings_LongRunning.fromJSON(object.longRunning) : undefined, + }; + }, + + toJSON(message: MethodSettings): unknown { + const obj: any = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.longRunning !== undefined && + (obj.longRunning = message.longRunning ? MethodSettings_LongRunning.toJSON(message.longRunning) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): MethodSettings_LongRunning { + return { + initialPollDelay: isSet(object.initialPollDelay) ? Duration.fromJSON(object.initialPollDelay) : undefined, + pollDelayMultiplier: isSet(object.pollDelayMultiplier) ? Number(object.pollDelayMultiplier) : 0, + maxPollDelay: isSet(object.maxPollDelay) ? Duration.fromJSON(object.maxPollDelay) : undefined, + totalPollTimeout: isSet(object.totalPollTimeout) ? Duration.fromJSON(object.totalPollTimeout) : undefined, + }; + }, + + toJSON(message: MethodSettings_LongRunning): unknown { + const obj: any = {}; + message.initialPollDelay !== undefined && + (obj.initialPollDelay = message.initialPollDelay ? Duration.toJSON(message.initialPollDelay) : undefined); + message.pollDelayMultiplier !== undefined && (obj.pollDelayMultiplier = message.pollDelayMultiplier); + message.maxPollDelay !== undefined && + (obj.maxPollDelay = message.maxPollDelay ? Duration.toJSON(message.maxPollDelay) : undefined); + message.totalPollTimeout !== undefined && + (obj.totalPollTimeout = message.totalPollTimeout ? Duration.toJSON(message.totalPollTimeout) : undefined); + return obj; + }, + + 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; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/google/api/http.ts b/frontend/web/src/types/proto/google/api/http.ts new file mode 100644 index 0000000..259368a --- /dev/null +++ b/frontend/web/src/types/proto/google/api/http.ts @@ -0,0 +1,726 @@ +/* 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; + }, + + fromJSON(object: any): Http { + return { + rules: Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) + ? Boolean(object.fullyDecodeReservedExpansion) + : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.rules = []; + } + message.fullyDecodeReservedExpansion !== undefined && + (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion); + return obj; + }, + + 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; + }, + + fromJSON(object: any): HttpRule { + return { + selector: isSet(object.selector) ? String(object.selector) : "", + get: isSet(object.get) ? String(object.get) : undefined, + put: isSet(object.put) ? String(object.put) : undefined, + post: isSet(object.post) ? String(object.post) : undefined, + delete: isSet(object.delete) ? String(object.delete) : undefined, + patch: isSet(object.patch) ? String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? String(object.body) : "", + responseBody: isSet(object.responseBody) ? String(object.responseBody) : "", + additionalBindings: Array.isArray(object?.additionalBindings) + ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + message.selector !== undefined && (obj.selector = message.selector); + message.get !== undefined && (obj.get = message.get); + message.put !== undefined && (obj.put = message.put); + message.post !== undefined && (obj.post = message.post); + message.delete !== undefined && (obj.delete = message.delete); + message.patch !== undefined && (obj.patch = message.patch); + message.custom !== undefined && + (obj.custom = message.custom ? CustomHttpPattern.toJSON(message.custom) : undefined); + message.body !== undefined && (obj.body = message.body); + message.responseBody !== undefined && (obj.responseBody = message.responseBody); + if (message.additionalBindings) { + obj.additionalBindings = message.additionalBindings.map((e) => e ? HttpRule.toJSON(e) : undefined); + } else { + obj.additionalBindings = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): CustomHttpPattern { + return { kind: isSet(object.kind) ? String(object.kind) : "", path: isSet(object.path) ? String(object.path) : "" }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + message.kind !== undefined && (obj.kind = message.kind); + message.path !== undefined && (obj.path = message.path); + return obj; + }, + + 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; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/google/api/launch_stage.ts b/frontend/web/src/types/proto/google/api/launch_stage.ts new file mode 100644 index 0000000..8bdd5e6 --- /dev/null +++ b/frontend/web/src/types/proto/google/api/launch_stage.ts @@ -0,0 +1,115 @@ +/* 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, +} + +export function launchStageFromJSON(object: any): LaunchStage { + switch (object) { + case 0: + case "LAUNCH_STAGE_UNSPECIFIED": + return LaunchStage.LAUNCH_STAGE_UNSPECIFIED; + case 6: + case "UNIMPLEMENTED": + return LaunchStage.UNIMPLEMENTED; + case 7: + case "PRELAUNCH": + return LaunchStage.PRELAUNCH; + case 1: + case "EARLY_ACCESS": + return LaunchStage.EARLY_ACCESS; + case 2: + case "ALPHA": + return LaunchStage.ALPHA; + case 3: + case "BETA": + return LaunchStage.BETA; + case 4: + case "GA": + return LaunchStage.GA; + case 5: + case "DEPRECATED": + return LaunchStage.DEPRECATED; + case -1: + case "UNRECOGNIZED": + default: + return LaunchStage.UNRECOGNIZED; + } +} + +export function launchStageToJSON(object: LaunchStage): string { + switch (object) { + case LaunchStage.LAUNCH_STAGE_UNSPECIFIED: + return "LAUNCH_STAGE_UNSPECIFIED"; + case LaunchStage.UNIMPLEMENTED: + return "UNIMPLEMENTED"; + case LaunchStage.PRELAUNCH: + return "PRELAUNCH"; + case LaunchStage.EARLY_ACCESS: + return "EARLY_ACCESS"; + case LaunchStage.ALPHA: + return "ALPHA"; + case LaunchStage.BETA: + return "BETA"; + case LaunchStage.GA: + return "GA"; + case LaunchStage.DEPRECATED: + return "DEPRECATED"; + case LaunchStage.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/frontend/web/src/types/proto/google/protobuf/descriptor.ts b/frontend/web/src/types/proto/google/protobuf/descriptor.ts new file mode 100644 index 0000000..6a78778 --- /dev/null +++ b/frontend/web/src/types/proto/google/protobuf/descriptor.ts @@ -0,0 +1,4738 @@ +/* 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 function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} + +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} + +export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** 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 function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} + +export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +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 function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} + +export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +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, +} + +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} + +export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * 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, +} + +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * 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 function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +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, +} + +export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} + +export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** + * 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, +} + +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +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; + }, + + fromJSON(object: any): FileDescriptorSet { + return { file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [] }; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map((e) => e ? FileDescriptorProto.toJSON(e) : undefined); + } else { + obj.file = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): FileDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + package: isSet(object.package) ? String(object.package) : "", + dependency: Array.isArray(object?.dependency) ? object.dependency.map((e: any) => String(e)) : [], + publicDependency: Array.isArray(object?.publicDependency) + ? object.publicDependency.map((e: any) => Number(e)) + : [], + weakDependency: Array.isArray(object?.weakDependency) ? object.weakDependency.map((e: any) => Number(e)) : [], + messageType: Array.isArray(object?.messageType) + ? object.messageType.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], + service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, + sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, + syntax: isSet(object.syntax) ? String(object.syntax) : "", + edition: isSet(object.edition) ? String(object.edition) : "", + }; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.package !== undefined && (obj.package = message.package); + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.publicDependency = message.publicDependency.map((e) => Math.round(e)); + } else { + obj.publicDependency = []; + } + if (message.weakDependency) { + obj.weakDependency = message.weakDependency.map((e) => Math.round(e)); + } else { + obj.weakDependency = []; + } + if (message.messageType) { + obj.messageType = message.messageType.map((e) => e ? DescriptorProto.toJSON(e) : undefined); + } else { + obj.messageType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => e ? EnumDescriptorProto.toJSON(e) : undefined); + } else { + obj.enumType = []; + } + if (message.service) { + obj.service = message.service.map((e) => e ? ServiceDescriptorProto.toJSON(e) : undefined); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.extension = []; + } + message.options !== undefined && (obj.options = message.options ? FileOptions.toJSON(message.options) : undefined); + message.sourceCodeInfo !== undefined && + (obj.sourceCodeInfo = message.sourceCodeInfo ? SourceCodeInfo.toJSON(message.sourceCodeInfo) : undefined); + message.syntax !== undefined && (obj.syntax = message.syntax); + message.edition !== undefined && (obj.edition = message.edition); + return obj; + }, + + 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; + }, + + fromJSON(object: any): DescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) + : [], + nestedType: Array.isArray(object?.nestedType) + ? object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)) + : [], + enumType: Array.isArray(object?.enumType) ? object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], + extensionRange: Array.isArray(object?.extensionRange) + ? object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)) + : [], + oneofDecl: Array.isArray(object?.oneofDecl) + ? object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)) + : [], + options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, + reservedRange: Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)) + : [], + reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.field) { + obj.field = message.field.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => e ? FieldDescriptorProto.toJSON(e) : undefined); + } else { + obj.extension = []; + } + if (message.nestedType) { + obj.nestedType = message.nestedType.map((e) => e ? DescriptorProto.toJSON(e) : undefined); + } else { + obj.nestedType = []; + } + if (message.enumType) { + obj.enumType = message.enumType.map((e) => e ? EnumDescriptorProto.toJSON(e) : undefined); + } else { + obj.enumType = []; + } + if (message.extensionRange) { + obj.extensionRange = message.extensionRange.map((e) => e ? DescriptorProto_ExtensionRange.toJSON(e) : undefined); + } else { + obj.extensionRange = []; + } + if (message.oneofDecl) { + obj.oneofDecl = message.oneofDecl.map((e) => e ? OneofDescriptorProto.toJSON(e) : undefined); + } else { + obj.oneofDecl = []; + } + message.options !== undefined && + (obj.options = message.options ? MessageOptions.toJSON(message.options) : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => e ? DescriptorProto_ReservedRange.toJSON(e) : undefined); + } else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } else { + obj.reservedName = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): DescriptorProto_ExtensionRange { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.options !== undefined && + (obj.options = message.options ? ExtensionRangeOptions.toJSON(message.options) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): DescriptorProto_ReservedRange { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + 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; + }, + + fromJSON(object: any): ExtensionRangeOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): FieldDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : 1, + typeName: isSet(object.typeName) ? String(object.typeName) : "", + extendee: isSet(object.extendee) ? String(object.extendee) : "", + defaultValue: isSet(object.defaultValue) ? String(object.defaultValue) : "", + oneofIndex: isSet(object.oneofIndex) ? Number(object.oneofIndex) : 0, + jsonName: isSet(object.jsonName) ? String(object.jsonName) : "", + options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, + proto3Optional: isSet(object.proto3Optional) ? Boolean(object.proto3Optional) : false, + }; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + message.typeName !== undefined && (obj.typeName = message.typeName); + message.extendee !== undefined && (obj.extendee = message.extendee); + message.defaultValue !== undefined && (obj.defaultValue = message.defaultValue); + message.oneofIndex !== undefined && (obj.oneofIndex = Math.round(message.oneofIndex)); + message.jsonName !== undefined && (obj.jsonName = message.jsonName); + message.options !== undefined && (obj.options = message.options ? FieldOptions.toJSON(message.options) : undefined); + message.proto3Optional !== undefined && (obj.proto3Optional = message.proto3Optional); + return obj; + }, + + 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; + }, + + fromJSON(object: any): OneofDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.options !== undefined && (obj.options = message.options ? OneofOptions.toJSON(message.options) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): EnumDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, + reservedRange: Array.isArray(object?.reservedRange) + ? object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)) + : [], + reservedName: Array.isArray(object?.reservedName) ? object.reservedName.map((e: any) => String(e)) : [], + }; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.value) { + obj.value = message.value.map((e) => e ? EnumValueDescriptorProto.toJSON(e) : undefined); + } else { + obj.value = []; + } + message.options !== undefined && (obj.options = message.options ? EnumOptions.toJSON(message.options) : undefined); + if (message.reservedRange) { + obj.reservedRange = message.reservedRange.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toJSON(e) : undefined + ); + } else { + obj.reservedRange = []; + } + if (message.reservedName) { + obj.reservedName = message.reservedName.map((e) => e); + } else { + obj.reservedName = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + return { start: isSet(object.start) ? Number(object.start) : 0, end: isSet(object.end) ? Number(object.end) : 0 }; + }, + + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + + 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; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.options !== undefined && + (obj.options = message.options ? EnumValueOptions.toJSON(message.options) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): ServiceDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + if (message.method) { + obj.method = message.method.map((e) => e ? MethodDescriptorProto.toJSON(e) : undefined); + } else { + obj.method = []; + } + message.options !== undefined && + (obj.options = message.options ? ServiceOptions.toJSON(message.options) : undefined); + return obj; + }, + + 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; + }, + + fromJSON(object: any): MethodDescriptorProto { + return { + name: isSet(object.name) ? String(object.name) : "", + inputType: isSet(object.inputType) ? String(object.inputType) : "", + outputType: isSet(object.outputType) ? String(object.outputType) : "", + options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, + clientStreaming: isSet(object.clientStreaming) ? Boolean(object.clientStreaming) : false, + serverStreaming: isSet(object.serverStreaming) ? Boolean(object.serverStreaming) : false, + }; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.inputType !== undefined && (obj.inputType = message.inputType); + message.outputType !== undefined && (obj.outputType = message.outputType); + message.options !== undefined && + (obj.options = message.options ? MethodOptions.toJSON(message.options) : undefined); + message.clientStreaming !== undefined && (obj.clientStreaming = message.clientStreaming); + message.serverStreaming !== undefined && (obj.serverStreaming = message.serverStreaming); + return obj; + }, + + 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; + }, + + fromJSON(object: any): FileOptions { + return { + javaPackage: isSet(object.javaPackage) ? String(object.javaPackage) : "", + javaOuterClassname: isSet(object.javaOuterClassname) ? String(object.javaOuterClassname) : "", + javaMultipleFiles: isSet(object.javaMultipleFiles) ? Boolean(object.javaMultipleFiles) : false, + javaGenerateEqualsAndHash: isSet(object.javaGenerateEqualsAndHash) + ? Boolean(object.javaGenerateEqualsAndHash) + : false, + javaStringCheckUtf8: isSet(object.javaStringCheckUtf8) ? Boolean(object.javaStringCheckUtf8) : false, + optimizeFor: isSet(object.optimizeFor) ? fileOptions_OptimizeModeFromJSON(object.optimizeFor) : 1, + goPackage: isSet(object.goPackage) ? String(object.goPackage) : "", + ccGenericServices: isSet(object.ccGenericServices) ? Boolean(object.ccGenericServices) : false, + javaGenericServices: isSet(object.javaGenericServices) ? Boolean(object.javaGenericServices) : false, + pyGenericServices: isSet(object.pyGenericServices) ? Boolean(object.pyGenericServices) : false, + phpGenericServices: isSet(object.phpGenericServices) ? Boolean(object.phpGenericServices) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + ccEnableArenas: isSet(object.ccEnableArenas) ? Boolean(object.ccEnableArenas) : false, + objcClassPrefix: isSet(object.objcClassPrefix) ? String(object.objcClassPrefix) : "", + csharpNamespace: isSet(object.csharpNamespace) ? String(object.csharpNamespace) : "", + swiftPrefix: isSet(object.swiftPrefix) ? String(object.swiftPrefix) : "", + phpClassPrefix: isSet(object.phpClassPrefix) ? String(object.phpClassPrefix) : "", + phpNamespace: isSet(object.phpNamespace) ? String(object.phpNamespace) : "", + phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? String(object.phpMetadataNamespace) : "", + rubyPackage: isSet(object.rubyPackage) ? String(object.rubyPackage) : "", + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + message.javaPackage !== undefined && (obj.javaPackage = message.javaPackage); + message.javaOuterClassname !== undefined && (obj.javaOuterClassname = message.javaOuterClassname); + message.javaMultipleFiles !== undefined && (obj.javaMultipleFiles = message.javaMultipleFiles); + message.javaGenerateEqualsAndHash !== undefined && + (obj.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash); + message.javaStringCheckUtf8 !== undefined && (obj.javaStringCheckUtf8 = message.javaStringCheckUtf8); + message.optimizeFor !== undefined && (obj.optimizeFor = fileOptions_OptimizeModeToJSON(message.optimizeFor)); + message.goPackage !== undefined && (obj.goPackage = message.goPackage); + message.ccGenericServices !== undefined && (obj.ccGenericServices = message.ccGenericServices); + message.javaGenericServices !== undefined && (obj.javaGenericServices = message.javaGenericServices); + message.pyGenericServices !== undefined && (obj.pyGenericServices = message.pyGenericServices); + message.phpGenericServices !== undefined && (obj.phpGenericServices = message.phpGenericServices); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.ccEnableArenas !== undefined && (obj.ccEnableArenas = message.ccEnableArenas); + message.objcClassPrefix !== undefined && (obj.objcClassPrefix = message.objcClassPrefix); + message.csharpNamespace !== undefined && (obj.csharpNamespace = message.csharpNamespace); + message.swiftPrefix !== undefined && (obj.swiftPrefix = message.swiftPrefix); + message.phpClassPrefix !== undefined && (obj.phpClassPrefix = message.phpClassPrefix); + message.phpNamespace !== undefined && (obj.phpNamespace = message.phpNamespace); + message.phpMetadataNamespace !== undefined && (obj.phpMetadataNamespace = message.phpMetadataNamespace); + message.rubyPackage !== undefined && (obj.rubyPackage = message.rubyPackage); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): MessageOptions { + return { + messageSetWireFormat: isSet(object.messageSetWireFormat) ? Boolean(object.messageSetWireFormat) : false, + noStandardDescriptorAccessor: isSet(object.noStandardDescriptorAccessor) + ? Boolean(object.noStandardDescriptorAccessor) + : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + mapEntry: isSet(object.mapEntry) ? Boolean(object.mapEntry) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + message.messageSetWireFormat !== undefined && (obj.messageSetWireFormat = message.messageSetWireFormat); + message.noStandardDescriptorAccessor !== undefined && + (obj.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.mapEntry !== undefined && (obj.mapEntry = message.mapEntry); + message.deprecatedLegacyJsonFieldConflicts !== undefined && + (obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + unverifiedLazy: isSet(object.unverifiedLazy) ? Boolean(object.unverifiedLazy) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? Boolean(object.weak) : false, + debugRedact: isSet(object.debugRedact) ? Boolean(object.debugRedact) : false, + retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, + target: isSet(object.target) ? fieldOptions_OptionTargetTypeFromJSON(object.target) : 0, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + message.packed !== undefined && (obj.packed = message.packed); + message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + message.lazy !== undefined && (obj.lazy = message.lazy); + message.unverifiedLazy !== undefined && (obj.unverifiedLazy = message.unverifiedLazy); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.weak !== undefined && (obj.weak = message.weak); + message.debugRedact !== undefined && (obj.debugRedact = message.debugRedact); + message.retention !== undefined && (obj.retention = fieldOptions_OptionRetentionToJSON(message.retention)); + message.target !== undefined && (obj.target = fieldOptions_OptionTargetTypeToJSON(message.target)); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): OneofOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): EnumOptions { + return { + allowAlias: isSet(object.allowAlias) ? Boolean(object.allowAlias) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) + ? Boolean(object.deprecatedLegacyJsonFieldConflicts) + : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + message.allowAlias !== undefined && (obj.allowAlias = message.allowAlias); + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.deprecatedLegacyJsonFieldConflicts !== undefined && + (obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): EnumValueOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): ServiceOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): MethodOptions { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + idempotencyLevel: isSet(object.idempotencyLevel) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) + : 0, + uninterpretedOption: Array.isArray(object?.uninterpretedOption) + ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + message.deprecated !== undefined && (obj.deprecated = message.deprecated); + message.idempotencyLevel !== undefined && + (obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map((e) => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): UninterpretedOption { + return { + name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)) : [], + identifierValue: isSet(object.identifierValue) ? String(object.identifierValue) : "", + positiveIntValue: isSet(object.positiveIntValue) ? Number(object.positiveIntValue) : 0, + negativeIntValue: isSet(object.negativeIntValue) ? Number(object.negativeIntValue) : 0, + doubleValue: isSet(object.doubleValue) ? Number(object.doubleValue) : 0, + stringValue: isSet(object.stringValue) ? bytesFromBase64(object.stringValue) : new Uint8Array(0), + aggregateValue: isSet(object.aggregateValue) ? String(object.aggregateValue) : "", + }; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => e ? UninterpretedOption_NamePart.toJSON(e) : undefined); + } else { + obj.name = []; + } + message.identifierValue !== undefined && (obj.identifierValue = message.identifierValue); + message.positiveIntValue !== undefined && (obj.positiveIntValue = Math.round(message.positiveIntValue)); + message.negativeIntValue !== undefined && (obj.negativeIntValue = Math.round(message.negativeIntValue)); + message.doubleValue !== undefined && (obj.doubleValue = message.doubleValue); + message.stringValue !== undefined && + (obj.stringValue = base64FromBytes(message.stringValue !== undefined ? message.stringValue : new Uint8Array(0))); + message.aggregateValue !== undefined && (obj.aggregateValue = message.aggregateValue); + return obj; + }, + + 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; + }, + + fromJSON(object: any): UninterpretedOption_NamePart { + return { + namePart: isSet(object.namePart) ? String(object.namePart) : "", + isExtension: isSet(object.isExtension) ? Boolean(object.isExtension) : false, + }; + }, + + toJSON(message: UninterpretedOption_NamePart): unknown { + const obj: any = {}; + message.namePart !== undefined && (obj.namePart = message.namePart); + message.isExtension !== undefined && (obj.isExtension = message.isExtension); + return obj; + }, + + 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; + }, + + fromJSON(object: any): SourceCodeInfo { + return { + location: Array.isArray(object?.location) + ? object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map((e) => e ? SourceCodeInfo_Location.toJSON(e) : undefined); + } else { + obj.location = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): SourceCodeInfo_Location { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + span: Array.isArray(object?.span) ? object.span.map((e: any) => Number(e)) : [], + leadingComments: isSet(object.leadingComments) ? String(object.leadingComments) : "", + trailingComments: isSet(object.trailingComments) ? String(object.trailingComments) : "", + leadingDetachedComments: Array.isArray(object?.leadingDetachedComments) + ? object.leadingDetachedComments.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => Math.round(e)); + } else { + obj.span = []; + } + message.leadingComments !== undefined && (obj.leadingComments = message.leadingComments); + message.trailingComments !== undefined && (obj.trailingComments = message.trailingComments); + if (message.leadingDetachedComments) { + obj.leadingDetachedComments = message.leadingDetachedComments.map((e) => e); + } else { + obj.leadingDetachedComments = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): GeneratedCodeInfo { + return { + annotation: Array.isArray(object?.annotation) + ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); + } else { + obj.annotation = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): GeneratedCodeInfo_Annotation { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + sourceFile: isSet(object.sourceFile) ? String(object.sourceFile) : "", + begin: isSet(object.begin) ? Number(object.begin) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfo_Annotation_SemanticFromJSON(object.semantic) : 0, + }; + }, + + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => Math.round(e)); + } else { + obj.path = []; + } + message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); + message.begin !== undefined && (obj.begin = Math.round(message.begin)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.semantic !== undefined && (obj.semantic = generatedCodeInfo_Annotation_SemanticToJSON(message.semantic)); + return obj; + }, + + 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"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (tsProtoGlobalThis.Buffer) { + return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); + } else { + const bin = tsProtoGlobalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (tsProtoGlobalThis.Buffer) { + return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return tsProtoGlobalThis.btoa(bin.join("")); + } +} + +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(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/google/protobuf/duration.ts b/frontend/web/src/types/proto/google/protobuf/duration.ts new file mode 100644 index 0000000..77dbf42 --- /dev/null +++ b/frontend/web/src/types/proto/google/protobuf/duration.ts @@ -0,0 +1,196 @@ +/* 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; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + 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(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/google/protobuf/field_mask.ts b/frontend/web/src/types/proto/google/protobuf/field_mask.ts new file mode 100644 index 0000000..95026d0 --- /dev/null +++ b/frontend/web/src/types/proto/google/protobuf/field_mask.ts @@ -0,0 +1,286 @@ +/* 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; + }, + + fromJSON(object: any): FieldMask { + return { + paths: typeof (object) === "string" + ? object.split(",").filter(Boolean) + : Array.isArray(object?.paths) + ? object.paths.map(String) + : [], + }; + }, + + toJSON(message: FieldMask): string { + return message.paths.join(","); + }, + + 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/frontend/web/src/types/proto/google/protobuf/timestamp.ts b/frontend/web/src/types/proto/google/protobuf/timestamp.ts new file mode 100644 index 0000000..d37cc92 --- /dev/null +++ b/frontend/web/src/types/proto/google/protobuf/timestamp.ts @@ -0,0 +1,225 @@ +/* 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; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = Math.round(message.seconds)); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + + 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(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/store/activity.ts b/frontend/web/src/types/proto/store/activity.ts new file mode 100644 index 0000000..3afc47d --- /dev/null +++ b/frontend/web/src/types/proto/store/activity.ts @@ -0,0 +1,75 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "slash.store"; + +export interface ActivityShorcutCreatePayload { + shortcutId: number; +} + +function createBaseActivityShorcutCreatePayload(): ActivityShorcutCreatePayload { + return { shortcutId: 0 }; +} + +export const ActivityShorcutCreatePayload = { + encode(message: ActivityShorcutCreatePayload, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.shortcutId !== 0) { + writer.uint32(8).int32(message.shortcutId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActivityShorcutCreatePayload { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActivityShorcutCreatePayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.shortcutId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): ActivityShorcutCreatePayload { + return { shortcutId: isSet(object.shortcutId) ? Number(object.shortcutId) : 0 }; + }, + + toJSON(message: ActivityShorcutCreatePayload): unknown { + const obj: any = {}; + message.shortcutId !== undefined && (obj.shortcutId = Math.round(message.shortcutId)); + return obj; + }, + + create(base?: DeepPartial): ActivityShorcutCreatePayload { + return ActivityShorcutCreatePayload.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): ActivityShorcutCreatePayload { + const message = createBaseActivityShorcutCreatePayload(); + message.shortcutId = object.shortcutId ?? 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; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/store/common.ts b/frontend/web/src/types/proto/store/common.ts new file mode 100644 index 0000000..c3c6248 --- /dev/null +++ b/frontend/web/src/types/proto/store/common.ts @@ -0,0 +1,42 @@ +/* eslint-disable */ + +export const protobufPackage = "slash.store"; + +export enum RowStatus { + ROW_STATUS_UNSPECIFIED = 0, + NORMAL = 1, + ARCHIVED = 2, + UNRECOGNIZED = -1, +} + +export function rowStatusFromJSON(object: any): RowStatus { + switch (object) { + case 0: + case "ROW_STATUS_UNSPECIFIED": + return RowStatus.ROW_STATUS_UNSPECIFIED; + case 1: + case "NORMAL": + return RowStatus.NORMAL; + case 2: + case "ARCHIVED": + return RowStatus.ARCHIVED; + case -1: + case "UNRECOGNIZED": + default: + return RowStatus.UNRECOGNIZED; + } +} + +export function rowStatusToJSON(object: RowStatus): string { + switch (object) { + case RowStatus.ROW_STATUS_UNSPECIFIED: + return "ROW_STATUS_UNSPECIFIED"; + case RowStatus.NORMAL: + return "NORMAL"; + case RowStatus.ARCHIVED: + return "ARCHIVED"; + case RowStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/frontend/web/src/types/proto/store/shortcut.ts b/frontend/web/src/types/proto/store/shortcut.ts new file mode 100644 index 0000000..0fd0e35 --- /dev/null +++ b/frontend/web/src/types/proto/store/shortcut.ts @@ -0,0 +1,419 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { RowStatus, rowStatusFromJSON, rowStatusToJSON } from "./common"; + +export const protobufPackage = "slash.store"; + +export enum Visibility { + VISIBILITY_UNSPECIFIED = 0, + PRIVATE = 1, + WORKSPACE = 2, + PUBLIC = 3, + UNRECOGNIZED = -1, +} + +export function visibilityFromJSON(object: any): Visibility { + switch (object) { + case 0: + case "VISIBILITY_UNSPECIFIED": + return Visibility.VISIBILITY_UNSPECIFIED; + case 1: + case "PRIVATE": + return Visibility.PRIVATE; + case 2: + case "WORKSPACE": + return Visibility.WORKSPACE; + case 3: + case "PUBLIC": + return Visibility.PUBLIC; + case -1: + case "UNRECOGNIZED": + default: + return Visibility.UNRECOGNIZED; + } +} + +export function visibilityToJSON(object: Visibility): string { + switch (object) { + case Visibility.VISIBILITY_UNSPECIFIED: + return "VISIBILITY_UNSPECIFIED"; + case Visibility.PRIVATE: + return "PRIVATE"; + case Visibility.WORKSPACE: + return "WORKSPACE"; + case Visibility.PUBLIC: + return "PUBLIC"; + case Visibility.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Shortcut { + id: number; + creatorId: number; + createdTs: number; + updatedTs: number; + rowStatus: RowStatus; + name: string; + link: string; + title: string; + tags: string[]; + description: string; + visibility: Visibility; + ogMetadata?: OpenGraphMetadata | undefined; +} + +export interface OpenGraphMetadata { + title: string; + description: string; + image: string; +} + +function createBaseShortcut(): Shortcut { + return { + id: 0, + creatorId: 0, + createdTs: 0, + updatedTs: 0, + rowStatus: 0, + name: "", + link: "", + title: "", + tags: [], + description: "", + visibility: 0, + ogMetadata: undefined, + }; +} + +export const Shortcut = { + encode(message: Shortcut, 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.createdTs !== 0) { + writer.uint32(24).int64(message.createdTs); + } + if (message.updatedTs !== 0) { + writer.uint32(32).int64(message.updatedTs); + } + if (message.rowStatus !== 0) { + writer.uint32(40).int32(message.rowStatus); + } + if (message.name !== "") { + writer.uint32(50).string(message.name); + } + if (message.link !== "") { + writer.uint32(58).string(message.link); + } + if (message.title !== "") { + writer.uint32(66).string(message.title); + } + for (const v of message.tags) { + writer.uint32(74).string(v!); + } + if (message.description !== "") { + writer.uint32(82).string(message.description); + } + if (message.visibility !== 0) { + writer.uint32(88).int32(message.visibility); + } + if (message.ogMetadata !== undefined) { + OpenGraphMetadata.encode(message.ogMetadata, writer.uint32(98).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Shortcut { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShortcut(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.creatorId = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.createdTs = longToNumber(reader.int64() as Long); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.updatedTs = longToNumber(reader.int64() as Long); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.rowStatus = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.name = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.link = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.title = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.tags.push(reader.string()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.description = reader.string(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.visibility = reader.int32() as any; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.ogMetadata = OpenGraphMetadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Shortcut { + return { + id: isSet(object.id) ? Number(object.id) : 0, + creatorId: isSet(object.creatorId) ? Number(object.creatorId) : 0, + createdTs: isSet(object.createdTs) ? Number(object.createdTs) : 0, + updatedTs: isSet(object.updatedTs) ? Number(object.updatedTs) : 0, + rowStatus: isSet(object.rowStatus) ? rowStatusFromJSON(object.rowStatus) : 0, + name: isSet(object.name) ? String(object.name) : "", + link: isSet(object.link) ? String(object.link) : "", + title: isSet(object.title) ? String(object.title) : "", + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => String(e)) : [], + description: isSet(object.description) ? String(object.description) : "", + visibility: isSet(object.visibility) ? visibilityFromJSON(object.visibility) : 0, + ogMetadata: isSet(object.ogMetadata) ? OpenGraphMetadata.fromJSON(object.ogMetadata) : undefined, + }; + }, + + toJSON(message: Shortcut): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + message.creatorId !== undefined && (obj.creatorId = Math.round(message.creatorId)); + message.createdTs !== undefined && (obj.createdTs = Math.round(message.createdTs)); + message.updatedTs !== undefined && (obj.updatedTs = Math.round(message.updatedTs)); + message.rowStatus !== undefined && (obj.rowStatus = rowStatusToJSON(message.rowStatus)); + message.name !== undefined && (obj.name = message.name); + message.link !== undefined && (obj.link = message.link); + message.title !== undefined && (obj.title = message.title); + if (message.tags) { + obj.tags = message.tags.map((e) => e); + } else { + obj.tags = []; + } + message.description !== undefined && (obj.description = message.description); + message.visibility !== undefined && (obj.visibility = visibilityToJSON(message.visibility)); + message.ogMetadata !== undefined && + (obj.ogMetadata = message.ogMetadata ? OpenGraphMetadata.toJSON(message.ogMetadata) : undefined); + return obj; + }, + + create(base?: DeepPartial): Shortcut { + return Shortcut.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): Shortcut { + const message = createBaseShortcut(); + message.id = object.id ?? 0; + message.creatorId = object.creatorId ?? 0; + message.createdTs = object.createdTs ?? 0; + message.updatedTs = object.updatedTs ?? 0; + message.rowStatus = object.rowStatus ?? 0; + message.name = object.name ?? ""; + message.link = object.link ?? ""; + message.title = object.title ?? ""; + message.tags = object.tags?.map((e) => e) || []; + message.description = object.description ?? ""; + message.visibility = object.visibility ?? 0; + message.ogMetadata = (object.ogMetadata !== undefined && object.ogMetadata !== null) + ? OpenGraphMetadata.fromPartial(object.ogMetadata) + : undefined; + return message; + }, +}; + +function createBaseOpenGraphMetadata(): OpenGraphMetadata { + return { title: "", description: "", image: "" }; +} + +export const OpenGraphMetadata = { + encode(message: OpenGraphMetadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.image !== "") { + writer.uint32(26).string(message.image); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OpenGraphMetadata { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOpenGraphMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.image = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): OpenGraphMetadata { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + image: isSet(object.image) ? String(object.image) : "", + }; + }, + + toJSON(message: OpenGraphMetadata): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && (obj.description = message.description); + message.image !== undefined && (obj.image = message.image); + return obj; + }, + + create(base?: DeepPartial): OpenGraphMetadata { + return OpenGraphMetadata.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): OpenGraphMetadata { + const message = createBaseOpenGraphMetadata(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.image = object.image ?? ""; + 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(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/store/user_setting.ts b/frontend/web/src/types/proto/store/user_setting.ts new file mode 100644 index 0000000..97ee00b --- /dev/null +++ b/frontend/web/src/types/proto/store/user_setting.ts @@ -0,0 +1,352 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "slash.store"; + +export enum UserSettingKey { + USER_SETTING_KEY_UNSPECIFIED = 0, + /** USER_SETTING_ACCESS_TOKENS - Access tokens for the user. */ + USER_SETTING_ACCESS_TOKENS = 1, + /** USER_SETTING_LOCALE - Locale for the user. */ + USER_SETTING_LOCALE = 2, + UNRECOGNIZED = -1, +} + +export function userSettingKeyFromJSON(object: any): UserSettingKey { + switch (object) { + case 0: + case "USER_SETTING_KEY_UNSPECIFIED": + return UserSettingKey.USER_SETTING_KEY_UNSPECIFIED; + case 1: + case "USER_SETTING_ACCESS_TOKENS": + return UserSettingKey.USER_SETTING_ACCESS_TOKENS; + case 2: + case "USER_SETTING_LOCALE": + return UserSettingKey.USER_SETTING_LOCALE; + case -1: + case "UNRECOGNIZED": + default: + return UserSettingKey.UNRECOGNIZED; + } +} + +export function userSettingKeyToJSON(object: UserSettingKey): string { + switch (object) { + case UserSettingKey.USER_SETTING_KEY_UNSPECIFIED: + return "USER_SETTING_KEY_UNSPECIFIED"; + case UserSettingKey.USER_SETTING_ACCESS_TOKENS: + return "USER_SETTING_ACCESS_TOKENS"; + case UserSettingKey.USER_SETTING_LOCALE: + return "USER_SETTING_LOCALE"; + case UserSettingKey.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum LocaleUserSetting { + LOCALE_USER_SETTING_UNSPECIFIED = 0, + LOCALE_USER_SETTING_EN = 1, + LOCALE_USER_SETTING_ZH = 2, + UNRECOGNIZED = -1, +} + +export function localeUserSettingFromJSON(object: any): LocaleUserSetting { + switch (object) { + case 0: + case "LOCALE_USER_SETTING_UNSPECIFIED": + return LocaleUserSetting.LOCALE_USER_SETTING_UNSPECIFIED; + case 1: + case "LOCALE_USER_SETTING_EN": + return LocaleUserSetting.LOCALE_USER_SETTING_EN; + case 2: + case "LOCALE_USER_SETTING_ZH": + return LocaleUserSetting.LOCALE_USER_SETTING_ZH; + case -1: + case "UNRECOGNIZED": + default: + return LocaleUserSetting.UNRECOGNIZED; + } +} + +export function localeUserSettingToJSON(object: LocaleUserSetting): string { + switch (object) { + case LocaleUserSetting.LOCALE_USER_SETTING_UNSPECIFIED: + return "LOCALE_USER_SETTING_UNSPECIFIED"; + case LocaleUserSetting.LOCALE_USER_SETTING_EN: + return "LOCALE_USER_SETTING_EN"; + case LocaleUserSetting.LOCALE_USER_SETTING_ZH: + return "LOCALE_USER_SETTING_ZH"; + case LocaleUserSetting.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface UserSetting { + userId: number; + key: UserSettingKey; + accessTokens?: AccessTokensUserSetting | undefined; + locale?: LocaleUserSetting | 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, locale: 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(); + } + if (message.locale !== undefined) { + writer.uint32(32).int32(message.locale); + } + 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; + case 4: + if (tag !== 32) { + break; + } + + message.locale = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserSetting { + return { + userId: isSet(object.userId) ? Number(object.userId) : 0, + key: isSet(object.key) ? userSettingKeyFromJSON(object.key) : 0, + accessTokens: isSet(object.accessTokens) ? AccessTokensUserSetting.fromJSON(object.accessTokens) : undefined, + locale: isSet(object.locale) ? localeUserSettingFromJSON(object.locale) : undefined, + }; + }, + + toJSON(message: UserSetting): unknown { + const obj: any = {}; + message.userId !== undefined && (obj.userId = Math.round(message.userId)); + message.key !== undefined && (obj.key = userSettingKeyToJSON(message.key)); + message.accessTokens !== undefined && + (obj.accessTokens = message.accessTokens ? AccessTokensUserSetting.toJSON(message.accessTokens) : undefined); + message.locale !== undefined && + (obj.locale = message.locale !== undefined ? localeUserSettingToJSON(message.locale) : undefined); + return obj; + }, + + 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; + message.locale = object.locale ?? 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; + }, + + fromJSON(object: any): AccessTokensUserSetting { + return { + accessTokens: Array.isArray(object?.accessTokens) + ? object.accessTokens.map((e: any) => AccessTokensUserSetting_AccessToken.fromJSON(e)) + : [], + }; + }, + + toJSON(message: AccessTokensUserSetting): unknown { + const obj: any = {}; + if (message.accessTokens) { + obj.accessTokens = message.accessTokens.map((e) => e ? AccessTokensUserSetting_AccessToken.toJSON(e) : undefined); + } else { + obj.accessTokens = []; + } + return obj; + }, + + 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; + }, + + fromJSON(object: any): AccessTokensUserSetting_AccessToken { + return { + accessToken: isSet(object.accessToken) ? String(object.accessToken) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + + toJSON(message: AccessTokensUserSetting_AccessToken): unknown { + const obj: any = {}; + message.accessToken !== undefined && (obj.accessToken = message.accessToken); + message.description !== undefined && (obj.description = message.description); + return obj; + }, + + 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; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/src/types/proto/store/workspace_setting.ts b/frontend/web/src/types/proto/store/workspace_setting.ts new file mode 100644 index 0000000..4733ece --- /dev/null +++ b/frontend/web/src/types/proto/store/workspace_setting.ts @@ -0,0 +1,224 @@ +/* eslint-disable */ +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "slash.store"; + +export enum WorkspaceSettingKey { + WORKSPACE_SETTING_KEY_UNSPECIFIED = 0, + WORKSPACE_SETTING_AUTO_BACKUP = 1, + UNRECOGNIZED = -1, +} + +export function workspaceSettingKeyFromJSON(object: any): WorkspaceSettingKey { + switch (object) { + case 0: + case "WORKSPACE_SETTING_KEY_UNSPECIFIED": + return WorkspaceSettingKey.WORKSPACE_SETTING_KEY_UNSPECIFIED; + case 1: + case "WORKSPACE_SETTING_AUTO_BACKUP": + return WorkspaceSettingKey.WORKSPACE_SETTING_AUTO_BACKUP; + case -1: + case "UNRECOGNIZED": + default: + return WorkspaceSettingKey.UNRECOGNIZED; + } +} + +export function workspaceSettingKeyToJSON(object: WorkspaceSettingKey): string { + switch (object) { + case WorkspaceSettingKey.WORKSPACE_SETTING_KEY_UNSPECIFIED: + return "WORKSPACE_SETTING_KEY_UNSPECIFIED"; + case WorkspaceSettingKey.WORKSPACE_SETTING_AUTO_BACKUP: + return "WORKSPACE_SETTING_AUTO_BACKUP"; + case WorkspaceSettingKey.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface WorkspaceSetting { + key: WorkspaceSettingKey; + autoBackup?: AutoBackupWorkspaceSetting | undefined; +} + +export interface AutoBackupWorkspaceSetting { + /** Whether auto backup is enabled. */ + enabled: boolean; + /** + * The cron expression for auto backup. + * For example, "0 0 0 * * *" means backup at 00:00:00 every day. + * See https://en.wikipedia.org/wiki/Cron for more details. + */ + cronExpression: string; + /** The maximum number of backups to keep. */ + maxKeep: number; +} + +function createBaseWorkspaceSetting(): WorkspaceSetting { + return { key: 0, autoBackup: undefined }; +} + +export const WorkspaceSetting = { + encode(message: WorkspaceSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== 0) { + writer.uint32(8).int32(message.key); + } + if (message.autoBackup !== undefined) { + AutoBackupWorkspaceSetting.encode(message.autoBackup, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): WorkspaceSetting { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkspaceSetting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.key = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.autoBackup = AutoBackupWorkspaceSetting.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): WorkspaceSetting { + return { + key: isSet(object.key) ? workspaceSettingKeyFromJSON(object.key) : 0, + autoBackup: isSet(object.autoBackup) ? AutoBackupWorkspaceSetting.fromJSON(object.autoBackup) : undefined, + }; + }, + + toJSON(message: WorkspaceSetting): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = workspaceSettingKeyToJSON(message.key)); + message.autoBackup !== undefined && + (obj.autoBackup = message.autoBackup ? AutoBackupWorkspaceSetting.toJSON(message.autoBackup) : undefined); + return obj; + }, + + create(base?: DeepPartial): WorkspaceSetting { + return WorkspaceSetting.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): WorkspaceSetting { + const message = createBaseWorkspaceSetting(); + message.key = object.key ?? 0; + message.autoBackup = (object.autoBackup !== undefined && object.autoBackup !== null) + ? AutoBackupWorkspaceSetting.fromPartial(object.autoBackup) + : undefined; + return message; + }, +}; + +function createBaseAutoBackupWorkspaceSetting(): AutoBackupWorkspaceSetting { + return { enabled: false, cronExpression: "", maxKeep: 0 }; +} + +export const AutoBackupWorkspaceSetting = { + encode(message: AutoBackupWorkspaceSetting, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.enabled === true) { + writer.uint32(8).bool(message.enabled); + } + if (message.cronExpression !== "") { + writer.uint32(18).string(message.cronExpression); + } + if (message.maxKeep !== 0) { + writer.uint32(24).int32(message.maxKeep); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): AutoBackupWorkspaceSetting { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAutoBackupWorkspaceSetting(); + 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.cronExpression = 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; + }, + + fromJSON(object: any): AutoBackupWorkspaceSetting { + return { + enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, + cronExpression: isSet(object.cronExpression) ? String(object.cronExpression) : "", + maxKeep: isSet(object.maxKeep) ? Number(object.maxKeep) : 0, + }; + }, + + toJSON(message: AutoBackupWorkspaceSetting): unknown { + const obj: any = {}; + message.enabled !== undefined && (obj.enabled = message.enabled); + message.cronExpression !== undefined && (obj.cronExpression = message.cronExpression); + message.maxKeep !== undefined && (obj.maxKeep = Math.round(message.maxKeep)); + return obj; + }, + + create(base?: DeepPartial): AutoBackupWorkspaceSetting { + return AutoBackupWorkspaceSetting.fromPartial(base ?? {}); + }, + + fromPartial(object: DeepPartial): AutoBackupWorkspaceSetting { + const message = createBaseAutoBackupWorkspaceSetting(); + message.enabled = object.enabled ?? false; + message.cronExpression = object.cronExpression ?? ""; + 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; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/frontend/web/tsconfig.json b/frontend/web/tsconfig.json index acd97ec..4a48a6e 100644 --- a/frontend/web/tsconfig.json +++ b/frontend/web/tsconfig.json @@ -5,7 +5,7 @@ "types": ["vite/client"], "allowJs": false, "skipLibCheck": false, - "esModuleInterop": false, + "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, @@ -19,11 +19,8 @@ "@/*": [ "./src/*" ], - "@pbtypes/*": [ - "../types/*" - ] }, "baseUrl": "." }, - "include": ["./src", "../types"] + "include": ["./src"] } diff --git a/frontend/web/vite.config.ts b/frontend/web/vite.config.ts index 28ddada..cc570fa 100644 --- a/frontend/web/vite.config.ts +++ b/frontend/web/vite.config.ts @@ -1,4 +1,5 @@ import react from "@vitejs/plugin-react-swc"; +import { resolve } from "path"; import { defineConfig } from "vite"; // https://vitejs.dev/config/ @@ -18,4 +19,9 @@ export default defineConfig({ }, }, }, + resolve: { + alias: { + "@/": `${resolve(__dirname, "src")}/`, + }, + }, }); diff --git a/proto/api/v2/user_setting_service.proto b/proto/api/v2/user_setting_service.proto index 6913c34..38981d0 100644 --- a/proto/api/v2/user_setting_service.proto +++ b/proto/api/v2/user_setting_service.proto @@ -11,13 +11,13 @@ option go_package = "gen/api/v2"; service UserSettingService { // GetUserSetting returns the user setting. rpc GetUserSetting(GetUserSettingRequest) returns (GetUserSettingResponse) { - option (google.api.http) = {get: "/api/v2/user/{id}/setting"}; + option (google.api.http) = {get: "/api/v2/users/{id}/settings"}; option (google.api.method_signature) = "id"; } // UpdateUserSetting updates the user setting. rpc UpdateUserSetting(UpdateUserSettingRequest) returns (UpdateUserSettingResponse) { option (google.api.http) = { - put: "/api/v2/user/{id}/settins" + put: "/api/v2/users/{id}/settings" body: "*" }; option (google.api.method_signature) = "id"; diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index 2b71189..1d1b5f5 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -20,6 +20,10 @@ plugins: - paths=source_relative - plugin: buf.build/bufbuild/es:v1.3.0 out: ../frontend/types/proto + - plugin: buf.build/community/stephenh-ts-proto:v1.152.1 + out: ../frontend/web/src/types/proto + # reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md#using-ts-proto + opt: env=browser,useOptionals=messages,outputServices=false,useExactTypes=false,esModuleInterop=true - plugin: buf.build/community/pseudomuto-doc:v1.5.1 out: gen opt: diff --git a/proto/gen/api/v2/user_setting_service.pb.go b/proto/gen/api/v2/user_setting_service.pb.go index 905d38b..e2396fc 100644 --- a/proto/gen/api/v2/user_setting_service.pb.go +++ b/proto/gen/api/v2/user_setting_service.pb.go @@ -381,37 +381,38 @@ var file_api_v2_user_setting_service_proto_rawDesc = []byte{ 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x0b, 0x75, 0x73, 0x65, - 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xac, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xb0, 0x02, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x83, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, + 0x85, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0xda, - 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x8f, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x73, 0x6c, - 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0xda, 0x41, - 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x01, 0x2a, 0x1a, 0x19, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, - 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, - 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x17, 0x55, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x6f, 0x6f, 0x6a, 0x61, 0x63, 0x6b, 0x2f, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, - 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, - 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x53, - 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, - 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0xda, + 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x91, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, + 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, + 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x3a, 0x01, 0x2a, 0x1a, 0x1b, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x69, + 0x64, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x10, + 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x42, 0x17, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x6f, 0x6f, 0x6a, 0x61, 0x63, 0x6b, 0x2f, + 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x32, 0xa2, 0x02, 0x03, 0x53, + 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, + 0x32, 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, + 0xe2, 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x53, 0x6c, + 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/api/v2/user_setting_service.pb.gw.go b/proto/gen/api/v2/user_setting_service.pb.gw.go index bfae62b..84ea3cd 100644 --- a/proto/gen/api/v2/user_setting_service.pb.gw.go +++ b/proto/gen/api/v2/user_setting_service.pb.gw.go @@ -165,7 +165,7 @@ func RegisterUserSettingServiceHandlerServer(ctx context.Context, mux *runtime.S inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.UserSettingService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/setting")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.UserSettingService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v2/users/{id}/settings")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -190,7 +190,7 @@ func RegisterUserSettingServiceHandlerServer(ctx context.Context, mux *runtime.S inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.UserSettingService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/settins")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.UserSettingService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v2/users/{id}/settings")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -254,7 +254,7 @@ func RegisterUserSettingServiceHandlerClient(ctx context.Context, mux *runtime.S inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.UserSettingService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/setting")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.UserSettingService/GetUserSetting", runtime.WithHTTPPathPattern("/api/v2/users/{id}/settings")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -276,7 +276,7 @@ func RegisterUserSettingServiceHandlerClient(ctx context.Context, mux *runtime.S inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.UserSettingService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v2/user/{id}/settins")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.UserSettingService/UpdateUserSetting", runtime.WithHTTPPathPattern("/api/v2/users/{id}/settings")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -296,9 +296,9 @@ func RegisterUserSettingServiceHandlerClient(ctx context.Context, mux *runtime.S } var ( - pattern_UserSettingService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "user", "id", "setting"}, "")) + pattern_UserSettingService_GetUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "users", "id", "settings"}, "")) - pattern_UserSettingService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "user", "id", "settins"}, "")) + pattern_UserSettingService_UpdateUserSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 2, 4}, []string{"api", "v2", "users", "id", "settings"}, "")) ) var (