From 0ecb9322e7f9e8fa386afeddf7f3879fa99476b8 Mon Sep 17 00:00:00 2001 From: Akari <60416767+MotooriKashin@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:34:54 +0800 Subject: [PATCH] bilibili.app.playerunite.v1.Player/PlayViewUnite (#19) * bilibili.app.playerunite.v1 * bilibili.app.playerunite.v1.Player/PlayViewUnite --- .vscode/tasks.json | 7 + package.json | 3 +- src/build/esbuild.ts | 33 +- src/index.ts | 0 src/io/Android.ts | 219 + .../app/playerunite/PGCAnyModel.proto | 22 + .../bilibili/app/playerunite/PGCAnyModel.ts | 175 + .../app/playerunite/PUGVAnyModel.proto | 47 + .../bilibili/app/playerunite/PUGVAnyModel.ts | 455 ++ .../app/playerunite/UGCAnyModel.proto | 35 + .../bilibili/app/playerunite/UGCAnyModel.ts | 375 ++ .../app/playerunite/v1/PlayViewUnite.proto | 60 + .../app/playerunite/v1/PlayViewUnite.ts | 568 +++ .../com/bapis/bilibili/metadata/Device.proto | 42 + src/io/com/bapis/bilibili/metadata/Device.ts | 363 ++ .../com/bapis/bilibili/metadata/Fawkes.proto | 21 + src/io/com/bapis/bilibili/metadata/Fawkes.ts | 216 + .../com/bapis/bilibili/metadata/Locale.proto | 25 + src/io/com/bapis/bilibili/metadata/Locale.ts | 262 ++ .../bapis/bilibili/metadata/Metadata.proto | 20 + .../com/bapis/bilibili/metadata/Metadata.ts | 203 + .../com/bapis/bilibili/metadata/Network.proto | 46 + src/io/com/bapis/bilibili/metadata/Network.ts | 270 ++ .../bapis/bilibili/metadata/Restriction.proto | 34 + .../bapis/bilibili/metadata/Restriction.ts | 236 + .../pgc/gateway/player/v2/Event.proto | 15 + .../bilibili/pgc/gateway/player/v2/Event.ts | 161 + .../player/v2/PlayAbilityExtConf.proto | 38 + .../gateway/player/v2/PlayAbilityExtConf.ts | 361 ++ .../pgc/gateway/player/v2/PlayExtInfo.proto | 70 + .../pgc/gateway/player/v2/PlayExtInfo.ts | 706 +++ .../player/v2/PlayViewBusinessInfo.proto | 370 ++ .../gateway/player/v2/PlayViewBusinessInfo.ts | 3880 +++++++++++++++++ .../pgc/gateway/player/v2/ViewInfo.proto | 304 ++ .../pgc/gateway/player/v2/ViewInfo.ts | 3511 +++++++++++++++ .../bapis/bilibili/playershared/Event.proto | 15 + .../com/bapis/bilibili/playershared/Event.ts | 160 + .../bilibili/playershared/Fragment.proto | 39 + .../bapis/bilibili/playershared/Fragment.ts | 353 ++ .../bilibili/playershared/FragmentVideo.proto | 30 + .../bilibili/playershared/FragmentVideo.ts | 282 ++ .../bapis/bilibili/playershared/History.proto | 26 + .../bapis/bilibili/playershared/History.ts | 258 ++ .../bapis/bilibili/playershared/PlayArc.proto | 87 + .../bapis/bilibili/playershared/PlayArc.ts | 720 +++ .../bilibili/playershared/PlayArcConf.proto | 28 + .../bilibili/playershared/PlayArcConf.ts | 420 ++ .../playershared/PlayDeviceConf.proto | 22 + .../bilibili/playershared/PlayDeviceConf.ts | 349 ++ .../bilibili/playershared/QnTrialInfo.proto | 23 + .../bilibili/playershared/QnTrialInfo.ts | 211 + .../bapis/bilibili/playershared/Toast.proto | 20 + .../com/bapis/bilibili/playershared/Toast.ts | 322 ++ .../bilibili/playershared/VideoVod.proto | 51 + .../bapis/bilibili/playershared/VideoVod.ts | 352 ++ .../bilibili/playershared/ViewInfo.proto | 317 ++ .../bapis/bilibili/playershared/ViewInfo.ts | 3011 +++++++++++++ .../bapis/bilibili/playershared/VodInfo.proto | 216 + .../bapis/bilibili/playershared/VodInfo.ts | 2066 +++++++++ .../com/bapis/google/protobuf/timestamp.proto | 135 + src/io/com/bapis/google/protobuf/timestamp.ts | 207 + .../PlayViewUnite.ts | 43 + src/io/net/biliapi/grpc/index.ts | 1 + src/io/sign/genAuroraEid.ts | 12 + src/io/sign/genTraceId.ts | 4 + src/isolated/index.ts | 49 + src/main/GM/index.ts | 67 + src/main/GM/messageToIsolated.ts | 21 + src/main/player/danmaku/index.ts | 44 +- src/main/player/index.ts | 3 +- src/manifest.json | 14 + src/options/index.css | 6 +- src/sw/SessionRules.ts | 14 + src/sw/index.ts | 22 + src/utils/base64.ts | 4 +- 75 files changed, 23145 insertions(+), 32 deletions(-) delete mode 100644 src/index.ts create mode 100644 src/io/Android.ts create mode 100644 src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.proto create mode 100644 src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.ts create mode 100644 src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.proto create mode 100644 src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.ts create mode 100644 src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.proto create mode 100644 src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.ts create mode 100644 src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.proto create mode 100644 src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.ts create mode 100644 src/io/com/bapis/bilibili/metadata/Device.proto create mode 100644 src/io/com/bapis/bilibili/metadata/Device.ts create mode 100644 src/io/com/bapis/bilibili/metadata/Fawkes.proto create mode 100644 src/io/com/bapis/bilibili/metadata/Fawkes.ts create mode 100644 src/io/com/bapis/bilibili/metadata/Locale.proto create mode 100644 src/io/com/bapis/bilibili/metadata/Locale.ts create mode 100644 src/io/com/bapis/bilibili/metadata/Metadata.proto create mode 100644 src/io/com/bapis/bilibili/metadata/Metadata.ts create mode 100644 src/io/com/bapis/bilibili/metadata/Network.proto create mode 100644 src/io/com/bapis/bilibili/metadata/Network.ts create mode 100644 src/io/com/bapis/bilibili/metadata/Restriction.proto create mode 100644 src/io/com/bapis/bilibili/metadata/Restriction.ts create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.proto create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.ts create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.proto create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.ts create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.proto create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.ts create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.ts create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.proto create mode 100644 src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.ts create mode 100644 src/io/com/bapis/bilibili/playershared/Event.proto create mode 100644 src/io/com/bapis/bilibili/playershared/Event.ts create mode 100644 src/io/com/bapis/bilibili/playershared/Fragment.proto create mode 100644 src/io/com/bapis/bilibili/playershared/Fragment.ts create mode 100644 src/io/com/bapis/bilibili/playershared/FragmentVideo.proto create mode 100644 src/io/com/bapis/bilibili/playershared/FragmentVideo.ts create mode 100644 src/io/com/bapis/bilibili/playershared/History.proto create mode 100644 src/io/com/bapis/bilibili/playershared/History.ts create mode 100644 src/io/com/bapis/bilibili/playershared/PlayArc.proto create mode 100644 src/io/com/bapis/bilibili/playershared/PlayArc.ts create mode 100644 src/io/com/bapis/bilibili/playershared/PlayArcConf.proto create mode 100644 src/io/com/bapis/bilibili/playershared/PlayArcConf.ts create mode 100644 src/io/com/bapis/bilibili/playershared/PlayDeviceConf.proto create mode 100644 src/io/com/bapis/bilibili/playershared/PlayDeviceConf.ts create mode 100644 src/io/com/bapis/bilibili/playershared/QnTrialInfo.proto create mode 100644 src/io/com/bapis/bilibili/playershared/QnTrialInfo.ts create mode 100644 src/io/com/bapis/bilibili/playershared/Toast.proto create mode 100644 src/io/com/bapis/bilibili/playershared/Toast.ts create mode 100644 src/io/com/bapis/bilibili/playershared/VideoVod.proto create mode 100644 src/io/com/bapis/bilibili/playershared/VideoVod.ts create mode 100644 src/io/com/bapis/bilibili/playershared/ViewInfo.proto create mode 100644 src/io/com/bapis/bilibili/playershared/ViewInfo.ts create mode 100644 src/io/com/bapis/bilibili/playershared/VodInfo.proto create mode 100644 src/io/com/bapis/bilibili/playershared/VodInfo.ts create mode 100644 src/io/com/bapis/google/protobuf/timestamp.proto create mode 100644 src/io/com/bapis/google/protobuf/timestamp.ts create mode 100644 src/io/net/biliapi/grpc/bilibili.app.playerunite.v1.Player/PlayViewUnite.ts create mode 100644 src/io/net/biliapi/grpc/index.ts create mode 100644 src/io/sign/genAuroraEid.ts create mode 100644 src/io/sign/genTraceId.ts create mode 100644 src/isolated/index.ts create mode 100644 src/main/GM/index.ts create mode 100644 src/main/GM/messageToIsolated.ts create mode 100644 src/sw/SessionRules.ts create mode 100644 src/sw/index.ts diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a0d4eb6..b646063 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -18,6 +18,13 @@ "command": "./protoc --ts_proto_opt=forceLong=bigint --ts_proto_opt=initializeFieldsAsUndefined=false --plugin=protoc-gen-ts_proto=\".\\\\node_modules\\\\.bin\\\\protoc-gen-ts_proto.cmd\" --ts_proto_out=. ${relativeFile}", "problemMatcher": [], "detail": "编译当前 proto 文件到 typescript 文件(依赖根目录下的 protoc 编译器)" + }, + { + "label": "esbuild", + "type": "shell", + "command": "npx esbuild ${file} --bundle --tree-shaking=true --charset=utf8 --outfile=${fileDirname}/${fileBasenameNoExtension}.js", + "problemMatcher": [], + "detail": "编译当前 ts 文件用于临时测试" } ] } \ No newline at end of file diff --git a/package.json b/package.json index 46e3564..ecf528b 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "@types/fs-extra": "*", "esbuild": "*", "fs-extra": "*", - "ts-proto": "*" + "ts-proto": "*", + "@types/chrome": "*" }, "scripts": { "build": "node --no-warnings --experimental-strip-types ./src/build/index.ts", diff --git a/src/build/esbuild.ts b/src/build/esbuild.ts index 18b3b87..a5bc40c 100644 --- a/src/build/esbuild.ts +++ b/src/build/esbuild.ts @@ -29,11 +29,38 @@ const cssConstructStylesheetPlugin = { } } -// 编译资源文件 -await build({ +const key = crypto.randomUUID(); + +build({ entryPoints: [ + 'src/sw/index.ts', 'src/sidebar/index.ts', 'src/options/index.ts', + ], + outdir: 'dist', + outbase: "src", + bundle: true, + minify: true, + format: 'esm', + sourcemap: true, + treeShaking: true, + charset: 'utf8', + supported: { + decorators: false, // 装饰器暂未得到任何浏览器支持 + }, + plugins: [cssConstructStylesheetPlugin], + define: { + __TOTP_KEY__: `'${key}'`, // 基于哈希消息认证码的一次性口令的密钥 + }, + loader: { + '.svg': 'text', + }, +}) + +// 编译资源文件 +build({ + entryPoints: [ + 'src/isolated/index.ts', 'src/main/index.ts', ], outdir: 'dist', @@ -49,7 +76,7 @@ await build({ }, plugins: [cssConstructStylesheetPlugin], define: { - __TOTP_KEY__: `'${crypto.randomUUID()}'`, // 基于哈希消息认证码的一次性口令的密钥 + __TOTP_KEY__: `'${key}'`, // 基于哈希消息认证码的一次性口令的密钥 }, loader: { '.svg': 'text', diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/io/Android.ts b/src/io/Android.ts new file mode 100644 index 0000000..46e945d --- /dev/null +++ b/src/io/Android.ts @@ -0,0 +1,219 @@ +import { GM } from "../main/GM"; +import { base64 } from "../utils/base64"; +import { Device } from "./com/bapis/bilibili/metadata/Device"; +import { FawkesReq } from "./com/bapis/bilibili/metadata/Fawkes"; +import { Locale, LocaleIds } from "./com/bapis/bilibili/metadata/Locale"; +import { Metadata } from "./com/bapis/bilibili/metadata/Metadata"; +import { Network, NetworkType } from "./com/bapis/bilibili/metadata/Network"; +import { genAuroraEid } from "./sign/genAuroraEid"; +import { genTraceId } from "./sign/genTraceId"; + +/** Android端通用变量 */ +export namespace Andoroid { + /** 包类型 */ + export const mobiApp = 'android'; + + /** 客户端在fawkes系统的唯一名 */ + export const appkey = 'android64'; + + /** 客户端在fawkes系统中的环境参数 */ + export const env = 'prod'; + + /** 启动id */ + export const sessionId = crypto.randomUUID().split('-')[0]; + + /** 版本号(version_code) */ + export const build = 8080200; + + /** 渠道 */ + export const channel = 'html5_app_bili'; + + /** 设备buvid */ + export const buvid = `XU${crypto.randomUUID().split('-').join(Math.floor(Math.random() * 10).toString()).slice(-35).toLocaleUpperCase()}`; + + /** 设备类型 */ + export const platform = 'android'; + + /** + * 产品编号 + * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | + * | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | + * | 粉 | 白 | 蓝 | 直播姬 | HD | 海外 | OTT | 漫画 | TV野版 | 小视频 | 网易漫画 | 网易漫画lite | 网易漫画HD | 国际版 | + */ + export const appId = 0; + + /** 手机品牌 */ + export const brand = 'Apple'; + + /** 手机型号 */ + export const model = '16'; + + /** 系统版本 */ + export const osver = '16'; + + /** 设备指纹, 不区分本地或远程设备指纹,作为推送目标的索引. */ + export const fp = genTraceId() + genTraceId(); + + /** 版本号(version_name) */ + export const versionName = '8.14.0'; + + /** 首次启动时的毫秒时间戳 */ + export const fts = BigInt(Math.floor(Date.now() / 1000)); + + export const userAgent = `Dalvik/2.1.0 (Linux; U; Android 12; ${model} Build/${build}) ${versionName} os/android model/${model} mobi_app/${mobiApp} build/${build} channel/master innerVer/${build} osVer/12 network/2 grpc-java-cronet/1.36.1`; + + const localeIds = LocaleIds.create({ language: 'zh', region: 'CN' }); + + /** 发送 grpc 请求 */ + export async function rpc( + /** 请求url */ + input: RequestInfo | URL, + /** 请求 body */ + post: Uint8Array, + /** 登录鉴权 */ + accessKey: string, + /** 用户uid */ + mid = 0n, + ) { + const body = new ArrayBuffer(post.length + 5); + const dataview = new DataView(body); + dataview.setUint32(1, post.length); // 写入字节标记 + const uInt8 = new Uint8Array(body); + uInt8[0] = 1; // 写入压缩标记 + uInt8.set(post, 5); // 写入数据 + const response = await GM.fetch( + input, + { + method: 'POST', + body, + }, + [ + { + header: 'referer', // grpc 请求不该有referer + operation: 'remove', + }, + { + header: 'user-agent', + operation: 'set', + value: userAgent, + }, + { + header: 'Content-type', + operation: 'set', + value: 'application/grpc', + }, + { + header: 'te', + operation: 'set', + value: 'trailers', + }, + { + header: 'x-bili-gaia-vtoken', + operation: 'set', + value: '', + }, + { + header: 'x-bili-aurora-eid', + operation: 'set', + value: genAuroraEid(mid), + }, + { + header: 'x-bili-mid', + operation: 'set', + value: mid.toString(), + }, + { + header: 'x-bili-aurora-zone', + operation: 'set', + value: '', + }, + { + header: 'x-bili-trace-id', + operation: 'set', + value: genTraceId(), + }, + { + header: 'x-bili-fawkes-req-bin', + operation: 'set', + value: base64.fromUint8Array(FawkesReq.encode({ appkey, env, sessionId }).finish()), + }, + { + header: 'x-bili-metadata-bin', + operation: 'set', + value: base64.fromUint8Array(Metadata.encode({ accessKey, mobiApp, build, channel, buvid, platform }).finish()), + }, + { + header: 'authorization', + operation: 'set', + value: `identify_v1 ${accessKey}`, + }, + { + header: 'x-bili-device-bin', + operation: 'set', + value: base64.fromUint8Array(Device.encode({ appId, build, buvid, mobiApp, platform, channel, brand, model, osver, fpLocal: fp, fpRemote: fp, versionName, fp, fts }).finish()), + }, + { + header: 'x-bili-network-bin', + operation: 'set', + value: base64.fromUint8Array(Network.encode({ type: NetworkType.WIFI }).finish()), + }, + { + header: 'x-bili-restriction-bin', + operation: 'set', + value: '', + }, + { + header: 'x-bili-locale-bin', + operation: 'set', + value: base64.fromUint8Array(Locale.encode({ cLocale: localeIds, sLocale: localeIds }).finish()), + }, + { + header: 'x-bili-exps-bin', + operation: 'set', + value: '', + }, + { + header: 'buvid', + operation: 'set', + value: buvid, + }, + { + header: 'grpc-encoding', + operation: 'set', + value: 'gzip', + }, + { + header: 'grpc-accept-encoding', + operation: 'set', + value: 'identity,gzip', + }, + ], + [ + { + header: 'Access-Control-Allow-Credentials', // 允许携带cookie + operation: 'set', + value: 'true', + }, + { + header: 'Access-Control-Allow-Methods', // 允许各种请求方法 + value: 'GET,POST,PUT,OPTIONS,DELETE', + operation: 'set' + }, + { + header: 'Access-Control-Allow-Origin', // 允许请求来源 + operation: 'set', + value: 'https://www.bilibili.com', + }, + { + header: 'Access-Control-Expose-Headers', // 允许读取grpc头 + operation: 'set', + value: 'grpc-status,grpc-message,grpc-status-details-bin,grpc-encoding', + } + ] + ); + const arraybuffer = await response.arrayBuffer(); + // 需要剔除5字节的grpc压缩及字节标记! + const uint8Array = new Uint8Array(arraybuffer.slice(5)); + return new Response(new Blob([uint8Array]).stream().pipeThrough(new DecompressionStream('gzip'))); + } +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.proto b/src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.proto new file mode 100644 index 0000000..5ddb58a --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package bilibili.app.playerunite.pgcanymodel; + +import "src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto"; +import "src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.proto"; +import "src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.proto"; +import "src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.proto"; +import "src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.proto"; + +message PGCAnyModel { + + bilibili.pgc.gateway.player.v2.PlayViewBusinessInfo business = 3; + + bilibili.pgc.gateway.player.v2.Event event = 4; + + bilibili.pgc.gateway.player.v2.ViewInfo view_info = 5; + + bilibili.pgc.gateway.player.v2.PlayAbilityExtConf play_ext_conf = 6; + + bilibili.pgc.gateway.player.v2.PlayExtInfo play_ext_info = 7; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.ts b/src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.ts new file mode 100644 index 0000000..14389fa --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.ts @@ -0,0 +1,175 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/app/playerunite/PGCAnyModel.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Event } from "../../pgc/gateway/player/v2/Event"; +import { PlayAbilityExtConf } from "../../pgc/gateway/player/v2/PlayAbilityExtConf"; +import { PlayExtInfo } from "../../pgc/gateway/player/v2/PlayExtInfo"; +import { PlayViewBusinessInfo } from "../../pgc/gateway/player/v2/PlayViewBusinessInfo"; +import { ViewInfo } from "../../pgc/gateway/player/v2/ViewInfo"; + +export const protobufPackage = "bilibili.app.playerunite.pgcanymodel"; + +export interface PGCAnyModel { + business: PlayViewBusinessInfo | undefined; + event: Event | undefined; + viewInfo: ViewInfo | undefined; + playExtConf: PlayAbilityExtConf | undefined; + playExtInfo: PlayExtInfo | undefined; +} + +function createBasePGCAnyModel(): PGCAnyModel { + return { business: undefined, event: undefined, viewInfo: undefined, playExtConf: undefined, playExtInfo: undefined }; +} + +export const PGCAnyModel: MessageFns = { + encode(message: PGCAnyModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.business !== undefined) { + PlayViewBusinessInfo.encode(message.business, writer.uint32(26).fork()).join(); + } + if (message.event !== undefined) { + Event.encode(message.event, writer.uint32(34).fork()).join(); + } + if (message.viewInfo !== undefined) { + ViewInfo.encode(message.viewInfo, writer.uint32(42).fork()).join(); + } + if (message.playExtConf !== undefined) { + PlayAbilityExtConf.encode(message.playExtConf, writer.uint32(50).fork()).join(); + } + if (message.playExtInfo !== undefined) { + PlayExtInfo.encode(message.playExtInfo, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PGCAnyModel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePGCAnyModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.business = PlayViewBusinessInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.event = Event.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.viewInfo = ViewInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.playExtConf = PlayAbilityExtConf.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.playExtInfo = PlayExtInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PGCAnyModel { + return { + business: isSet(object.business) ? PlayViewBusinessInfo.fromJSON(object.business) : undefined, + event: isSet(object.event) ? Event.fromJSON(object.event) : undefined, + viewInfo: isSet(object.viewInfo) ? ViewInfo.fromJSON(object.viewInfo) : undefined, + playExtConf: isSet(object.playExtConf) ? PlayAbilityExtConf.fromJSON(object.playExtConf) : undefined, + playExtInfo: isSet(object.playExtInfo) ? PlayExtInfo.fromJSON(object.playExtInfo) : undefined, + }; + }, + + toJSON(message: PGCAnyModel): unknown { + const obj: any = {}; + if (message.business !== undefined) { + obj.business = PlayViewBusinessInfo.toJSON(message.business); + } + if (message.event !== undefined) { + obj.event = Event.toJSON(message.event); + } + if (message.viewInfo !== undefined) { + obj.viewInfo = ViewInfo.toJSON(message.viewInfo); + } + if (message.playExtConf !== undefined) { + obj.playExtConf = PlayAbilityExtConf.toJSON(message.playExtConf); + } + if (message.playExtInfo !== undefined) { + obj.playExtInfo = PlayExtInfo.toJSON(message.playExtInfo); + } + return obj; + }, + + create, I>>(base?: I): PGCAnyModel { + return PGCAnyModel.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PGCAnyModel { + const message = createBasePGCAnyModel(); + message.business = (object.business !== undefined && object.business !== null) + ? PlayViewBusinessInfo.fromPartial(object.business) + : undefined; + message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined; + message.viewInfo = (object.viewInfo !== undefined && object.viewInfo !== null) + ? ViewInfo.fromPartial(object.viewInfo) + : undefined; + message.playExtConf = (object.playExtConf !== undefined && object.playExtConf !== null) + ? PlayAbilityExtConf.fromPartial(object.playExtConf) + : undefined; + message.playExtInfo = (object.playExtInfo !== undefined && object.playExtInfo !== null) + ? PlayExtInfo.fromPartial(object.playExtInfo) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.proto b/src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.proto new file mode 100644 index 0000000..1fa2518 --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; + +package bilibili.app.playerunite.pugvanymodel; + +message PUGVAnyModel { + + int64 season_id = 1; + + int64 episode_id = 2; + + EpisodeStatus status = 3; + + RiskControl risk_control = 4; + + PlayerMask player_mask = 5; +} + +enum EpisodeStatus { + EPISODE_STATUS_UNSPECIFIED = 0; + EPISODE_STATUS_TRY_WATCH_WHOLE = 1; + EPISODE_STATUS_NOT_TRY_WATCH = 2; + EPISODE_STATUS_TRY_WATCH_5_MINUTES = 3; +} + +message RiskControl { + + bool need_send_sms = 1; + + string title = 2; + + string risk_message = 3; + + string action_desc = 4; + + string send_sms_url = 5; + + string buvid = 6; +} + +message PlayerMask { + + string title = 1; + + string prefix = 2; + + string suffix = 3; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.ts b/src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.ts new file mode 100644 index 0000000..078e1ba --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.ts @@ -0,0 +1,455 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/app/playerunite/PUGVAnyModel.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.app.playerunite.pugvanymodel"; + +export enum EpisodeStatus { + EPISODE_STATUS_UNSPECIFIED = 0, + EPISODE_STATUS_TRY_WATCH_WHOLE = 1, + EPISODE_STATUS_NOT_TRY_WATCH = 2, + EPISODE_STATUS_TRY_WATCH_5_MINUTES = 3, + UNRECOGNIZED = -1, +} + +export function episodeStatusFromJSON(object: any): EpisodeStatus { + switch (object) { + case 0: + case "EPISODE_STATUS_UNSPECIFIED": + return EpisodeStatus.EPISODE_STATUS_UNSPECIFIED; + case 1: + case "EPISODE_STATUS_TRY_WATCH_WHOLE": + return EpisodeStatus.EPISODE_STATUS_TRY_WATCH_WHOLE; + case 2: + case "EPISODE_STATUS_NOT_TRY_WATCH": + return EpisodeStatus.EPISODE_STATUS_NOT_TRY_WATCH; + case 3: + case "EPISODE_STATUS_TRY_WATCH_5_MINUTES": + return EpisodeStatus.EPISODE_STATUS_TRY_WATCH_5_MINUTES; + case -1: + case "UNRECOGNIZED": + default: + return EpisodeStatus.UNRECOGNIZED; + } +} + +export function episodeStatusToJSON(object: EpisodeStatus): string { + switch (object) { + case EpisodeStatus.EPISODE_STATUS_UNSPECIFIED: + return "EPISODE_STATUS_UNSPECIFIED"; + case EpisodeStatus.EPISODE_STATUS_TRY_WATCH_WHOLE: + return "EPISODE_STATUS_TRY_WATCH_WHOLE"; + case EpisodeStatus.EPISODE_STATUS_NOT_TRY_WATCH: + return "EPISODE_STATUS_NOT_TRY_WATCH"; + case EpisodeStatus.EPISODE_STATUS_TRY_WATCH_5_MINUTES: + return "EPISODE_STATUS_TRY_WATCH_5_MINUTES"; + case EpisodeStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface PUGVAnyModel { + seasonId: bigint; + episodeId: bigint; + status: EpisodeStatus; + riskControl: RiskControl | undefined; + playerMask: PlayerMask | undefined; +} + +export interface RiskControl { + needSendSms: boolean; + title: string; + riskMessage: string; + actionDesc: string; + sendSmsUrl: string; + buvid: string; +} + +export interface PlayerMask { + title: string; + prefix: string; + suffix: string; +} + +function createBasePUGVAnyModel(): PUGVAnyModel { + return { seasonId: 0n, episodeId: 0n, status: 0, riskControl: undefined, playerMask: undefined }; +} + +export const PUGVAnyModel: MessageFns = { + encode(message: PUGVAnyModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seasonId !== 0n) { + if (BigInt.asIntN(64, message.seasonId) !== message.seasonId) { + throw new globalThis.Error("value provided for field message.seasonId of type int64 too large"); + } + writer.uint32(8).int64(message.seasonId); + } + if (message.episodeId !== 0n) { + if (BigInt.asIntN(64, message.episodeId) !== message.episodeId) { + throw new globalThis.Error("value provided for field message.episodeId of type int64 too large"); + } + writer.uint32(16).int64(message.episodeId); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.riskControl !== undefined) { + RiskControl.encode(message.riskControl, writer.uint32(34).fork()).join(); + } + if (message.playerMask !== undefined) { + PlayerMask.encode(message.playerMask, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PUGVAnyModel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePUGVAnyModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seasonId = reader.int64() as bigint; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.episodeId = reader.int64() as bigint; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.riskControl = RiskControl.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.playerMask = PlayerMask.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PUGVAnyModel { + return { + seasonId: isSet(object.seasonId) ? BigInt(object.seasonId) : 0n, + episodeId: isSet(object.episodeId) ? BigInt(object.episodeId) : 0n, + status: isSet(object.status) ? episodeStatusFromJSON(object.status) : 0, + riskControl: isSet(object.riskControl) ? RiskControl.fromJSON(object.riskControl) : undefined, + playerMask: isSet(object.playerMask) ? PlayerMask.fromJSON(object.playerMask) : undefined, + }; + }, + + toJSON(message: PUGVAnyModel): unknown { + const obj: any = {}; + if (message.seasonId !== 0n) { + obj.seasonId = message.seasonId.toString(); + } + if (message.episodeId !== 0n) { + obj.episodeId = message.episodeId.toString(); + } + if (message.status !== 0) { + obj.status = episodeStatusToJSON(message.status); + } + if (message.riskControl !== undefined) { + obj.riskControl = RiskControl.toJSON(message.riskControl); + } + if (message.playerMask !== undefined) { + obj.playerMask = PlayerMask.toJSON(message.playerMask); + } + return obj; + }, + + create, I>>(base?: I): PUGVAnyModel { + return PUGVAnyModel.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PUGVAnyModel { + const message = createBasePUGVAnyModel(); + message.seasonId = object.seasonId ?? 0n; + message.episodeId = object.episodeId ?? 0n; + message.status = object.status ?? 0; + message.riskControl = (object.riskControl !== undefined && object.riskControl !== null) + ? RiskControl.fromPartial(object.riskControl) + : undefined; + message.playerMask = (object.playerMask !== undefined && object.playerMask !== null) + ? PlayerMask.fromPartial(object.playerMask) + : undefined; + return message; + }, +}; + +function createBaseRiskControl(): RiskControl { + return { needSendSms: false, title: "", riskMessage: "", actionDesc: "", sendSmsUrl: "", buvid: "" }; +} + +export const RiskControl: MessageFns = { + encode(message: RiskControl, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.needSendSms !== false) { + writer.uint32(8).bool(message.needSendSms); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.riskMessage !== "") { + writer.uint32(26).string(message.riskMessage); + } + if (message.actionDesc !== "") { + writer.uint32(34).string(message.actionDesc); + } + if (message.sendSmsUrl !== "") { + writer.uint32(42).string(message.sendSmsUrl); + } + if (message.buvid !== "") { + writer.uint32(50).string(message.buvid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RiskControl { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRiskControl(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.needSendSms = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.riskMessage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.actionDesc = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.sendSmsUrl = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.buvid = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RiskControl { + return { + needSendSms: isSet(object.needSendSms) ? globalThis.Boolean(object.needSendSms) : false, + title: isSet(object.title) ? globalThis.String(object.title) : "", + riskMessage: isSet(object.riskMessage) ? globalThis.String(object.riskMessage) : "", + actionDesc: isSet(object.actionDesc) ? globalThis.String(object.actionDesc) : "", + sendSmsUrl: isSet(object.sendSmsUrl) ? globalThis.String(object.sendSmsUrl) : "", + buvid: isSet(object.buvid) ? globalThis.String(object.buvid) : "", + }; + }, + + toJSON(message: RiskControl): unknown { + const obj: any = {}; + if (message.needSendSms !== false) { + obj.needSendSms = message.needSendSms; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.riskMessage !== "") { + obj.riskMessage = message.riskMessage; + } + if (message.actionDesc !== "") { + obj.actionDesc = message.actionDesc; + } + if (message.sendSmsUrl !== "") { + obj.sendSmsUrl = message.sendSmsUrl; + } + if (message.buvid !== "") { + obj.buvid = message.buvid; + } + return obj; + }, + + create, I>>(base?: I): RiskControl { + return RiskControl.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RiskControl { + const message = createBaseRiskControl(); + message.needSendSms = object.needSendSms ?? false; + message.title = object.title ?? ""; + message.riskMessage = object.riskMessage ?? ""; + message.actionDesc = object.actionDesc ?? ""; + message.sendSmsUrl = object.sendSmsUrl ?? ""; + message.buvid = object.buvid ?? ""; + return message; + }, +}; + +function createBasePlayerMask(): PlayerMask { + return { title: "", prefix: "", suffix: "" }; +} + +export const PlayerMask: MessageFns = { + encode(message: PlayerMask, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.prefix !== "") { + writer.uint32(18).string(message.prefix); + } + if (message.suffix !== "") { + writer.uint32(26).string(message.suffix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayerMask { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayerMask(); + 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.prefix = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.suffix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayerMask { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + prefix: isSet(object.prefix) ? globalThis.String(object.prefix) : "", + suffix: isSet(object.suffix) ? globalThis.String(object.suffix) : "", + }; + }, + + toJSON(message: PlayerMask): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.prefix !== "") { + obj.prefix = message.prefix; + } + if (message.suffix !== "") { + obj.suffix = message.suffix; + } + return obj; + }, + + create, I>>(base?: I): PlayerMask { + return PlayerMask.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayerMask { + const message = createBasePlayerMask(); + message.title = object.title ?? ""; + message.prefix = object.prefix ?? ""; + message.suffix = object.suffix ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.proto b/src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.proto new file mode 100644 index 0000000..4e957af --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package bilibili.app.playerunite.ugcanymodel; + +message UGCAnyModel { + PlayLimit play_limit = 1; +} + +message PlayLimit { + PlayLimitCode code = 1; + string message = 2; + string sub_message = 3; + ButtonStyle button = 4; +} + +/** 播放限制 */ +enum PlayLimitCode { + + PLC_UNKNOWN = 0; + /** 未付费 */ + PLC_NOTPAYED = 1; + + PLC_ChargingPlusNotPass = 2; + + PLC_ChargingPlusUpgrade = 3; + + PLC_ChargingPlusReject = 4; +} + +message ButtonStyle { + string text = 1; + string text_color = 2; + string bg_color = 3; + string jump_link = 4; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.ts b/src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.ts new file mode 100644 index 0000000..915bc58 --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.ts @@ -0,0 +1,375 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/app/playerunite/UGCAnyModel.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.app.playerunite.ugcanymodel"; + +/** 播放限制 */ +export enum PlayLimitCode { + PLC_UNKNOWN = 0, + /** PLC_NOTPAYED - 未付费 */ + PLC_NOTPAYED = 1, + PLC_ChargingPlusNotPass = 2, + PLC_ChargingPlusUpgrade = 3, + PLC_ChargingPlusReject = 4, + UNRECOGNIZED = -1, +} + +export function playLimitCodeFromJSON(object: any): PlayLimitCode { + switch (object) { + case 0: + case "PLC_UNKNOWN": + return PlayLimitCode.PLC_UNKNOWN; + case 1: + case "PLC_NOTPAYED": + return PlayLimitCode.PLC_NOTPAYED; + case 2: + case "PLC_ChargingPlusNotPass": + return PlayLimitCode.PLC_ChargingPlusNotPass; + case 3: + case "PLC_ChargingPlusUpgrade": + return PlayLimitCode.PLC_ChargingPlusUpgrade; + case 4: + case "PLC_ChargingPlusReject": + return PlayLimitCode.PLC_ChargingPlusReject; + case -1: + case "UNRECOGNIZED": + default: + return PlayLimitCode.UNRECOGNIZED; + } +} + +export function playLimitCodeToJSON(object: PlayLimitCode): string { + switch (object) { + case PlayLimitCode.PLC_UNKNOWN: + return "PLC_UNKNOWN"; + case PlayLimitCode.PLC_NOTPAYED: + return "PLC_NOTPAYED"; + case PlayLimitCode.PLC_ChargingPlusNotPass: + return "PLC_ChargingPlusNotPass"; + case PlayLimitCode.PLC_ChargingPlusUpgrade: + return "PLC_ChargingPlusUpgrade"; + case PlayLimitCode.PLC_ChargingPlusReject: + return "PLC_ChargingPlusReject"; + case PlayLimitCode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface UGCAnyModel { + playLimit: PlayLimit | undefined; +} + +export interface PlayLimit { + code: PlayLimitCode; + message: string; + subMessage: string; + button: ButtonStyle | undefined; +} + +export interface ButtonStyle { + text: string; + textColor: string; + bgColor: string; + jumpLink: string; +} + +function createBaseUGCAnyModel(): UGCAnyModel { + return { playLimit: undefined }; +} + +export const UGCAnyModel: MessageFns = { + encode(message: UGCAnyModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.playLimit !== undefined) { + PlayLimit.encode(message.playLimit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UGCAnyModel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUGCAnyModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.playLimit = PlayLimit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UGCAnyModel { + return { playLimit: isSet(object.playLimit) ? PlayLimit.fromJSON(object.playLimit) : undefined }; + }, + + toJSON(message: UGCAnyModel): unknown { + const obj: any = {}; + if (message.playLimit !== undefined) { + obj.playLimit = PlayLimit.toJSON(message.playLimit); + } + return obj; + }, + + create, I>>(base?: I): UGCAnyModel { + return UGCAnyModel.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UGCAnyModel { + const message = createBaseUGCAnyModel(); + message.playLimit = (object.playLimit !== undefined && object.playLimit !== null) + ? PlayLimit.fromPartial(object.playLimit) + : undefined; + return message; + }, +}; + +function createBasePlayLimit(): PlayLimit { + return { code: 0, message: "", subMessage: "", button: undefined }; +} + +export const PlayLimit: MessageFns = { + encode(message: PlayLimit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).int32(message.code); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + if (message.subMessage !== "") { + writer.uint32(26).string(message.subMessage); + } + if (message.button !== undefined) { + ButtonStyle.encode(message.button, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayLimit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayLimit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.subMessage = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.button = ButtonStyle.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayLimit { + return { + code: isSet(object.code) ? playLimitCodeFromJSON(object.code) : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + subMessage: isSet(object.subMessage) ? globalThis.String(object.subMessage) : "", + button: isSet(object.button) ? ButtonStyle.fromJSON(object.button) : undefined, + }; + }, + + toJSON(message: PlayLimit): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = playLimitCodeToJSON(message.code); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.subMessage !== "") { + obj.subMessage = message.subMessage; + } + if (message.button !== undefined) { + obj.button = ButtonStyle.toJSON(message.button); + } + return obj; + }, + + create, I>>(base?: I): PlayLimit { + return PlayLimit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayLimit { + const message = createBasePlayLimit(); + message.code = object.code ?? 0; + message.message = object.message ?? ""; + message.subMessage = object.subMessage ?? ""; + message.button = (object.button !== undefined && object.button !== null) + ? ButtonStyle.fromPartial(object.button) + : undefined; + return message; + }, +}; + +function createBaseButtonStyle(): ButtonStyle { + return { text: "", textColor: "", bgColor: "", jumpLink: "" }; +} + +export const ButtonStyle: MessageFns = { + encode(message: ButtonStyle, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.textColor !== "") { + writer.uint32(18).string(message.textColor); + } + if (message.bgColor !== "") { + writer.uint32(26).string(message.bgColor); + } + if (message.jumpLink !== "") { + writer.uint32(34).string(message.jumpLink); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ButtonStyle { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseButtonStyle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.textColor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bgColor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jumpLink = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ButtonStyle { + return { + text: isSet(object.text) ? globalThis.String(object.text) : "", + textColor: isSet(object.textColor) ? globalThis.String(object.textColor) : "", + bgColor: isSet(object.bgColor) ? globalThis.String(object.bgColor) : "", + jumpLink: isSet(object.jumpLink) ? globalThis.String(object.jumpLink) : "", + }; + }, + + toJSON(message: ButtonStyle): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.textColor !== "") { + obj.textColor = message.textColor; + } + if (message.bgColor !== "") { + obj.bgColor = message.bgColor; + } + if (message.jumpLink !== "") { + obj.jumpLink = message.jumpLink; + } + return obj; + }, + + create, I>>(base?: I): ButtonStyle { + return ButtonStyle.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ButtonStyle { + const message = createBaseButtonStyle(); + message.text = object.text ?? ""; + message.textColor = object.textColor ?? ""; + message.bgColor = object.bgColor ?? ""; + message.jumpLink = object.jumpLink ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.proto b/src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.proto new file mode 100644 index 0000000..d1f680d --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; + +package bilibili.app.playerunite.v1; + +import "src/io/com/bapis/google/protobuf/any.proto"; +import "src/io/com/bapis/bilibili/playershared/VideoVod.proto"; +import "src/io/com/bapis/bilibili/playershared/Fragment.proto"; +import "src/io/com/bapis/bilibili/playershared/VodInfo.proto"; +import "src/io/com/bapis/bilibili/playershared/PlayArcConf.proto"; +import "src/io/com/bapis/bilibili/playershared/PlayDeviceConf.proto"; +import "src/io/com/bapis/bilibili/playershared/Event.proto"; +import "src/io/com/bapis/bilibili/playershared/PlayArc.proto"; +import "src/io/com/bapis/bilibili/playershared/QnTrialInfo.proto"; +import "src/io/com/bapis/bilibili/playershared/History.proto"; +import "src/io/com/bapis/bilibili/playershared/ViewInfo.proto"; +import "src/io/com/bapis/bilibili/playershared/FragmentVideo.proto"; + +/** 统一视频url */ +message PlayViewUniteReq { + /** 请求资源VOD信息 */ + bilibili.playershared.VideoVod vod = 1; + + optional string spmid = 2; + + optional string from_spmid = 3; + /** 补充信息, 如ep_id等 */ + map extra_content = 4; + + optional string bvid = 5; + + optional string ad_extra = 6; + + optional bilibili.playershared.Fragment fragment = 7; + + optional string from_scene = 8; +} + +/** 统一视频url */ +message PlayViewUniteResp { + /** 音视频流信息 */ + bilibili.playershared.VodInfo vod_info = 1; + + bilibili.playershared.PlayArcConf play_arc_conf = 2; + + bilibili.playershared.PlayDeviceConf play_device_conf = 3; + + optional bilibili.playershared.Event event = 4; + /** 使用 pgcanymodel / ugcanymodel 进行proto any转换成对应业务码结构体 */ + optional google.protobuf.Any supplement = 5; + + bilibili.playershared.PlayArc play_arc = 6; + + optional bilibili.playershared.QnTrialInfo qn_trial_info = 7; + + optional bilibili.playershared.History history = 8; + + optional bilibili.playershared.ViewInfo view_info = 9; + + optional bilibili.playershared.FragmentVideo fragment_video = 10; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.ts b/src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.ts new file mode 100644 index 0000000..f092d09 --- /dev/null +++ b/src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.ts @@ -0,0 +1,568 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/app/playerunite/v1/PlayViewUnite.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../../../google/protobuf/any"; +import { Event } from "../../../playershared/Event"; +import { Fragment } from "../../../playershared/Fragment"; +import { FragmentVideo } from "../../../playershared/FragmentVideo"; +import { History } from "../../../playershared/History"; +import { PlayArc } from "../../../playershared/PlayArc"; +import { PlayArcConf } from "../../../playershared/PlayArcConf"; +import { PlayDeviceConf } from "../../../playershared/PlayDeviceConf"; +import { QnTrialInfo } from "../../../playershared/QnTrialInfo"; +import { VideoVod } from "../../../playershared/VideoVod"; +import { ViewInfo } from "../../../playershared/ViewInfo"; +import { VodInfo } from "../../../playershared/VodInfo"; + +export const protobufPackage = "bilibili.app.playerunite.v1"; + +/** 统一视频url */ +export interface PlayViewUniteReq { + /** 请求资源VOD信息 */ + vod: VideoVod | undefined; + spmid?: string | undefined; + fromSpmid?: + | string + | undefined; + /** 补充信息, 如ep_id等 */ + extraContent: { [key: string]: string }; + bvid?: string | undefined; + adExtra?: string | undefined; + fragment?: Fragment | undefined; + fromScene?: string | undefined; +} + +export interface PlayViewUniteReq_ExtraContentEntry { + key: string; + value: string; +} + +/** 统一视频url */ +export interface PlayViewUniteResp { + /** 音视频流信息 */ + vodInfo: VodInfo | undefined; + playArcConf: PlayArcConf | undefined; + playDeviceConf: PlayDeviceConf | undefined; + event?: + | Event + | undefined; + /** 使用 pgcanymodel / ugcanymodel 进行proto any转换成对应业务码结构体 */ + supplement?: Any | undefined; + playArc: PlayArc | undefined; + qnTrialInfo?: QnTrialInfo | undefined; + history?: History | undefined; + viewInfo?: ViewInfo | undefined; + fragmentVideo?: FragmentVideo | undefined; +} + +function createBasePlayViewUniteReq(): PlayViewUniteReq { + return { vod: undefined, extraContent: {} }; +} + +export const PlayViewUniteReq: MessageFns = { + encode(message: PlayViewUniteReq, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vod !== undefined) { + VideoVod.encode(message.vod, writer.uint32(10).fork()).join(); + } + if (message.spmid !== undefined) { + writer.uint32(18).string(message.spmid); + } + if (message.fromSpmid !== undefined) { + writer.uint32(26).string(message.fromSpmid); + } + Object.entries(message.extraContent).forEach(([key, value]) => { + PlayViewUniteReq_ExtraContentEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join(); + }); + if (message.bvid !== undefined) { + writer.uint32(42).string(message.bvid); + } + if (message.adExtra !== undefined) { + writer.uint32(50).string(message.adExtra); + } + if (message.fragment !== undefined) { + Fragment.encode(message.fragment, writer.uint32(58).fork()).join(); + } + if (message.fromScene !== undefined) { + writer.uint32(66).string(message.fromScene); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayViewUniteReq { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayViewUniteReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vod = VideoVod.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.spmid = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.fromSpmid = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + const entry4 = PlayViewUniteReq_ExtraContentEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.extraContent[entry4.key] = entry4.value; + } + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bvid = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.adExtra = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.fragment = Fragment.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.fromScene = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayViewUniteReq { + return { + vod: isSet(object.vod) ? VideoVod.fromJSON(object.vod) : undefined, + spmid: isSet(object.spmid) ? globalThis.String(object.spmid) : undefined, + fromSpmid: isSet(object.fromSpmid) ? globalThis.String(object.fromSpmid) : undefined, + extraContent: isObject(object.extraContent) + ? Object.entries(object.extraContent).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + bvid: isSet(object.bvid) ? globalThis.String(object.bvid) : undefined, + adExtra: isSet(object.adExtra) ? globalThis.String(object.adExtra) : undefined, + fragment: isSet(object.fragment) ? Fragment.fromJSON(object.fragment) : undefined, + fromScene: isSet(object.fromScene) ? globalThis.String(object.fromScene) : undefined, + }; + }, + + toJSON(message: PlayViewUniteReq): unknown { + const obj: any = {}; + if (message.vod !== undefined) { + obj.vod = VideoVod.toJSON(message.vod); + } + if (message.spmid !== undefined) { + obj.spmid = message.spmid; + } + if (message.fromSpmid !== undefined) { + obj.fromSpmid = message.fromSpmid; + } + if (message.extraContent) { + const entries = Object.entries(message.extraContent); + if (entries.length > 0) { + obj.extraContent = {}; + entries.forEach(([k, v]) => { + obj.extraContent[k] = v; + }); + } + } + if (message.bvid !== undefined) { + obj.bvid = message.bvid; + } + if (message.adExtra !== undefined) { + obj.adExtra = message.adExtra; + } + if (message.fragment !== undefined) { + obj.fragment = Fragment.toJSON(message.fragment); + } + if (message.fromScene !== undefined) { + obj.fromScene = message.fromScene; + } + return obj; + }, + + create, I>>(base?: I): PlayViewUniteReq { + return PlayViewUniteReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayViewUniteReq { + const message = createBasePlayViewUniteReq(); + message.vod = (object.vod !== undefined && object.vod !== null) ? VideoVod.fromPartial(object.vod) : undefined; + message.spmid = object.spmid ?? undefined; + message.fromSpmid = object.fromSpmid ?? undefined; + message.extraContent = Object.entries(object.extraContent ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.bvid = object.bvid ?? undefined; + message.adExtra = object.adExtra ?? undefined; + message.fragment = (object.fragment !== undefined && object.fragment !== null) + ? Fragment.fromPartial(object.fragment) + : undefined; + message.fromScene = object.fromScene ?? undefined; + return message; + }, +}; + +function createBasePlayViewUniteReq_ExtraContentEntry(): PlayViewUniteReq_ExtraContentEntry { + return { key: "", value: "" }; +} + +export const PlayViewUniteReq_ExtraContentEntry: MessageFns = { + encode(message: PlayViewUniteReq_ExtraContentEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayViewUniteReq_ExtraContentEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayViewUniteReq_ExtraContentEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayViewUniteReq_ExtraContentEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: PlayViewUniteReq_ExtraContentEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): PlayViewUniteReq_ExtraContentEntry { + return PlayViewUniteReq_ExtraContentEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PlayViewUniteReq_ExtraContentEntry { + const message = createBasePlayViewUniteReq_ExtraContentEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBasePlayViewUniteResp(): PlayViewUniteResp { + return { vodInfo: undefined, playArcConf: undefined, playDeviceConf: undefined, playArc: undefined }; +} + +export const PlayViewUniteResp: MessageFns = { + encode(message: PlayViewUniteResp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vodInfo !== undefined) { + VodInfo.encode(message.vodInfo, writer.uint32(10).fork()).join(); + } + if (message.playArcConf !== undefined) { + PlayArcConf.encode(message.playArcConf, writer.uint32(18).fork()).join(); + } + if (message.playDeviceConf !== undefined) { + PlayDeviceConf.encode(message.playDeviceConf, writer.uint32(26).fork()).join(); + } + if (message.event !== undefined) { + Event.encode(message.event, writer.uint32(34).fork()).join(); + } + if (message.supplement !== undefined) { + Any.encode(message.supplement, writer.uint32(42).fork()).join(); + } + if (message.playArc !== undefined) { + PlayArc.encode(message.playArc, writer.uint32(50).fork()).join(); + } + if (message.qnTrialInfo !== undefined) { + QnTrialInfo.encode(message.qnTrialInfo, writer.uint32(58).fork()).join(); + } + if (message.history !== undefined) { + History.encode(message.history, writer.uint32(66).fork()).join(); + } + if (message.viewInfo !== undefined) { + ViewInfo.encode(message.viewInfo, writer.uint32(74).fork()).join(); + } + if (message.fragmentVideo !== undefined) { + FragmentVideo.encode(message.fragmentVideo, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayViewUniteResp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayViewUniteResp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vodInfo = VodInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.playArcConf = PlayArcConf.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.playDeviceConf = PlayDeviceConf.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.event = Event.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.supplement = Any.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.playArc = PlayArc.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.qnTrialInfo = QnTrialInfo.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.history = History.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.viewInfo = ViewInfo.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.fragmentVideo = FragmentVideo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayViewUniteResp { + return { + vodInfo: isSet(object.vodInfo) ? VodInfo.fromJSON(object.vodInfo) : undefined, + playArcConf: isSet(object.playArcConf) ? PlayArcConf.fromJSON(object.playArcConf) : undefined, + playDeviceConf: isSet(object.playDeviceConf) ? PlayDeviceConf.fromJSON(object.playDeviceConf) : undefined, + event: isSet(object.event) ? Event.fromJSON(object.event) : undefined, + supplement: isSet(object.supplement) ? Any.fromJSON(object.supplement) : undefined, + playArc: isSet(object.playArc) ? PlayArc.fromJSON(object.playArc) : undefined, + qnTrialInfo: isSet(object.qnTrialInfo) ? QnTrialInfo.fromJSON(object.qnTrialInfo) : undefined, + history: isSet(object.history) ? History.fromJSON(object.history) : undefined, + viewInfo: isSet(object.viewInfo) ? ViewInfo.fromJSON(object.viewInfo) : undefined, + fragmentVideo: isSet(object.fragmentVideo) ? FragmentVideo.fromJSON(object.fragmentVideo) : undefined, + }; + }, + + toJSON(message: PlayViewUniteResp): unknown { + const obj: any = {}; + if (message.vodInfo !== undefined) { + obj.vodInfo = VodInfo.toJSON(message.vodInfo); + } + if (message.playArcConf !== undefined) { + obj.playArcConf = PlayArcConf.toJSON(message.playArcConf); + } + if (message.playDeviceConf !== undefined) { + obj.playDeviceConf = PlayDeviceConf.toJSON(message.playDeviceConf); + } + if (message.event !== undefined) { + obj.event = Event.toJSON(message.event); + } + if (message.supplement !== undefined) { + obj.supplement = Any.toJSON(message.supplement); + } + if (message.playArc !== undefined) { + obj.playArc = PlayArc.toJSON(message.playArc); + } + if (message.qnTrialInfo !== undefined) { + obj.qnTrialInfo = QnTrialInfo.toJSON(message.qnTrialInfo); + } + if (message.history !== undefined) { + obj.history = History.toJSON(message.history); + } + if (message.viewInfo !== undefined) { + obj.viewInfo = ViewInfo.toJSON(message.viewInfo); + } + if (message.fragmentVideo !== undefined) { + obj.fragmentVideo = FragmentVideo.toJSON(message.fragmentVideo); + } + return obj; + }, + + create, I>>(base?: I): PlayViewUniteResp { + return PlayViewUniteResp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayViewUniteResp { + const message = createBasePlayViewUniteResp(); + message.vodInfo = (object.vodInfo !== undefined && object.vodInfo !== null) + ? VodInfo.fromPartial(object.vodInfo) + : undefined; + message.playArcConf = (object.playArcConf !== undefined && object.playArcConf !== null) + ? PlayArcConf.fromPartial(object.playArcConf) + : undefined; + message.playDeviceConf = (object.playDeviceConf !== undefined && object.playDeviceConf !== null) + ? PlayDeviceConf.fromPartial(object.playDeviceConf) + : undefined; + message.event = (object.event !== undefined && object.event !== null) ? Event.fromPartial(object.event) : undefined; + message.supplement = (object.supplement !== undefined && object.supplement !== null) + ? Any.fromPartial(object.supplement) + : undefined; + message.playArc = (object.playArc !== undefined && object.playArc !== null) + ? PlayArc.fromPartial(object.playArc) + : undefined; + message.qnTrialInfo = (object.qnTrialInfo !== undefined && object.qnTrialInfo !== null) + ? QnTrialInfo.fromPartial(object.qnTrialInfo) + : undefined; + message.history = (object.history !== undefined && object.history !== null) + ? History.fromPartial(object.history) + : undefined; + message.viewInfo = (object.viewInfo !== undefined && object.viewInfo !== null) + ? ViewInfo.fromPartial(object.viewInfo) + : undefined; + message.fragmentVideo = (object.fragmentVideo !== undefined && object.fragmentVideo !== null) + ? FragmentVideo.fromPartial(object.fragmentVideo) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/metadata/Device.proto b/src/io/com/bapis/bilibili/metadata/Device.proto new file mode 100644 index 0000000..26f432f --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Device.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +package bilibili.metadata.device; + +/** 设备信息 */ +message Device { + /** + * 产品编号 + * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | + * | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | + * | 粉 | 白 | 蓝 | 直播姬 | HD | 海外 | OTT | 漫画 | TV野版 | 小视频 | 网易漫画 | 网易漫画lite | 网易漫画HD | 国际版 | + */ + int32 app_id = 1; + /** 版本号(version_code) */ + int32 build = 2; + /** 设备id */ + string buvid = 3; + /** 包类型 */ + string mobi_app = 4; + /** 平台:ios/android */ + string platform = 5; + /** 运行设备 */ + optional string device = 6; + /** 渠道 */ + string channel = 7; + /** 手机品牌 */ + string brand = 8; + /** 手机型号 */ + string model = 9; + /** 系统版本 */ + string osver = 10; + /** 本地设备指纹 */ + string fp_local = 11; + /** 远程设备指纹 */ + string fp_remote = 12; + /** 版本号(version_name) */ + string version_name = 13; + /** 设备指纹, 不区分本地或远程设备指纹,作为推送目标的索引. */ + string fp = 14; + /** 首次启动时的毫秒时间戳 */ + int64 fts = 15; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/metadata/Device.ts b/src/io/com/bapis/bilibili/metadata/Device.ts new file mode 100644 index 0000000..1922306 --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Device.ts @@ -0,0 +1,363 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/metadata/Device.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.metadata.device"; + +/** 设备信息 */ +export interface Device { + /** + * 产品编号 + * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | + * | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | + * | 粉 | 白 | 蓝 | 直播姬 | HD | 海外 | OTT | 漫画 | TV野版 | 小视频 | 网易漫画 | 网易漫画lite | 网易漫画HD | 国际版 | + */ + appId: number; + /** 版本号(version_code) */ + build: number; + /** 设备id */ + buvid: string; + /** 包类型 */ + mobiApp: string; + /** 平台:ios/android */ + platform: string; + /** 运行设备 */ + device?: + | string + | undefined; + /** 渠道 */ + channel: string; + /** 手机品牌 */ + brand: string; + /** 手机型号 */ + model: string; + /** 系统版本 */ + osver: string; + /** 本地设备指纹 */ + fpLocal: string; + /** 远程设备指纹 */ + fpRemote: string; + /** 版本号(version_name) */ + versionName: string; + /** 设备指纹, 不区分本地或远程设备指纹,作为推送目标的索引. */ + fp: string; + /** 首次启动时的毫秒时间戳 */ + fts: bigint; +} + +function createBaseDevice(): Device { + return { + appId: 0, + build: 0, + buvid: "", + mobiApp: "", + platform: "", + channel: "", + brand: "", + model: "", + osver: "", + fpLocal: "", + fpRemote: "", + versionName: "", + fp: "", + fts: 0n, + }; +} + +export const Device: MessageFns = { + encode(message: Device, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appId !== 0) { + writer.uint32(8).int32(message.appId); + } + if (message.build !== 0) { + writer.uint32(16).int32(message.build); + } + if (message.buvid !== "") { + writer.uint32(26).string(message.buvid); + } + if (message.mobiApp !== "") { + writer.uint32(34).string(message.mobiApp); + } + if (message.platform !== "") { + writer.uint32(42).string(message.platform); + } + if (message.device !== undefined) { + writer.uint32(50).string(message.device); + } + if (message.channel !== "") { + writer.uint32(58).string(message.channel); + } + if (message.brand !== "") { + writer.uint32(66).string(message.brand); + } + if (message.model !== "") { + writer.uint32(74).string(message.model); + } + if (message.osver !== "") { + writer.uint32(82).string(message.osver); + } + if (message.fpLocal !== "") { + writer.uint32(90).string(message.fpLocal); + } + if (message.fpRemote !== "") { + writer.uint32(98).string(message.fpRemote); + } + if (message.versionName !== "") { + writer.uint32(106).string(message.versionName); + } + if (message.fp !== "") { + writer.uint32(114).string(message.fp); + } + if (message.fts !== 0n) { + if (BigInt.asIntN(64, message.fts) !== message.fts) { + throw new globalThis.Error("value provided for field message.fts of type int64 too large"); + } + writer.uint32(120).int64(message.fts); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Device { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDevice(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.appId = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.build = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.buvid = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.mobiApp = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.platform = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.device = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.channel = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.brand = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.model = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.osver = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.fpLocal = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.fpRemote = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.versionName = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.fp = reader.string(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.fts = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Device { + return { + appId: isSet(object.appId) ? globalThis.Number(object.appId) : 0, + build: isSet(object.build) ? globalThis.Number(object.build) : 0, + buvid: isSet(object.buvid) ? globalThis.String(object.buvid) : "", + mobiApp: isSet(object.mobiApp) ? globalThis.String(object.mobiApp) : "", + platform: isSet(object.platform) ? globalThis.String(object.platform) : "", + device: isSet(object.device) ? globalThis.String(object.device) : undefined, + channel: isSet(object.channel) ? globalThis.String(object.channel) : "", + brand: isSet(object.brand) ? globalThis.String(object.brand) : "", + model: isSet(object.model) ? globalThis.String(object.model) : "", + osver: isSet(object.osver) ? globalThis.String(object.osver) : "", + fpLocal: isSet(object.fpLocal) ? globalThis.String(object.fpLocal) : "", + fpRemote: isSet(object.fpRemote) ? globalThis.String(object.fpRemote) : "", + versionName: isSet(object.versionName) ? globalThis.String(object.versionName) : "", + fp: isSet(object.fp) ? globalThis.String(object.fp) : "", + fts: isSet(object.fts) ? BigInt(object.fts) : 0n, + }; + }, + + toJSON(message: Device): unknown { + const obj: any = {}; + if (message.appId !== 0) { + obj.appId = Math.round(message.appId); + } + if (message.build !== 0) { + obj.build = Math.round(message.build); + } + if (message.buvid !== "") { + obj.buvid = message.buvid; + } + if (message.mobiApp !== "") { + obj.mobiApp = message.mobiApp; + } + if (message.platform !== "") { + obj.platform = message.platform; + } + if (message.device !== undefined) { + obj.device = message.device; + } + if (message.channel !== "") { + obj.channel = message.channel; + } + if (message.brand !== "") { + obj.brand = message.brand; + } + if (message.model !== "") { + obj.model = message.model; + } + if (message.osver !== "") { + obj.osver = message.osver; + } + if (message.fpLocal !== "") { + obj.fpLocal = message.fpLocal; + } + if (message.fpRemote !== "") { + obj.fpRemote = message.fpRemote; + } + if (message.versionName !== "") { + obj.versionName = message.versionName; + } + if (message.fp !== "") { + obj.fp = message.fp; + } + if (message.fts !== 0n) { + obj.fts = message.fts.toString(); + } + return obj; + }, + + create, I>>(base?: I): Device { + return Device.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Device { + const message = createBaseDevice(); + message.appId = object.appId ?? 0; + message.build = object.build ?? 0; + message.buvid = object.buvid ?? ""; + message.mobiApp = object.mobiApp ?? ""; + message.platform = object.platform ?? ""; + message.device = object.device ?? undefined; + message.channel = object.channel ?? ""; + message.brand = object.brand ?? ""; + message.model = object.model ?? ""; + message.osver = object.osver ?? ""; + message.fpLocal = object.fpLocal ?? ""; + message.fpRemote = object.fpRemote ?? ""; + message.versionName = object.versionName ?? ""; + message.fp = object.fp ?? ""; + message.fts = object.fts ?? 0n; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/metadata/Fawkes.proto b/src/io/com/bapis/bilibili/metadata/Fawkes.proto new file mode 100644 index 0000000..7a3cffc --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Fawkes.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package bilibili.metadata.fawkes; + +/** 设备 Fawkes 信息 */ +message FawkesReq { + /** 客户端在fawkes系统的唯一名 */ + string appkey = 1; + /** 客户端在fawkes系统中的环境参数 */ + string env = 2; + /** 启动id */ + string session_id = 3; +} + +/** 设备 Fawkes 信息 */ +message FawkesReply { + /** 客户端在fawkes系统中对应的已发布最新的config版本号 */ + string config = 1; + /** 客户端在fawkes系统中对应的已发布最新的ff版本号 */ + string ff = 2; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/metadata/Fawkes.ts b/src/io/com/bapis/bilibili/metadata/Fawkes.ts new file mode 100644 index 0000000..8298e9b --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Fawkes.ts @@ -0,0 +1,216 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/metadata/Fawkes.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.metadata.fawkes"; + +/** 设备 Fawkes 信息 */ +export interface FawkesReq { + /** 客户端在fawkes系统的唯一名 */ + appkey: string; + /** 客户端在fawkes系统中的环境参数 */ + env: string; + /** 启动id */ + sessionId: string; +} + +/** 设备 Fawkes 信息 */ +export interface FawkesReply { + /** 客户端在fawkes系统中对应的已发布最新的config版本号 */ + config: string; + /** 客户端在fawkes系统中对应的已发布最新的ff版本号 */ + ff: string; +} + +function createBaseFawkesReq(): FawkesReq { + return { appkey: "", env: "", sessionId: "" }; +} + +export const FawkesReq: MessageFns = { + encode(message: FawkesReq, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appkey !== "") { + writer.uint32(10).string(message.appkey); + } + if (message.env !== "") { + writer.uint32(18).string(message.env); + } + if (message.sessionId !== "") { + writer.uint32(26).string(message.sessionId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FawkesReq { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFawkesReq(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.appkey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.env = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sessionId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FawkesReq { + return { + appkey: isSet(object.appkey) ? globalThis.String(object.appkey) : "", + env: isSet(object.env) ? globalThis.String(object.env) : "", + sessionId: isSet(object.sessionId) ? globalThis.String(object.sessionId) : "", + }; + }, + + toJSON(message: FawkesReq): unknown { + const obj: any = {}; + if (message.appkey !== "") { + obj.appkey = message.appkey; + } + if (message.env !== "") { + obj.env = message.env; + } + if (message.sessionId !== "") { + obj.sessionId = message.sessionId; + } + return obj; + }, + + create, I>>(base?: I): FawkesReq { + return FawkesReq.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FawkesReq { + const message = createBaseFawkesReq(); + message.appkey = object.appkey ?? ""; + message.env = object.env ?? ""; + message.sessionId = object.sessionId ?? ""; + return message; + }, +}; + +function createBaseFawkesReply(): FawkesReply { + return { config: "", ff: "" }; +} + +export const FawkesReply: MessageFns = { + encode(message: FawkesReply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== "") { + writer.uint32(10).string(message.config); + } + if (message.ff !== "") { + writer.uint32(18).string(message.ff); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FawkesReply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFawkesReply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.config = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ff = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FawkesReply { + return { + config: isSet(object.config) ? globalThis.String(object.config) : "", + ff: isSet(object.ff) ? globalThis.String(object.ff) : "", + }; + }, + + toJSON(message: FawkesReply): unknown { + const obj: any = {}; + if (message.config !== "") { + obj.config = message.config; + } + if (message.ff !== "") { + obj.ff = message.ff; + } + return obj; + }, + + create, I>>(base?: I): FawkesReply { + return FawkesReply.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FawkesReply { + const message = createBaseFawkesReply(); + message.config = object.config ?? ""; + message.ff = object.ff ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/metadata/Locale.proto b/src/io/com/bapis/bilibili/metadata/Locale.proto new file mode 100644 index 0000000..af4f5db --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Locale.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package bilibili.metadata.locale; + +/** 设备区域信息 */ +message Locale { + /** App设置的locale. */ + LocaleIds c_locale = 1; + /** 系统默认的locale. */ + LocaleIds s_locale = 2; + /** sim卡的国家码+运营商码 */ + optional string sim_code = 3; + /** 时区 */ + optional string timezone = 4; +} + +/** Defined by https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html */ +message LocaleIds { + /** A language designator is a code that represents a language. */ + string language = 1; + /** Writing systems. */ + optional string script = 2; + /** A region designator is a code that represents a country or an area. */ + string region = 3; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/metadata/Locale.ts b/src/io/com/bapis/bilibili/metadata/Locale.ts new file mode 100644 index 0000000..bf65822 --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Locale.ts @@ -0,0 +1,262 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/metadata/Locale.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.metadata.locale"; + +/** 设备区域信息 */ +export interface Locale { + /** App设置的locale. */ + cLocale: + | LocaleIds + | undefined; + /** 系统默认的locale. */ + sLocale: + | LocaleIds + | undefined; + /** sim卡的国家码+运营商码 */ + simCode?: + | string + | undefined; + /** 时区 */ + timezone?: string | undefined; +} + +/** Defined by https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html */ +export interface LocaleIds { + /** A language designator is a code that represents a language. */ + language: string; + /** Writing systems. */ + script?: + | string + | undefined; + /** A region designator is a code that represents a country or an area. */ + region: string; +} + +function createBaseLocale(): Locale { + return { cLocale: undefined, sLocale: undefined }; +} + +export const Locale: MessageFns = { + encode(message: Locale, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cLocale !== undefined) { + LocaleIds.encode(message.cLocale, writer.uint32(10).fork()).join(); + } + if (message.sLocale !== undefined) { + LocaleIds.encode(message.sLocale, writer.uint32(18).fork()).join(); + } + if (message.simCode !== undefined) { + writer.uint32(26).string(message.simCode); + } + if (message.timezone !== undefined) { + writer.uint32(34).string(message.timezone); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Locale { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLocale(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cLocale = LocaleIds.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.sLocale = LocaleIds.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.simCode = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.timezone = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Locale { + return { + cLocale: isSet(object.cLocale) ? LocaleIds.fromJSON(object.cLocale) : undefined, + sLocale: isSet(object.sLocale) ? LocaleIds.fromJSON(object.sLocale) : undefined, + simCode: isSet(object.simCode) ? globalThis.String(object.simCode) : undefined, + timezone: isSet(object.timezone) ? globalThis.String(object.timezone) : undefined, + }; + }, + + toJSON(message: Locale): unknown { + const obj: any = {}; + if (message.cLocale !== undefined) { + obj.cLocale = LocaleIds.toJSON(message.cLocale); + } + if (message.sLocale !== undefined) { + obj.sLocale = LocaleIds.toJSON(message.sLocale); + } + if (message.simCode !== undefined) { + obj.simCode = message.simCode; + } + if (message.timezone !== undefined) { + obj.timezone = message.timezone; + } + return obj; + }, + + create, I>>(base?: I): Locale { + return Locale.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Locale { + const message = createBaseLocale(); + message.cLocale = (object.cLocale !== undefined && object.cLocale !== null) + ? LocaleIds.fromPartial(object.cLocale) + : undefined; + message.sLocale = (object.sLocale !== undefined && object.sLocale !== null) + ? LocaleIds.fromPartial(object.sLocale) + : undefined; + message.simCode = object.simCode ?? undefined; + message.timezone = object.timezone ?? undefined; + return message; + }, +}; + +function createBaseLocaleIds(): LocaleIds { + return { language: "", region: "" }; +} + +export const LocaleIds: MessageFns = { + encode(message: LocaleIds, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.language !== "") { + writer.uint32(10).string(message.language); + } + if (message.script !== undefined) { + writer.uint32(18).string(message.script); + } + if (message.region !== "") { + writer.uint32(26).string(message.region); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LocaleIds { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLocaleIds(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.language = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.script = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.region = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LocaleIds { + return { + language: isSet(object.language) ? globalThis.String(object.language) : "", + script: isSet(object.script) ? globalThis.String(object.script) : undefined, + region: isSet(object.region) ? globalThis.String(object.region) : "", + }; + }, + + toJSON(message: LocaleIds): unknown { + const obj: any = {}; + if (message.language !== "") { + obj.language = message.language; + } + if (message.script !== undefined) { + obj.script = message.script; + } + if (message.region !== "") { + obj.region = message.region; + } + return obj; + }, + + create, I>>(base?: I): LocaleIds { + return LocaleIds.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LocaleIds { + const message = createBaseLocaleIds(); + message.language = object.language ?? ""; + message.script = object.script ?? undefined; + message.region = object.region ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/metadata/Metadata.proto b/src/io/com/bapis/bilibili/metadata/Metadata.proto new file mode 100644 index 0000000..341c505 --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Metadata.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package bilibili.metadata; + +message Metadata { + /** 登录鉴权 */ + string access_key = 1; + /** 包类型 */ + string mobi_app = 2; + /** 运行设备 */ + optional string device = 3; + /** 构建号 */ + int32 build = 4; + /** 渠道 */ + string channel = 5; + /** 设备buvid */ + string buvid = 6; + /** 设备类型 */ + string platform = 7; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/metadata/Metadata.ts b/src/io/com/bapis/bilibili/metadata/Metadata.ts new file mode 100644 index 0000000..1363a7f --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Metadata.ts @@ -0,0 +1,203 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/metadata/Metadata.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.metadata"; + +export interface Metadata { + /** 登录鉴权 */ + accessKey: string; + /** 包类型 */ + mobiApp: string; + /** 运行设备 */ + device?: + | string + | undefined; + /** 构建号 */ + build: number; + /** 渠道 */ + channel: string; + /** 设备buvid */ + buvid: string; + /** 设备类型 */ + platform: string; +} + +function createBaseMetadata(): Metadata { + return { accessKey: "", mobiApp: "", build: 0, channel: "", buvid: "", platform: "" }; +} + +export const Metadata: MessageFns = { + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.accessKey !== "") { + writer.uint32(10).string(message.accessKey); + } + if (message.mobiApp !== "") { + writer.uint32(18).string(message.mobiApp); + } + if (message.device !== undefined) { + writer.uint32(26).string(message.device); + } + if (message.build !== 0) { + writer.uint32(32).int32(message.build); + } + if (message.channel !== "") { + writer.uint32(42).string(message.channel); + } + if (message.buvid !== "") { + writer.uint32(50).string(message.buvid); + } + if (message.platform !== "") { + writer.uint32(58).string(message.platform); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accessKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.mobiApp = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.device = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.build = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.channel = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.buvid = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.platform = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + accessKey: isSet(object.accessKey) ? globalThis.String(object.accessKey) : "", + mobiApp: isSet(object.mobiApp) ? globalThis.String(object.mobiApp) : "", + device: isSet(object.device) ? globalThis.String(object.device) : undefined, + build: isSet(object.build) ? globalThis.Number(object.build) : 0, + channel: isSet(object.channel) ? globalThis.String(object.channel) : "", + buvid: isSet(object.buvid) ? globalThis.String(object.buvid) : "", + platform: isSet(object.platform) ? globalThis.String(object.platform) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.accessKey !== "") { + obj.accessKey = message.accessKey; + } + if (message.mobiApp !== "") { + obj.mobiApp = message.mobiApp; + } + if (message.device !== undefined) { + obj.device = message.device; + } + if (message.build !== 0) { + obj.build = Math.round(message.build); + } + if (message.channel !== "") { + obj.channel = message.channel; + } + if (message.buvid !== "") { + obj.buvid = message.buvid; + } + if (message.platform !== "") { + obj.platform = message.platform; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.accessKey = object.accessKey ?? ""; + message.mobiApp = object.mobiApp ?? ""; + message.device = object.device ?? undefined; + message.build = object.build ?? 0; + message.channel = object.channel ?? ""; + message.buvid = object.buvid ?? ""; + message.platform = object.platform ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/metadata/Network.proto b/src/io/com/bapis/bilibili/metadata/Network.proto new file mode 100644 index 0000000..2a7a7c3 --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Network.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +package bilibili.metadata.network; + +message Network { + /** 网络类型 */ + NetworkType type = 1; + /** 免流类型 */ + optional TFType tf = 2; + /** 运营商 */ + optional string oid = 3; +} + +/** 网络类型 */ +enum NetworkType { + /** 未知 */ + NT_UNKNOWN = 0; + /** WIFI */ + WIFI = 1; + /** 移动网络 */ + CELLULAR = 2; + /** 未连接 */ + OFFLINE = 3; + /** 其他网络 */ + OTHERNET = 4; + /** 以太网 */ + ETHERNET = 5; +} + +/** 免流类型 */ +enum TFType { + /** 正常计费 */ + TF_UNKNOWN = 0; + /** 联通卡 */ + U_CARD = 1; + /** 联通包 */ + U_PKG = 2; + /** 移动卡 */ + C_CARD = 3; + /** 移动包 */ + C_PKG = 4; + /** 电信卡 */ + T_CARD = 5; + /** 电信包 */ + T_PKG = 6; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/metadata/Network.ts b/src/io/com/bapis/bilibili/metadata/Network.ts new file mode 100644 index 0000000..cf63c8d --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Network.ts @@ -0,0 +1,270 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/metadata/Network.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.metadata.network"; + +/** 网络类型 */ +export enum NetworkType { + /** NT_UNKNOWN - 未知 */ + NT_UNKNOWN = 0, + /** WIFI - WIFI */ + WIFI = 1, + /** CELLULAR - 移动网络 */ + CELLULAR = 2, + /** OFFLINE - 未连接 */ + OFFLINE = 3, + /** OTHERNET - 其他网络 */ + OTHERNET = 4, + /** ETHERNET - 以太网 */ + ETHERNET = 5, + UNRECOGNIZED = -1, +} + +export function networkTypeFromJSON(object: any): NetworkType { + switch (object) { + case 0: + case "NT_UNKNOWN": + return NetworkType.NT_UNKNOWN; + case 1: + case "WIFI": + return NetworkType.WIFI; + case 2: + case "CELLULAR": + return NetworkType.CELLULAR; + case 3: + case "OFFLINE": + return NetworkType.OFFLINE; + case 4: + case "OTHERNET": + return NetworkType.OTHERNET; + case 5: + case "ETHERNET": + return NetworkType.ETHERNET; + case -1: + case "UNRECOGNIZED": + default: + return NetworkType.UNRECOGNIZED; + } +} + +export function networkTypeToJSON(object: NetworkType): string { + switch (object) { + case NetworkType.NT_UNKNOWN: + return "NT_UNKNOWN"; + case NetworkType.WIFI: + return "WIFI"; + case NetworkType.CELLULAR: + return "CELLULAR"; + case NetworkType.OFFLINE: + return "OFFLINE"; + case NetworkType.OTHERNET: + return "OTHERNET"; + case NetworkType.ETHERNET: + return "ETHERNET"; + case NetworkType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** 免流类型 */ +export enum TFType { + /** TF_UNKNOWN - 正常计费 */ + TF_UNKNOWN = 0, + /** U_CARD - 联通卡 */ + U_CARD = 1, + /** U_PKG - 联通包 */ + U_PKG = 2, + /** C_CARD - 移动卡 */ + C_CARD = 3, + /** C_PKG - 移动包 */ + C_PKG = 4, + /** T_CARD - 电信卡 */ + T_CARD = 5, + /** T_PKG - 电信包 */ + T_PKG = 6, + UNRECOGNIZED = -1, +} + +export function tFTypeFromJSON(object: any): TFType { + switch (object) { + case 0: + case "TF_UNKNOWN": + return TFType.TF_UNKNOWN; + case 1: + case "U_CARD": + return TFType.U_CARD; + case 2: + case "U_PKG": + return TFType.U_PKG; + case 3: + case "C_CARD": + return TFType.C_CARD; + case 4: + case "C_PKG": + return TFType.C_PKG; + case 5: + case "T_CARD": + return TFType.T_CARD; + case 6: + case "T_PKG": + return TFType.T_PKG; + case -1: + case "UNRECOGNIZED": + default: + return TFType.UNRECOGNIZED; + } +} + +export function tFTypeToJSON(object: TFType): string { + switch (object) { + case TFType.TF_UNKNOWN: + return "TF_UNKNOWN"; + case TFType.U_CARD: + return "U_CARD"; + case TFType.U_PKG: + return "U_PKG"; + case TFType.C_CARD: + return "C_CARD"; + case TFType.C_PKG: + return "C_PKG"; + case TFType.T_CARD: + return "T_CARD"; + case TFType.T_PKG: + return "T_PKG"; + case TFType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Network { + /** 网络类型 */ + type: NetworkType; + /** 免流类型 */ + tf?: + | TFType + | undefined; + /** 运营商 */ + oid?: string | undefined; +} + +function createBaseNetwork(): Network { + return { type: 0 }; +} + +export const Network: MessageFns = { + encode(message: Network, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.tf !== undefined) { + writer.uint32(16).int32(message.tf); + } + if (message.oid !== undefined) { + writer.uint32(26).string(message.oid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Network { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNetwork(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.tf = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.oid = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Network { + return { + type: isSet(object.type) ? networkTypeFromJSON(object.type) : 0, + tf: isSet(object.tf) ? tFTypeFromJSON(object.tf) : undefined, + oid: isSet(object.oid) ? globalThis.String(object.oid) : undefined, + }; + }, + + toJSON(message: Network): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = networkTypeToJSON(message.type); + } + if (message.tf !== undefined) { + obj.tf = tFTypeToJSON(message.tf); + } + if (message.oid !== undefined) { + obj.oid = message.oid; + } + return obj; + }, + + create, I>>(base?: I): Network { + return Network.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Network { + const message = createBaseNetwork(); + message.type = object.type ?? 0; + message.tf = object.tf ?? undefined; + message.oid = object.oid ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/metadata/Restriction.proto b/src/io/com/bapis/bilibili/metadata/Restriction.proto new file mode 100644 index 0000000..705fccb --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Restriction.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package bilibili.metadata.restriction; + +/** 限制条件 */ +message Restriction { + /** 青少年模式开关状态 */ + bool teenagers_mode = 1; + /** 课堂模式开关状态 */ + bool lessons_mode = 2; + /** + * 多种模式开关打开,根据互斥和优先级确认的最终模式 + * @deprecated 自app 5.60起废弃,由业务服务根据前两个模式计算 + */ + ModeType mode = 3; + /** app 审核review状态,用于appstore/market审核时服务端返回数据过虑 */ + bool review = 4; + /** 客户端是否选择关闭个性化推荐 */ + bool disable_rcmd = 5; + + bool basic_mode = 6; +} + +/** 模式类型 */ +enum ModeType { + /** 正常模式 */ + NORMAL = 0; + /** 青少年模式 */ + TEENAGERS = 1; + /** 课堂模式 */ + LESSONS = 2; + + BASIC = 3; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/metadata/Restriction.ts b/src/io/com/bapis/bilibili/metadata/Restriction.ts new file mode 100644 index 0000000..e6cdf23 --- /dev/null +++ b/src/io/com/bapis/bilibili/metadata/Restriction.ts @@ -0,0 +1,236 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/metadata/Restriction.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.metadata.restriction"; + +/** 模式类型 */ +export enum ModeType { + /** NORMAL - 正常模式 */ + NORMAL = 0, + /** TEENAGERS - 青少年模式 */ + TEENAGERS = 1, + /** LESSONS - 课堂模式 */ + LESSONS = 2, + BASIC = 3, + UNRECOGNIZED = -1, +} + +export function modeTypeFromJSON(object: any): ModeType { + switch (object) { + case 0: + case "NORMAL": + return ModeType.NORMAL; + case 1: + case "TEENAGERS": + return ModeType.TEENAGERS; + case 2: + case "LESSONS": + return ModeType.LESSONS; + case 3: + case "BASIC": + return ModeType.BASIC; + case -1: + case "UNRECOGNIZED": + default: + return ModeType.UNRECOGNIZED; + } +} + +export function modeTypeToJSON(object: ModeType): string { + switch (object) { + case ModeType.NORMAL: + return "NORMAL"; + case ModeType.TEENAGERS: + return "TEENAGERS"; + case ModeType.LESSONS: + return "LESSONS"; + case ModeType.BASIC: + return "BASIC"; + case ModeType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** 限制条件 */ +export interface Restriction { + /** 青少年模式开关状态 */ + teenagersMode: boolean; + /** 课堂模式开关状态 */ + lessonsMode: boolean; + /** + * 多种模式开关打开,根据互斥和优先级确认的最终模式 + * @deprecated 自app 5.60起废弃,由业务服务根据前两个模式计算 + */ + mode: ModeType; + /** app 审核review状态,用于appstore/market审核时服务端返回数据过虑 */ + review: boolean; + /** 客户端是否选择关闭个性化推荐 */ + disableRcmd: boolean; + basicMode: boolean; +} + +function createBaseRestriction(): Restriction { + return { teenagersMode: false, lessonsMode: false, mode: 0, review: false, disableRcmd: false, basicMode: false }; +} + +export const Restriction: MessageFns = { + encode(message: Restriction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.teenagersMode !== false) { + writer.uint32(8).bool(message.teenagersMode); + } + if (message.lessonsMode !== false) { + writer.uint32(16).bool(message.lessonsMode); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.review !== false) { + writer.uint32(32).bool(message.review); + } + if (message.disableRcmd !== false) { + writer.uint32(40).bool(message.disableRcmd); + } + if (message.basicMode !== false) { + writer.uint32(48).bool(message.basicMode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Restriction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRestriction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.teenagersMode = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.lessonsMode = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.review = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.disableRcmd = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.basicMode = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Restriction { + return { + teenagersMode: isSet(object.teenagersMode) ? globalThis.Boolean(object.teenagersMode) : false, + lessonsMode: isSet(object.lessonsMode) ? globalThis.Boolean(object.lessonsMode) : false, + mode: isSet(object.mode) ? modeTypeFromJSON(object.mode) : 0, + review: isSet(object.review) ? globalThis.Boolean(object.review) : false, + disableRcmd: isSet(object.disableRcmd) ? globalThis.Boolean(object.disableRcmd) : false, + basicMode: isSet(object.basicMode) ? globalThis.Boolean(object.basicMode) : false, + }; + }, + + toJSON(message: Restriction): unknown { + const obj: any = {}; + if (message.teenagersMode !== false) { + obj.teenagersMode = message.teenagersMode; + } + if (message.lessonsMode !== false) { + obj.lessonsMode = message.lessonsMode; + } + if (message.mode !== 0) { + obj.mode = modeTypeToJSON(message.mode); + } + if (message.review !== false) { + obj.review = message.review; + } + if (message.disableRcmd !== false) { + obj.disableRcmd = message.disableRcmd; + } + if (message.basicMode !== false) { + obj.basicMode = message.basicMode; + } + return obj; + }, + + create, I>>(base?: I): Restriction { + return Restriction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Restriction { + const message = createBaseRestriction(); + message.teenagersMode = object.teenagersMode ?? false; + message.lessonsMode = object.lessonsMode ?? false; + message.mode = object.mode ?? 0; + message.review = object.review ?? false; + message.disableRcmd = object.disableRcmd ?? false; + message.basicMode = object.basicMode ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.proto b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.proto new file mode 100644 index 0000000..ab717c0 --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package bilibili.pgc.gateway.player.v2; + +/** 事件 */ +message Event { + /** 震动 */ + Shake shake = 1; +} + +/** 震动 */ +message Shake { + /** 文件地址 */ + string file = 1; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.ts b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.ts new file mode 100644 index 0000000..0fd0318 --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.ts @@ -0,0 +1,161 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/pgc/gateway/player/v2/Event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.pgc.gateway.player.v2"; + +/** 事件 */ +export interface Event { + /** 震动 */ + shake: Shake | undefined; +} + +/** 震动 */ +export interface Shake { + /** 文件地址 */ + file: string; +} + +function createBaseEvent(): Event { + return { shake: undefined }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.shake !== undefined) { + Shake.encode(message.shake, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shake = Shake.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { shake: isSet(object.shake) ? Shake.fromJSON(object.shake) : undefined }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.shake !== undefined) { + obj.shake = Shake.toJSON(message.shake); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.shake = (object.shake !== undefined && object.shake !== null) ? Shake.fromPartial(object.shake) : undefined; + return message; + }, +}; + +function createBaseShake(): Shake { + return { file: "" }; +} + +export const Shake: MessageFns = { + encode(message: Shake, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.file !== "") { + writer.uint32(10).string(message.file); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Shake { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShake(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.file = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Shake { + return { file: isSet(object.file) ? globalThis.String(object.file) : "" }; + }, + + toJSON(message: Shake): unknown { + const obj: any = {}; + if (message.file !== "") { + obj.file = message.file; + } + return obj; + }, + + create, I>>(base?: I): Shake { + return Shake.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Shake { + const message = createBaseShake(); + message.file = object.file ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.proto b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.proto new file mode 100644 index 0000000..12e6e1c --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; + +package bilibili.pgc.gateway.player.v2; + +/** 云控扩展配置信息 */ +message PlayAbilityExtConf { + + bool allow_close_subtitle = 1; + + FreyaConfig freya_config = 2; + + CastTips cast_tips = 3; +} + +/** 放映室提示语 */ +message FreyaConfig { + + string desc = 1; + + int32 type = 2; + + int32 issued_cnt = 3; + + bool is_always_show = 4; + + int32 screen_number = 5; + + int32 full_screen_number = 6; +} + + +/** 投屏限制 */ +message CastTips { + /** 0 时为无限制, 否则表示不不允许投屏并提示message */ + int32 code = 1; + /** 提示 */ + string message = 2; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.ts b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.ts new file mode 100644 index 0000000..b16f57f --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.ts @@ -0,0 +1,361 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayAbilityExtConf.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.pgc.gateway.player.v2"; + +/** 云控扩展配置信息 */ +export interface PlayAbilityExtConf { + allowCloseSubtitle: boolean; + freyaConfig: FreyaConfig | undefined; + castTips: CastTips | undefined; +} + +/** 放映室提示语 */ +export interface FreyaConfig { + desc: string; + type: number; + issuedCnt: number; + isAlwaysShow: boolean; + screenNumber: number; + fullScreenNumber: number; +} + +/** 投屏限制 */ +export interface CastTips { + /** 0 时为无限制, 否则表示不不允许投屏并提示message */ + code: number; + /** 提示 */ + message: string; +} + +function createBasePlayAbilityExtConf(): PlayAbilityExtConf { + return { allowCloseSubtitle: false, freyaConfig: undefined, castTips: undefined }; +} + +export const PlayAbilityExtConf: MessageFns = { + encode(message: PlayAbilityExtConf, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowCloseSubtitle !== false) { + writer.uint32(8).bool(message.allowCloseSubtitle); + } + if (message.freyaConfig !== undefined) { + FreyaConfig.encode(message.freyaConfig, writer.uint32(18).fork()).join(); + } + if (message.castTips !== undefined) { + CastTips.encode(message.castTips, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayAbilityExtConf { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayAbilityExtConf(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.allowCloseSubtitle = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.freyaConfig = FreyaConfig.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.castTips = CastTips.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayAbilityExtConf { + return { + allowCloseSubtitle: isSet(object.allowCloseSubtitle) ? globalThis.Boolean(object.allowCloseSubtitle) : false, + freyaConfig: isSet(object.freyaConfig) ? FreyaConfig.fromJSON(object.freyaConfig) : undefined, + castTips: isSet(object.castTips) ? CastTips.fromJSON(object.castTips) : undefined, + }; + }, + + toJSON(message: PlayAbilityExtConf): unknown { + const obj: any = {}; + if (message.allowCloseSubtitle !== false) { + obj.allowCloseSubtitle = message.allowCloseSubtitle; + } + if (message.freyaConfig !== undefined) { + obj.freyaConfig = FreyaConfig.toJSON(message.freyaConfig); + } + if (message.castTips !== undefined) { + obj.castTips = CastTips.toJSON(message.castTips); + } + return obj; + }, + + create, I>>(base?: I): PlayAbilityExtConf { + return PlayAbilityExtConf.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayAbilityExtConf { + const message = createBasePlayAbilityExtConf(); + message.allowCloseSubtitle = object.allowCloseSubtitle ?? false; + message.freyaConfig = (object.freyaConfig !== undefined && object.freyaConfig !== null) + ? FreyaConfig.fromPartial(object.freyaConfig) + : undefined; + message.castTips = (object.castTips !== undefined && object.castTips !== null) + ? CastTips.fromPartial(object.castTips) + : undefined; + return message; + }, +}; + +function createBaseFreyaConfig(): FreyaConfig { + return { desc: "", type: 0, issuedCnt: 0, isAlwaysShow: false, screenNumber: 0, fullScreenNumber: 0 }; +} + +export const FreyaConfig: MessageFns = { + encode(message: FreyaConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.desc !== "") { + writer.uint32(10).string(message.desc); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + if (message.issuedCnt !== 0) { + writer.uint32(24).int32(message.issuedCnt); + } + if (message.isAlwaysShow !== false) { + writer.uint32(32).bool(message.isAlwaysShow); + } + if (message.screenNumber !== 0) { + writer.uint32(40).int32(message.screenNumber); + } + if (message.fullScreenNumber !== 0) { + writer.uint32(48).int32(message.fullScreenNumber); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FreyaConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFreyaConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.desc = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.issuedCnt = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isAlwaysShow = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.screenNumber = reader.int32(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.fullScreenNumber = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FreyaConfig { + return { + desc: isSet(object.desc) ? globalThis.String(object.desc) : "", + type: isSet(object.type) ? globalThis.Number(object.type) : 0, + issuedCnt: isSet(object.issuedCnt) ? globalThis.Number(object.issuedCnt) : 0, + isAlwaysShow: isSet(object.isAlwaysShow) ? globalThis.Boolean(object.isAlwaysShow) : false, + screenNumber: isSet(object.screenNumber) ? globalThis.Number(object.screenNumber) : 0, + fullScreenNumber: isSet(object.fullScreenNumber) ? globalThis.Number(object.fullScreenNumber) : 0, + }; + }, + + toJSON(message: FreyaConfig): unknown { + const obj: any = {}; + if (message.desc !== "") { + obj.desc = message.desc; + } + if (message.type !== 0) { + obj.type = Math.round(message.type); + } + if (message.issuedCnt !== 0) { + obj.issuedCnt = Math.round(message.issuedCnt); + } + if (message.isAlwaysShow !== false) { + obj.isAlwaysShow = message.isAlwaysShow; + } + if (message.screenNumber !== 0) { + obj.screenNumber = Math.round(message.screenNumber); + } + if (message.fullScreenNumber !== 0) { + obj.fullScreenNumber = Math.round(message.fullScreenNumber); + } + return obj; + }, + + create, I>>(base?: I): FreyaConfig { + return FreyaConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FreyaConfig { + const message = createBaseFreyaConfig(); + message.desc = object.desc ?? ""; + message.type = object.type ?? 0; + message.issuedCnt = object.issuedCnt ?? 0; + message.isAlwaysShow = object.isAlwaysShow ?? false; + message.screenNumber = object.screenNumber ?? 0; + message.fullScreenNumber = object.fullScreenNumber ?? 0; + return message; + }, +}; + +function createBaseCastTips(): CastTips { + return { code: 0, message: "" }; +} + +export const CastTips: MessageFns = { + encode(message: CastTips, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).int32(message.code); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CastTips { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCastTips(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CastTips { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CastTips): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): CastTips { + return CastTips.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CastTips { + const message = createBaseCastTips(); + message.code = object.code ?? 0; + message.message = object.message ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.proto b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.proto new file mode 100644 index 0000000..14a7143 --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.proto @@ -0,0 +1,70 @@ +syntax = "proto3"; + +package bilibili.pgc.gateway.player.v2; + +/** 播放扩展信息 */ +message PlayExtInfo { + /** 播放配音信息 */ + PlayDubbingInfo play_dubbing_info = 1; +} + +/** 播放配音信息 */ +message PlayDubbingInfo { + /** 背景音频 */ + AudioMaterialProto background_audio = 1; + /** 角色音频列表 */ + repeated RoleAudioProto role_audio_list = 2; + /** 引导文本 */ + string guide_text = 3; +} + +message AudioMaterialProto { + + string audio_id = 1; + + string title = 2; + + string edition = 3; + + uint64 person_id = 4; + + string person_name = 5; + + string person_avatar = 6; + + repeated DashItem audio = 7; +} + +/** dash条目 */ +message DashItem { + /** 清晰度 */ + uint32 id = 1; + /** 主线流 */ + string base_url = 2; + /** 备用流 */ + repeated string backup_url = 3; + /** 带宽 */ + uint32 bandwidth = 4; + /** 编码id */ + uint32 codecid = 5; + /** md5 */ + string md5 = 6; + /** 视频大小 */ + uint64 size = 7; + /** 帧率 */ + string frame_rate = 8; + /** DRM widevine 密钥 */ + string widevine_pssh = 9; +} + +/** 角色配音信息 */ +message RoleAudioProto { + /** 角色ID */ + int64 role_id = 1; + /** 角色名称 */ + string role_name = 2; + /** 角色头像 */ + string role_avatar = 3; + /** 音频素材列表 */ + repeated AudioMaterialProto audio_material_list = 4; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.ts b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.ts new file mode 100644 index 0000000..991c4e3 --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.ts @@ -0,0 +1,706 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayExtInfo.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.pgc.gateway.player.v2"; + +/** 播放扩展信息 */ +export interface PlayExtInfo { + /** 播放配音信息 */ + playDubbingInfo: PlayDubbingInfo | undefined; +} + +/** 播放配音信息 */ +export interface PlayDubbingInfo { + /** 背景音频 */ + backgroundAudio: + | AudioMaterialProto + | undefined; + /** 角色音频列表 */ + roleAudioList: RoleAudioProto[]; + /** 引导文本 */ + guideText: string; +} + +export interface AudioMaterialProto { + audioId: string; + title: string; + edition: string; + personId: bigint; + personName: string; + personAvatar: string; + audio: DashItem[]; +} + +/** dash条目 */ +export interface DashItem { + /** 清晰度 */ + id: number; + /** 主线流 */ + baseUrl: string; + /** 备用流 */ + backupUrl: string[]; + /** 带宽 */ + bandwidth: number; + /** 编码id */ + codecid: number; + /** md5 */ + md5: string; + /** 视频大小 */ + size: bigint; + /** 帧率 */ + frameRate: string; + /** DRM widevine 密钥 */ + widevinePssh: string; +} + +/** 角色配音信息 */ +export interface RoleAudioProto { + /** 角色ID */ + roleId: bigint; + /** 角色名称 */ + roleName: string; + /** 角色头像 */ + roleAvatar: string; + /** 音频素材列表 */ + audioMaterialList: AudioMaterialProto[]; +} + +function createBasePlayExtInfo(): PlayExtInfo { + return { playDubbingInfo: undefined }; +} + +export const PlayExtInfo: MessageFns = { + encode(message: PlayExtInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.playDubbingInfo !== undefined) { + PlayDubbingInfo.encode(message.playDubbingInfo, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayExtInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayExtInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.playDubbingInfo = PlayDubbingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayExtInfo { + return { + playDubbingInfo: isSet(object.playDubbingInfo) ? PlayDubbingInfo.fromJSON(object.playDubbingInfo) : undefined, + }; + }, + + toJSON(message: PlayExtInfo): unknown { + const obj: any = {}; + if (message.playDubbingInfo !== undefined) { + obj.playDubbingInfo = PlayDubbingInfo.toJSON(message.playDubbingInfo); + } + return obj; + }, + + create, I>>(base?: I): PlayExtInfo { + return PlayExtInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayExtInfo { + const message = createBasePlayExtInfo(); + message.playDubbingInfo = (object.playDubbingInfo !== undefined && object.playDubbingInfo !== null) + ? PlayDubbingInfo.fromPartial(object.playDubbingInfo) + : undefined; + return message; + }, +}; + +function createBasePlayDubbingInfo(): PlayDubbingInfo { + return { backgroundAudio: undefined, roleAudioList: [], guideText: "" }; +} + +export const PlayDubbingInfo: MessageFns = { + encode(message: PlayDubbingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.backgroundAudio !== undefined) { + AudioMaterialProto.encode(message.backgroundAudio, writer.uint32(10).fork()).join(); + } + for (const v of message.roleAudioList) { + RoleAudioProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.guideText !== "") { + writer.uint32(26).string(message.guideText); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayDubbingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayDubbingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.backgroundAudio = AudioMaterialProto.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.roleAudioList.push(RoleAudioProto.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.guideText = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayDubbingInfo { + return { + backgroundAudio: isSet(object.backgroundAudio) ? AudioMaterialProto.fromJSON(object.backgroundAudio) : undefined, + roleAudioList: globalThis.Array.isArray(object?.roleAudioList) + ? object.roleAudioList.map((e: any) => RoleAudioProto.fromJSON(e)) + : [], + guideText: isSet(object.guideText) ? globalThis.String(object.guideText) : "", + }; + }, + + toJSON(message: PlayDubbingInfo): unknown { + const obj: any = {}; + if (message.backgroundAudio !== undefined) { + obj.backgroundAudio = AudioMaterialProto.toJSON(message.backgroundAudio); + } + if (message.roleAudioList?.length) { + obj.roleAudioList = message.roleAudioList.map((e) => RoleAudioProto.toJSON(e)); + } + if (message.guideText !== "") { + obj.guideText = message.guideText; + } + return obj; + }, + + create, I>>(base?: I): PlayDubbingInfo { + return PlayDubbingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayDubbingInfo { + const message = createBasePlayDubbingInfo(); + message.backgroundAudio = (object.backgroundAudio !== undefined && object.backgroundAudio !== null) + ? AudioMaterialProto.fromPartial(object.backgroundAudio) + : undefined; + message.roleAudioList = object.roleAudioList?.map((e) => RoleAudioProto.fromPartial(e)) || []; + message.guideText = object.guideText ?? ""; + return message; + }, +}; + +function createBaseAudioMaterialProto(): AudioMaterialProto { + return { audioId: "", title: "", edition: "", personId: 0n, personName: "", personAvatar: "", audio: [] }; +} + +export const AudioMaterialProto: MessageFns = { + encode(message: AudioMaterialProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.audioId !== "") { + writer.uint32(10).string(message.audioId); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.edition !== "") { + writer.uint32(26).string(message.edition); + } + if (message.personId !== 0n) { + if (BigInt.asUintN(64, message.personId) !== message.personId) { + throw new globalThis.Error("value provided for field message.personId of type uint64 too large"); + } + writer.uint32(32).uint64(message.personId); + } + if (message.personName !== "") { + writer.uint32(42).string(message.personName); + } + if (message.personAvatar !== "") { + writer.uint32(50).string(message.personAvatar); + } + for (const v of message.audio) { + DashItem.encode(v!, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AudioMaterialProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAudioMaterialProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.audioId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.edition = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.personId = reader.uint64() as bigint; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.personName = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.personAvatar = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.audio.push(DashItem.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AudioMaterialProto { + return { + audioId: isSet(object.audioId) ? globalThis.String(object.audioId) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + edition: isSet(object.edition) ? globalThis.String(object.edition) : "", + personId: isSet(object.personId) ? BigInt(object.personId) : 0n, + personName: isSet(object.personName) ? globalThis.String(object.personName) : "", + personAvatar: isSet(object.personAvatar) ? globalThis.String(object.personAvatar) : "", + audio: globalThis.Array.isArray(object?.audio) ? object.audio.map((e: any) => DashItem.fromJSON(e)) : [], + }; + }, + + toJSON(message: AudioMaterialProto): unknown { + const obj: any = {}; + if (message.audioId !== "") { + obj.audioId = message.audioId; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.edition !== "") { + obj.edition = message.edition; + } + if (message.personId !== 0n) { + obj.personId = message.personId.toString(); + } + if (message.personName !== "") { + obj.personName = message.personName; + } + if (message.personAvatar !== "") { + obj.personAvatar = message.personAvatar; + } + if (message.audio?.length) { + obj.audio = message.audio.map((e) => DashItem.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AudioMaterialProto { + return AudioMaterialProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AudioMaterialProto { + const message = createBaseAudioMaterialProto(); + message.audioId = object.audioId ?? ""; + message.title = object.title ?? ""; + message.edition = object.edition ?? ""; + message.personId = object.personId ?? 0n; + message.personName = object.personName ?? ""; + message.personAvatar = object.personAvatar ?? ""; + message.audio = object.audio?.map((e) => DashItem.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDashItem(): DashItem { + return { + id: 0, + baseUrl: "", + backupUrl: [], + bandwidth: 0, + codecid: 0, + md5: "", + size: 0n, + frameRate: "", + widevinePssh: "", + }; +} + +export const DashItem: MessageFns = { + encode(message: DashItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + if (message.baseUrl !== "") { + writer.uint32(18).string(message.baseUrl); + } + for (const v of message.backupUrl) { + writer.uint32(26).string(v!); + } + if (message.bandwidth !== 0) { + writer.uint32(32).uint32(message.bandwidth); + } + if (message.codecid !== 0) { + writer.uint32(40).uint32(message.codecid); + } + if (message.md5 !== "") { + writer.uint32(50).string(message.md5); + } + if (message.size !== 0n) { + if (BigInt.asUintN(64, message.size) !== message.size) { + throw new globalThis.Error("value provided for field message.size of type uint64 too large"); + } + writer.uint32(56).uint64(message.size); + } + if (message.frameRate !== "") { + writer.uint32(66).string(message.frameRate); + } + if (message.widevinePssh !== "") { + writer.uint32(74).string(message.widevinePssh); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DashItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDashItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.id = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.baseUrl = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.backupUrl.push(reader.string()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.bandwidth = reader.uint32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.codecid = reader.uint32(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.md5 = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.size = reader.uint64() as bigint; + continue; + case 8: + if (tag !== 66) { + break; + } + + message.frameRate = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.widevinePssh = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DashItem { + return { + id: isSet(object.id) ? globalThis.Number(object.id) : 0, + baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : "", + backupUrl: globalThis.Array.isArray(object?.backupUrl) + ? object.backupUrl.map((e: any) => globalThis.String(e)) + : [], + bandwidth: isSet(object.bandwidth) ? globalThis.Number(object.bandwidth) : 0, + codecid: isSet(object.codecid) ? globalThis.Number(object.codecid) : 0, + md5: isSet(object.md5) ? globalThis.String(object.md5) : "", + size: isSet(object.size) ? BigInt(object.size) : 0n, + frameRate: isSet(object.frameRate) ? globalThis.String(object.frameRate) : "", + widevinePssh: isSet(object.widevinePssh) ? globalThis.String(object.widevinePssh) : "", + }; + }, + + toJSON(message: DashItem): unknown { + const obj: any = {}; + if (message.id !== 0) { + obj.id = Math.round(message.id); + } + if (message.baseUrl !== "") { + obj.baseUrl = message.baseUrl; + } + if (message.backupUrl?.length) { + obj.backupUrl = message.backupUrl; + } + if (message.bandwidth !== 0) { + obj.bandwidth = Math.round(message.bandwidth); + } + if (message.codecid !== 0) { + obj.codecid = Math.round(message.codecid); + } + if (message.md5 !== "") { + obj.md5 = message.md5; + } + if (message.size !== 0n) { + obj.size = message.size.toString(); + } + if (message.frameRate !== "") { + obj.frameRate = message.frameRate; + } + if (message.widevinePssh !== "") { + obj.widevinePssh = message.widevinePssh; + } + return obj; + }, + + create, I>>(base?: I): DashItem { + return DashItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DashItem { + const message = createBaseDashItem(); + message.id = object.id ?? 0; + message.baseUrl = object.baseUrl ?? ""; + message.backupUrl = object.backupUrl?.map((e) => e) || []; + message.bandwidth = object.bandwidth ?? 0; + message.codecid = object.codecid ?? 0; + message.md5 = object.md5 ?? ""; + message.size = object.size ?? 0n; + message.frameRate = object.frameRate ?? ""; + message.widevinePssh = object.widevinePssh ?? ""; + return message; + }, +}; + +function createBaseRoleAudioProto(): RoleAudioProto { + return { roleId: 0n, roleName: "", roleAvatar: "", audioMaterialList: [] }; +} + +export const RoleAudioProto: MessageFns = { + encode(message: RoleAudioProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.roleId !== 0n) { + if (BigInt.asIntN(64, message.roleId) !== message.roleId) { + throw new globalThis.Error("value provided for field message.roleId of type int64 too large"); + } + writer.uint32(8).int64(message.roleId); + } + if (message.roleName !== "") { + writer.uint32(18).string(message.roleName); + } + if (message.roleAvatar !== "") { + writer.uint32(26).string(message.roleAvatar); + } + for (const v of message.audioMaterialList) { + AudioMaterialProto.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RoleAudioProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRoleAudioProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.roleId = reader.int64() as bigint; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.roleName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.roleAvatar = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.audioMaterialList.push(AudioMaterialProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RoleAudioProto { + return { + roleId: isSet(object.roleId) ? BigInt(object.roleId) : 0n, + roleName: isSet(object.roleName) ? globalThis.String(object.roleName) : "", + roleAvatar: isSet(object.roleAvatar) ? globalThis.String(object.roleAvatar) : "", + audioMaterialList: globalThis.Array.isArray(object?.audioMaterialList) + ? object.audioMaterialList.map((e: any) => AudioMaterialProto.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RoleAudioProto): unknown { + const obj: any = {}; + if (message.roleId !== 0n) { + obj.roleId = message.roleId.toString(); + } + if (message.roleName !== "") { + obj.roleName = message.roleName; + } + if (message.roleAvatar !== "") { + obj.roleAvatar = message.roleAvatar; + } + if (message.audioMaterialList?.length) { + obj.audioMaterialList = message.audioMaterialList.map((e) => AudioMaterialProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RoleAudioProto { + return RoleAudioProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RoleAudioProto { + const message = createBaseRoleAudioProto(); + message.roleId = object.roleId ?? 0n; + message.roleName = object.roleName ?? ""; + message.roleAvatar = object.roleAvatar ?? ""; + message.audioMaterialList = object.audioMaterialList?.map((e) => AudioMaterialProto.fromPartial(e)) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto new file mode 100644 index 0000000..84a7549 --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto @@ -0,0 +1,370 @@ +syntax = "proto3"; + +package bilibili.pgc.gateway.player.v2; + +/** 其他业务信息 */ +message PlayViewBusinessInfo { + /** 当前视频是否是预览 */ + bool is_preview = 1; + /** 用户是否承包过 */ + bool bp = 2; + /** drm使用 */ + string marlin_token = 3; + /** 倍速动效色值 */ + string playback_speed_color = 4; + + ContinuePlayInfo continue_play_info = 5; + /** 跳过片头/片尾配置 */ + repeated ClipInfo clip_info = 6; + + InlineType inline_type = 7; + + int32 ep_whole_duration = 8; + /** 当前分辨率信息 */ + Dimension dimension = 9; + + map quality_ext_map = 10; + + map exp_map = 11; + /** DRM技术类型 */ + DrmTechType drm_tech_type = 12; + + int32 limit_action_type = 13; + + bool is_drm = 14; + + RecordInfo record_info = 15; + + int32 vip_status = 16; + + bool is_live_pre = 17; + + EpisodeInfo episode_info = 18; + + EpisodeAdvertisementInfo episode_advertisement_info = 19; + + UserStatus user_status = 20; +} + +message ContinuePlayInfo { + + int64 continue_play_ep_id = 1; +} + +/** 跳过片头/片尾配置 */ +message ClipInfo { + + int64 material_no = 1; + /** DASH分段始 */ + int32 start = 2; + /** DASH分段终 */ + int32 end = 3; + /** Clip类型 */ + ClipType clip_type = 4; + /** 跳过片头/片尾时的提示语 */ + string toast_text = 5; + + MultiView multi_view = 6; +} + +/** 跳过片头/片尾配置: Clip类型 */ +enum ClipType { + + NT_UNKNOWN = 0; + /** 跳过OP */ + CLIP_TYPE_OP = 1; + /** 跳过ED */ + CLIP_TYPE_ED = 2; + + CLIP_TYPE_HE = 3; + + CLIP_TYPE_MULTI_VIEW = 4; + + CLIP_TYPE_AD = 5; +} + +message MultiView { + + string button_material = 1; + + int64 ep_id = 2; + + int64 cid = 3; + + int64 avid = 4; +} + +enum InlineType { + + TYPE_UNKNOWN = 0; + + TYPE_WHOLE = 1; + + TYPE_HE_CLIP = 2; + + TYPE_PREVIEW = 3; +} + +/** 当前分辨率信息 */ +message Dimension { + /** 宽 */ + int32 width = 1; + /** 长 */ + int32 height = 2; + /** 旋转角度 */ + int32 rotate = 3; +} + +/** 云控拓展视频画质信息 */ +message QualityExtInfo { + /** 是否支持试看 */ + bool trial_support = 1; +} + +/** DRM技术类型 */ +enum DrmTechType { + NON = 0; + + FAIR_PLAY = 1; + + WIDE_VINE = 2; + + BILI_DRM = 3; +} + +/** 备案信息 */ +message RecordInfo { + /** 记录 */ + string record = 1; + /** 记录图标 */ + string record_icon = 2; +} + +/** EP信息 */ +message EpisodeInfo { + + int32 ep_id = 1; + + int64 cid = 2; + + int64 aid = 3; + + int64 ep_status = 4; + + SeasonInfo season_info = 5; + + string cover = 6; + + string title = 7; + + Interaction interaction = 8; + + string long_title = 9; +} + +/** PGC SEASON 信息 */ +message SeasonInfo { + /** PGC SEASON ID */ + int32 season_id = 1; + /** PGC SEASON 类型 */ + int32 season_type = 2; + /** PGC SEASON 状态 */ + int32 season_status = 3; + /** 封面 */ + string cover = 4; + /** 标题 */ + string title = 5; + /** 权限信息 */ + Rights rights = 6; + /** 模式 */ + int32 mode = 7; +} + +/** 权限信息 */ +message Rights { + /** 是否可以观看 */ + int32 can_watch = 1; +} + +/** 交互信息 */ +message Interaction { + /** 历史节点 */ + HistoryNode history_node = 1; + /** 版本 */ + int64 graph_version = 2; + /** 交互消息 */ + string msg = 3; + /** 是否为交互 */ + bool is_interaction = 4; +} + +/** 历史记录节点 */ +message HistoryNode { + /** 节点ID */ + int64 node_id = 1; + /** 节点标题 */ + string title = 2; + /** 对应CID */ + int64 cid = 3; +} + +/** 剧集广告信息 */ +message EpisodeAdvertisementInfo { + + int64 aid = 1; + + string title = 2; + + string link = 3; + + int32 follow_video_bnt_flag = 4; + + string next_video_title = 5; + + string next_video_link = 6; + + int64 cid = 7; + + int32 season_id = 8; + + int32 follow = 9; +} + +/** 用户状态信息 */ +message UserStatus { + /** 是否支付 */ + bool pay_check = 1; + /** 是否承包 */ + bool sponsor = 2; + /** 观看进度 */ + WatchProgress watch_progress = 3; + /** 系列观看进度 */ + WatchProgress aid_watch_progress = 4; +} + +/** 观看进度信息 */ +message WatchProgress { + /** 上次观看的 EP ID */ + int32 last_ep_id = 1; + /** 上次观看到的EP INDEX */ + string last_ep_index = 2; + /** 上次观看的进度 */ + int64 progress = 3; + /** 上次观看的 CID */ + int64 last_play_cid = 4; + /** 带时间的提示信息 */ + Toast toast = 5; + /** 不带时间的提示信息 */ + Toast toast_without_time = 6; + /** 上次观看的 AID */ + int64 last_play_aid = 7; +} + +message Toast { + /** toast文案 老字段 */ + string text = 1; + /** toast按钮 */ + ButtonInfo button = 2; + /** 显示样式类型 */ + int32 show_style_type = 3; + /** 图标 */ + string icon = 4; + /** toast文案 新字段 */ + TextInfo toast_text = 5; + /** 埋点上报信息 */ + Report report = 6; + + map order_report_params = 7; +} + +/** 按钮信息 */ +message ButtonInfo { + /** 按钮文案 */ + string text = 1; + /** 按钮字体色值 */ + string text_color = 2; + /** 按钮字体色值-夜间模式 */ + string text_color_night = 3; + /** 按钮背景色 */ + string bg_color = 4; + /** 按钮背景色-夜间模式 */ + string bg_color_night = 5; + /** 按钮链接 */ + string link = 6; + /** 按钮动作类型 */ + string action_type = 7; + /** 角标信息 */ + BadgeInfo badge_info = 8; + /** 埋点上报信息 */ + Report report = 9; + /** 左侧删除线样式文案 */ + string left_strikethrough_text = 10; + /** 缩略按钮文案信息 */ + TextInfo simple_text_info = 11; + /** 缩略按钮背景色值 */ + string simple_bg_color = 12; + /** 缩略按钮字体色值-夜间模式 */ + string simple_bg_color_night = 13; + + GradientColor bg_gradient_color = 14; + + map order_report_params = 15; + + TaskParam task_param = 16; + + string pc_link = 17; +} + +/** 角标信息 */ +message BadgeInfo { + /** 角标文案 */ + string text = 1; + /** 角标色值 */ + string bg_color = 2; + /** 角标色值-夜间模式 */ + string bg_color_night = 3; + /** 文案色值 */ + string text_color = 4; + /** ? 新版本客户端已弃用此项 */ + GradientColor bg_gradient_color = 5; + + string img = 6; +} + +/** 渐变色信息 */ +message GradientColor { + + string start_color = 1; + + string end_color = 2; +} + +/** 埋点上报信息 */ +message Report { + /** 曝光事件 */ + string show_event_id = 1; + /** 点击事件 */ + string click_event_id = 2; + /** 埋点透传参数 */ + string extends = 3; +} + +/** 文案信息 */ +message TextInfo { + /** 文案 */ + string text = 1; + /** 字体色值 */ + string text_color = 2; + /** 字体色值-夜间模式 */ + string text_color_night = 3; +} + +/** 任务参数信息 */ +message TaskParam { + /** 任务类型 */ + string task_type = 1; + /** 活动ID */ + int64 activity_id = 2; + /** 提示ID */ + int64 tips_id = 3; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.ts b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.ts new file mode 100644 index 0000000..526234b --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.ts @@ -0,0 +1,3880 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.pgc.gateway.player.v2"; + +/** 跳过片头/片尾配置: Clip类型 */ +export enum ClipType { + NT_UNKNOWN = 0, + /** CLIP_TYPE_OP - 跳过OP */ + CLIP_TYPE_OP = 1, + /** CLIP_TYPE_ED - 跳过ED */ + CLIP_TYPE_ED = 2, + CLIP_TYPE_HE = 3, + CLIP_TYPE_MULTI_VIEW = 4, + CLIP_TYPE_AD = 5, + UNRECOGNIZED = -1, +} + +export function clipTypeFromJSON(object: any): ClipType { + switch (object) { + case 0: + case "NT_UNKNOWN": + return ClipType.NT_UNKNOWN; + case 1: + case "CLIP_TYPE_OP": + return ClipType.CLIP_TYPE_OP; + case 2: + case "CLIP_TYPE_ED": + return ClipType.CLIP_TYPE_ED; + case 3: + case "CLIP_TYPE_HE": + return ClipType.CLIP_TYPE_HE; + case 4: + case "CLIP_TYPE_MULTI_VIEW": + return ClipType.CLIP_TYPE_MULTI_VIEW; + case 5: + case "CLIP_TYPE_AD": + return ClipType.CLIP_TYPE_AD; + case -1: + case "UNRECOGNIZED": + default: + return ClipType.UNRECOGNIZED; + } +} + +export function clipTypeToJSON(object: ClipType): string { + switch (object) { + case ClipType.NT_UNKNOWN: + return "NT_UNKNOWN"; + case ClipType.CLIP_TYPE_OP: + return "CLIP_TYPE_OP"; + case ClipType.CLIP_TYPE_ED: + return "CLIP_TYPE_ED"; + case ClipType.CLIP_TYPE_HE: + return "CLIP_TYPE_HE"; + case ClipType.CLIP_TYPE_MULTI_VIEW: + return "CLIP_TYPE_MULTI_VIEW"; + case ClipType.CLIP_TYPE_AD: + return "CLIP_TYPE_AD"; + case ClipType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum InlineType { + TYPE_UNKNOWN = 0, + TYPE_WHOLE = 1, + TYPE_HE_CLIP = 2, + TYPE_PREVIEW = 3, + UNRECOGNIZED = -1, +} + +export function inlineTypeFromJSON(object: any): InlineType { + switch (object) { + case 0: + case "TYPE_UNKNOWN": + return InlineType.TYPE_UNKNOWN; + case 1: + case "TYPE_WHOLE": + return InlineType.TYPE_WHOLE; + case 2: + case "TYPE_HE_CLIP": + return InlineType.TYPE_HE_CLIP; + case 3: + case "TYPE_PREVIEW": + return InlineType.TYPE_PREVIEW; + case -1: + case "UNRECOGNIZED": + default: + return InlineType.UNRECOGNIZED; + } +} + +export function inlineTypeToJSON(object: InlineType): string { + switch (object) { + case InlineType.TYPE_UNKNOWN: + return "TYPE_UNKNOWN"; + case InlineType.TYPE_WHOLE: + return "TYPE_WHOLE"; + case InlineType.TYPE_HE_CLIP: + return "TYPE_HE_CLIP"; + case InlineType.TYPE_PREVIEW: + return "TYPE_PREVIEW"; + case InlineType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** DRM技术类型 */ +export enum DrmTechType { + NON = 0, + FAIR_PLAY = 1, + WIDE_VINE = 2, + BILI_DRM = 3, + UNRECOGNIZED = -1, +} + +export function drmTechTypeFromJSON(object: any): DrmTechType { + switch (object) { + case 0: + case "NON": + return DrmTechType.NON; + case 1: + case "FAIR_PLAY": + return DrmTechType.FAIR_PLAY; + case 2: + case "WIDE_VINE": + return DrmTechType.WIDE_VINE; + case 3: + case "BILI_DRM": + return DrmTechType.BILI_DRM; + case -1: + case "UNRECOGNIZED": + default: + return DrmTechType.UNRECOGNIZED; + } +} + +export function drmTechTypeToJSON(object: DrmTechType): string { + switch (object) { + case DrmTechType.NON: + return "NON"; + case DrmTechType.FAIR_PLAY: + return "FAIR_PLAY"; + case DrmTechType.WIDE_VINE: + return "WIDE_VINE"; + case DrmTechType.BILI_DRM: + return "BILI_DRM"; + case DrmTechType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** 其他业务信息 */ +export interface PlayViewBusinessInfo { + /** 当前视频是否是预览 */ + isPreview: boolean; + /** 用户是否承包过 */ + bp: boolean; + /** drm使用 */ + marlinToken: string; + /** 倍速动效色值 */ + playbackSpeedColor: string; + continuePlayInfo: + | ContinuePlayInfo + | undefined; + /** 跳过片头/片尾配置 */ + clipInfo: ClipInfo[]; + inlineType: InlineType; + epWholeDuration: number; + /** 当前分辨率信息 */ + dimension: Dimension | undefined; + qualityExtMap: { [key: number]: QualityExtInfo }; + expMap: { [key: string]: number }; + /** DRM技术类型 */ + drmTechType: DrmTechType; + limitActionType: number; + isDrm: boolean; + recordInfo: RecordInfo | undefined; + vipStatus: number; + isLivePre: boolean; + episodeInfo: EpisodeInfo | undefined; + episodeAdvertisementInfo: EpisodeAdvertisementInfo | undefined; + userStatus: UserStatus | undefined; +} + +export interface PlayViewBusinessInfo_QualityExtMapEntry { + key: number; + value: QualityExtInfo | undefined; +} + +export interface PlayViewBusinessInfo_ExpMapEntry { + key: string; + value: number; +} + +export interface ContinuePlayInfo { + continuePlayEpId: bigint; +} + +/** 跳过片头/片尾配置 */ +export interface ClipInfo { + materialNo: bigint; + /** DASH分段始 */ + start: number; + /** DASH分段终 */ + end: number; + /** Clip类型 */ + clipType: ClipType; + /** 跳过片头/片尾时的提示语 */ + toastText: string; + multiView: MultiView | undefined; +} + +export interface MultiView { + buttonMaterial: string; + epId: bigint; + cid: bigint; + avid: bigint; +} + +/** 当前分辨率信息 */ +export interface Dimension { + /** 宽 */ + width: number; + /** 长 */ + height: number; + /** 旋转角度 */ + rotate: number; +} + +/** 云控拓展视频画质信息 */ +export interface QualityExtInfo { + /** 是否支持试看 */ + trialSupport: boolean; +} + +/** 备案信息 */ +export interface RecordInfo { + /** 记录 */ + record: string; + /** 记录图标 */ + recordIcon: string; +} + +/** EP信息 */ +export interface EpisodeInfo { + epId: number; + cid: bigint; + aid: bigint; + epStatus: bigint; + seasonInfo: SeasonInfo | undefined; + cover: string; + title: string; + interaction: Interaction | undefined; + longTitle: string; +} + +/** PGC SEASON 信息 */ +export interface SeasonInfo { + /** PGC SEASON ID */ + seasonId: number; + /** PGC SEASON 类型 */ + seasonType: number; + /** PGC SEASON 状态 */ + seasonStatus: number; + /** 封面 */ + cover: string; + /** 标题 */ + title: string; + /** 权限信息 */ + rights: + | Rights + | undefined; + /** 模式 */ + mode: number; +} + +/** 权限信息 */ +export interface Rights { + /** 是否可以观看 */ + canWatch: number; +} + +/** 交互信息 */ +export interface Interaction { + /** 历史节点 */ + historyNode: + | HistoryNode + | undefined; + /** 版本 */ + graphVersion: bigint; + /** 交互消息 */ + msg: string; + /** 是否为交互 */ + isInteraction: boolean; +} + +/** 历史记录节点 */ +export interface HistoryNode { + /** 节点ID */ + nodeId: bigint; + /** 节点标题 */ + title: string; + /** 对应CID */ + cid: bigint; +} + +/** 剧集广告信息 */ +export interface EpisodeAdvertisementInfo { + aid: bigint; + title: string; + link: string; + followVideoBntFlag: number; + nextVideoTitle: string; + nextVideoLink: string; + cid: bigint; + seasonId: number; + follow: number; +} + +/** 用户状态信息 */ +export interface UserStatus { + /** 是否支付 */ + payCheck: boolean; + /** 是否承包 */ + sponsor: boolean; + /** 观看进度 */ + watchProgress: + | WatchProgress + | undefined; + /** 系列观看进度 */ + aidWatchProgress: WatchProgress | undefined; +} + +/** 观看进度信息 */ +export interface WatchProgress { + /** 上次观看的 EP ID */ + lastEpId: number; + /** 上次观看到的EP INDEX */ + lastEpIndex: string; + /** 上次观看的进度 */ + progress: bigint; + /** 上次观看的 CID */ + lastPlayCid: bigint; + /** 带时间的提示信息 */ + toast: + | Toast + | undefined; + /** 不带时间的提示信息 */ + toastWithoutTime: + | Toast + | undefined; + /** 上次观看的 AID */ + lastPlayAid: bigint; +} + +export interface Toast { + /** toast文案 老字段 */ + text: string; + /** toast按钮 */ + button: + | ButtonInfo + | undefined; + /** 显示样式类型 */ + showStyleType: number; + /** 图标 */ + icon: string; + /** toast文案 新字段 */ + toastText: + | TextInfo + | undefined; + /** 埋点上报信息 */ + report: Report | undefined; + orderReportParams: { [key: string]: string }; +} + +export interface Toast_OrderReportParamsEntry { + key: string; + value: string; +} + +/** 按钮信息 */ +export interface ButtonInfo { + /** 按钮文案 */ + text: string; + /** 按钮字体色值 */ + textColor: string; + /** 按钮字体色值-夜间模式 */ + textColorNight: string; + /** 按钮背景色 */ + bgColor: string; + /** 按钮背景色-夜间模式 */ + bgColorNight: string; + /** 按钮链接 */ + link: string; + /** 按钮动作类型 */ + actionType: string; + /** 角标信息 */ + badgeInfo: + | BadgeInfo + | undefined; + /** 埋点上报信息 */ + report: + | Report + | undefined; + /** 左侧删除线样式文案 */ + leftStrikethroughText: string; + /** 缩略按钮文案信息 */ + simpleTextInfo: + | TextInfo + | undefined; + /** 缩略按钮背景色值 */ + simpleBgColor: string; + /** 缩略按钮字体色值-夜间模式 */ + simpleBgColorNight: string; + bgGradientColor: GradientColor | undefined; + orderReportParams: { [key: string]: string }; + taskParam: TaskParam | undefined; + pcLink: string; +} + +export interface ButtonInfo_OrderReportParamsEntry { + key: string; + value: string; +} + +/** 角标信息 */ +export interface BadgeInfo { + /** 角标文案 */ + text: string; + /** 角标色值 */ + bgColor: string; + /** 角标色值-夜间模式 */ + bgColorNight: string; + /** 文案色值 */ + textColor: string; + /** ? 新版本客户端已弃用此项 */ + bgGradientColor: GradientColor | undefined; + img: string; +} + +/** 渐变色信息 */ +export interface GradientColor { + startColor: string; + endColor: string; +} + +/** 埋点上报信息 */ +export interface Report { + /** 曝光事件 */ + showEventId: string; + /** 点击事件 */ + clickEventId: string; + /** 埋点透传参数 */ + extends: string; +} + +/** 文案信息 */ +export interface TextInfo { + /** 文案 */ + text: string; + /** 字体色值 */ + textColor: string; + /** 字体色值-夜间模式 */ + textColorNight: string; +} + +/** 任务参数信息 */ +export interface TaskParam { + /** 任务类型 */ + taskType: string; + /** 活动ID */ + activityId: bigint; + /** 提示ID */ + tipsId: bigint; +} + +function createBasePlayViewBusinessInfo(): PlayViewBusinessInfo { + return { + isPreview: false, + bp: false, + marlinToken: "", + playbackSpeedColor: "", + continuePlayInfo: undefined, + clipInfo: [], + inlineType: 0, + epWholeDuration: 0, + dimension: undefined, + qualityExtMap: {}, + expMap: {}, + drmTechType: 0, + limitActionType: 0, + isDrm: false, + recordInfo: undefined, + vipStatus: 0, + isLivePre: false, + episodeInfo: undefined, + episodeAdvertisementInfo: undefined, + userStatus: undefined, + }; +} + +export const PlayViewBusinessInfo: MessageFns = { + encode(message: PlayViewBusinessInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.isPreview !== false) { + writer.uint32(8).bool(message.isPreview); + } + if (message.bp !== false) { + writer.uint32(16).bool(message.bp); + } + if (message.marlinToken !== "") { + writer.uint32(26).string(message.marlinToken); + } + if (message.playbackSpeedColor !== "") { + writer.uint32(34).string(message.playbackSpeedColor); + } + if (message.continuePlayInfo !== undefined) { + ContinuePlayInfo.encode(message.continuePlayInfo, writer.uint32(42).fork()).join(); + } + for (const v of message.clipInfo) { + ClipInfo.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.inlineType !== 0) { + writer.uint32(56).int32(message.inlineType); + } + if (message.epWholeDuration !== 0) { + writer.uint32(64).int32(message.epWholeDuration); + } + if (message.dimension !== undefined) { + Dimension.encode(message.dimension, writer.uint32(74).fork()).join(); + } + Object.entries(message.qualityExtMap).forEach(([key, value]) => { + PlayViewBusinessInfo_QualityExtMapEntry.encode({ key: key as any, value }, writer.uint32(82).fork()).join(); + }); + Object.entries(message.expMap).forEach(([key, value]) => { + PlayViewBusinessInfo_ExpMapEntry.encode({ key: key as any, value }, writer.uint32(90).fork()).join(); + }); + if (message.drmTechType !== 0) { + writer.uint32(96).int32(message.drmTechType); + } + if (message.limitActionType !== 0) { + writer.uint32(104).int32(message.limitActionType); + } + if (message.isDrm !== false) { + writer.uint32(112).bool(message.isDrm); + } + if (message.recordInfo !== undefined) { + RecordInfo.encode(message.recordInfo, writer.uint32(122).fork()).join(); + } + if (message.vipStatus !== 0) { + writer.uint32(128).int32(message.vipStatus); + } + if (message.isLivePre !== false) { + writer.uint32(136).bool(message.isLivePre); + } + if (message.episodeInfo !== undefined) { + EpisodeInfo.encode(message.episodeInfo, writer.uint32(146).fork()).join(); + } + if (message.episodeAdvertisementInfo !== undefined) { + EpisodeAdvertisementInfo.encode(message.episodeAdvertisementInfo, writer.uint32(154).fork()).join(); + } + if (message.userStatus !== undefined) { + UserStatus.encode(message.userStatus, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayViewBusinessInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayViewBusinessInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.isPreview = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.bp = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.marlinToken = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.playbackSpeedColor = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.continuePlayInfo = ContinuePlayInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.clipInfo.push(ClipInfo.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.inlineType = reader.int32() as any; + continue; + case 8: + if (tag !== 64) { + break; + } + + message.epWholeDuration = reader.int32(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.dimension = Dimension.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + const entry10 = PlayViewBusinessInfo_QualityExtMapEntry.decode(reader, reader.uint32()); + if (entry10.value !== undefined) { + message.qualityExtMap[entry10.key] = entry10.value; + } + continue; + case 11: + if (tag !== 90) { + break; + } + + const entry11 = PlayViewBusinessInfo_ExpMapEntry.decode(reader, reader.uint32()); + if (entry11.value !== undefined) { + message.expMap[entry11.key] = entry11.value; + } + continue; + case 12: + if (tag !== 96) { + break; + } + + message.drmTechType = reader.int32() as any; + continue; + case 13: + if (tag !== 104) { + break; + } + + message.limitActionType = reader.int32(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.isDrm = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.recordInfo = RecordInfo.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.vipStatus = reader.int32(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.isLivePre = reader.bool(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.episodeInfo = EpisodeInfo.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.episodeAdvertisementInfo = EpisodeAdvertisementInfo.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.userStatus = UserStatus.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayViewBusinessInfo { + return { + isPreview: isSet(object.isPreview) ? globalThis.Boolean(object.isPreview) : false, + bp: isSet(object.bp) ? globalThis.Boolean(object.bp) : false, + marlinToken: isSet(object.marlinToken) ? globalThis.String(object.marlinToken) : "", + playbackSpeedColor: isSet(object.playbackSpeedColor) ? globalThis.String(object.playbackSpeedColor) : "", + continuePlayInfo: isSet(object.continuePlayInfo) ? ContinuePlayInfo.fromJSON(object.continuePlayInfo) : undefined, + clipInfo: globalThis.Array.isArray(object?.clipInfo) ? object.clipInfo.map((e: any) => ClipInfo.fromJSON(e)) : [], + inlineType: isSet(object.inlineType) ? inlineTypeFromJSON(object.inlineType) : 0, + epWholeDuration: isSet(object.epWholeDuration) ? globalThis.Number(object.epWholeDuration) : 0, + dimension: isSet(object.dimension) ? Dimension.fromJSON(object.dimension) : undefined, + qualityExtMap: isObject(object.qualityExtMap) + ? Object.entries(object.qualityExtMap).reduce<{ [key: number]: QualityExtInfo }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = QualityExtInfo.fromJSON(value); + return acc; + }, {}) + : {}, + expMap: isObject(object.expMap) + ? Object.entries(object.expMap).reduce<{ [key: string]: number }>((acc, [key, value]) => { + acc[key] = Number(value); + return acc; + }, {}) + : {}, + drmTechType: isSet(object.drmTechType) ? drmTechTypeFromJSON(object.drmTechType) : 0, + limitActionType: isSet(object.limitActionType) ? globalThis.Number(object.limitActionType) : 0, + isDrm: isSet(object.isDrm) ? globalThis.Boolean(object.isDrm) : false, + recordInfo: isSet(object.recordInfo) ? RecordInfo.fromJSON(object.recordInfo) : undefined, + vipStatus: isSet(object.vipStatus) ? globalThis.Number(object.vipStatus) : 0, + isLivePre: isSet(object.isLivePre) ? globalThis.Boolean(object.isLivePre) : false, + episodeInfo: isSet(object.episodeInfo) ? EpisodeInfo.fromJSON(object.episodeInfo) : undefined, + episodeAdvertisementInfo: isSet(object.episodeAdvertisementInfo) + ? EpisodeAdvertisementInfo.fromJSON(object.episodeAdvertisementInfo) + : undefined, + userStatus: isSet(object.userStatus) ? UserStatus.fromJSON(object.userStatus) : undefined, + }; + }, + + toJSON(message: PlayViewBusinessInfo): unknown { + const obj: any = {}; + if (message.isPreview !== false) { + obj.isPreview = message.isPreview; + } + if (message.bp !== false) { + obj.bp = message.bp; + } + if (message.marlinToken !== "") { + obj.marlinToken = message.marlinToken; + } + if (message.playbackSpeedColor !== "") { + obj.playbackSpeedColor = message.playbackSpeedColor; + } + if (message.continuePlayInfo !== undefined) { + obj.continuePlayInfo = ContinuePlayInfo.toJSON(message.continuePlayInfo); + } + if (message.clipInfo?.length) { + obj.clipInfo = message.clipInfo.map((e) => ClipInfo.toJSON(e)); + } + if (message.inlineType !== 0) { + obj.inlineType = inlineTypeToJSON(message.inlineType); + } + if (message.epWholeDuration !== 0) { + obj.epWholeDuration = Math.round(message.epWholeDuration); + } + if (message.dimension !== undefined) { + obj.dimension = Dimension.toJSON(message.dimension); + } + if (message.qualityExtMap) { + const entries = Object.entries(message.qualityExtMap); + if (entries.length > 0) { + obj.qualityExtMap = {}; + entries.forEach(([k, v]) => { + obj.qualityExtMap[k] = QualityExtInfo.toJSON(v); + }); + } + } + if (message.expMap) { + const entries = Object.entries(message.expMap); + if (entries.length > 0) { + obj.expMap = {}; + entries.forEach(([k, v]) => { + obj.expMap[k] = Math.round(v); + }); + } + } + if (message.drmTechType !== 0) { + obj.drmTechType = drmTechTypeToJSON(message.drmTechType); + } + if (message.limitActionType !== 0) { + obj.limitActionType = Math.round(message.limitActionType); + } + if (message.isDrm !== false) { + obj.isDrm = message.isDrm; + } + if (message.recordInfo !== undefined) { + obj.recordInfo = RecordInfo.toJSON(message.recordInfo); + } + if (message.vipStatus !== 0) { + obj.vipStatus = Math.round(message.vipStatus); + } + if (message.isLivePre !== false) { + obj.isLivePre = message.isLivePre; + } + if (message.episodeInfo !== undefined) { + obj.episodeInfo = EpisodeInfo.toJSON(message.episodeInfo); + } + if (message.episodeAdvertisementInfo !== undefined) { + obj.episodeAdvertisementInfo = EpisodeAdvertisementInfo.toJSON(message.episodeAdvertisementInfo); + } + if (message.userStatus !== undefined) { + obj.userStatus = UserStatus.toJSON(message.userStatus); + } + return obj; + }, + + create, I>>(base?: I): PlayViewBusinessInfo { + return PlayViewBusinessInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayViewBusinessInfo { + const message = createBasePlayViewBusinessInfo(); + message.isPreview = object.isPreview ?? false; + message.bp = object.bp ?? false; + message.marlinToken = object.marlinToken ?? ""; + message.playbackSpeedColor = object.playbackSpeedColor ?? ""; + message.continuePlayInfo = (object.continuePlayInfo !== undefined && object.continuePlayInfo !== null) + ? ContinuePlayInfo.fromPartial(object.continuePlayInfo) + : undefined; + message.clipInfo = object.clipInfo?.map((e) => ClipInfo.fromPartial(e)) || []; + message.inlineType = object.inlineType ?? 0; + message.epWholeDuration = object.epWholeDuration ?? 0; + message.dimension = (object.dimension !== undefined && object.dimension !== null) + ? Dimension.fromPartial(object.dimension) + : undefined; + message.qualityExtMap = Object.entries(object.qualityExtMap ?? {}).reduce<{ [key: number]: QualityExtInfo }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = QualityExtInfo.fromPartial(value); + } + return acc; + }, + {}, + ); + message.expMap = Object.entries(object.expMap ?? {}).reduce<{ [key: string]: number }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.Number(value); + } + return acc; + }, {}); + message.drmTechType = object.drmTechType ?? 0; + message.limitActionType = object.limitActionType ?? 0; + message.isDrm = object.isDrm ?? false; + message.recordInfo = (object.recordInfo !== undefined && object.recordInfo !== null) + ? RecordInfo.fromPartial(object.recordInfo) + : undefined; + message.vipStatus = object.vipStatus ?? 0; + message.isLivePre = object.isLivePre ?? false; + message.episodeInfo = (object.episodeInfo !== undefined && object.episodeInfo !== null) + ? EpisodeInfo.fromPartial(object.episodeInfo) + : undefined; + message.episodeAdvertisementInfo = + (object.episodeAdvertisementInfo !== undefined && object.episodeAdvertisementInfo !== null) + ? EpisodeAdvertisementInfo.fromPartial(object.episodeAdvertisementInfo) + : undefined; + message.userStatus = (object.userStatus !== undefined && object.userStatus !== null) + ? UserStatus.fromPartial(object.userStatus) + : undefined; + return message; + }, +}; + +function createBasePlayViewBusinessInfo_QualityExtMapEntry(): PlayViewBusinessInfo_QualityExtMapEntry { + return { key: 0, value: undefined }; +} + +export const PlayViewBusinessInfo_QualityExtMapEntry: MessageFns = { + encode(message: PlayViewBusinessInfo_QualityExtMapEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).int32(message.key); + } + if (message.value !== undefined) { + QualityExtInfo.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayViewBusinessInfo_QualityExtMapEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayViewBusinessInfo_QualityExtMapEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.key = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = QualityExtInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayViewBusinessInfo_QualityExtMapEntry { + return { + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? QualityExtInfo.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PlayViewBusinessInfo_QualityExtMapEntry): unknown { + const obj: any = {}; + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = QualityExtInfo.toJSON(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PlayViewBusinessInfo_QualityExtMapEntry { + return PlayViewBusinessInfo_QualityExtMapEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PlayViewBusinessInfo_QualityExtMapEntry { + const message = createBasePlayViewBusinessInfo_QualityExtMapEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? QualityExtInfo.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBasePlayViewBusinessInfo_ExpMapEntry(): PlayViewBusinessInfo_ExpMapEntry { + return { key: "", value: 0 }; +} + +export const PlayViewBusinessInfo_ExpMapEntry: MessageFns = { + encode(message: PlayViewBusinessInfo_ExpMapEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== 0) { + writer.uint32(16).int32(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayViewBusinessInfo_ExpMapEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayViewBusinessInfo_ExpMapEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.value = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayViewBusinessInfo_ExpMapEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.Number(object.value) : 0, + }; + }, + + toJSON(message: PlayViewBusinessInfo_ExpMapEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== 0) { + obj.value = Math.round(message.value); + } + return obj; + }, + + create, I>>( + base?: I, + ): PlayViewBusinessInfo_ExpMapEntry { + return PlayViewBusinessInfo_ExpMapEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PlayViewBusinessInfo_ExpMapEntry { + const message = createBasePlayViewBusinessInfo_ExpMapEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? 0; + return message; + }, +}; + +function createBaseContinuePlayInfo(): ContinuePlayInfo { + return { continuePlayEpId: 0n }; +} + +export const ContinuePlayInfo: MessageFns = { + encode(message: ContinuePlayInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.continuePlayEpId !== 0n) { + if (BigInt.asIntN(64, message.continuePlayEpId) !== message.continuePlayEpId) { + throw new globalThis.Error("value provided for field message.continuePlayEpId of type int64 too large"); + } + writer.uint32(8).int64(message.continuePlayEpId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuePlayInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuePlayInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.continuePlayEpId = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuePlayInfo { + return { continuePlayEpId: isSet(object.continuePlayEpId) ? BigInt(object.continuePlayEpId) : 0n }; + }, + + toJSON(message: ContinuePlayInfo): unknown { + const obj: any = {}; + if (message.continuePlayEpId !== 0n) { + obj.continuePlayEpId = message.continuePlayEpId.toString(); + } + return obj; + }, + + create, I>>(base?: I): ContinuePlayInfo { + return ContinuePlayInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuePlayInfo { + const message = createBaseContinuePlayInfo(); + message.continuePlayEpId = object.continuePlayEpId ?? 0n; + return message; + }, +}; + +function createBaseClipInfo(): ClipInfo { + return { materialNo: 0n, start: 0, end: 0, clipType: 0, toastText: "", multiView: undefined }; +} + +export const ClipInfo: MessageFns = { + encode(message: ClipInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.materialNo !== 0n) { + if (BigInt.asIntN(64, message.materialNo) !== message.materialNo) { + throw new globalThis.Error("value provided for field message.materialNo of type int64 too large"); + } + writer.uint32(8).int64(message.materialNo); + } + if (message.start !== 0) { + writer.uint32(16).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(24).int32(message.end); + } + if (message.clipType !== 0) { + writer.uint32(32).int32(message.clipType); + } + if (message.toastText !== "") { + writer.uint32(42).string(message.toastText); + } + if (message.multiView !== undefined) { + MultiView.encode(message.multiView, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClipInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClipInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.materialNo = reader.int64() as bigint; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.start = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.end = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.clipType = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.toastText = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.multiView = MultiView.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClipInfo { + return { + materialNo: isSet(object.materialNo) ? BigInt(object.materialNo) : 0n, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + clipType: isSet(object.clipType) ? clipTypeFromJSON(object.clipType) : 0, + toastText: isSet(object.toastText) ? globalThis.String(object.toastText) : "", + multiView: isSet(object.multiView) ? MultiView.fromJSON(object.multiView) : undefined, + }; + }, + + toJSON(message: ClipInfo): unknown { + const obj: any = {}; + if (message.materialNo !== 0n) { + obj.materialNo = message.materialNo.toString(); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.clipType !== 0) { + obj.clipType = clipTypeToJSON(message.clipType); + } + if (message.toastText !== "") { + obj.toastText = message.toastText; + } + if (message.multiView !== undefined) { + obj.multiView = MultiView.toJSON(message.multiView); + } + return obj; + }, + + create, I>>(base?: I): ClipInfo { + return ClipInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClipInfo { + const message = createBaseClipInfo(); + message.materialNo = object.materialNo ?? 0n; + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.clipType = object.clipType ?? 0; + message.toastText = object.toastText ?? ""; + message.multiView = (object.multiView !== undefined && object.multiView !== null) + ? MultiView.fromPartial(object.multiView) + : undefined; + return message; + }, +}; + +function createBaseMultiView(): MultiView { + return { buttonMaterial: "", epId: 0n, cid: 0n, avid: 0n }; +} + +export const MultiView: MessageFns = { + encode(message: MultiView, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.buttonMaterial !== "") { + writer.uint32(10).string(message.buttonMaterial); + } + if (message.epId !== 0n) { + if (BigInt.asIntN(64, message.epId) !== message.epId) { + throw new globalThis.Error("value provided for field message.epId of type int64 too large"); + } + writer.uint32(16).int64(message.epId); + } + if (message.cid !== 0n) { + if (BigInt.asIntN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type int64 too large"); + } + writer.uint32(24).int64(message.cid); + } + if (message.avid !== 0n) { + if (BigInt.asIntN(64, message.avid) !== message.avid) { + throw new globalThis.Error("value provided for field message.avid of type int64 too large"); + } + writer.uint32(32).int64(message.avid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiView { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiView(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.buttonMaterial = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.epId = reader.int64() as bigint; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.cid = reader.int64() as bigint; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.avid = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiView { + return { + buttonMaterial: isSet(object.buttonMaterial) ? globalThis.String(object.buttonMaterial) : "", + epId: isSet(object.epId) ? BigInt(object.epId) : 0n, + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + avid: isSet(object.avid) ? BigInt(object.avid) : 0n, + }; + }, + + toJSON(message: MultiView): unknown { + const obj: any = {}; + if (message.buttonMaterial !== "") { + obj.buttonMaterial = message.buttonMaterial; + } + if (message.epId !== 0n) { + obj.epId = message.epId.toString(); + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + if (message.avid !== 0n) { + obj.avid = message.avid.toString(); + } + return obj; + }, + + create, I>>(base?: I): MultiView { + return MultiView.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiView { + const message = createBaseMultiView(); + message.buttonMaterial = object.buttonMaterial ?? ""; + message.epId = object.epId ?? 0n; + message.cid = object.cid ?? 0n; + message.avid = object.avid ?? 0n; + return message; + }, +}; + +function createBaseDimension(): Dimension { + return { width: 0, height: 0, rotate: 0 }; +} + +export const Dimension: MessageFns = { + encode(message: Dimension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.width !== 0) { + writer.uint32(8).int32(message.width); + } + if (message.height !== 0) { + writer.uint32(16).int32(message.height); + } + if (message.rotate !== 0) { + writer.uint32(24).int32(message.rotate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Dimension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDimension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.width = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.rotate = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Dimension { + return { + width: isSet(object.width) ? globalThis.Number(object.width) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + rotate: isSet(object.rotate) ? globalThis.Number(object.rotate) : 0, + }; + }, + + toJSON(message: Dimension): unknown { + const obj: any = {}; + if (message.width !== 0) { + obj.width = Math.round(message.width); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.rotate !== 0) { + obj.rotate = Math.round(message.rotate); + } + return obj; + }, + + create, I>>(base?: I): Dimension { + return Dimension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Dimension { + const message = createBaseDimension(); + message.width = object.width ?? 0; + message.height = object.height ?? 0; + message.rotate = object.rotate ?? 0; + return message; + }, +}; + +function createBaseQualityExtInfo(): QualityExtInfo { + return { trialSupport: false }; +} + +export const QualityExtInfo: MessageFns = { + encode(message: QualityExtInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.trialSupport !== false) { + writer.uint32(8).bool(message.trialSupport); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QualityExtInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQualityExtInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.trialSupport = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QualityExtInfo { + return { trialSupport: isSet(object.trialSupport) ? globalThis.Boolean(object.trialSupport) : false }; + }, + + toJSON(message: QualityExtInfo): unknown { + const obj: any = {}; + if (message.trialSupport !== false) { + obj.trialSupport = message.trialSupport; + } + return obj; + }, + + create, I>>(base?: I): QualityExtInfo { + return QualityExtInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QualityExtInfo { + const message = createBaseQualityExtInfo(); + message.trialSupport = object.trialSupport ?? false; + return message; + }, +}; + +function createBaseRecordInfo(): RecordInfo { + return { record: "", recordIcon: "" }; +} + +export const RecordInfo: MessageFns = { + encode(message: RecordInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.record !== "") { + writer.uint32(10).string(message.record); + } + if (message.recordIcon !== "") { + writer.uint32(18).string(message.recordIcon); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RecordInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRecordInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.record = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.recordIcon = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RecordInfo { + return { + record: isSet(object.record) ? globalThis.String(object.record) : "", + recordIcon: isSet(object.recordIcon) ? globalThis.String(object.recordIcon) : "", + }; + }, + + toJSON(message: RecordInfo): unknown { + const obj: any = {}; + if (message.record !== "") { + obj.record = message.record; + } + if (message.recordIcon !== "") { + obj.recordIcon = message.recordIcon; + } + return obj; + }, + + create, I>>(base?: I): RecordInfo { + return RecordInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RecordInfo { + const message = createBaseRecordInfo(); + message.record = object.record ?? ""; + message.recordIcon = object.recordIcon ?? ""; + return message; + }, +}; + +function createBaseEpisodeInfo(): EpisodeInfo { + return { + epId: 0, + cid: 0n, + aid: 0n, + epStatus: 0n, + seasonInfo: undefined, + cover: "", + title: "", + interaction: undefined, + longTitle: "", + }; +} + +export const EpisodeInfo: MessageFns = { + encode(message: EpisodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.epId !== 0) { + writer.uint32(8).int32(message.epId); + } + if (message.cid !== 0n) { + if (BigInt.asIntN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type int64 too large"); + } + writer.uint32(16).int64(message.cid); + } + if (message.aid !== 0n) { + if (BigInt.asIntN(64, message.aid) !== message.aid) { + throw new globalThis.Error("value provided for field message.aid of type int64 too large"); + } + writer.uint32(24).int64(message.aid); + } + if (message.epStatus !== 0n) { + if (BigInt.asIntN(64, message.epStatus) !== message.epStatus) { + throw new globalThis.Error("value provided for field message.epStatus of type int64 too large"); + } + writer.uint32(32).int64(message.epStatus); + } + if (message.seasonInfo !== undefined) { + SeasonInfo.encode(message.seasonInfo, writer.uint32(42).fork()).join(); + } + if (message.cover !== "") { + writer.uint32(50).string(message.cover); + } + if (message.title !== "") { + writer.uint32(58).string(message.title); + } + if (message.interaction !== undefined) { + Interaction.encode(message.interaction, writer.uint32(66).fork()).join(); + } + if (message.longTitle !== "") { + writer.uint32(74).string(message.longTitle); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EpisodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEpisodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.epId = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.cid = reader.int64() as bigint; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.aid = reader.int64() as bigint; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.epStatus = reader.int64() as bigint; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.seasonInfo = SeasonInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.cover = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.title = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.interaction = Interaction.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.longTitle = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EpisodeInfo { + return { + epId: isSet(object.epId) ? globalThis.Number(object.epId) : 0, + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + aid: isSet(object.aid) ? BigInt(object.aid) : 0n, + epStatus: isSet(object.epStatus) ? BigInt(object.epStatus) : 0n, + seasonInfo: isSet(object.seasonInfo) ? SeasonInfo.fromJSON(object.seasonInfo) : undefined, + cover: isSet(object.cover) ? globalThis.String(object.cover) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + interaction: isSet(object.interaction) ? Interaction.fromJSON(object.interaction) : undefined, + longTitle: isSet(object.longTitle) ? globalThis.String(object.longTitle) : "", + }; + }, + + toJSON(message: EpisodeInfo): unknown { + const obj: any = {}; + if (message.epId !== 0) { + obj.epId = Math.round(message.epId); + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + if (message.aid !== 0n) { + obj.aid = message.aid.toString(); + } + if (message.epStatus !== 0n) { + obj.epStatus = message.epStatus.toString(); + } + if (message.seasonInfo !== undefined) { + obj.seasonInfo = SeasonInfo.toJSON(message.seasonInfo); + } + if (message.cover !== "") { + obj.cover = message.cover; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.interaction !== undefined) { + obj.interaction = Interaction.toJSON(message.interaction); + } + if (message.longTitle !== "") { + obj.longTitle = message.longTitle; + } + return obj; + }, + + create, I>>(base?: I): EpisodeInfo { + return EpisodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EpisodeInfo { + const message = createBaseEpisodeInfo(); + message.epId = object.epId ?? 0; + message.cid = object.cid ?? 0n; + message.aid = object.aid ?? 0n; + message.epStatus = object.epStatus ?? 0n; + message.seasonInfo = (object.seasonInfo !== undefined && object.seasonInfo !== null) + ? SeasonInfo.fromPartial(object.seasonInfo) + : undefined; + message.cover = object.cover ?? ""; + message.title = object.title ?? ""; + message.interaction = (object.interaction !== undefined && object.interaction !== null) + ? Interaction.fromPartial(object.interaction) + : undefined; + message.longTitle = object.longTitle ?? ""; + return message; + }, +}; + +function createBaseSeasonInfo(): SeasonInfo { + return { seasonId: 0, seasonType: 0, seasonStatus: 0, cover: "", title: "", rights: undefined, mode: 0 }; +} + +export const SeasonInfo: MessageFns = { + encode(message: SeasonInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seasonId !== 0) { + writer.uint32(8).int32(message.seasonId); + } + if (message.seasonType !== 0) { + writer.uint32(16).int32(message.seasonType); + } + if (message.seasonStatus !== 0) { + writer.uint32(24).int32(message.seasonStatus); + } + if (message.cover !== "") { + writer.uint32(34).string(message.cover); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.rights !== undefined) { + Rights.encode(message.rights, writer.uint32(50).fork()).join(); + } + if (message.mode !== 0) { + writer.uint32(56).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SeasonInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSeasonInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seasonId = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.seasonType = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.seasonStatus = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.cover = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.rights = Rights.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.mode = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SeasonInfo { + return { + seasonId: isSet(object.seasonId) ? globalThis.Number(object.seasonId) : 0, + seasonType: isSet(object.seasonType) ? globalThis.Number(object.seasonType) : 0, + seasonStatus: isSet(object.seasonStatus) ? globalThis.Number(object.seasonStatus) : 0, + cover: isSet(object.cover) ? globalThis.String(object.cover) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + rights: isSet(object.rights) ? Rights.fromJSON(object.rights) : undefined, + mode: isSet(object.mode) ? globalThis.Number(object.mode) : 0, + }; + }, + + toJSON(message: SeasonInfo): unknown { + const obj: any = {}; + if (message.seasonId !== 0) { + obj.seasonId = Math.round(message.seasonId); + } + if (message.seasonType !== 0) { + obj.seasonType = Math.round(message.seasonType); + } + if (message.seasonStatus !== 0) { + obj.seasonStatus = Math.round(message.seasonStatus); + } + if (message.cover !== "") { + obj.cover = message.cover; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.rights !== undefined) { + obj.rights = Rights.toJSON(message.rights); + } + if (message.mode !== 0) { + obj.mode = Math.round(message.mode); + } + return obj; + }, + + create, I>>(base?: I): SeasonInfo { + return SeasonInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SeasonInfo { + const message = createBaseSeasonInfo(); + message.seasonId = object.seasonId ?? 0; + message.seasonType = object.seasonType ?? 0; + message.seasonStatus = object.seasonStatus ?? 0; + message.cover = object.cover ?? ""; + message.title = object.title ?? ""; + message.rights = (object.rights !== undefined && object.rights !== null) + ? Rights.fromPartial(object.rights) + : undefined; + message.mode = object.mode ?? 0; + return message; + }, +}; + +function createBaseRights(): Rights { + return { canWatch: 0 }; +} + +export const Rights: MessageFns = { + encode(message: Rights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.canWatch !== 0) { + writer.uint32(8).int32(message.canWatch); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Rights { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRights(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.canWatch = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Rights { + return { canWatch: isSet(object.canWatch) ? globalThis.Number(object.canWatch) : 0 }; + }, + + toJSON(message: Rights): unknown { + const obj: any = {}; + if (message.canWatch !== 0) { + obj.canWatch = Math.round(message.canWatch); + } + return obj; + }, + + create, I>>(base?: I): Rights { + return Rights.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Rights { + const message = createBaseRights(); + message.canWatch = object.canWatch ?? 0; + return message; + }, +}; + +function createBaseInteraction(): Interaction { + return { historyNode: undefined, graphVersion: 0n, msg: "", isInteraction: false }; +} + +export const Interaction: MessageFns = { + encode(message: Interaction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.historyNode !== undefined) { + HistoryNode.encode(message.historyNode, writer.uint32(10).fork()).join(); + } + if (message.graphVersion !== 0n) { + if (BigInt.asIntN(64, message.graphVersion) !== message.graphVersion) { + throw new globalThis.Error("value provided for field message.graphVersion of type int64 too large"); + } + writer.uint32(16).int64(message.graphVersion); + } + if (message.msg !== "") { + writer.uint32(26).string(message.msg); + } + if (message.isInteraction !== false) { + writer.uint32(32).bool(message.isInteraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Interaction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInteraction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.historyNode = HistoryNode.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.graphVersion = reader.int64() as bigint; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msg = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isInteraction = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Interaction { + return { + historyNode: isSet(object.historyNode) ? HistoryNode.fromJSON(object.historyNode) : undefined, + graphVersion: isSet(object.graphVersion) ? BigInt(object.graphVersion) : 0n, + msg: isSet(object.msg) ? globalThis.String(object.msg) : "", + isInteraction: isSet(object.isInteraction) ? globalThis.Boolean(object.isInteraction) : false, + }; + }, + + toJSON(message: Interaction): unknown { + const obj: any = {}; + if (message.historyNode !== undefined) { + obj.historyNode = HistoryNode.toJSON(message.historyNode); + } + if (message.graphVersion !== 0n) { + obj.graphVersion = message.graphVersion.toString(); + } + if (message.msg !== "") { + obj.msg = message.msg; + } + if (message.isInteraction !== false) { + obj.isInteraction = message.isInteraction; + } + return obj; + }, + + create, I>>(base?: I): Interaction { + return Interaction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Interaction { + const message = createBaseInteraction(); + message.historyNode = (object.historyNode !== undefined && object.historyNode !== null) + ? HistoryNode.fromPartial(object.historyNode) + : undefined; + message.graphVersion = object.graphVersion ?? 0n; + message.msg = object.msg ?? ""; + message.isInteraction = object.isInteraction ?? false; + return message; + }, +}; + +function createBaseHistoryNode(): HistoryNode { + return { nodeId: 0n, title: "", cid: 0n }; +} + +export const HistoryNode: MessageFns = { + encode(message: HistoryNode, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nodeId !== 0n) { + if (BigInt.asIntN(64, message.nodeId) !== message.nodeId) { + throw new globalThis.Error("value provided for field message.nodeId of type int64 too large"); + } + writer.uint32(8).int64(message.nodeId); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.cid !== 0n) { + if (BigInt.asIntN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type int64 too large"); + } + writer.uint32(24).int64(message.cid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoryNode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoryNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.nodeId = reader.int64() as bigint; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.cid = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoryNode { + return { + nodeId: isSet(object.nodeId) ? BigInt(object.nodeId) : 0n, + title: isSet(object.title) ? globalThis.String(object.title) : "", + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + }; + }, + + toJSON(message: HistoryNode): unknown { + const obj: any = {}; + if (message.nodeId !== 0n) { + obj.nodeId = message.nodeId.toString(); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + return obj; + }, + + create, I>>(base?: I): HistoryNode { + return HistoryNode.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HistoryNode { + const message = createBaseHistoryNode(); + message.nodeId = object.nodeId ?? 0n; + message.title = object.title ?? ""; + message.cid = object.cid ?? 0n; + return message; + }, +}; + +function createBaseEpisodeAdvertisementInfo(): EpisodeAdvertisementInfo { + return { + aid: 0n, + title: "", + link: "", + followVideoBntFlag: 0, + nextVideoTitle: "", + nextVideoLink: "", + cid: 0n, + seasonId: 0, + follow: 0, + }; +} + +export const EpisodeAdvertisementInfo: MessageFns = { + encode(message: EpisodeAdvertisementInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.aid !== 0n) { + if (BigInt.asIntN(64, message.aid) !== message.aid) { + throw new globalThis.Error("value provided for field message.aid of type int64 too large"); + } + writer.uint32(8).int64(message.aid); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.link !== "") { + writer.uint32(26).string(message.link); + } + if (message.followVideoBntFlag !== 0) { + writer.uint32(32).int32(message.followVideoBntFlag); + } + if (message.nextVideoTitle !== "") { + writer.uint32(42).string(message.nextVideoTitle); + } + if (message.nextVideoLink !== "") { + writer.uint32(50).string(message.nextVideoLink); + } + if (message.cid !== 0n) { + if (BigInt.asIntN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type int64 too large"); + } + writer.uint32(56).int64(message.cid); + } + if (message.seasonId !== 0) { + writer.uint32(64).int32(message.seasonId); + } + if (message.follow !== 0) { + writer.uint32(72).int32(message.follow); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EpisodeAdvertisementInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEpisodeAdvertisementInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.aid = reader.int64() as bigint; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.link = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.followVideoBntFlag = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.nextVideoTitle = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.nextVideoLink = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.cid = reader.int64() as bigint; + continue; + case 8: + if (tag !== 64) { + break; + } + + message.seasonId = reader.int32(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.follow = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EpisodeAdvertisementInfo { + return { + aid: isSet(object.aid) ? BigInt(object.aid) : 0n, + title: isSet(object.title) ? globalThis.String(object.title) : "", + link: isSet(object.link) ? globalThis.String(object.link) : "", + followVideoBntFlag: isSet(object.followVideoBntFlag) ? globalThis.Number(object.followVideoBntFlag) : 0, + nextVideoTitle: isSet(object.nextVideoTitle) ? globalThis.String(object.nextVideoTitle) : "", + nextVideoLink: isSet(object.nextVideoLink) ? globalThis.String(object.nextVideoLink) : "", + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + seasonId: isSet(object.seasonId) ? globalThis.Number(object.seasonId) : 0, + follow: isSet(object.follow) ? globalThis.Number(object.follow) : 0, + }; + }, + + toJSON(message: EpisodeAdvertisementInfo): unknown { + const obj: any = {}; + if (message.aid !== 0n) { + obj.aid = message.aid.toString(); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.link !== "") { + obj.link = message.link; + } + if (message.followVideoBntFlag !== 0) { + obj.followVideoBntFlag = Math.round(message.followVideoBntFlag); + } + if (message.nextVideoTitle !== "") { + obj.nextVideoTitle = message.nextVideoTitle; + } + if (message.nextVideoLink !== "") { + obj.nextVideoLink = message.nextVideoLink; + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + if (message.seasonId !== 0) { + obj.seasonId = Math.round(message.seasonId); + } + if (message.follow !== 0) { + obj.follow = Math.round(message.follow); + } + return obj; + }, + + create, I>>(base?: I): EpisodeAdvertisementInfo { + return EpisodeAdvertisementInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EpisodeAdvertisementInfo { + const message = createBaseEpisodeAdvertisementInfo(); + message.aid = object.aid ?? 0n; + message.title = object.title ?? ""; + message.link = object.link ?? ""; + message.followVideoBntFlag = object.followVideoBntFlag ?? 0; + message.nextVideoTitle = object.nextVideoTitle ?? ""; + message.nextVideoLink = object.nextVideoLink ?? ""; + message.cid = object.cid ?? 0n; + message.seasonId = object.seasonId ?? 0; + message.follow = object.follow ?? 0; + return message; + }, +}; + +function createBaseUserStatus(): UserStatus { + return { payCheck: false, sponsor: false, watchProgress: undefined, aidWatchProgress: undefined }; +} + +export const UserStatus: MessageFns = { + encode(message: UserStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payCheck !== false) { + writer.uint32(8).bool(message.payCheck); + } + if (message.sponsor !== false) { + writer.uint32(16).bool(message.sponsor); + } + if (message.watchProgress !== undefined) { + WatchProgress.encode(message.watchProgress, writer.uint32(26).fork()).join(); + } + if (message.aidWatchProgress !== undefined) { + WatchProgress.encode(message.aidWatchProgress, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.payCheck = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.sponsor = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.watchProgress = WatchProgress.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aidWatchProgress = WatchProgress.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserStatus { + return { + payCheck: isSet(object.payCheck) ? globalThis.Boolean(object.payCheck) : false, + sponsor: isSet(object.sponsor) ? globalThis.Boolean(object.sponsor) : false, + watchProgress: isSet(object.watchProgress) ? WatchProgress.fromJSON(object.watchProgress) : undefined, + aidWatchProgress: isSet(object.aidWatchProgress) ? WatchProgress.fromJSON(object.aidWatchProgress) : undefined, + }; + }, + + toJSON(message: UserStatus): unknown { + const obj: any = {}; + if (message.payCheck !== false) { + obj.payCheck = message.payCheck; + } + if (message.sponsor !== false) { + obj.sponsor = message.sponsor; + } + if (message.watchProgress !== undefined) { + obj.watchProgress = WatchProgress.toJSON(message.watchProgress); + } + if (message.aidWatchProgress !== undefined) { + obj.aidWatchProgress = WatchProgress.toJSON(message.aidWatchProgress); + } + return obj; + }, + + create, I>>(base?: I): UserStatus { + return UserStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserStatus { + const message = createBaseUserStatus(); + message.payCheck = object.payCheck ?? false; + message.sponsor = object.sponsor ?? false; + message.watchProgress = (object.watchProgress !== undefined && object.watchProgress !== null) + ? WatchProgress.fromPartial(object.watchProgress) + : undefined; + message.aidWatchProgress = (object.aidWatchProgress !== undefined && object.aidWatchProgress !== null) + ? WatchProgress.fromPartial(object.aidWatchProgress) + : undefined; + return message; + }, +}; + +function createBaseWatchProgress(): WatchProgress { + return { + lastEpId: 0, + lastEpIndex: "", + progress: 0n, + lastPlayCid: 0n, + toast: undefined, + toastWithoutTime: undefined, + lastPlayAid: 0n, + }; +} + +export const WatchProgress: MessageFns = { + encode(message: WatchProgress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lastEpId !== 0) { + writer.uint32(8).int32(message.lastEpId); + } + if (message.lastEpIndex !== "") { + writer.uint32(18).string(message.lastEpIndex); + } + if (message.progress !== 0n) { + if (BigInt.asIntN(64, message.progress) !== message.progress) { + throw new globalThis.Error("value provided for field message.progress of type int64 too large"); + } + writer.uint32(24).int64(message.progress); + } + if (message.lastPlayCid !== 0n) { + if (BigInt.asIntN(64, message.lastPlayCid) !== message.lastPlayCid) { + throw new globalThis.Error("value provided for field message.lastPlayCid of type int64 too large"); + } + writer.uint32(32).int64(message.lastPlayCid); + } + if (message.toast !== undefined) { + Toast.encode(message.toast, writer.uint32(42).fork()).join(); + } + if (message.toastWithoutTime !== undefined) { + Toast.encode(message.toastWithoutTime, writer.uint32(50).fork()).join(); + } + if (message.lastPlayAid !== 0n) { + if (BigInt.asIntN(64, message.lastPlayAid) !== message.lastPlayAid) { + throw new globalThis.Error("value provided for field message.lastPlayAid of type int64 too large"); + } + writer.uint32(56).int64(message.lastPlayAid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WatchProgress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWatchProgress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.lastEpId = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lastEpIndex = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.progress = reader.int64() as bigint; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.lastPlayCid = reader.int64() as bigint; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.toast = Toast.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.toastWithoutTime = Toast.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.lastPlayAid = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WatchProgress { + return { + lastEpId: isSet(object.lastEpId) ? globalThis.Number(object.lastEpId) : 0, + lastEpIndex: isSet(object.lastEpIndex) ? globalThis.String(object.lastEpIndex) : "", + progress: isSet(object.progress) ? BigInt(object.progress) : 0n, + lastPlayCid: isSet(object.lastPlayCid) ? BigInt(object.lastPlayCid) : 0n, + toast: isSet(object.toast) ? Toast.fromJSON(object.toast) : undefined, + toastWithoutTime: isSet(object.toastWithoutTime) ? Toast.fromJSON(object.toastWithoutTime) : undefined, + lastPlayAid: isSet(object.lastPlayAid) ? BigInt(object.lastPlayAid) : 0n, + }; + }, + + toJSON(message: WatchProgress): unknown { + const obj: any = {}; + if (message.lastEpId !== 0) { + obj.lastEpId = Math.round(message.lastEpId); + } + if (message.lastEpIndex !== "") { + obj.lastEpIndex = message.lastEpIndex; + } + if (message.progress !== 0n) { + obj.progress = message.progress.toString(); + } + if (message.lastPlayCid !== 0n) { + obj.lastPlayCid = message.lastPlayCid.toString(); + } + if (message.toast !== undefined) { + obj.toast = Toast.toJSON(message.toast); + } + if (message.toastWithoutTime !== undefined) { + obj.toastWithoutTime = Toast.toJSON(message.toastWithoutTime); + } + if (message.lastPlayAid !== 0n) { + obj.lastPlayAid = message.lastPlayAid.toString(); + } + return obj; + }, + + create, I>>(base?: I): WatchProgress { + return WatchProgress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WatchProgress { + const message = createBaseWatchProgress(); + message.lastEpId = object.lastEpId ?? 0; + message.lastEpIndex = object.lastEpIndex ?? ""; + message.progress = object.progress ?? 0n; + message.lastPlayCid = object.lastPlayCid ?? 0n; + message.toast = (object.toast !== undefined && object.toast !== null) ? Toast.fromPartial(object.toast) : undefined; + message.toastWithoutTime = (object.toastWithoutTime !== undefined && object.toastWithoutTime !== null) + ? Toast.fromPartial(object.toastWithoutTime) + : undefined; + message.lastPlayAid = object.lastPlayAid ?? 0n; + return message; + }, +}; + +function createBaseToast(): Toast { + return { + text: "", + button: undefined, + showStyleType: 0, + icon: "", + toastText: undefined, + report: undefined, + orderReportParams: {}, + }; +} + +export const Toast: MessageFns = { + encode(message: Toast, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.button !== undefined) { + ButtonInfo.encode(message.button, writer.uint32(18).fork()).join(); + } + if (message.showStyleType !== 0) { + writer.uint32(24).int32(message.showStyleType); + } + if (message.icon !== "") { + writer.uint32(34).string(message.icon); + } + if (message.toastText !== undefined) { + TextInfo.encode(message.toastText, writer.uint32(42).fork()).join(); + } + if (message.report !== undefined) { + Report.encode(message.report, writer.uint32(50).fork()).join(); + } + Object.entries(message.orderReportParams).forEach(([key, value]) => { + Toast_OrderReportParamsEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Toast { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToast(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.button = ButtonInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.showStyleType = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.icon = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.toastText = TextInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.report = Report.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + const entry7 = Toast_OrderReportParamsEntry.decode(reader, reader.uint32()); + if (entry7.value !== undefined) { + message.orderReportParams[entry7.key] = entry7.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Toast { + return { + text: isSet(object.text) ? globalThis.String(object.text) : "", + button: isSet(object.button) ? ButtonInfo.fromJSON(object.button) : undefined, + showStyleType: isSet(object.showStyleType) ? globalThis.Number(object.showStyleType) : 0, + icon: isSet(object.icon) ? globalThis.String(object.icon) : "", + toastText: isSet(object.toastText) ? TextInfo.fromJSON(object.toastText) : undefined, + report: isSet(object.report) ? Report.fromJSON(object.report) : undefined, + orderReportParams: isObject(object.orderReportParams) + ? Object.entries(object.orderReportParams).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Toast): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.button !== undefined) { + obj.button = ButtonInfo.toJSON(message.button); + } + if (message.showStyleType !== 0) { + obj.showStyleType = Math.round(message.showStyleType); + } + if (message.icon !== "") { + obj.icon = message.icon; + } + if (message.toastText !== undefined) { + obj.toastText = TextInfo.toJSON(message.toastText); + } + if (message.report !== undefined) { + obj.report = Report.toJSON(message.report); + } + if (message.orderReportParams) { + const entries = Object.entries(message.orderReportParams); + if (entries.length > 0) { + obj.orderReportParams = {}; + entries.forEach(([k, v]) => { + obj.orderReportParams[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): Toast { + return Toast.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Toast { + const message = createBaseToast(); + message.text = object.text ?? ""; + message.button = (object.button !== undefined && object.button !== null) + ? ButtonInfo.fromPartial(object.button) + : undefined; + message.showStyleType = object.showStyleType ?? 0; + message.icon = object.icon ?? ""; + message.toastText = (object.toastText !== undefined && object.toastText !== null) + ? TextInfo.fromPartial(object.toastText) + : undefined; + message.report = (object.report !== undefined && object.report !== null) + ? Report.fromPartial(object.report) + : undefined; + message.orderReportParams = Object.entries(object.orderReportParams ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseToast_OrderReportParamsEntry(): Toast_OrderReportParamsEntry { + return { key: "", value: "" }; +} + +export const Toast_OrderReportParamsEntry: MessageFns = { + encode(message: Toast_OrderReportParamsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Toast_OrderReportParamsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToast_OrderReportParamsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Toast_OrderReportParamsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Toast_OrderReportParamsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Toast_OrderReportParamsEntry { + return Toast_OrderReportParamsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Toast_OrderReportParamsEntry { + const message = createBaseToast_OrderReportParamsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseButtonInfo(): ButtonInfo { + return { + text: "", + textColor: "", + textColorNight: "", + bgColor: "", + bgColorNight: "", + link: "", + actionType: "", + badgeInfo: undefined, + report: undefined, + leftStrikethroughText: "", + simpleTextInfo: undefined, + simpleBgColor: "", + simpleBgColorNight: "", + bgGradientColor: undefined, + orderReportParams: {}, + taskParam: undefined, + pcLink: "", + }; +} + +export const ButtonInfo: MessageFns = { + encode(message: ButtonInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.textColor !== "") { + writer.uint32(18).string(message.textColor); + } + if (message.textColorNight !== "") { + writer.uint32(26).string(message.textColorNight); + } + if (message.bgColor !== "") { + writer.uint32(34).string(message.bgColor); + } + if (message.bgColorNight !== "") { + writer.uint32(42).string(message.bgColorNight); + } + if (message.link !== "") { + writer.uint32(50).string(message.link); + } + if (message.actionType !== "") { + writer.uint32(58).string(message.actionType); + } + if (message.badgeInfo !== undefined) { + BadgeInfo.encode(message.badgeInfo, writer.uint32(66).fork()).join(); + } + if (message.report !== undefined) { + Report.encode(message.report, writer.uint32(74).fork()).join(); + } + if (message.leftStrikethroughText !== "") { + writer.uint32(82).string(message.leftStrikethroughText); + } + if (message.simpleTextInfo !== undefined) { + TextInfo.encode(message.simpleTextInfo, writer.uint32(90).fork()).join(); + } + if (message.simpleBgColor !== "") { + writer.uint32(98).string(message.simpleBgColor); + } + if (message.simpleBgColorNight !== "") { + writer.uint32(106).string(message.simpleBgColorNight); + } + if (message.bgGradientColor !== undefined) { + GradientColor.encode(message.bgGradientColor, writer.uint32(114).fork()).join(); + } + Object.entries(message.orderReportParams).forEach(([key, value]) => { + ButtonInfo_OrderReportParamsEntry.encode({ key: key as any, value }, writer.uint32(122).fork()).join(); + }); + if (message.taskParam !== undefined) { + TaskParam.encode(message.taskParam, writer.uint32(130).fork()).join(); + } + if (message.pcLink !== "") { + writer.uint32(138).string(message.pcLink); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ButtonInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseButtonInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.textColor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.textColorNight = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bgColor = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bgColorNight = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.link = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.actionType = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.badgeInfo = BadgeInfo.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.report = Report.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.leftStrikethroughText = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.simpleTextInfo = TextInfo.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.simpleBgColor = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.simpleBgColorNight = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.bgGradientColor = GradientColor.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + const entry15 = ButtonInfo_OrderReportParamsEntry.decode(reader, reader.uint32()); + if (entry15.value !== undefined) { + message.orderReportParams[entry15.key] = entry15.value; + } + continue; + case 16: + if (tag !== 130) { + break; + } + + message.taskParam = TaskParam.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.pcLink = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ButtonInfo { + return { + text: isSet(object.text) ? globalThis.String(object.text) : "", + textColor: isSet(object.textColor) ? globalThis.String(object.textColor) : "", + textColorNight: isSet(object.textColorNight) ? globalThis.String(object.textColorNight) : "", + bgColor: isSet(object.bgColor) ? globalThis.String(object.bgColor) : "", + bgColorNight: isSet(object.bgColorNight) ? globalThis.String(object.bgColorNight) : "", + link: isSet(object.link) ? globalThis.String(object.link) : "", + actionType: isSet(object.actionType) ? globalThis.String(object.actionType) : "", + badgeInfo: isSet(object.badgeInfo) ? BadgeInfo.fromJSON(object.badgeInfo) : undefined, + report: isSet(object.report) ? Report.fromJSON(object.report) : undefined, + leftStrikethroughText: isSet(object.leftStrikethroughText) ? globalThis.String(object.leftStrikethroughText) : "", + simpleTextInfo: isSet(object.simpleTextInfo) ? TextInfo.fromJSON(object.simpleTextInfo) : undefined, + simpleBgColor: isSet(object.simpleBgColor) ? globalThis.String(object.simpleBgColor) : "", + simpleBgColorNight: isSet(object.simpleBgColorNight) ? globalThis.String(object.simpleBgColorNight) : "", + bgGradientColor: isSet(object.bgGradientColor) ? GradientColor.fromJSON(object.bgGradientColor) : undefined, + orderReportParams: isObject(object.orderReportParams) + ? Object.entries(object.orderReportParams).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + taskParam: isSet(object.taskParam) ? TaskParam.fromJSON(object.taskParam) : undefined, + pcLink: isSet(object.pcLink) ? globalThis.String(object.pcLink) : "", + }; + }, + + toJSON(message: ButtonInfo): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.textColor !== "") { + obj.textColor = message.textColor; + } + if (message.textColorNight !== "") { + obj.textColorNight = message.textColorNight; + } + if (message.bgColor !== "") { + obj.bgColor = message.bgColor; + } + if (message.bgColorNight !== "") { + obj.bgColorNight = message.bgColorNight; + } + if (message.link !== "") { + obj.link = message.link; + } + if (message.actionType !== "") { + obj.actionType = message.actionType; + } + if (message.badgeInfo !== undefined) { + obj.badgeInfo = BadgeInfo.toJSON(message.badgeInfo); + } + if (message.report !== undefined) { + obj.report = Report.toJSON(message.report); + } + if (message.leftStrikethroughText !== "") { + obj.leftStrikethroughText = message.leftStrikethroughText; + } + if (message.simpleTextInfo !== undefined) { + obj.simpleTextInfo = TextInfo.toJSON(message.simpleTextInfo); + } + if (message.simpleBgColor !== "") { + obj.simpleBgColor = message.simpleBgColor; + } + if (message.simpleBgColorNight !== "") { + obj.simpleBgColorNight = message.simpleBgColorNight; + } + if (message.bgGradientColor !== undefined) { + obj.bgGradientColor = GradientColor.toJSON(message.bgGradientColor); + } + if (message.orderReportParams) { + const entries = Object.entries(message.orderReportParams); + if (entries.length > 0) { + obj.orderReportParams = {}; + entries.forEach(([k, v]) => { + obj.orderReportParams[k] = v; + }); + } + } + if (message.taskParam !== undefined) { + obj.taskParam = TaskParam.toJSON(message.taskParam); + } + if (message.pcLink !== "") { + obj.pcLink = message.pcLink; + } + return obj; + }, + + create, I>>(base?: I): ButtonInfo { + return ButtonInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ButtonInfo { + const message = createBaseButtonInfo(); + message.text = object.text ?? ""; + message.textColor = object.textColor ?? ""; + message.textColorNight = object.textColorNight ?? ""; + message.bgColor = object.bgColor ?? ""; + message.bgColorNight = object.bgColorNight ?? ""; + message.link = object.link ?? ""; + message.actionType = object.actionType ?? ""; + message.badgeInfo = (object.badgeInfo !== undefined && object.badgeInfo !== null) + ? BadgeInfo.fromPartial(object.badgeInfo) + : undefined; + message.report = (object.report !== undefined && object.report !== null) + ? Report.fromPartial(object.report) + : undefined; + message.leftStrikethroughText = object.leftStrikethroughText ?? ""; + message.simpleTextInfo = (object.simpleTextInfo !== undefined && object.simpleTextInfo !== null) + ? TextInfo.fromPartial(object.simpleTextInfo) + : undefined; + message.simpleBgColor = object.simpleBgColor ?? ""; + message.simpleBgColorNight = object.simpleBgColorNight ?? ""; + message.bgGradientColor = (object.bgGradientColor !== undefined && object.bgGradientColor !== null) + ? GradientColor.fromPartial(object.bgGradientColor) + : undefined; + message.orderReportParams = Object.entries(object.orderReportParams ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.taskParam = (object.taskParam !== undefined && object.taskParam !== null) + ? TaskParam.fromPartial(object.taskParam) + : undefined; + message.pcLink = object.pcLink ?? ""; + return message; + }, +}; + +function createBaseButtonInfo_OrderReportParamsEntry(): ButtonInfo_OrderReportParamsEntry { + return { key: "", value: "" }; +} + +export const ButtonInfo_OrderReportParamsEntry: MessageFns = { + encode(message: ButtonInfo_OrderReportParamsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ButtonInfo_OrderReportParamsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseButtonInfo_OrderReportParamsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ButtonInfo_OrderReportParamsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ButtonInfo_OrderReportParamsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): ButtonInfo_OrderReportParamsEntry { + return ButtonInfo_OrderReportParamsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ButtonInfo_OrderReportParamsEntry { + const message = createBaseButtonInfo_OrderReportParamsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseBadgeInfo(): BadgeInfo { + return { text: "", bgColor: "", bgColorNight: "", textColor: "", bgGradientColor: undefined, img: "" }; +} + +export const BadgeInfo: MessageFns = { + encode(message: BadgeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.bgColor !== "") { + writer.uint32(18).string(message.bgColor); + } + if (message.bgColorNight !== "") { + writer.uint32(26).string(message.bgColorNight); + } + if (message.textColor !== "") { + writer.uint32(34).string(message.textColor); + } + if (message.bgGradientColor !== undefined) { + GradientColor.encode(message.bgGradientColor, writer.uint32(42).fork()).join(); + } + if (message.img !== "") { + writer.uint32(50).string(message.img); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BadgeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBadgeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bgColor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bgColorNight = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.textColor = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bgGradientColor = GradientColor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.img = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BadgeInfo { + return { + text: isSet(object.text) ? globalThis.String(object.text) : "", + bgColor: isSet(object.bgColor) ? globalThis.String(object.bgColor) : "", + bgColorNight: isSet(object.bgColorNight) ? globalThis.String(object.bgColorNight) : "", + textColor: isSet(object.textColor) ? globalThis.String(object.textColor) : "", + bgGradientColor: isSet(object.bgGradientColor) ? GradientColor.fromJSON(object.bgGradientColor) : undefined, + img: isSet(object.img) ? globalThis.String(object.img) : "", + }; + }, + + toJSON(message: BadgeInfo): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.bgColor !== "") { + obj.bgColor = message.bgColor; + } + if (message.bgColorNight !== "") { + obj.bgColorNight = message.bgColorNight; + } + if (message.textColor !== "") { + obj.textColor = message.textColor; + } + if (message.bgGradientColor !== undefined) { + obj.bgGradientColor = GradientColor.toJSON(message.bgGradientColor); + } + if (message.img !== "") { + obj.img = message.img; + } + return obj; + }, + + create, I>>(base?: I): BadgeInfo { + return BadgeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BadgeInfo { + const message = createBaseBadgeInfo(); + message.text = object.text ?? ""; + message.bgColor = object.bgColor ?? ""; + message.bgColorNight = object.bgColorNight ?? ""; + message.textColor = object.textColor ?? ""; + message.bgGradientColor = (object.bgGradientColor !== undefined && object.bgGradientColor !== null) + ? GradientColor.fromPartial(object.bgGradientColor) + : undefined; + message.img = object.img ?? ""; + return message; + }, +}; + +function createBaseGradientColor(): GradientColor { + return { startColor: "", endColor: "" }; +} + +export const GradientColor: MessageFns = { + encode(message: GradientColor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.startColor !== "") { + writer.uint32(10).string(message.startColor); + } + if (message.endColor !== "") { + writer.uint32(18).string(message.endColor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GradientColor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGradientColor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.startColor = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.endColor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GradientColor { + return { + startColor: isSet(object.startColor) ? globalThis.String(object.startColor) : "", + endColor: isSet(object.endColor) ? globalThis.String(object.endColor) : "", + }; + }, + + toJSON(message: GradientColor): unknown { + const obj: any = {}; + if (message.startColor !== "") { + obj.startColor = message.startColor; + } + if (message.endColor !== "") { + obj.endColor = message.endColor; + } + return obj; + }, + + create, I>>(base?: I): GradientColor { + return GradientColor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GradientColor { + const message = createBaseGradientColor(); + message.startColor = object.startColor ?? ""; + message.endColor = object.endColor ?? ""; + return message; + }, +}; + +function createBaseReport(): Report { + return { showEventId: "", clickEventId: "", extends: "" }; +} + +export const Report: MessageFns = { + encode(message: Report, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.showEventId !== "") { + writer.uint32(10).string(message.showEventId); + } + if (message.clickEventId !== "") { + writer.uint32(18).string(message.clickEventId); + } + if (message.extends !== "") { + writer.uint32(26).string(message.extends); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Report { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.showEventId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.clickEventId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extends = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Report { + return { + showEventId: isSet(object.showEventId) ? globalThis.String(object.showEventId) : "", + clickEventId: isSet(object.clickEventId) ? globalThis.String(object.clickEventId) : "", + extends: isSet(object.extends) ? globalThis.String(object.extends) : "", + }; + }, + + toJSON(message: Report): unknown { + const obj: any = {}; + if (message.showEventId !== "") { + obj.showEventId = message.showEventId; + } + if (message.clickEventId !== "") { + obj.clickEventId = message.clickEventId; + } + if (message.extends !== "") { + obj.extends = message.extends; + } + return obj; + }, + + create, I>>(base?: I): Report { + return Report.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Report { + const message = createBaseReport(); + message.showEventId = object.showEventId ?? ""; + message.clickEventId = object.clickEventId ?? ""; + message.extends = object.extends ?? ""; + return message; + }, +}; + +function createBaseTextInfo(): TextInfo { + return { text: "", textColor: "", textColorNight: "" }; +} + +export const TextInfo: MessageFns = { + encode(message: TextInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.textColor !== "") { + writer.uint32(18).string(message.textColor); + } + if (message.textColorNight !== "") { + writer.uint32(26).string(message.textColorNight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.textColor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.textColorNight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextInfo { + return { + text: isSet(object.text) ? globalThis.String(object.text) : "", + textColor: isSet(object.textColor) ? globalThis.String(object.textColor) : "", + textColorNight: isSet(object.textColorNight) ? globalThis.String(object.textColorNight) : "", + }; + }, + + toJSON(message: TextInfo): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.textColor !== "") { + obj.textColor = message.textColor; + } + if (message.textColorNight !== "") { + obj.textColorNight = message.textColorNight; + } + return obj; + }, + + create, I>>(base?: I): TextInfo { + return TextInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextInfo { + const message = createBaseTextInfo(); + message.text = object.text ?? ""; + message.textColor = object.textColor ?? ""; + message.textColorNight = object.textColorNight ?? ""; + return message; + }, +}; + +function createBaseTaskParam(): TaskParam { + return { taskType: "", activityId: 0n, tipsId: 0n }; +} + +export const TaskParam: MessageFns = { + encode(message: TaskParam, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.taskType !== "") { + writer.uint32(10).string(message.taskType); + } + if (message.activityId !== 0n) { + if (BigInt.asIntN(64, message.activityId) !== message.activityId) { + throw new globalThis.Error("value provided for field message.activityId of type int64 too large"); + } + writer.uint32(16).int64(message.activityId); + } + if (message.tipsId !== 0n) { + if (BigInt.asIntN(64, message.tipsId) !== message.tipsId) { + throw new globalThis.Error("value provided for field message.tipsId of type int64 too large"); + } + writer.uint32(24).int64(message.tipsId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TaskParam { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTaskParam(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.taskType = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.activityId = reader.int64() as bigint; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.tipsId = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TaskParam { + return { + taskType: isSet(object.taskType) ? globalThis.String(object.taskType) : "", + activityId: isSet(object.activityId) ? BigInt(object.activityId) : 0n, + tipsId: isSet(object.tipsId) ? BigInt(object.tipsId) : 0n, + }; + }, + + toJSON(message: TaskParam): unknown { + const obj: any = {}; + if (message.taskType !== "") { + obj.taskType = message.taskType; + } + if (message.activityId !== 0n) { + obj.activityId = message.activityId.toString(); + } + if (message.tipsId !== 0n) { + obj.tipsId = message.tipsId.toString(); + } + return obj; + }, + + create, I>>(base?: I): TaskParam { + return TaskParam.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TaskParam { + const message = createBaseTaskParam(); + message.taskType = object.taskType ?? ""; + message.activityId = object.activityId ?? 0n; + message.tipsId = object.tipsId ?? 0n; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.proto b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.proto new file mode 100644 index 0000000..176d4de --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.proto @@ -0,0 +1,304 @@ +syntax = "proto3"; + +package bilibili.pgc.gateway.player.v2; + +import "src/io/com/bapis/bilibili/pgc/gateway/player/v2/PlayViewBusinessInfo.proto"; + +/** 展示信息 */ +message ViewInfo { + /** 弹窗 */ + Dialog dialog = 1; + /** Toast */ + Toast toast = 2; + /** 优惠券信息 */ + CouponInfo coupon_info = 3; + /** 未支付剧集ID列表 */ + repeated int64 demand_no_pay_epids = 4; + /** 结束页 */ + EndPage end_page = 5; + /** 扩展配置 */ + map exp_config = 6; + /** 弹窗 */ + PopWin pop_win = 7; + /** 试看提示栏 */ + PromptBar try_watch_prompt_bar = 8; + /** 支付提示信息 */ + PayTip pay_tip = 9; + /** 高清试看提示信息 */ + HighDefinitionTrialInfo high_definition_trial_info = 10; + /** 弹窗扩展 */ + map ext_dialog = 11; + /** 动画 */ + Animation animation = 12; + /** Toast扩展 */ + map ext_toast = 13; +} + +/** 鉴权浮层 */ +message Dialog { + /** 鉴权限制码 */ + int64 code = 1; + /** 鉴权限制信息 */ + string msg = 2; + /** 浮层类型 */ + string type = 3; + /** 浮层样式类型 */ + string style_type = 4; + /** 浮层配置 */ + DialogConfig config = 5; + /** 标题 */ + TextInfo title = 6; + /** 副标题 */ + TextInfo subtitle = 7; + /** 图片信息 */ + ImageInfo image = 8; + /** 按钮列表 */ + repeated ButtonInfo button = 9; + /** 底部描述 */ + ButtonInfo bottom_desc = 10; + /** 埋点上报信息 */ + Report report = 11; + /** 倒计时 秒 */ + int32 count_down_sec = 12; + /** 右下描述 */ + TextInfo right_bottom_desc = 13; + + repeated BottomDisplay bottom_display = 14; + + repeated PlayList play_list = 15; +} + +/** 鉴权浮层配置 */ +message DialogConfig { + /** 是否显示高斯模糊背景图 */ + bool is_show_cover = 1; + /** 是否响应转屏 */ + bool is_orientation_enable = 2; + /** 是否响应上滑吸顶 */ + bool is_nested_scroll_enable = 3; + /** 是否强制竖屏 */ + bool is_force_halfscreen_enable = 4; + /** 是否启用背景半透明 */ + bool is_background_translucent_enable = 5; +} + +/** 图片信息 */ +message ImageInfo { + /** 图片链接 */ + string url = 1; +} + +/** Dialog组件: 底部显示 */ +message BottomDisplay { + /** 文案 */ + TextInfo title = 1; + /** 图标 */ + string icon = 2; +} + +message PlayList { + + int32 season_id = 1; + + string title = 2; + + string cover = 3; + + string link = 4; + + BadgeInfo badge_info = 5; +} + +/** 优惠券信息 */ +message CouponInfo { + /** 提示框信息 */ + CouponToast toast = 1; + /** 弹窗信息 */ + PopWin pop_win = 2; +} + +/** 优惠券提示框信息 */ +message CouponToast { + /** 提示框文案信息 */ + CouponTextInfo text_info = 1; + /** 提示框按钮 */ + ButtonInfo button = 2; +} + +/** 优惠券提示框文案信息 */ +message CouponTextInfo { + /** 提示框文案-播正片6分钟预览 */ + string positive_preview = 1; + /** 提示框文案-播非正片分节ep */ + string section = 2; +} + +/** 弹窗信息 */ +message PopWin { + /** 弹窗标题 老字段 */ + string title = 1; + /** 优惠券列表 */ + repeated Coupon coupon = 2; + /** 弹窗按钮列表 */ + repeated ButtonInfo button = 3; + /** 底部文案 老字段 */ + string bottom_text = 4; + /** 弹窗标题 新字段 */ + TextInfo pop_title = 5; + /** 弹窗副标题 */ + TextInfo subtitle = 6; + /** 底部描述 新字段 */ + ButtonInfo bottom_desc = 7; + /** 弹窗小图 */ + string cover = 8; + /** 弹窗类型 */ + string pop_type = 9; +} + +/** 优惠券 */ +message Coupon { + /** 优惠券token */ + string coupon_token = 1; + /** + * 优惠券类型 + * | 1 | 2 | 3 | + * | :-: | :-: | :-: | + * | 折扣券 | 满减券 | 兑换券 | + */ + int64 type = 2; + /** 优惠券面值 */ + string value = 3; + /** 优惠券使用描述 */ + string use_desc = 4; + /** 优惠券标题 */ + string title = 5; + /** 优惠券描述 */ + string desc = 6; + /** 优惠券支付按钮文案 */ + string pay_button_text = 7; + /** 优惠券支付按钮删除线文案 */ + string pay_button_text_line_through = 8; + /** 实付金额 */ + string real_amount = 9; + /** 使用过期时间 */ + Timestamp expire_time = 10; + + int64 otype = 11; + + string amount = 12; +} + +/** 广告组件: 竖屏时视频下部提示栏 */ +message PromptBar { + /** 主标题, 如: "本片含大会员专享内容" */ + TextInfo title = 1; + /** 副标题, 如: "成为大会员可免费看全部剧集" */ + TextInfo sub_title = 2; + /** 副标题前面的icon */ + string sub_title_icon = 3; + /** 背景图 */ + string bg_image = 4; + /** 背景渐变色 */ + GradientColor bg_gradient_color = 5; + /** 按钮 */ + repeated ButtonInfo button = 6; + /** 埋点上报信息 */ + Report report = 7; + + string full_screen_ip_icon = 8; + + GradientColor full_screen_bg_gradient_color = 9; +} + +/** 大会员广告: 支付提示信息 */ +message PayTip { + /** 标题 */ + string title = 1; + /** 跳转链接 */ + string url = 2; + /** 图标 */ + string icon = 3; + /** 浮层类型 */ + int32 type = 4; + /** 显示类型 */ + int32 show_type = 5; + /** 图片信息 */ + string img = 6; + /** 白天背景颜色 */ + string bg_day_color = 7; + /** 夜间背景颜色 */ + string bg_night_color = 8; + /** 白天线条颜色 */ + string bg_line_color = 9; + /** 夜间线条颜色 */ + string bg_night_line_color = 10; + /** 文字颜色 */ + string text_color = 11; + /** 夜间文字颜色 */ + string text_night_color = 12; + /** 视图展示起始时间 */ + int64 view_start_time = 13; + /** 按钮列表 */ + repeated ButtonInfo button = 14; + /** 跳转链接打开方式 */ + int32 url_open_type = 15; + /** 埋点上报信息 */ + Report report = 16; + /** 角度样式 */ + int32 angle_style = 17; + /** 埋点上报类型 */ + int32 report_type = 18; + /** 订单埋点上报参数 */ + map order_report_params = 19; + /** 巨屏图片信息 */ + string giant_screen_img = 20; +} + +/** 高画质试看信息 */ +message HighDefinitionTrialInfo { + + bool trial_able = 1; + + int32 remaining_times = 2; + + int32 start = 3; + + int32 time_length = 4; + + Toast start_toast = 5; + + Toast end_toast = 6; + + Report report = 7; + + ButtonInfo quality_open_tip_btn = 8; + + ButtonInfo no_longer_trial_btn = 9; +} + +message Animation { + + map qn_svga_animation_map = 1; +} + +/** 播放结束后的尾页Dialog */ +message EndPage { + + Dialog dialog = 1; + + bool hide = 2; +} + +message 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. + int64 seconds = 1; + + // 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. + int32 nanos = 2; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.ts b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.ts new file mode 100644 index 0000000..ad4f3b1 --- /dev/null +++ b/src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.ts @@ -0,0 +1,3511 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/pgc/gateway/player/v2/ViewInfo.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { BadgeInfo, ButtonInfo, GradientColor, Report, TextInfo, Toast } from "./PlayViewBusinessInfo"; + +export const protobufPackage = "bilibili.pgc.gateway.player.v2"; + +/** 展示信息 */ +export interface ViewInfo { + /** 弹窗 */ + dialog: + | Dialog + | undefined; + /** Toast */ + toast: + | Toast + | undefined; + /** 优惠券信息 */ + couponInfo: + | CouponInfo + | undefined; + /** 未支付剧集ID列表 */ + demandNoPayEpids: bigint[]; + /** 结束页 */ + endPage: + | EndPage + | undefined; + /** 扩展配置 */ + expConfig: { [key: string]: boolean }; + /** 弹窗 */ + popWin: + | PopWin + | undefined; + /** 试看提示栏 */ + tryWatchPromptBar: + | PromptBar + | undefined; + /** 支付提示信息 */ + payTip: + | PayTip + | undefined; + /** 高清试看提示信息 */ + highDefinitionTrialInfo: + | HighDefinitionTrialInfo + | undefined; + /** 弹窗扩展 */ + extDialog: { [key: string]: Dialog }; + /** 动画 */ + animation: + | Animation + | undefined; + /** Toast扩展 */ + extToast: { [key: string]: Toast }; +} + +export interface ViewInfo_ExpConfigEntry { + key: string; + value: boolean; +} + +export interface ViewInfo_ExtDialogEntry { + key: string; + value: Dialog | undefined; +} + +export interface ViewInfo_ExtToastEntry { + key: string; + value: Toast | undefined; +} + +/** 鉴权浮层 */ +export interface Dialog { + /** 鉴权限制码 */ + code: bigint; + /** 鉴权限制信息 */ + msg: string; + /** 浮层类型 */ + type: string; + /** 浮层样式类型 */ + styleType: string; + /** 浮层配置 */ + config: + | DialogConfig + | undefined; + /** 标题 */ + title: + | TextInfo + | undefined; + /** 副标题 */ + subtitle: + | TextInfo + | undefined; + /** 图片信息 */ + image: + | ImageInfo + | undefined; + /** 按钮列表 */ + button: ButtonInfo[]; + /** 底部描述 */ + bottomDesc: + | ButtonInfo + | undefined; + /** 埋点上报信息 */ + report: + | Report + | undefined; + /** 倒计时 秒 */ + countDownSec: number; + /** 右下描述 */ + rightBottomDesc: TextInfo | undefined; + bottomDisplay: BottomDisplay[]; + playList: PlayList[]; +} + +/** 鉴权浮层配置 */ +export interface DialogConfig { + /** 是否显示高斯模糊背景图 */ + isShowCover: boolean; + /** 是否响应转屏 */ + isOrientationEnable: boolean; + /** 是否响应上滑吸顶 */ + isNestedScrollEnable: boolean; + /** 是否强制竖屏 */ + isForceHalfscreenEnable: boolean; + /** 是否启用背景半透明 */ + isBackgroundTranslucentEnable: boolean; +} + +/** 图片信息 */ +export interface ImageInfo { + /** 图片链接 */ + url: string; +} + +/** Dialog组件: 底部显示 */ +export interface BottomDisplay { + /** 文案 */ + title: + | TextInfo + | undefined; + /** 图标 */ + icon: string; +} + +export interface PlayList { + seasonId: number; + title: string; + cover: string; + link: string; + badgeInfo: BadgeInfo | undefined; +} + +/** 优惠券信息 */ +export interface CouponInfo { + /** 提示框信息 */ + toast: + | CouponToast + | undefined; + /** 弹窗信息 */ + popWin: PopWin | undefined; +} + +/** 优惠券提示框信息 */ +export interface CouponToast { + /** 提示框文案信息 */ + textInfo: + | CouponTextInfo + | undefined; + /** 提示框按钮 */ + button: ButtonInfo | undefined; +} + +/** 优惠券提示框文案信息 */ +export interface CouponTextInfo { + /** 提示框文案-播正片6分钟预览 */ + positivePreview: string; + /** 提示框文案-播非正片分节ep */ + section: string; +} + +/** 弹窗信息 */ +export interface PopWin { + /** 弹窗标题 老字段 */ + title: string; + /** 优惠券列表 */ + coupon: Coupon[]; + /** 弹窗按钮列表 */ + button: ButtonInfo[]; + /** 底部文案 老字段 */ + bottomText: string; + /** 弹窗标题 新字段 */ + popTitle: + | TextInfo + | undefined; + /** 弹窗副标题 */ + subtitle: + | TextInfo + | undefined; + /** 底部描述 新字段 */ + bottomDesc: + | ButtonInfo + | undefined; + /** 弹窗小图 */ + cover: string; + /** 弹窗类型 */ + popType: string; +} + +/** 优惠券 */ +export interface Coupon { + /** 优惠券token */ + couponToken: string; + /** + * 优惠券类型 + * | 1 | 2 | 3 | + * | :-: | :-: | :-: | + * | 折扣券 | 满减券 | 兑换券 | + */ + type: bigint; + /** 优惠券面值 */ + value: string; + /** 优惠券使用描述 */ + useDesc: string; + /** 优惠券标题 */ + title: string; + /** 优惠券描述 */ + desc: string; + /** 优惠券支付按钮文案 */ + payButtonText: string; + /** 优惠券支付按钮删除线文案 */ + payButtonTextLineThrough: string; + /** 实付金额 */ + realAmount: string; + /** 使用过期时间 */ + expireTime: Timestamp | undefined; + otype: bigint; + amount: string; +} + +/** 广告组件: 竖屏时视频下部提示栏 */ +export interface PromptBar { + /** 主标题, 如: "本片含大会员专享内容" */ + title: + | TextInfo + | undefined; + /** 副标题, 如: "成为大会员可免费看全部剧集" */ + subTitle: + | TextInfo + | undefined; + /** 副标题前面的icon */ + subTitleIcon: string; + /** 背景图 */ + bgImage: string; + /** 背景渐变色 */ + bgGradientColor: + | GradientColor + | undefined; + /** 按钮 */ + button: ButtonInfo[]; + /** 埋点上报信息 */ + report: Report | undefined; + fullScreenIpIcon: string; + fullScreenBgGradientColor: GradientColor | undefined; +} + +/** 大会员广告: 支付提示信息 */ +export interface PayTip { + /** 标题 */ + title: string; + /** 跳转链接 */ + url: string; + /** 图标 */ + icon: string; + /** 浮层类型 */ + type: number; + /** 显示类型 */ + showType: number; + /** 图片信息 */ + img: string; + /** 白天背景颜色 */ + bgDayColor: string; + /** 夜间背景颜色 */ + bgNightColor: string; + /** 白天线条颜色 */ + bgLineColor: string; + /** 夜间线条颜色 */ + bgNightLineColor: string; + /** 文字颜色 */ + textColor: string; + /** 夜间文字颜色 */ + textNightColor: string; + /** 视图展示起始时间 */ + viewStartTime: bigint; + /** 按钮列表 */ + button: ButtonInfo[]; + /** 跳转链接打开方式 */ + urlOpenType: number; + /** 埋点上报信息 */ + report: + | Report + | undefined; + /** 角度样式 */ + angleStyle: number; + /** 埋点上报类型 */ + reportType: number; + /** 订单埋点上报参数 */ + orderReportParams: { [key: string]: string }; + /** 巨屏图片信息 */ + giantScreenImg: string; +} + +export interface PayTip_OrderReportParamsEntry { + key: string; + value: string; +} + +/** 高画质试看信息 */ +export interface HighDefinitionTrialInfo { + trialAble: boolean; + remainingTimes: number; + start: number; + timeLength: number; + startToast: Toast | undefined; + endToast: Toast | undefined; + report: Report | undefined; + qualityOpenTipBtn: ButtonInfo | undefined; + noLongerTrialBtn: ButtonInfo | undefined; +} + +export interface Animation { + qnSvgaAnimationMap: { [key: string]: string }; +} + +export interface Animation_QnSvgaAnimationMapEntry { + key: string; + value: string; +} + +/** 播放结束后的尾页Dialog */ +export interface EndPage { + dialog: Dialog | undefined; + hide: boolean; +} + +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: bigint; + /** + * 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 createBaseViewInfo(): ViewInfo { + return { + dialog: undefined, + toast: undefined, + couponInfo: undefined, + demandNoPayEpids: [], + endPage: undefined, + expConfig: {}, + popWin: undefined, + tryWatchPromptBar: undefined, + payTip: undefined, + highDefinitionTrialInfo: undefined, + extDialog: {}, + animation: undefined, + extToast: {}, + }; +} + +export const ViewInfo: MessageFns = { + encode(message: ViewInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dialog !== undefined) { + Dialog.encode(message.dialog, writer.uint32(10).fork()).join(); + } + if (message.toast !== undefined) { + Toast.encode(message.toast, writer.uint32(18).fork()).join(); + } + if (message.couponInfo !== undefined) { + CouponInfo.encode(message.couponInfo, writer.uint32(26).fork()).join(); + } + writer.uint32(34).fork(); + for (const v of message.demandNoPayEpids) { + if (BigInt.asIntN(64, v) !== v) { + throw new globalThis.Error("a value provided in array field demandNoPayEpids of type int64 is too large"); + } + writer.int64(v); + } + writer.join(); + if (message.endPage !== undefined) { + EndPage.encode(message.endPage, writer.uint32(42).fork()).join(); + } + Object.entries(message.expConfig).forEach(([key, value]) => { + ViewInfo_ExpConfigEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).join(); + }); + if (message.popWin !== undefined) { + PopWin.encode(message.popWin, writer.uint32(58).fork()).join(); + } + if (message.tryWatchPromptBar !== undefined) { + PromptBar.encode(message.tryWatchPromptBar, writer.uint32(66).fork()).join(); + } + if (message.payTip !== undefined) { + PayTip.encode(message.payTip, writer.uint32(74).fork()).join(); + } + if (message.highDefinitionTrialInfo !== undefined) { + HighDefinitionTrialInfo.encode(message.highDefinitionTrialInfo, writer.uint32(82).fork()).join(); + } + Object.entries(message.extDialog).forEach(([key, value]) => { + ViewInfo_ExtDialogEntry.encode({ key: key as any, value }, writer.uint32(90).fork()).join(); + }); + if (message.animation !== undefined) { + Animation.encode(message.animation, writer.uint32(98).fork()).join(); + } + Object.entries(message.extToast).forEach(([key, value]) => { + ViewInfo_ExtToastEntry.encode({ key: key as any, value }, writer.uint32(106).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ViewInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseViewInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dialog = Dialog.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.toast = Toast.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.couponInfo = CouponInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag === 32) { + message.demandNoPayEpids.push(reader.int64() as bigint); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.demandNoPayEpids.push(reader.int64() as bigint); + } + + continue; + } + + break; + case 5: + if (tag !== 42) { + break; + } + + message.endPage = EndPage.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + const entry6 = ViewInfo_ExpConfigEntry.decode(reader, reader.uint32()); + if (entry6.value !== undefined) { + message.expConfig[entry6.key] = entry6.value; + } + continue; + case 7: + if (tag !== 58) { + break; + } + + message.popWin = PopWin.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.tryWatchPromptBar = PromptBar.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.payTip = PayTip.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.highDefinitionTrialInfo = HighDefinitionTrialInfo.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + const entry11 = ViewInfo_ExtDialogEntry.decode(reader, reader.uint32()); + if (entry11.value !== undefined) { + message.extDialog[entry11.key] = entry11.value; + } + continue; + case 12: + if (tag !== 98) { + break; + } + + message.animation = Animation.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + const entry13 = ViewInfo_ExtToastEntry.decode(reader, reader.uint32()); + if (entry13.value !== undefined) { + message.extToast[entry13.key] = entry13.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ViewInfo { + return { + dialog: isSet(object.dialog) ? Dialog.fromJSON(object.dialog) : undefined, + toast: isSet(object.toast) ? Toast.fromJSON(object.toast) : undefined, + couponInfo: isSet(object.couponInfo) ? CouponInfo.fromJSON(object.couponInfo) : undefined, + demandNoPayEpids: globalThis.Array.isArray(object?.demandNoPayEpids) + ? object.demandNoPayEpids.map((e: any) => BigInt(e)) + : [], + endPage: isSet(object.endPage) ? EndPage.fromJSON(object.endPage) : undefined, + expConfig: isObject(object.expConfig) + ? Object.entries(object.expConfig).reduce<{ [key: string]: boolean }>((acc, [key, value]) => { + acc[key] = Boolean(value); + return acc; + }, {}) + : {}, + popWin: isSet(object.popWin) ? PopWin.fromJSON(object.popWin) : undefined, + tryWatchPromptBar: isSet(object.tryWatchPromptBar) ? PromptBar.fromJSON(object.tryWatchPromptBar) : undefined, + payTip: isSet(object.payTip) ? PayTip.fromJSON(object.payTip) : undefined, + highDefinitionTrialInfo: isSet(object.highDefinitionTrialInfo) + ? HighDefinitionTrialInfo.fromJSON(object.highDefinitionTrialInfo) + : undefined, + extDialog: isObject(object.extDialog) + ? Object.entries(object.extDialog).reduce<{ [key: string]: Dialog }>((acc, [key, value]) => { + acc[key] = Dialog.fromJSON(value); + return acc; + }, {}) + : {}, + animation: isSet(object.animation) ? Animation.fromJSON(object.animation) : undefined, + extToast: isObject(object.extToast) + ? Object.entries(object.extToast).reduce<{ [key: string]: Toast }>((acc, [key, value]) => { + acc[key] = Toast.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: ViewInfo): unknown { + const obj: any = {}; + if (message.dialog !== undefined) { + obj.dialog = Dialog.toJSON(message.dialog); + } + if (message.toast !== undefined) { + obj.toast = Toast.toJSON(message.toast); + } + if (message.couponInfo !== undefined) { + obj.couponInfo = CouponInfo.toJSON(message.couponInfo); + } + if (message.demandNoPayEpids?.length) { + obj.demandNoPayEpids = message.demandNoPayEpids.map((e) => e.toString()); + } + if (message.endPage !== undefined) { + obj.endPage = EndPage.toJSON(message.endPage); + } + if (message.expConfig) { + const entries = Object.entries(message.expConfig); + if (entries.length > 0) { + obj.expConfig = {}; + entries.forEach(([k, v]) => { + obj.expConfig[k] = v; + }); + } + } + if (message.popWin !== undefined) { + obj.popWin = PopWin.toJSON(message.popWin); + } + if (message.tryWatchPromptBar !== undefined) { + obj.tryWatchPromptBar = PromptBar.toJSON(message.tryWatchPromptBar); + } + if (message.payTip !== undefined) { + obj.payTip = PayTip.toJSON(message.payTip); + } + if (message.highDefinitionTrialInfo !== undefined) { + obj.highDefinitionTrialInfo = HighDefinitionTrialInfo.toJSON(message.highDefinitionTrialInfo); + } + if (message.extDialog) { + const entries = Object.entries(message.extDialog); + if (entries.length > 0) { + obj.extDialog = {}; + entries.forEach(([k, v]) => { + obj.extDialog[k] = Dialog.toJSON(v); + }); + } + } + if (message.animation !== undefined) { + obj.animation = Animation.toJSON(message.animation); + } + if (message.extToast) { + const entries = Object.entries(message.extToast); + if (entries.length > 0) { + obj.extToast = {}; + entries.forEach(([k, v]) => { + obj.extToast[k] = Toast.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): ViewInfo { + return ViewInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ViewInfo { + const message = createBaseViewInfo(); + message.dialog = (object.dialog !== undefined && object.dialog !== null) + ? Dialog.fromPartial(object.dialog) + : undefined; + message.toast = (object.toast !== undefined && object.toast !== null) ? Toast.fromPartial(object.toast) : undefined; + message.couponInfo = (object.couponInfo !== undefined && object.couponInfo !== null) + ? CouponInfo.fromPartial(object.couponInfo) + : undefined; + message.demandNoPayEpids = object.demandNoPayEpids?.map((e) => e) || []; + message.endPage = (object.endPage !== undefined && object.endPage !== null) + ? EndPage.fromPartial(object.endPage) + : undefined; + message.expConfig = Object.entries(object.expConfig ?? {}).reduce<{ [key: string]: boolean }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.Boolean(value); + } + return acc; + }, + {}, + ); + message.popWin = (object.popWin !== undefined && object.popWin !== null) + ? PopWin.fromPartial(object.popWin) + : undefined; + message.tryWatchPromptBar = (object.tryWatchPromptBar !== undefined && object.tryWatchPromptBar !== null) + ? PromptBar.fromPartial(object.tryWatchPromptBar) + : undefined; + message.payTip = (object.payTip !== undefined && object.payTip !== null) + ? PayTip.fromPartial(object.payTip) + : undefined; + message.highDefinitionTrialInfo = + (object.highDefinitionTrialInfo !== undefined && object.highDefinitionTrialInfo !== null) + ? HighDefinitionTrialInfo.fromPartial(object.highDefinitionTrialInfo) + : undefined; + message.extDialog = Object.entries(object.extDialog ?? {}).reduce<{ [key: string]: Dialog }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Dialog.fromPartial(value); + } + return acc; + }, + {}, + ); + message.animation = (object.animation !== undefined && object.animation !== null) + ? Animation.fromPartial(object.animation) + : undefined; + message.extToast = Object.entries(object.extToast ?? {}).reduce<{ [key: string]: Toast }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Toast.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseViewInfo_ExpConfigEntry(): ViewInfo_ExpConfigEntry { + return { key: "", value: false }; +} + +export const ViewInfo_ExpConfigEntry: MessageFns = { + encode(message: ViewInfo_ExpConfigEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== false) { + writer.uint32(16).bool(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ViewInfo_ExpConfigEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseViewInfo_ExpConfigEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.value = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ViewInfo_ExpConfigEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.Boolean(object.value) : false, + }; + }, + + toJSON(message: ViewInfo_ExpConfigEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== false) { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ViewInfo_ExpConfigEntry { + return ViewInfo_ExpConfigEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ViewInfo_ExpConfigEntry { + const message = createBaseViewInfo_ExpConfigEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? false; + return message; + }, +}; + +function createBaseViewInfo_ExtDialogEntry(): ViewInfo_ExtDialogEntry { + return { key: "", value: undefined }; +} + +export const ViewInfo_ExtDialogEntry: MessageFns = { + encode(message: ViewInfo_ExtDialogEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Dialog.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ViewInfo_ExtDialogEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseViewInfo_ExtDialogEntry(); + 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 = Dialog.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ViewInfo_ExtDialogEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Dialog.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ViewInfo_ExtDialogEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Dialog.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): ViewInfo_ExtDialogEntry { + return ViewInfo_ExtDialogEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ViewInfo_ExtDialogEntry { + const message = createBaseViewInfo_ExtDialogEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Dialog.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseViewInfo_ExtToastEntry(): ViewInfo_ExtToastEntry { + return { key: "", value: undefined }; +} + +export const ViewInfo_ExtToastEntry: MessageFns = { + encode(message: ViewInfo_ExtToastEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Toast.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ViewInfo_ExtToastEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseViewInfo_ExtToastEntry(); + 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 = Toast.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ViewInfo_ExtToastEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Toast.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: ViewInfo_ExtToastEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Toast.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): ViewInfo_ExtToastEntry { + return ViewInfo_ExtToastEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ViewInfo_ExtToastEntry { + const message = createBaseViewInfo_ExtToastEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Toast.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseDialog(): Dialog { + return { + code: 0n, + msg: "", + type: "", + styleType: "", + config: undefined, + title: undefined, + subtitle: undefined, + image: undefined, + button: [], + bottomDesc: undefined, + report: undefined, + countDownSec: 0, + rightBottomDesc: undefined, + bottomDisplay: [], + playList: [], + }; +} + +export const Dialog: MessageFns = { + encode(message: Dialog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0n) { + if (BigInt.asIntN(64, message.code) !== message.code) { + throw new globalThis.Error("value provided for field message.code of type int64 too large"); + } + writer.uint32(8).int64(message.code); + } + if (message.msg !== "") { + writer.uint32(18).string(message.msg); + } + if (message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.styleType !== "") { + writer.uint32(34).string(message.styleType); + } + if (message.config !== undefined) { + DialogConfig.encode(message.config, writer.uint32(42).fork()).join(); + } + if (message.title !== undefined) { + TextInfo.encode(message.title, writer.uint32(50).fork()).join(); + } + if (message.subtitle !== undefined) { + TextInfo.encode(message.subtitle, writer.uint32(58).fork()).join(); + } + if (message.image !== undefined) { + ImageInfo.encode(message.image, writer.uint32(66).fork()).join(); + } + for (const v of message.button) { + ButtonInfo.encode(v!, writer.uint32(74).fork()).join(); + } + if (message.bottomDesc !== undefined) { + ButtonInfo.encode(message.bottomDesc, writer.uint32(82).fork()).join(); + } + if (message.report !== undefined) { + Report.encode(message.report, writer.uint32(90).fork()).join(); + } + if (message.countDownSec !== 0) { + writer.uint32(96).int32(message.countDownSec); + } + if (message.rightBottomDesc !== undefined) { + TextInfo.encode(message.rightBottomDesc, writer.uint32(106).fork()).join(); + } + for (const v of message.bottomDisplay) { + BottomDisplay.encode(v!, writer.uint32(114).fork()).join(); + } + for (const v of message.playList) { + PlayList.encode(v!, writer.uint32(122).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Dialog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDialog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.int64() as bigint; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msg = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.styleType = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.config = DialogConfig.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.title = TextInfo.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.subtitle = TextInfo.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.image = ImageInfo.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.button.push(ButtonInfo.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.bottomDesc = ButtonInfo.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.report = Report.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.countDownSec = reader.int32(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.rightBottomDesc = TextInfo.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.bottomDisplay.push(BottomDisplay.decode(reader, reader.uint32())); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.playList.push(PlayList.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Dialog { + return { + code: isSet(object.code) ? BigInt(object.code) : 0n, + msg: isSet(object.msg) ? globalThis.String(object.msg) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + styleType: isSet(object.styleType) ? globalThis.String(object.styleType) : "", + config: isSet(object.config) ? DialogConfig.fromJSON(object.config) : undefined, + title: isSet(object.title) ? TextInfo.fromJSON(object.title) : undefined, + subtitle: isSet(object.subtitle) ? TextInfo.fromJSON(object.subtitle) : undefined, + image: isSet(object.image) ? ImageInfo.fromJSON(object.image) : undefined, + button: globalThis.Array.isArray(object?.button) ? object.button.map((e: any) => ButtonInfo.fromJSON(e)) : [], + bottomDesc: isSet(object.bottomDesc) ? ButtonInfo.fromJSON(object.bottomDesc) : undefined, + report: isSet(object.report) ? Report.fromJSON(object.report) : undefined, + countDownSec: isSet(object.countDownSec) ? globalThis.Number(object.countDownSec) : 0, + rightBottomDesc: isSet(object.rightBottomDesc) ? TextInfo.fromJSON(object.rightBottomDesc) : undefined, + bottomDisplay: globalThis.Array.isArray(object?.bottomDisplay) + ? object.bottomDisplay.map((e: any) => BottomDisplay.fromJSON(e)) + : [], + playList: globalThis.Array.isArray(object?.playList) ? object.playList.map((e: any) => PlayList.fromJSON(e)) : [], + }; + }, + + toJSON(message: Dialog): unknown { + const obj: any = {}; + if (message.code !== 0n) { + obj.code = message.code.toString(); + } + if (message.msg !== "") { + obj.msg = message.msg; + } + if (message.type !== "") { + obj.type = message.type; + } + if (message.styleType !== "") { + obj.styleType = message.styleType; + } + if (message.config !== undefined) { + obj.config = DialogConfig.toJSON(message.config); + } + if (message.title !== undefined) { + obj.title = TextInfo.toJSON(message.title); + } + if (message.subtitle !== undefined) { + obj.subtitle = TextInfo.toJSON(message.subtitle); + } + if (message.image !== undefined) { + obj.image = ImageInfo.toJSON(message.image); + } + if (message.button?.length) { + obj.button = message.button.map((e) => ButtonInfo.toJSON(e)); + } + if (message.bottomDesc !== undefined) { + obj.bottomDesc = ButtonInfo.toJSON(message.bottomDesc); + } + if (message.report !== undefined) { + obj.report = Report.toJSON(message.report); + } + if (message.countDownSec !== 0) { + obj.countDownSec = Math.round(message.countDownSec); + } + if (message.rightBottomDesc !== undefined) { + obj.rightBottomDesc = TextInfo.toJSON(message.rightBottomDesc); + } + if (message.bottomDisplay?.length) { + obj.bottomDisplay = message.bottomDisplay.map((e) => BottomDisplay.toJSON(e)); + } + if (message.playList?.length) { + obj.playList = message.playList.map((e) => PlayList.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Dialog { + return Dialog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Dialog { + const message = createBaseDialog(); + message.code = object.code ?? 0n; + message.msg = object.msg ?? ""; + message.type = object.type ?? ""; + message.styleType = object.styleType ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? DialogConfig.fromPartial(object.config) + : undefined; + message.title = (object.title !== undefined && object.title !== null) + ? TextInfo.fromPartial(object.title) + : undefined; + message.subtitle = (object.subtitle !== undefined && object.subtitle !== null) + ? TextInfo.fromPartial(object.subtitle) + : undefined; + message.image = (object.image !== undefined && object.image !== null) + ? ImageInfo.fromPartial(object.image) + : undefined; + message.button = object.button?.map((e) => ButtonInfo.fromPartial(e)) || []; + message.bottomDesc = (object.bottomDesc !== undefined && object.bottomDesc !== null) + ? ButtonInfo.fromPartial(object.bottomDesc) + : undefined; + message.report = (object.report !== undefined && object.report !== null) + ? Report.fromPartial(object.report) + : undefined; + message.countDownSec = object.countDownSec ?? 0; + message.rightBottomDesc = (object.rightBottomDesc !== undefined && object.rightBottomDesc !== null) + ? TextInfo.fromPartial(object.rightBottomDesc) + : undefined; + message.bottomDisplay = object.bottomDisplay?.map((e) => BottomDisplay.fromPartial(e)) || []; + message.playList = object.playList?.map((e) => PlayList.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDialogConfig(): DialogConfig { + return { + isShowCover: false, + isOrientationEnable: false, + isNestedScrollEnable: false, + isForceHalfscreenEnable: false, + isBackgroundTranslucentEnable: false, + }; +} + +export const DialogConfig: MessageFns = { + encode(message: DialogConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.isShowCover !== false) { + writer.uint32(8).bool(message.isShowCover); + } + if (message.isOrientationEnable !== false) { + writer.uint32(16).bool(message.isOrientationEnable); + } + if (message.isNestedScrollEnable !== false) { + writer.uint32(24).bool(message.isNestedScrollEnable); + } + if (message.isForceHalfscreenEnable !== false) { + writer.uint32(32).bool(message.isForceHalfscreenEnable); + } + if (message.isBackgroundTranslucentEnable !== false) { + writer.uint32(40).bool(message.isBackgroundTranslucentEnable); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DialogConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDialogConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.isShowCover = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.isOrientationEnable = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.isNestedScrollEnable = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isForceHalfscreenEnable = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.isBackgroundTranslucentEnable = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DialogConfig { + return { + isShowCover: isSet(object.isShowCover) ? globalThis.Boolean(object.isShowCover) : false, + isOrientationEnable: isSet(object.isOrientationEnable) ? globalThis.Boolean(object.isOrientationEnable) : false, + isNestedScrollEnable: isSet(object.isNestedScrollEnable) + ? globalThis.Boolean(object.isNestedScrollEnable) + : false, + isForceHalfscreenEnable: isSet(object.isForceHalfscreenEnable) + ? globalThis.Boolean(object.isForceHalfscreenEnable) + : false, + isBackgroundTranslucentEnable: isSet(object.isBackgroundTranslucentEnable) + ? globalThis.Boolean(object.isBackgroundTranslucentEnable) + : false, + }; + }, + + toJSON(message: DialogConfig): unknown { + const obj: any = {}; + if (message.isShowCover !== false) { + obj.isShowCover = message.isShowCover; + } + if (message.isOrientationEnable !== false) { + obj.isOrientationEnable = message.isOrientationEnable; + } + if (message.isNestedScrollEnable !== false) { + obj.isNestedScrollEnable = message.isNestedScrollEnable; + } + if (message.isForceHalfscreenEnable !== false) { + obj.isForceHalfscreenEnable = message.isForceHalfscreenEnable; + } + if (message.isBackgroundTranslucentEnable !== false) { + obj.isBackgroundTranslucentEnable = message.isBackgroundTranslucentEnable; + } + return obj; + }, + + create, I>>(base?: I): DialogConfig { + return DialogConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DialogConfig { + const message = createBaseDialogConfig(); + message.isShowCover = object.isShowCover ?? false; + message.isOrientationEnable = object.isOrientationEnable ?? false; + message.isNestedScrollEnable = object.isNestedScrollEnable ?? false; + message.isForceHalfscreenEnable = object.isForceHalfscreenEnable ?? false; + message.isBackgroundTranslucentEnable = object.isBackgroundTranslucentEnable ?? false; + return message; + }, +}; + +function createBaseImageInfo(): ImageInfo { + return { url: "" }; +} + +export const ImageInfo: MessageFns = { + encode(message: ImageInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.url !== "") { + writer.uint32(10).string(message.url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ImageInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseImageInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.url = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ImageInfo { + return { url: isSet(object.url) ? globalThis.String(object.url) : "" }; + }, + + toJSON(message: ImageInfo): unknown { + const obj: any = {}; + if (message.url !== "") { + obj.url = message.url; + } + return obj; + }, + + create, I>>(base?: I): ImageInfo { + return ImageInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ImageInfo { + const message = createBaseImageInfo(); + message.url = object.url ?? ""; + return message; + }, +}; + +function createBaseBottomDisplay(): BottomDisplay { + return { title: undefined, icon: "" }; +} + +export const BottomDisplay: MessageFns = { + encode(message: BottomDisplay, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== undefined) { + TextInfo.encode(message.title, writer.uint32(10).fork()).join(); + } + if (message.icon !== "") { + writer.uint32(18).string(message.icon); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BottomDisplay { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBottomDisplay(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = TextInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.icon = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BottomDisplay { + return { + title: isSet(object.title) ? TextInfo.fromJSON(object.title) : undefined, + icon: isSet(object.icon) ? globalThis.String(object.icon) : "", + }; + }, + + toJSON(message: BottomDisplay): unknown { + const obj: any = {}; + if (message.title !== undefined) { + obj.title = TextInfo.toJSON(message.title); + } + if (message.icon !== "") { + obj.icon = message.icon; + } + return obj; + }, + + create, I>>(base?: I): BottomDisplay { + return BottomDisplay.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BottomDisplay { + const message = createBaseBottomDisplay(); + message.title = (object.title !== undefined && object.title !== null) + ? TextInfo.fromPartial(object.title) + : undefined; + message.icon = object.icon ?? ""; + return message; + }, +}; + +function createBasePlayList(): PlayList { + return { seasonId: 0, title: "", cover: "", link: "", badgeInfo: undefined }; +} + +export const PlayList: MessageFns = { + encode(message: PlayList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seasonId !== 0) { + writer.uint32(8).int32(message.seasonId); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.cover !== "") { + writer.uint32(26).string(message.cover); + } + if (message.link !== "") { + writer.uint32(34).string(message.link); + } + if (message.badgeInfo !== undefined) { + BadgeInfo.encode(message.badgeInfo, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seasonId = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.cover = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.link = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.badgeInfo = BadgeInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayList { + return { + seasonId: isSet(object.seasonId) ? globalThis.Number(object.seasonId) : 0, + title: isSet(object.title) ? globalThis.String(object.title) : "", + cover: isSet(object.cover) ? globalThis.String(object.cover) : "", + link: isSet(object.link) ? globalThis.String(object.link) : "", + badgeInfo: isSet(object.badgeInfo) ? BadgeInfo.fromJSON(object.badgeInfo) : undefined, + }; + }, + + toJSON(message: PlayList): unknown { + const obj: any = {}; + if (message.seasonId !== 0) { + obj.seasonId = Math.round(message.seasonId); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.cover !== "") { + obj.cover = message.cover; + } + if (message.link !== "") { + obj.link = message.link; + } + if (message.badgeInfo !== undefined) { + obj.badgeInfo = BadgeInfo.toJSON(message.badgeInfo); + } + return obj; + }, + + create, I>>(base?: I): PlayList { + return PlayList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayList { + const message = createBasePlayList(); + message.seasonId = object.seasonId ?? 0; + message.title = object.title ?? ""; + message.cover = object.cover ?? ""; + message.link = object.link ?? ""; + message.badgeInfo = (object.badgeInfo !== undefined && object.badgeInfo !== null) + ? BadgeInfo.fromPartial(object.badgeInfo) + : undefined; + return message; + }, +}; + +function createBaseCouponInfo(): CouponInfo { + return { toast: undefined, popWin: undefined }; +} + +export const CouponInfo: MessageFns = { + encode(message: CouponInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.toast !== undefined) { + CouponToast.encode(message.toast, writer.uint32(10).fork()).join(); + } + if (message.popWin !== undefined) { + PopWin.encode(message.popWin, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CouponInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCouponInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.toast = CouponToast.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.popWin = PopWin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CouponInfo { + return { + toast: isSet(object.toast) ? CouponToast.fromJSON(object.toast) : undefined, + popWin: isSet(object.popWin) ? PopWin.fromJSON(object.popWin) : undefined, + }; + }, + + toJSON(message: CouponInfo): unknown { + const obj: any = {}; + if (message.toast !== undefined) { + obj.toast = CouponToast.toJSON(message.toast); + } + if (message.popWin !== undefined) { + obj.popWin = PopWin.toJSON(message.popWin); + } + return obj; + }, + + create, I>>(base?: I): CouponInfo { + return CouponInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CouponInfo { + const message = createBaseCouponInfo(); + message.toast = (object.toast !== undefined && object.toast !== null) + ? CouponToast.fromPartial(object.toast) + : undefined; + message.popWin = (object.popWin !== undefined && object.popWin !== null) + ? PopWin.fromPartial(object.popWin) + : undefined; + return message; + }, +}; + +function createBaseCouponToast(): CouponToast { + return { textInfo: undefined, button: undefined }; +} + +export const CouponToast: MessageFns = { + encode(message: CouponToast, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.textInfo !== undefined) { + CouponTextInfo.encode(message.textInfo, writer.uint32(10).fork()).join(); + } + if (message.button !== undefined) { + ButtonInfo.encode(message.button, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CouponToast { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCouponToast(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.textInfo = CouponTextInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.button = ButtonInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CouponToast { + return { + textInfo: isSet(object.textInfo) ? CouponTextInfo.fromJSON(object.textInfo) : undefined, + button: isSet(object.button) ? ButtonInfo.fromJSON(object.button) : undefined, + }; + }, + + toJSON(message: CouponToast): unknown { + const obj: any = {}; + if (message.textInfo !== undefined) { + obj.textInfo = CouponTextInfo.toJSON(message.textInfo); + } + if (message.button !== undefined) { + obj.button = ButtonInfo.toJSON(message.button); + } + return obj; + }, + + create, I>>(base?: I): CouponToast { + return CouponToast.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CouponToast { + const message = createBaseCouponToast(); + message.textInfo = (object.textInfo !== undefined && object.textInfo !== null) + ? CouponTextInfo.fromPartial(object.textInfo) + : undefined; + message.button = (object.button !== undefined && object.button !== null) + ? ButtonInfo.fromPartial(object.button) + : undefined; + return message; + }, +}; + +function createBaseCouponTextInfo(): CouponTextInfo { + return { positivePreview: "", section: "" }; +} + +export const CouponTextInfo: MessageFns = { + encode(message: CouponTextInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.positivePreview !== "") { + writer.uint32(10).string(message.positivePreview); + } + if (message.section !== "") { + writer.uint32(18).string(message.section); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CouponTextInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCouponTextInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.positivePreview = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.section = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CouponTextInfo { + return { + positivePreview: isSet(object.positivePreview) ? globalThis.String(object.positivePreview) : "", + section: isSet(object.section) ? globalThis.String(object.section) : "", + }; + }, + + toJSON(message: CouponTextInfo): unknown { + const obj: any = {}; + if (message.positivePreview !== "") { + obj.positivePreview = message.positivePreview; + } + if (message.section !== "") { + obj.section = message.section; + } + return obj; + }, + + create, I>>(base?: I): CouponTextInfo { + return CouponTextInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CouponTextInfo { + const message = createBaseCouponTextInfo(); + message.positivePreview = object.positivePreview ?? ""; + message.section = object.section ?? ""; + return message; + }, +}; + +function createBasePopWin(): PopWin { + return { + title: "", + coupon: [], + button: [], + bottomText: "", + popTitle: undefined, + subtitle: undefined, + bottomDesc: undefined, + cover: "", + popType: "", + }; +} + +export const PopWin: MessageFns = { + encode(message: PopWin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + for (const v of message.coupon) { + Coupon.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.button) { + ButtonInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.bottomText !== "") { + writer.uint32(34).string(message.bottomText); + } + if (message.popTitle !== undefined) { + TextInfo.encode(message.popTitle, writer.uint32(42).fork()).join(); + } + if (message.subtitle !== undefined) { + TextInfo.encode(message.subtitle, writer.uint32(50).fork()).join(); + } + if (message.bottomDesc !== undefined) { + ButtonInfo.encode(message.bottomDesc, writer.uint32(58).fork()).join(); + } + if (message.cover !== "") { + writer.uint32(66).string(message.cover); + } + if (message.popType !== "") { + writer.uint32(74).string(message.popType); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PopWin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePopWin(); + 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.coupon.push(Coupon.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.button.push(ButtonInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bottomText = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.popTitle = TextInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.subtitle = TextInfo.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.bottomDesc = ButtonInfo.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cover = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.popType = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PopWin { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + coupon: globalThis.Array.isArray(object?.coupon) ? object.coupon.map((e: any) => Coupon.fromJSON(e)) : [], + button: globalThis.Array.isArray(object?.button) ? object.button.map((e: any) => ButtonInfo.fromJSON(e)) : [], + bottomText: isSet(object.bottomText) ? globalThis.String(object.bottomText) : "", + popTitle: isSet(object.popTitle) ? TextInfo.fromJSON(object.popTitle) : undefined, + subtitle: isSet(object.subtitle) ? TextInfo.fromJSON(object.subtitle) : undefined, + bottomDesc: isSet(object.bottomDesc) ? ButtonInfo.fromJSON(object.bottomDesc) : undefined, + cover: isSet(object.cover) ? globalThis.String(object.cover) : "", + popType: isSet(object.popType) ? globalThis.String(object.popType) : "", + }; + }, + + toJSON(message: PopWin): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.coupon?.length) { + obj.coupon = message.coupon.map((e) => Coupon.toJSON(e)); + } + if (message.button?.length) { + obj.button = message.button.map((e) => ButtonInfo.toJSON(e)); + } + if (message.bottomText !== "") { + obj.bottomText = message.bottomText; + } + if (message.popTitle !== undefined) { + obj.popTitle = TextInfo.toJSON(message.popTitle); + } + if (message.subtitle !== undefined) { + obj.subtitle = TextInfo.toJSON(message.subtitle); + } + if (message.bottomDesc !== undefined) { + obj.bottomDesc = ButtonInfo.toJSON(message.bottomDesc); + } + if (message.cover !== "") { + obj.cover = message.cover; + } + if (message.popType !== "") { + obj.popType = message.popType; + } + return obj; + }, + + create, I>>(base?: I): PopWin { + return PopWin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PopWin { + const message = createBasePopWin(); + message.title = object.title ?? ""; + message.coupon = object.coupon?.map((e) => Coupon.fromPartial(e)) || []; + message.button = object.button?.map((e) => ButtonInfo.fromPartial(e)) || []; + message.bottomText = object.bottomText ?? ""; + message.popTitle = (object.popTitle !== undefined && object.popTitle !== null) + ? TextInfo.fromPartial(object.popTitle) + : undefined; + message.subtitle = (object.subtitle !== undefined && object.subtitle !== null) + ? TextInfo.fromPartial(object.subtitle) + : undefined; + message.bottomDesc = (object.bottomDesc !== undefined && object.bottomDesc !== null) + ? ButtonInfo.fromPartial(object.bottomDesc) + : undefined; + message.cover = object.cover ?? ""; + message.popType = object.popType ?? ""; + return message; + }, +}; + +function createBaseCoupon(): Coupon { + return { + couponToken: "", + type: 0n, + value: "", + useDesc: "", + title: "", + desc: "", + payButtonText: "", + payButtonTextLineThrough: "", + realAmount: "", + expireTime: undefined, + otype: 0n, + amount: "", + }; +} + +export const Coupon: MessageFns = { + encode(message: Coupon, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.couponToken !== "") { + writer.uint32(10).string(message.couponToken); + } + if (message.type !== 0n) { + if (BigInt.asIntN(64, message.type) !== message.type) { + throw new globalThis.Error("value provided for field message.type of type int64 too large"); + } + writer.uint32(16).int64(message.type); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + if (message.useDesc !== "") { + writer.uint32(34).string(message.useDesc); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.desc !== "") { + writer.uint32(50).string(message.desc); + } + if (message.payButtonText !== "") { + writer.uint32(58).string(message.payButtonText); + } + if (message.payButtonTextLineThrough !== "") { + writer.uint32(66).string(message.payButtonTextLineThrough); + } + if (message.realAmount !== "") { + writer.uint32(74).string(message.realAmount); + } + if (message.expireTime !== undefined) { + Timestamp.encode(message.expireTime, writer.uint32(82).fork()).join(); + } + if (message.otype !== 0n) { + if (BigInt.asIntN(64, message.otype) !== message.otype) { + throw new globalThis.Error("value provided for field message.otype of type int64 too large"); + } + writer.uint32(88).int64(message.otype); + } + if (message.amount !== "") { + writer.uint32(98).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coupon { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoupon(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.couponToken = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int64() as bigint; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.useDesc = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.title = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.desc = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.payButtonText = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.payButtonTextLineThrough = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.realAmount = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.expireTime = Timestamp.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.otype = reader.int64() as bigint; + continue; + case 12: + if (tag !== 98) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coupon { + return { + couponToken: isSet(object.couponToken) ? globalThis.String(object.couponToken) : "", + type: isSet(object.type) ? BigInt(object.type) : 0n, + value: isSet(object.value) ? globalThis.String(object.value) : "", + useDesc: isSet(object.useDesc) ? globalThis.String(object.useDesc) : "", + title: isSet(object.title) ? globalThis.String(object.title) : "", + desc: isSet(object.desc) ? globalThis.String(object.desc) : "", + payButtonText: isSet(object.payButtonText) ? globalThis.String(object.payButtonText) : "", + payButtonTextLineThrough: isSet(object.payButtonTextLineThrough) + ? globalThis.String(object.payButtonTextLineThrough) + : "", + realAmount: isSet(object.realAmount) ? globalThis.String(object.realAmount) : "", + expireTime: isSet(object.expireTime) ? Timestamp.fromJSON(object.expireTime) : undefined, + otype: isSet(object.otype) ? BigInt(object.otype) : 0n, + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coupon): unknown { + const obj: any = {}; + if (message.couponToken !== "") { + obj.couponToken = message.couponToken; + } + if (message.type !== 0n) { + obj.type = message.type.toString(); + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.useDesc !== "") { + obj.useDesc = message.useDesc; + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.desc !== "") { + obj.desc = message.desc; + } + if (message.payButtonText !== "") { + obj.payButtonText = message.payButtonText; + } + if (message.payButtonTextLineThrough !== "") { + obj.payButtonTextLineThrough = message.payButtonTextLineThrough; + } + if (message.realAmount !== "") { + obj.realAmount = message.realAmount; + } + if (message.expireTime !== undefined) { + obj.expireTime = Timestamp.toJSON(message.expireTime); + } + if (message.otype !== 0n) { + obj.otype = message.otype.toString(); + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + + create, I>>(base?: I): Coupon { + return Coupon.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Coupon { + const message = createBaseCoupon(); + message.couponToken = object.couponToken ?? ""; + message.type = object.type ?? 0n; + message.value = object.value ?? ""; + message.useDesc = object.useDesc ?? ""; + message.title = object.title ?? ""; + message.desc = object.desc ?? ""; + message.payButtonText = object.payButtonText ?? ""; + message.payButtonTextLineThrough = object.payButtonTextLineThrough ?? ""; + message.realAmount = object.realAmount ?? ""; + message.expireTime = (object.expireTime !== undefined && object.expireTime !== null) + ? Timestamp.fromPartial(object.expireTime) + : undefined; + message.otype = object.otype ?? 0n; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBasePromptBar(): PromptBar { + return { + title: undefined, + subTitle: undefined, + subTitleIcon: "", + bgImage: "", + bgGradientColor: undefined, + button: [], + report: undefined, + fullScreenIpIcon: "", + fullScreenBgGradientColor: undefined, + }; +} + +export const PromptBar: MessageFns = { + encode(message: PromptBar, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== undefined) { + TextInfo.encode(message.title, writer.uint32(10).fork()).join(); + } + if (message.subTitle !== undefined) { + TextInfo.encode(message.subTitle, writer.uint32(18).fork()).join(); + } + if (message.subTitleIcon !== "") { + writer.uint32(26).string(message.subTitleIcon); + } + if (message.bgImage !== "") { + writer.uint32(34).string(message.bgImage); + } + if (message.bgGradientColor !== undefined) { + GradientColor.encode(message.bgGradientColor, writer.uint32(42).fork()).join(); + } + for (const v of message.button) { + ButtonInfo.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.report !== undefined) { + Report.encode(message.report, writer.uint32(58).fork()).join(); + } + if (message.fullScreenIpIcon !== "") { + writer.uint32(66).string(message.fullScreenIpIcon); + } + if (message.fullScreenBgGradientColor !== undefined) { + GradientColor.encode(message.fullScreenBgGradientColor, writer.uint32(74).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PromptBar { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePromptBar(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = TextInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.subTitle = TextInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.subTitleIcon = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.bgImage = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bgGradientColor = GradientColor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.button.push(ButtonInfo.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.report = Report.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.fullScreenIpIcon = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.fullScreenBgGradientColor = GradientColor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PromptBar { + return { + title: isSet(object.title) ? TextInfo.fromJSON(object.title) : undefined, + subTitle: isSet(object.subTitle) ? TextInfo.fromJSON(object.subTitle) : undefined, + subTitleIcon: isSet(object.subTitleIcon) ? globalThis.String(object.subTitleIcon) : "", + bgImage: isSet(object.bgImage) ? globalThis.String(object.bgImage) : "", + bgGradientColor: isSet(object.bgGradientColor) ? GradientColor.fromJSON(object.bgGradientColor) : undefined, + button: globalThis.Array.isArray(object?.button) ? object.button.map((e: any) => ButtonInfo.fromJSON(e)) : [], + report: isSet(object.report) ? Report.fromJSON(object.report) : undefined, + fullScreenIpIcon: isSet(object.fullScreenIpIcon) ? globalThis.String(object.fullScreenIpIcon) : "", + fullScreenBgGradientColor: isSet(object.fullScreenBgGradientColor) + ? GradientColor.fromJSON(object.fullScreenBgGradientColor) + : undefined, + }; + }, + + toJSON(message: PromptBar): unknown { + const obj: any = {}; + if (message.title !== undefined) { + obj.title = TextInfo.toJSON(message.title); + } + if (message.subTitle !== undefined) { + obj.subTitle = TextInfo.toJSON(message.subTitle); + } + if (message.subTitleIcon !== "") { + obj.subTitleIcon = message.subTitleIcon; + } + if (message.bgImage !== "") { + obj.bgImage = message.bgImage; + } + if (message.bgGradientColor !== undefined) { + obj.bgGradientColor = GradientColor.toJSON(message.bgGradientColor); + } + if (message.button?.length) { + obj.button = message.button.map((e) => ButtonInfo.toJSON(e)); + } + if (message.report !== undefined) { + obj.report = Report.toJSON(message.report); + } + if (message.fullScreenIpIcon !== "") { + obj.fullScreenIpIcon = message.fullScreenIpIcon; + } + if (message.fullScreenBgGradientColor !== undefined) { + obj.fullScreenBgGradientColor = GradientColor.toJSON(message.fullScreenBgGradientColor); + } + return obj; + }, + + create, I>>(base?: I): PromptBar { + return PromptBar.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PromptBar { + const message = createBasePromptBar(); + message.title = (object.title !== undefined && object.title !== null) + ? TextInfo.fromPartial(object.title) + : undefined; + message.subTitle = (object.subTitle !== undefined && object.subTitle !== null) + ? TextInfo.fromPartial(object.subTitle) + : undefined; + message.subTitleIcon = object.subTitleIcon ?? ""; + message.bgImage = object.bgImage ?? ""; + message.bgGradientColor = (object.bgGradientColor !== undefined && object.bgGradientColor !== null) + ? GradientColor.fromPartial(object.bgGradientColor) + : undefined; + message.button = object.button?.map((e) => ButtonInfo.fromPartial(e)) || []; + message.report = (object.report !== undefined && object.report !== null) + ? Report.fromPartial(object.report) + : undefined; + message.fullScreenIpIcon = object.fullScreenIpIcon ?? ""; + message.fullScreenBgGradientColor = + (object.fullScreenBgGradientColor !== undefined && object.fullScreenBgGradientColor !== null) + ? GradientColor.fromPartial(object.fullScreenBgGradientColor) + : undefined; + return message; + }, +}; + +function createBasePayTip(): PayTip { + return { + title: "", + url: "", + icon: "", + type: 0, + showType: 0, + img: "", + bgDayColor: "", + bgNightColor: "", + bgLineColor: "", + bgNightLineColor: "", + textColor: "", + textNightColor: "", + viewStartTime: 0n, + button: [], + urlOpenType: 0, + report: undefined, + angleStyle: 0, + reportType: 0, + orderReportParams: {}, + giantScreenImg: "", + }; +} + +export const PayTip: MessageFns = { + encode(message: PayTip, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.url !== "") { + writer.uint32(18).string(message.url); + } + if (message.icon !== "") { + writer.uint32(26).string(message.icon); + } + if (message.type !== 0) { + writer.uint32(32).int32(message.type); + } + if (message.showType !== 0) { + writer.uint32(40).int32(message.showType); + } + if (message.img !== "") { + writer.uint32(50).string(message.img); + } + if (message.bgDayColor !== "") { + writer.uint32(58).string(message.bgDayColor); + } + if (message.bgNightColor !== "") { + writer.uint32(66).string(message.bgNightColor); + } + if (message.bgLineColor !== "") { + writer.uint32(74).string(message.bgLineColor); + } + if (message.bgNightLineColor !== "") { + writer.uint32(82).string(message.bgNightLineColor); + } + if (message.textColor !== "") { + writer.uint32(90).string(message.textColor); + } + if (message.textNightColor !== "") { + writer.uint32(98).string(message.textNightColor); + } + if (message.viewStartTime !== 0n) { + if (BigInt.asIntN(64, message.viewStartTime) !== message.viewStartTime) { + throw new globalThis.Error("value provided for field message.viewStartTime of type int64 too large"); + } + writer.uint32(104).int64(message.viewStartTime); + } + for (const v of message.button) { + ButtonInfo.encode(v!, writer.uint32(114).fork()).join(); + } + if (message.urlOpenType !== 0) { + writer.uint32(120).int32(message.urlOpenType); + } + if (message.report !== undefined) { + Report.encode(message.report, writer.uint32(130).fork()).join(); + } + if (message.angleStyle !== 0) { + writer.uint32(136).int32(message.angleStyle); + } + if (message.reportType !== 0) { + writer.uint32(144).int32(message.reportType); + } + Object.entries(message.orderReportParams).forEach(([key, value]) => { + PayTip_OrderReportParamsEntry.encode({ key: key as any, value }, writer.uint32(154).fork()).join(); + }); + if (message.giantScreenImg !== "") { + writer.uint32(162).string(message.giantScreenImg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PayTip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePayTip(); + 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.url = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.icon = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.type = reader.int32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.showType = reader.int32(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.img = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.bgDayColor = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.bgNightColor = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.bgLineColor = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.bgNightLineColor = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.textColor = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.textNightColor = reader.string(); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.viewStartTime = reader.int64() as bigint; + continue; + case 14: + if (tag !== 114) { + break; + } + + message.button.push(ButtonInfo.decode(reader, reader.uint32())); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.urlOpenType = reader.int32(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.report = Report.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.angleStyle = reader.int32(); + continue; + case 18: + if (tag !== 144) { + break; + } + + message.reportType = reader.int32(); + continue; + case 19: + if (tag !== 154) { + break; + } + + const entry19 = PayTip_OrderReportParamsEntry.decode(reader, reader.uint32()); + if (entry19.value !== undefined) { + message.orderReportParams[entry19.key] = entry19.value; + } + continue; + case 20: + if (tag !== 162) { + break; + } + + message.giantScreenImg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PayTip { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + url: isSet(object.url) ? globalThis.String(object.url) : "", + icon: isSet(object.icon) ? globalThis.String(object.icon) : "", + type: isSet(object.type) ? globalThis.Number(object.type) : 0, + showType: isSet(object.showType) ? globalThis.Number(object.showType) : 0, + img: isSet(object.img) ? globalThis.String(object.img) : "", + bgDayColor: isSet(object.bgDayColor) ? globalThis.String(object.bgDayColor) : "", + bgNightColor: isSet(object.bgNightColor) ? globalThis.String(object.bgNightColor) : "", + bgLineColor: isSet(object.bgLineColor) ? globalThis.String(object.bgLineColor) : "", + bgNightLineColor: isSet(object.bgNightLineColor) ? globalThis.String(object.bgNightLineColor) : "", + textColor: isSet(object.textColor) ? globalThis.String(object.textColor) : "", + textNightColor: isSet(object.textNightColor) ? globalThis.String(object.textNightColor) : "", + viewStartTime: isSet(object.viewStartTime) ? BigInt(object.viewStartTime) : 0n, + button: globalThis.Array.isArray(object?.button) ? object.button.map((e: any) => ButtonInfo.fromJSON(e)) : [], + urlOpenType: isSet(object.urlOpenType) ? globalThis.Number(object.urlOpenType) : 0, + report: isSet(object.report) ? Report.fromJSON(object.report) : undefined, + angleStyle: isSet(object.angleStyle) ? globalThis.Number(object.angleStyle) : 0, + reportType: isSet(object.reportType) ? globalThis.Number(object.reportType) : 0, + orderReportParams: isObject(object.orderReportParams) + ? Object.entries(object.orderReportParams).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + giantScreenImg: isSet(object.giantScreenImg) ? globalThis.String(object.giantScreenImg) : "", + }; + }, + + toJSON(message: PayTip): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.url !== "") { + obj.url = message.url; + } + if (message.icon !== "") { + obj.icon = message.icon; + } + if (message.type !== 0) { + obj.type = Math.round(message.type); + } + if (message.showType !== 0) { + obj.showType = Math.round(message.showType); + } + if (message.img !== "") { + obj.img = message.img; + } + if (message.bgDayColor !== "") { + obj.bgDayColor = message.bgDayColor; + } + if (message.bgNightColor !== "") { + obj.bgNightColor = message.bgNightColor; + } + if (message.bgLineColor !== "") { + obj.bgLineColor = message.bgLineColor; + } + if (message.bgNightLineColor !== "") { + obj.bgNightLineColor = message.bgNightLineColor; + } + if (message.textColor !== "") { + obj.textColor = message.textColor; + } + if (message.textNightColor !== "") { + obj.textNightColor = message.textNightColor; + } + if (message.viewStartTime !== 0n) { + obj.viewStartTime = message.viewStartTime.toString(); + } + if (message.button?.length) { + obj.button = message.button.map((e) => ButtonInfo.toJSON(e)); + } + if (message.urlOpenType !== 0) { + obj.urlOpenType = Math.round(message.urlOpenType); + } + if (message.report !== undefined) { + obj.report = Report.toJSON(message.report); + } + if (message.angleStyle !== 0) { + obj.angleStyle = Math.round(message.angleStyle); + } + if (message.reportType !== 0) { + obj.reportType = Math.round(message.reportType); + } + if (message.orderReportParams) { + const entries = Object.entries(message.orderReportParams); + if (entries.length > 0) { + obj.orderReportParams = {}; + entries.forEach(([k, v]) => { + obj.orderReportParams[k] = v; + }); + } + } + if (message.giantScreenImg !== "") { + obj.giantScreenImg = message.giantScreenImg; + } + return obj; + }, + + create, I>>(base?: I): PayTip { + return PayTip.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PayTip { + const message = createBasePayTip(); + message.title = object.title ?? ""; + message.url = object.url ?? ""; + message.icon = object.icon ?? ""; + message.type = object.type ?? 0; + message.showType = object.showType ?? 0; + message.img = object.img ?? ""; + message.bgDayColor = object.bgDayColor ?? ""; + message.bgNightColor = object.bgNightColor ?? ""; + message.bgLineColor = object.bgLineColor ?? ""; + message.bgNightLineColor = object.bgNightLineColor ?? ""; + message.textColor = object.textColor ?? ""; + message.textNightColor = object.textNightColor ?? ""; + message.viewStartTime = object.viewStartTime ?? 0n; + message.button = object.button?.map((e) => ButtonInfo.fromPartial(e)) || []; + message.urlOpenType = object.urlOpenType ?? 0; + message.report = (object.report !== undefined && object.report !== null) + ? Report.fromPartial(object.report) + : undefined; + message.angleStyle = object.angleStyle ?? 0; + message.reportType = object.reportType ?? 0; + message.orderReportParams = Object.entries(object.orderReportParams ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + message.giantScreenImg = object.giantScreenImg ?? ""; + return message; + }, +}; + +function createBasePayTip_OrderReportParamsEntry(): PayTip_OrderReportParamsEntry { + return { key: "", value: "" }; +} + +export const PayTip_OrderReportParamsEntry: MessageFns = { + encode(message: PayTip_OrderReportParamsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PayTip_OrderReportParamsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePayTip_OrderReportParamsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PayTip_OrderReportParamsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: PayTip_OrderReportParamsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): PayTip_OrderReportParamsEntry { + return PayTip_OrderReportParamsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PayTip_OrderReportParamsEntry { + const message = createBasePayTip_OrderReportParamsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseHighDefinitionTrialInfo(): HighDefinitionTrialInfo { + return { + trialAble: false, + remainingTimes: 0, + start: 0, + timeLength: 0, + startToast: undefined, + endToast: undefined, + report: undefined, + qualityOpenTipBtn: undefined, + noLongerTrialBtn: undefined, + }; +} + +export const HighDefinitionTrialInfo: MessageFns = { + encode(message: HighDefinitionTrialInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.trialAble !== false) { + writer.uint32(8).bool(message.trialAble); + } + if (message.remainingTimes !== 0) { + writer.uint32(16).int32(message.remainingTimes); + } + if (message.start !== 0) { + writer.uint32(24).int32(message.start); + } + if (message.timeLength !== 0) { + writer.uint32(32).int32(message.timeLength); + } + if (message.startToast !== undefined) { + Toast.encode(message.startToast, writer.uint32(42).fork()).join(); + } + if (message.endToast !== undefined) { + Toast.encode(message.endToast, writer.uint32(50).fork()).join(); + } + if (message.report !== undefined) { + Report.encode(message.report, writer.uint32(58).fork()).join(); + } + if (message.qualityOpenTipBtn !== undefined) { + ButtonInfo.encode(message.qualityOpenTipBtn, writer.uint32(66).fork()).join(); + } + if (message.noLongerTrialBtn !== undefined) { + ButtonInfo.encode(message.noLongerTrialBtn, writer.uint32(74).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HighDefinitionTrialInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHighDefinitionTrialInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.trialAble = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.remainingTimes = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.start = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.timeLength = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.startToast = Toast.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.endToast = Toast.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.report = Report.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.qualityOpenTipBtn = ButtonInfo.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.noLongerTrialBtn = ButtonInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HighDefinitionTrialInfo { + return { + trialAble: isSet(object.trialAble) ? globalThis.Boolean(object.trialAble) : false, + remainingTimes: isSet(object.remainingTimes) ? globalThis.Number(object.remainingTimes) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + timeLength: isSet(object.timeLength) ? globalThis.Number(object.timeLength) : 0, + startToast: isSet(object.startToast) ? Toast.fromJSON(object.startToast) : undefined, + endToast: isSet(object.endToast) ? Toast.fromJSON(object.endToast) : undefined, + report: isSet(object.report) ? Report.fromJSON(object.report) : undefined, + qualityOpenTipBtn: isSet(object.qualityOpenTipBtn) ? ButtonInfo.fromJSON(object.qualityOpenTipBtn) : undefined, + noLongerTrialBtn: isSet(object.noLongerTrialBtn) ? ButtonInfo.fromJSON(object.noLongerTrialBtn) : undefined, + }; + }, + + toJSON(message: HighDefinitionTrialInfo): unknown { + const obj: any = {}; + if (message.trialAble !== false) { + obj.trialAble = message.trialAble; + } + if (message.remainingTimes !== 0) { + obj.remainingTimes = Math.round(message.remainingTimes); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.timeLength !== 0) { + obj.timeLength = Math.round(message.timeLength); + } + if (message.startToast !== undefined) { + obj.startToast = Toast.toJSON(message.startToast); + } + if (message.endToast !== undefined) { + obj.endToast = Toast.toJSON(message.endToast); + } + if (message.report !== undefined) { + obj.report = Report.toJSON(message.report); + } + if (message.qualityOpenTipBtn !== undefined) { + obj.qualityOpenTipBtn = ButtonInfo.toJSON(message.qualityOpenTipBtn); + } + if (message.noLongerTrialBtn !== undefined) { + obj.noLongerTrialBtn = ButtonInfo.toJSON(message.noLongerTrialBtn); + } + return obj; + }, + + create, I>>(base?: I): HighDefinitionTrialInfo { + return HighDefinitionTrialInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HighDefinitionTrialInfo { + const message = createBaseHighDefinitionTrialInfo(); + message.trialAble = object.trialAble ?? false; + message.remainingTimes = object.remainingTimes ?? 0; + message.start = object.start ?? 0; + message.timeLength = object.timeLength ?? 0; + message.startToast = (object.startToast !== undefined && object.startToast !== null) + ? Toast.fromPartial(object.startToast) + : undefined; + message.endToast = (object.endToast !== undefined && object.endToast !== null) + ? Toast.fromPartial(object.endToast) + : undefined; + message.report = (object.report !== undefined && object.report !== null) + ? Report.fromPartial(object.report) + : undefined; + message.qualityOpenTipBtn = (object.qualityOpenTipBtn !== undefined && object.qualityOpenTipBtn !== null) + ? ButtonInfo.fromPartial(object.qualityOpenTipBtn) + : undefined; + message.noLongerTrialBtn = (object.noLongerTrialBtn !== undefined && object.noLongerTrialBtn !== null) + ? ButtonInfo.fromPartial(object.noLongerTrialBtn) + : undefined; + return message; + }, +}; + +function createBaseAnimation(): Animation { + return { qnSvgaAnimationMap: {} }; +} + +export const Animation: MessageFns = { + encode(message: Animation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.qnSvgaAnimationMap).forEach(([key, value]) => { + Animation_QnSvgaAnimationMapEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Animation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAnimation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = Animation_QnSvgaAnimationMapEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.qnSvgaAnimationMap[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Animation { + return { + qnSvgaAnimationMap: isObject(object.qnSvgaAnimationMap) + ? Object.entries(object.qnSvgaAnimationMap).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Animation): unknown { + const obj: any = {}; + if (message.qnSvgaAnimationMap) { + const entries = Object.entries(message.qnSvgaAnimationMap); + if (entries.length > 0) { + obj.qnSvgaAnimationMap = {}; + entries.forEach(([k, v]) => { + obj.qnSvgaAnimationMap[k] = v; + }); + } + } + return obj; + }, + + create, I>>(base?: I): Animation { + return Animation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Animation { + const message = createBaseAnimation(); + message.qnSvgaAnimationMap = Object.entries(object.qnSvgaAnimationMap ?? {}).reduce<{ [key: string]: string }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAnimation_QnSvgaAnimationMapEntry(): Animation_QnSvgaAnimationMapEntry { + return { key: "", value: "" }; +} + +export const Animation_QnSvgaAnimationMapEntry: MessageFns = { + encode(message: Animation_QnSvgaAnimationMapEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Animation_QnSvgaAnimationMapEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAnimation_QnSvgaAnimationMapEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Animation_QnSvgaAnimationMapEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Animation_QnSvgaAnimationMapEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>( + base?: I, + ): Animation_QnSvgaAnimationMapEntry { + return Animation_QnSvgaAnimationMapEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): Animation_QnSvgaAnimationMapEntry { + const message = createBaseAnimation_QnSvgaAnimationMapEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseEndPage(): EndPage { + return { dialog: undefined, hide: false }; +} + +export const EndPage: MessageFns = { + encode(message: EndPage, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dialog !== undefined) { + Dialog.encode(message.dialog, writer.uint32(10).fork()).join(); + } + if (message.hide !== false) { + writer.uint32(16).bool(message.hide); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EndPage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEndPage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dialog = Dialog.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.hide = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EndPage { + return { + dialog: isSet(object.dialog) ? Dialog.fromJSON(object.dialog) : undefined, + hide: isSet(object.hide) ? globalThis.Boolean(object.hide) : false, + }; + }, + + toJSON(message: EndPage): unknown { + const obj: any = {}; + if (message.dialog !== undefined) { + obj.dialog = Dialog.toJSON(message.dialog); + } + if (message.hide !== false) { + obj.hide = message.hide; + } + return obj; + }, + + create, I>>(base?: I): EndPage { + return EndPage.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EndPage { + const message = createBaseEndPage(); + message.dialog = (object.dialog !== undefined && object.dialog !== null) + ? Dialog.fromPartial(object.dialog) + : undefined; + message.hide = object.hide ?? false; + return message; + }, +}; + +function createBaseTimestamp(): Timestamp { + return { seconds: 0n, nanos: 0 }; +} + +export const Timestamp: MessageFns = { + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0n) { + if (BigInt.asIntN(64, message.seconds) !== message.seconds) { + throw new globalThis.Error("value provided for field message.seconds of type int64 too large"); + } + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = reader.int64() as bigint; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? BigInt(object.seconds) : 0n, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + if (message.seconds !== 0n) { + obj.seconds = message.seconds.toString(); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create, I>>(base?: I): Timestamp { + return Timestamp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0n; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/Event.proto b/src/io/com/bapis/bilibili/playershared/Event.proto new file mode 100644 index 0000000..2634aa7 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/Event.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package bilibili.playershared; + +/** 事件 */ +message Event { + /** 震动 */ + Shake shake = 1; +} + +/** 震动 */ +message Shake { + + string file = 1; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/Event.ts b/src/io/com/bapis/bilibili/playershared/Event.ts new file mode 100644 index 0000000..1bd9904 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/Event.ts @@ -0,0 +1,160 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/Event.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.playershared"; + +/** 事件 */ +export interface Event { + /** 震动 */ + shake: Shake | undefined; +} + +/** 震动 */ +export interface Shake { + file: string; +} + +function createBaseEvent(): Event { + return { shake: undefined }; +} + +export const Event: MessageFns = { + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.shake !== undefined) { + Shake.encode(message.shake, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shake = Shake.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { shake: isSet(object.shake) ? Shake.fromJSON(object.shake) : undefined }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.shake !== undefined) { + obj.shake = Shake.toJSON(message.shake); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.shake = (object.shake !== undefined && object.shake !== null) ? Shake.fromPartial(object.shake) : undefined; + return message; + }, +}; + +function createBaseShake(): Shake { + return { file: "" }; +} + +export const Shake: MessageFns = { + encode(message: Shake, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.file !== "") { + writer.uint32(10).string(message.file); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Shake { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShake(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.file = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Shake { + return { file: isSet(object.file) ? globalThis.String(object.file) : "" }; + }, + + toJSON(message: Shake): unknown { + const obj: any = {}; + if (message.file !== "") { + obj.file = message.file; + } + return obj; + }, + + create, I>>(base?: I): Shake { + return Shake.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Shake { + const message = createBaseShake(); + message.file = object.file ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/Fragment.proto b/src/io/com/bapis/bilibili/playershared/Fragment.proto new file mode 100644 index 0000000..ec00360 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/Fragment.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package bilibili.playershared; + +import "src/io/com/bapis/google/protobuf/any.proto"; + +message Fragment { + repeated FragmentInfo infos = 1; +} + +message FragmentInfo { + + int32 index = 1; + + FragmentPosition fragment_position = 2; + + FragmentType fragment_type = 3; + + int64 aid = 4; + + int64 cid = 5; + + int64 start_time = 6; + + google.protobuf.Any report = 7; +} + +enum FragmentPosition { + INVALID = 0; + PRE = 1; + MIDDLE = 2; + POST = 3; +} + +enum FragmentType { + UNKNOWN = 0; + AD_FRAGMENT = 1; + OGV_FRAGMENT = 2; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/Fragment.ts b/src/io/com/bapis/bilibili/playershared/Fragment.ts new file mode 100644 index 0000000..1ab82c0 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/Fragment.ts @@ -0,0 +1,353 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/Fragment.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Any } from "../../google/protobuf/any"; + +export const protobufPackage = "bilibili.playershared"; + +export enum FragmentPosition { + INVALID = 0, + PRE = 1, + MIDDLE = 2, + POST = 3, + UNRECOGNIZED = -1, +} + +export function fragmentPositionFromJSON(object: any): FragmentPosition { + switch (object) { + case 0: + case "INVALID": + return FragmentPosition.INVALID; + case 1: + case "PRE": + return FragmentPosition.PRE; + case 2: + case "MIDDLE": + return FragmentPosition.MIDDLE; + case 3: + case "POST": + return FragmentPosition.POST; + case -1: + case "UNRECOGNIZED": + default: + return FragmentPosition.UNRECOGNIZED; + } +} + +export function fragmentPositionToJSON(object: FragmentPosition): string { + switch (object) { + case FragmentPosition.INVALID: + return "INVALID"; + case FragmentPosition.PRE: + return "PRE"; + case FragmentPosition.MIDDLE: + return "MIDDLE"; + case FragmentPosition.POST: + return "POST"; + case FragmentPosition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum FragmentType { + UNKNOWN = 0, + AD_FRAGMENT = 1, + OGV_FRAGMENT = 2, + UNRECOGNIZED = -1, +} + +export function fragmentTypeFromJSON(object: any): FragmentType { + switch (object) { + case 0: + case "UNKNOWN": + return FragmentType.UNKNOWN; + case 1: + case "AD_FRAGMENT": + return FragmentType.AD_FRAGMENT; + case 2: + case "OGV_FRAGMENT": + return FragmentType.OGV_FRAGMENT; + case -1: + case "UNRECOGNIZED": + default: + return FragmentType.UNRECOGNIZED; + } +} + +export function fragmentTypeToJSON(object: FragmentType): string { + switch (object) { + case FragmentType.UNKNOWN: + return "UNKNOWN"; + case FragmentType.AD_FRAGMENT: + return "AD_FRAGMENT"; + case FragmentType.OGV_FRAGMENT: + return "OGV_FRAGMENT"; + case FragmentType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface Fragment { + infos: FragmentInfo[]; +} + +export interface FragmentInfo { + index: number; + fragmentPosition: FragmentPosition; + fragmentType: FragmentType; + aid: bigint; + cid: bigint; + startTime: bigint; + report: Any | undefined; +} + +function createBaseFragment(): Fragment { + return { infos: [] }; +} + +export const Fragment: MessageFns = { + encode(message: Fragment, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.infos) { + FragmentInfo.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fragment { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFragment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.infos.push(FragmentInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fragment { + return { + infos: globalThis.Array.isArray(object?.infos) ? object.infos.map((e: any) => FragmentInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: Fragment): unknown { + const obj: any = {}; + if (message.infos?.length) { + obj.infos = message.infos.map((e) => FragmentInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Fragment { + return Fragment.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fragment { + const message = createBaseFragment(); + message.infos = object.infos?.map((e) => FragmentInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFragmentInfo(): FragmentInfo { + return { index: 0, fragmentPosition: 0, fragmentType: 0, aid: 0n, cid: 0n, startTime: 0n, report: undefined }; +} + +export const FragmentInfo: MessageFns = { + encode(message: FragmentInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int32(message.index); + } + if (message.fragmentPosition !== 0) { + writer.uint32(16).int32(message.fragmentPosition); + } + if (message.fragmentType !== 0) { + writer.uint32(24).int32(message.fragmentType); + } + if (message.aid !== 0n) { + if (BigInt.asIntN(64, message.aid) !== message.aid) { + throw new globalThis.Error("value provided for field message.aid of type int64 too large"); + } + writer.uint32(32).int64(message.aid); + } + if (message.cid !== 0n) { + if (BigInt.asIntN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type int64 too large"); + } + writer.uint32(40).int64(message.cid); + } + if (message.startTime !== 0n) { + if (BigInt.asIntN(64, message.startTime) !== message.startTime) { + throw new globalThis.Error("value provided for field message.startTime of type int64 too large"); + } + writer.uint32(48).int64(message.startTime); + } + if (message.report !== undefined) { + Any.encode(message.report, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FragmentInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFragmentInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.fragmentPosition = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.fragmentType = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.aid = reader.int64() as bigint; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.cid = reader.int64() as bigint; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.startTime = reader.int64() as bigint; + continue; + case 7: + if (tag !== 58) { + break; + } + + message.report = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FragmentInfo { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + fragmentPosition: isSet(object.fragmentPosition) ? fragmentPositionFromJSON(object.fragmentPosition) : 0, + fragmentType: isSet(object.fragmentType) ? fragmentTypeFromJSON(object.fragmentType) : 0, + aid: isSet(object.aid) ? BigInt(object.aid) : 0n, + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + startTime: isSet(object.startTime) ? BigInt(object.startTime) : 0n, + report: isSet(object.report) ? Any.fromJSON(object.report) : undefined, + }; + }, + + toJSON(message: FragmentInfo): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.fragmentPosition !== 0) { + obj.fragmentPosition = fragmentPositionToJSON(message.fragmentPosition); + } + if (message.fragmentType !== 0) { + obj.fragmentType = fragmentTypeToJSON(message.fragmentType); + } + if (message.aid !== 0n) { + obj.aid = message.aid.toString(); + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + if (message.startTime !== 0n) { + obj.startTime = message.startTime.toString(); + } + if (message.report !== undefined) { + obj.report = Any.toJSON(message.report); + } + return obj; + }, + + create, I>>(base?: I): FragmentInfo { + return FragmentInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FragmentInfo { + const message = createBaseFragmentInfo(); + message.index = object.index ?? 0; + message.fragmentPosition = object.fragmentPosition ?? 0; + message.fragmentType = object.fragmentType ?? 0; + message.aid = object.aid ?? 0n; + message.cid = object.cid ?? 0n; + message.startTime = object.startTime ?? 0n; + message.report = (object.report !== undefined && object.report !== null) + ? Any.fromPartial(object.report) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/FragmentVideo.proto b/src/io/com/bapis/bilibili/playershared/FragmentVideo.proto new file mode 100644 index 0000000..929e8b9 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/FragmentVideo.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package bilibili.playershared; + +import "src/io/com/bapis/bilibili/playershared/Fragment.proto"; +import "src/io/com/bapis/bilibili/playershared/VodInfo.proto"; +import "src/io/com/bapis/bilibili/playershared/PlayArcConf.proto"; +import "src/io/com/bapis/bilibili/playershared/PlayArc.proto"; + +message FragmentVideo { + + repeated FragmentVideoInfo videos = 1; +} + +message FragmentVideoInfo { + + FragmentInfo fragment_info = 1; + + VodInfo vod_info = 2; + + PlayArcConf play_arc_conf = 3; + + Dimension dimension = 4; + + int64 timelength = 5; + + BizType video_type = 6; + + bool playable_status = 7; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/FragmentVideo.ts b/src/io/com/bapis/bilibili/playershared/FragmentVideo.ts new file mode 100644 index 0000000..8141e32 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/FragmentVideo.ts @@ -0,0 +1,282 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/FragmentVideo.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { FragmentInfo } from "./Fragment"; +import { BizType, bizTypeFromJSON, bizTypeToJSON, Dimension } from "./PlayArc"; +import { PlayArcConf } from "./PlayArcConf"; +import { VodInfo } from "./VodInfo"; + +export const protobufPackage = "bilibili.playershared"; + +export interface FragmentVideo { + videos: FragmentVideoInfo[]; +} + +export interface FragmentVideoInfo { + fragmentInfo: FragmentInfo | undefined; + vodInfo: VodInfo | undefined; + playArcConf: PlayArcConf | undefined; + dimension: Dimension | undefined; + timelength: bigint; + videoType: BizType; + playableStatus: boolean; +} + +function createBaseFragmentVideo(): FragmentVideo { + return { videos: [] }; +} + +export const FragmentVideo: MessageFns = { + encode(message: FragmentVideo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.videos) { + FragmentVideoInfo.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FragmentVideo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFragmentVideo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.videos.push(FragmentVideoInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FragmentVideo { + return { + videos: globalThis.Array.isArray(object?.videos) + ? object.videos.map((e: any) => FragmentVideoInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FragmentVideo): unknown { + const obj: any = {}; + if (message.videos?.length) { + obj.videos = message.videos.map((e) => FragmentVideoInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FragmentVideo { + return FragmentVideo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FragmentVideo { + const message = createBaseFragmentVideo(); + message.videos = object.videos?.map((e) => FragmentVideoInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseFragmentVideoInfo(): FragmentVideoInfo { + return { + fragmentInfo: undefined, + vodInfo: undefined, + playArcConf: undefined, + dimension: undefined, + timelength: 0n, + videoType: 0, + playableStatus: false, + }; +} + +export const FragmentVideoInfo: MessageFns = { + encode(message: FragmentVideoInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fragmentInfo !== undefined) { + FragmentInfo.encode(message.fragmentInfo, writer.uint32(10).fork()).join(); + } + if (message.vodInfo !== undefined) { + VodInfo.encode(message.vodInfo, writer.uint32(18).fork()).join(); + } + if (message.playArcConf !== undefined) { + PlayArcConf.encode(message.playArcConf, writer.uint32(26).fork()).join(); + } + if (message.dimension !== undefined) { + Dimension.encode(message.dimension, writer.uint32(34).fork()).join(); + } + if (message.timelength !== 0n) { + if (BigInt.asIntN(64, message.timelength) !== message.timelength) { + throw new globalThis.Error("value provided for field message.timelength of type int64 too large"); + } + writer.uint32(40).int64(message.timelength); + } + if (message.videoType !== 0) { + writer.uint32(48).int32(message.videoType); + } + if (message.playableStatus !== false) { + writer.uint32(56).bool(message.playableStatus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FragmentVideoInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFragmentVideoInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fragmentInfo = FragmentInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.vodInfo = VodInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.playArcConf = PlayArcConf.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.dimension = Dimension.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.timelength = reader.int64() as bigint; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.videoType = reader.int32() as any; + continue; + case 7: + if (tag !== 56) { + break; + } + + message.playableStatus = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FragmentVideoInfo { + return { + fragmentInfo: isSet(object.fragmentInfo) ? FragmentInfo.fromJSON(object.fragmentInfo) : undefined, + vodInfo: isSet(object.vodInfo) ? VodInfo.fromJSON(object.vodInfo) : undefined, + playArcConf: isSet(object.playArcConf) ? PlayArcConf.fromJSON(object.playArcConf) : undefined, + dimension: isSet(object.dimension) ? Dimension.fromJSON(object.dimension) : undefined, + timelength: isSet(object.timelength) ? BigInt(object.timelength) : 0n, + videoType: isSet(object.videoType) ? bizTypeFromJSON(object.videoType) : 0, + playableStatus: isSet(object.playableStatus) ? globalThis.Boolean(object.playableStatus) : false, + }; + }, + + toJSON(message: FragmentVideoInfo): unknown { + const obj: any = {}; + if (message.fragmentInfo !== undefined) { + obj.fragmentInfo = FragmentInfo.toJSON(message.fragmentInfo); + } + if (message.vodInfo !== undefined) { + obj.vodInfo = VodInfo.toJSON(message.vodInfo); + } + if (message.playArcConf !== undefined) { + obj.playArcConf = PlayArcConf.toJSON(message.playArcConf); + } + if (message.dimension !== undefined) { + obj.dimension = Dimension.toJSON(message.dimension); + } + if (message.timelength !== 0n) { + obj.timelength = message.timelength.toString(); + } + if (message.videoType !== 0) { + obj.videoType = bizTypeToJSON(message.videoType); + } + if (message.playableStatus !== false) { + obj.playableStatus = message.playableStatus; + } + return obj; + }, + + create, I>>(base?: I): FragmentVideoInfo { + return FragmentVideoInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FragmentVideoInfo { + const message = createBaseFragmentVideoInfo(); + message.fragmentInfo = (object.fragmentInfo !== undefined && object.fragmentInfo !== null) + ? FragmentInfo.fromPartial(object.fragmentInfo) + : undefined; + message.vodInfo = (object.vodInfo !== undefined && object.vodInfo !== null) + ? VodInfo.fromPartial(object.vodInfo) + : undefined; + message.playArcConf = (object.playArcConf !== undefined && object.playArcConf !== null) + ? PlayArcConf.fromPartial(object.playArcConf) + : undefined; + message.dimension = (object.dimension !== undefined && object.dimension !== null) + ? Dimension.fromPartial(object.dimension) + : undefined; + message.timelength = object.timelength ?? 0n; + message.videoType = object.videoType ?? 0; + message.playableStatus = object.playableStatus ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/History.proto b/src/io/com/bapis/bilibili/playershared/History.proto new file mode 100644 index 0000000..1fee742 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/History.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package bilibili.playershared; + +import "src/io/com/bapis/bilibili/playershared/Toast.proto"; + +/** 播放历史 */ +message History { + + optional HistoryInfo current_video = 1; + + optional HistoryInfo related_video = 2; +} + +message HistoryInfo { + + int64 progress = 1; + + int64 last_play_cid = 2; + + Toast toast = 3; + + Toast toast_without_time = 4; + + int64 last_play_aid = 5; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/History.ts b/src/io/com/bapis/bilibili/playershared/History.ts new file mode 100644 index 0000000..fce406d --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/History.ts @@ -0,0 +1,258 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/History.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Toast } from "./Toast"; + +export const protobufPackage = "bilibili.playershared"; + +/** 播放历史 */ +export interface History { + currentVideo?: HistoryInfo | undefined; + relatedVideo?: HistoryInfo | undefined; +} + +export interface HistoryInfo { + progress: bigint; + lastPlayCid: bigint; + toast: Toast | undefined; + toastWithoutTime: Toast | undefined; + lastPlayAid: bigint; +} + +function createBaseHistory(): History { + return {}; +} + +export const History: MessageFns = { + encode(message: History, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.currentVideo !== undefined) { + HistoryInfo.encode(message.currentVideo, writer.uint32(10).fork()).join(); + } + if (message.relatedVideo !== undefined) { + HistoryInfo.encode(message.relatedVideo, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): History { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistory(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.currentVideo = HistoryInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.relatedVideo = HistoryInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): History { + return { + currentVideo: isSet(object.currentVideo) ? HistoryInfo.fromJSON(object.currentVideo) : undefined, + relatedVideo: isSet(object.relatedVideo) ? HistoryInfo.fromJSON(object.relatedVideo) : undefined, + }; + }, + + toJSON(message: History): unknown { + const obj: any = {}; + if (message.currentVideo !== undefined) { + obj.currentVideo = HistoryInfo.toJSON(message.currentVideo); + } + if (message.relatedVideo !== undefined) { + obj.relatedVideo = HistoryInfo.toJSON(message.relatedVideo); + } + return obj; + }, + + create, I>>(base?: I): History { + return History.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): History { + const message = createBaseHistory(); + message.currentVideo = (object.currentVideo !== undefined && object.currentVideo !== null) + ? HistoryInfo.fromPartial(object.currentVideo) + : undefined; + message.relatedVideo = (object.relatedVideo !== undefined && object.relatedVideo !== null) + ? HistoryInfo.fromPartial(object.relatedVideo) + : undefined; + return message; + }, +}; + +function createBaseHistoryInfo(): HistoryInfo { + return { progress: 0n, lastPlayCid: 0n, toast: undefined, toastWithoutTime: undefined, lastPlayAid: 0n }; +} + +export const HistoryInfo: MessageFns = { + encode(message: HistoryInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.progress !== 0n) { + if (BigInt.asIntN(64, message.progress) !== message.progress) { + throw new globalThis.Error("value provided for field message.progress of type int64 too large"); + } + writer.uint32(8).int64(message.progress); + } + if (message.lastPlayCid !== 0n) { + if (BigInt.asIntN(64, message.lastPlayCid) !== message.lastPlayCid) { + throw new globalThis.Error("value provided for field message.lastPlayCid of type int64 too large"); + } + writer.uint32(16).int64(message.lastPlayCid); + } + if (message.toast !== undefined) { + Toast.encode(message.toast, writer.uint32(26).fork()).join(); + } + if (message.toastWithoutTime !== undefined) { + Toast.encode(message.toastWithoutTime, writer.uint32(34).fork()).join(); + } + if (message.lastPlayAid !== 0n) { + if (BigInt.asIntN(64, message.lastPlayAid) !== message.lastPlayAid) { + throw new globalThis.Error("value provided for field message.lastPlayAid of type int64 too large"); + } + writer.uint32(40).int64(message.lastPlayAid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoryInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoryInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.progress = reader.int64() as bigint; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.lastPlayCid = reader.int64() as bigint; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.toast = Toast.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.toastWithoutTime = Toast.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.lastPlayAid = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoryInfo { + return { + progress: isSet(object.progress) ? BigInt(object.progress) : 0n, + lastPlayCid: isSet(object.lastPlayCid) ? BigInt(object.lastPlayCid) : 0n, + toast: isSet(object.toast) ? Toast.fromJSON(object.toast) : undefined, + toastWithoutTime: isSet(object.toastWithoutTime) ? Toast.fromJSON(object.toastWithoutTime) : undefined, + lastPlayAid: isSet(object.lastPlayAid) ? BigInt(object.lastPlayAid) : 0n, + }; + }, + + toJSON(message: HistoryInfo): unknown { + const obj: any = {}; + if (message.progress !== 0n) { + obj.progress = message.progress.toString(); + } + if (message.lastPlayCid !== 0n) { + obj.lastPlayCid = message.lastPlayCid.toString(); + } + if (message.toast !== undefined) { + obj.toast = Toast.toJSON(message.toast); + } + if (message.toastWithoutTime !== undefined) { + obj.toastWithoutTime = Toast.toJSON(message.toastWithoutTime); + } + if (message.lastPlayAid !== 0n) { + obj.lastPlayAid = message.lastPlayAid.toString(); + } + return obj; + }, + + create, I>>(base?: I): HistoryInfo { + return HistoryInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HistoryInfo { + const message = createBaseHistoryInfo(); + message.progress = object.progress ?? 0n; + message.lastPlayCid = object.lastPlayCid ?? 0n; + message.toast = (object.toast !== undefined && object.toast !== null) ? Toast.fromPartial(object.toast) : undefined; + message.toastWithoutTime = (object.toastWithoutTime !== undefined && object.toastWithoutTime !== null) + ? Toast.fromPartial(object.toastWithoutTime) + : undefined; + message.lastPlayAid = object.lastPlayAid ?? 0n; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/PlayArc.proto b/src/io/com/bapis/bilibili/playershared/PlayArc.proto new file mode 100644 index 0000000..705917d --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/PlayArc.proto @@ -0,0 +1,87 @@ +syntax = "proto3"; + +package bilibili.playershared; + +message PlayArc { + + BizType video_type = 1; + + uint64 aid = 2; + + uint64 cid = 3; + + optional DrmTechType drm_tech_type = 4; + + optional ArcType arc_type = 5; + + optional Interaction interaction = 6; + + Dimension dimension = 7; + + int64 duration = 8; + + optional bool is_preview = 9; + + int64 watch_time_length = 10; + + int64 duration_ms = 11; +} + +enum BizType { + + BIZ_TYPE_UNKNOWN = 0; + + BIZ_TYPE_UGC = 1; + + BIZ_TYPE_PGC = 2; + + BIZ_TYPE_PUGV = 3; +} + +enum DrmTechType { + + UNKNOWN_DRM = 0; + + FAIR_PLAY = 1; + + WIDE_VINE = 2; + /** 哔哩哔哩自研DRM */ + BILI_DRM = 3; +} + +enum ArcType { + + ARC_TYPE_NORMAL = 0; + + ARC_TYPE_INTERACT = 1; +} + +message Interaction { + + Node history_node = 1; + + int64 graph_version = 2; + + string msg = 3; + + int64 mark = 4; +} + +message Node { + + int64 node_id = 1; + + string title = 2; + + int64 cid = 3; +} + +/** 当前分辨率信息 */ +message Dimension { + /** 宽 */ + int32 width = 1; + /** 长 */ + int32 height = 2; + /** 旋转角度 */ + int32 rotate = 3; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/PlayArc.ts b/src/io/com/bapis/bilibili/playershared/PlayArc.ts new file mode 100644 index 0000000..c8aed60 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/PlayArc.ts @@ -0,0 +1,720 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/PlayArc.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.playershared"; + +export enum BizType { + BIZ_TYPE_UNKNOWN = 0, + BIZ_TYPE_UGC = 1, + BIZ_TYPE_PGC = 2, + BIZ_TYPE_PUGV = 3, + UNRECOGNIZED = -1, +} + +export function bizTypeFromJSON(object: any): BizType { + switch (object) { + case 0: + case "BIZ_TYPE_UNKNOWN": + return BizType.BIZ_TYPE_UNKNOWN; + case 1: + case "BIZ_TYPE_UGC": + return BizType.BIZ_TYPE_UGC; + case 2: + case "BIZ_TYPE_PGC": + return BizType.BIZ_TYPE_PGC; + case 3: + case "BIZ_TYPE_PUGV": + return BizType.BIZ_TYPE_PUGV; + case -1: + case "UNRECOGNIZED": + default: + return BizType.UNRECOGNIZED; + } +} + +export function bizTypeToJSON(object: BizType): string { + switch (object) { + case BizType.BIZ_TYPE_UNKNOWN: + return "BIZ_TYPE_UNKNOWN"; + case BizType.BIZ_TYPE_UGC: + return "BIZ_TYPE_UGC"; + case BizType.BIZ_TYPE_PGC: + return "BIZ_TYPE_PGC"; + case BizType.BIZ_TYPE_PUGV: + return "BIZ_TYPE_PUGV"; + case BizType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum DrmTechType { + UNKNOWN_DRM = 0, + FAIR_PLAY = 1, + WIDE_VINE = 2, + /** BILI_DRM - 哔哩哔哩自研DRM */ + BILI_DRM = 3, + UNRECOGNIZED = -1, +} + +export function drmTechTypeFromJSON(object: any): DrmTechType { + switch (object) { + case 0: + case "UNKNOWN_DRM": + return DrmTechType.UNKNOWN_DRM; + case 1: + case "FAIR_PLAY": + return DrmTechType.FAIR_PLAY; + case 2: + case "WIDE_VINE": + return DrmTechType.WIDE_VINE; + case 3: + case "BILI_DRM": + return DrmTechType.BILI_DRM; + case -1: + case "UNRECOGNIZED": + default: + return DrmTechType.UNRECOGNIZED; + } +} + +export function drmTechTypeToJSON(object: DrmTechType): string { + switch (object) { + case DrmTechType.UNKNOWN_DRM: + return "UNKNOWN_DRM"; + case DrmTechType.FAIR_PLAY: + return "FAIR_PLAY"; + case DrmTechType.WIDE_VINE: + return "WIDE_VINE"; + case DrmTechType.BILI_DRM: + return "BILI_DRM"; + case DrmTechType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ArcType { + ARC_TYPE_NORMAL = 0, + ARC_TYPE_INTERACT = 1, + UNRECOGNIZED = -1, +} + +export function arcTypeFromJSON(object: any): ArcType { + switch (object) { + case 0: + case "ARC_TYPE_NORMAL": + return ArcType.ARC_TYPE_NORMAL; + case 1: + case "ARC_TYPE_INTERACT": + return ArcType.ARC_TYPE_INTERACT; + case -1: + case "UNRECOGNIZED": + default: + return ArcType.UNRECOGNIZED; + } +} + +export function arcTypeToJSON(object: ArcType): string { + switch (object) { + case ArcType.ARC_TYPE_NORMAL: + return "ARC_TYPE_NORMAL"; + case ArcType.ARC_TYPE_INTERACT: + return "ARC_TYPE_INTERACT"; + case ArcType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface PlayArc { + videoType: BizType; + aid: bigint; + cid: bigint; + drmTechType?: DrmTechType | undefined; + arcType?: ArcType | undefined; + interaction?: Interaction | undefined; + dimension: Dimension | undefined; + duration: bigint; + isPreview?: boolean | undefined; + watchTimeLength: bigint; + durationMs: bigint; +} + +export interface Interaction { + historyNode: Node | undefined; + graphVersion: bigint; + msg: string; + mark: bigint; +} + +export interface Node { + nodeId: bigint; + title: string; + cid: bigint; +} + +/** 当前分辨率信息 */ +export interface Dimension { + /** 宽 */ + width: number; + /** 长 */ + height: number; + /** 旋转角度 */ + rotate: number; +} + +function createBasePlayArc(): PlayArc { + return { videoType: 0, aid: 0n, cid: 0n, dimension: undefined, duration: 0n, watchTimeLength: 0n, durationMs: 0n }; +} + +export const PlayArc: MessageFns = { + encode(message: PlayArc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoType !== 0) { + writer.uint32(8).int32(message.videoType); + } + if (message.aid !== 0n) { + if (BigInt.asUintN(64, message.aid) !== message.aid) { + throw new globalThis.Error("value provided for field message.aid of type uint64 too large"); + } + writer.uint32(16).uint64(message.aid); + } + if (message.cid !== 0n) { + if (BigInt.asUintN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type uint64 too large"); + } + writer.uint32(24).uint64(message.cid); + } + if (message.drmTechType !== undefined) { + writer.uint32(32).int32(message.drmTechType); + } + if (message.arcType !== undefined) { + writer.uint32(40).int32(message.arcType); + } + if (message.interaction !== undefined) { + Interaction.encode(message.interaction, writer.uint32(50).fork()).join(); + } + if (message.dimension !== undefined) { + Dimension.encode(message.dimension, writer.uint32(58).fork()).join(); + } + if (message.duration !== 0n) { + if (BigInt.asIntN(64, message.duration) !== message.duration) { + throw new globalThis.Error("value provided for field message.duration of type int64 too large"); + } + writer.uint32(64).int64(message.duration); + } + if (message.isPreview !== undefined) { + writer.uint32(72).bool(message.isPreview); + } + if (message.watchTimeLength !== 0n) { + if (BigInt.asIntN(64, message.watchTimeLength) !== message.watchTimeLength) { + throw new globalThis.Error("value provided for field message.watchTimeLength of type int64 too large"); + } + writer.uint32(80).int64(message.watchTimeLength); + } + if (message.durationMs !== 0n) { + if (BigInt.asIntN(64, message.durationMs) !== message.durationMs) { + throw new globalThis.Error("value provided for field message.durationMs of type int64 too large"); + } + writer.uint32(88).int64(message.durationMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayArc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayArc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.videoType = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.aid = reader.uint64() as bigint; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.cid = reader.uint64() as bigint; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.drmTechType = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.arcType = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.interaction = Interaction.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.dimension = Dimension.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.duration = reader.int64() as bigint; + continue; + case 9: + if (tag !== 72) { + break; + } + + message.isPreview = reader.bool(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.watchTimeLength = reader.int64() as bigint; + continue; + case 11: + if (tag !== 88) { + break; + } + + message.durationMs = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayArc { + return { + videoType: isSet(object.videoType) ? bizTypeFromJSON(object.videoType) : 0, + aid: isSet(object.aid) ? BigInt(object.aid) : 0n, + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + drmTechType: isSet(object.drmTechType) ? drmTechTypeFromJSON(object.drmTechType) : undefined, + arcType: isSet(object.arcType) ? arcTypeFromJSON(object.arcType) : undefined, + interaction: isSet(object.interaction) ? Interaction.fromJSON(object.interaction) : undefined, + dimension: isSet(object.dimension) ? Dimension.fromJSON(object.dimension) : undefined, + duration: isSet(object.duration) ? BigInt(object.duration) : 0n, + isPreview: isSet(object.isPreview) ? globalThis.Boolean(object.isPreview) : undefined, + watchTimeLength: isSet(object.watchTimeLength) ? BigInt(object.watchTimeLength) : 0n, + durationMs: isSet(object.durationMs) ? BigInt(object.durationMs) : 0n, + }; + }, + + toJSON(message: PlayArc): unknown { + const obj: any = {}; + if (message.videoType !== 0) { + obj.videoType = bizTypeToJSON(message.videoType); + } + if (message.aid !== 0n) { + obj.aid = message.aid.toString(); + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + if (message.drmTechType !== undefined) { + obj.drmTechType = drmTechTypeToJSON(message.drmTechType); + } + if (message.arcType !== undefined) { + obj.arcType = arcTypeToJSON(message.arcType); + } + if (message.interaction !== undefined) { + obj.interaction = Interaction.toJSON(message.interaction); + } + if (message.dimension !== undefined) { + obj.dimension = Dimension.toJSON(message.dimension); + } + if (message.duration !== 0n) { + obj.duration = message.duration.toString(); + } + if (message.isPreview !== undefined) { + obj.isPreview = message.isPreview; + } + if (message.watchTimeLength !== 0n) { + obj.watchTimeLength = message.watchTimeLength.toString(); + } + if (message.durationMs !== 0n) { + obj.durationMs = message.durationMs.toString(); + } + return obj; + }, + + create, I>>(base?: I): PlayArc { + return PlayArc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayArc { + const message = createBasePlayArc(); + message.videoType = object.videoType ?? 0; + message.aid = object.aid ?? 0n; + message.cid = object.cid ?? 0n; + message.drmTechType = object.drmTechType ?? undefined; + message.arcType = object.arcType ?? undefined; + message.interaction = (object.interaction !== undefined && object.interaction !== null) + ? Interaction.fromPartial(object.interaction) + : undefined; + message.dimension = (object.dimension !== undefined && object.dimension !== null) + ? Dimension.fromPartial(object.dimension) + : undefined; + message.duration = object.duration ?? 0n; + message.isPreview = object.isPreview ?? undefined; + message.watchTimeLength = object.watchTimeLength ?? 0n; + message.durationMs = object.durationMs ?? 0n; + return message; + }, +}; + +function createBaseInteraction(): Interaction { + return { historyNode: undefined, graphVersion: 0n, msg: "", mark: 0n }; +} + +export const Interaction: MessageFns = { + encode(message: Interaction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.historyNode !== undefined) { + Node.encode(message.historyNode, writer.uint32(10).fork()).join(); + } + if (message.graphVersion !== 0n) { + if (BigInt.asIntN(64, message.graphVersion) !== message.graphVersion) { + throw new globalThis.Error("value provided for field message.graphVersion of type int64 too large"); + } + writer.uint32(16).int64(message.graphVersion); + } + if (message.msg !== "") { + writer.uint32(26).string(message.msg); + } + if (message.mark !== 0n) { + if (BigInt.asIntN(64, message.mark) !== message.mark) { + throw new globalThis.Error("value provided for field message.mark of type int64 too large"); + } + writer.uint32(32).int64(message.mark); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Interaction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInteraction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.historyNode = Node.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.graphVersion = reader.int64() as bigint; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msg = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.mark = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Interaction { + return { + historyNode: isSet(object.historyNode) ? Node.fromJSON(object.historyNode) : undefined, + graphVersion: isSet(object.graphVersion) ? BigInt(object.graphVersion) : 0n, + msg: isSet(object.msg) ? globalThis.String(object.msg) : "", + mark: isSet(object.mark) ? BigInt(object.mark) : 0n, + }; + }, + + toJSON(message: Interaction): unknown { + const obj: any = {}; + if (message.historyNode !== undefined) { + obj.historyNode = Node.toJSON(message.historyNode); + } + if (message.graphVersion !== 0n) { + obj.graphVersion = message.graphVersion.toString(); + } + if (message.msg !== "") { + obj.msg = message.msg; + } + if (message.mark !== 0n) { + obj.mark = message.mark.toString(); + } + return obj; + }, + + create, I>>(base?: I): Interaction { + return Interaction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Interaction { + const message = createBaseInteraction(); + message.historyNode = (object.historyNode !== undefined && object.historyNode !== null) + ? Node.fromPartial(object.historyNode) + : undefined; + message.graphVersion = object.graphVersion ?? 0n; + message.msg = object.msg ?? ""; + message.mark = object.mark ?? 0n; + return message; + }, +}; + +function createBaseNode(): Node { + return { nodeId: 0n, title: "", cid: 0n }; +} + +export const Node: MessageFns = { + encode(message: Node, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nodeId !== 0n) { + if (BigInt.asIntN(64, message.nodeId) !== message.nodeId) { + throw new globalThis.Error("value provided for field message.nodeId of type int64 too large"); + } + writer.uint32(8).int64(message.nodeId); + } + if (message.title !== "") { + writer.uint32(18).string(message.title); + } + if (message.cid !== 0n) { + if (BigInt.asIntN(64, message.cid) !== message.cid) { + throw new globalThis.Error("value provided for field message.cid of type int64 too large"); + } + writer.uint32(24).int64(message.cid); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Node { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.nodeId = reader.int64() as bigint; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.title = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.cid = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Node { + return { + nodeId: isSet(object.nodeId) ? BigInt(object.nodeId) : 0n, + title: isSet(object.title) ? globalThis.String(object.title) : "", + cid: isSet(object.cid) ? BigInt(object.cid) : 0n, + }; + }, + + toJSON(message: Node): unknown { + const obj: any = {}; + if (message.nodeId !== 0n) { + obj.nodeId = message.nodeId.toString(); + } + if (message.title !== "") { + obj.title = message.title; + } + if (message.cid !== 0n) { + obj.cid = message.cid.toString(); + } + return obj; + }, + + create, I>>(base?: I): Node { + return Node.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Node { + const message = createBaseNode(); + message.nodeId = object.nodeId ?? 0n; + message.title = object.title ?? ""; + message.cid = object.cid ?? 0n; + return message; + }, +}; + +function createBaseDimension(): Dimension { + return { width: 0, height: 0, rotate: 0 }; +} + +export const Dimension: MessageFns = { + encode(message: Dimension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.width !== 0) { + writer.uint32(8).int32(message.width); + } + if (message.height !== 0) { + writer.uint32(16).int32(message.height); + } + if (message.rotate !== 0) { + writer.uint32(24).int32(message.rotate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Dimension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDimension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.width = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.rotate = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Dimension { + return { + width: isSet(object.width) ? globalThis.Number(object.width) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + rotate: isSet(object.rotate) ? globalThis.Number(object.rotate) : 0, + }; + }, + + toJSON(message: Dimension): unknown { + const obj: any = {}; + if (message.width !== 0) { + obj.width = Math.round(message.width); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.rotate !== 0) { + obj.rotate = Math.round(message.rotate); + } + return obj; + }, + + create, I>>(base?: I): Dimension { + return Dimension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Dimension { + const message = createBaseDimension(); + message.width = object.width ?? 0; + message.height = object.height ?? 0; + message.rotate = object.rotate ?? 0; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/PlayArcConf.proto b/src/io/com/bapis/bilibili/playershared/PlayArcConf.proto new file mode 100644 index 0000000..bed6b20 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/PlayArcConf.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +package bilibili.playershared; + +/** 播放页信息-响应: PlayArcConf */ +message PlayArcConf { + map arc_confs = 1; +} + +/** ArcConf消息 */ +message ArcConf { + /** 是否支持 */ + bool is_support = 1; + /** 是否禁用 */ + bool disabled = 2; + /** 额外内容 */ + optional ExtraContent extra_content = 3; + /** 不支持场景列表 */ + repeated int32 unsupport_scene = 4; +} + +/** ? 错误码补充信息 */ +message ExtraContent { + + string disable_reason = 1; + + int64 disable_code = 2; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/PlayArcConf.ts b/src/io/com/bapis/bilibili/playershared/PlayArcConf.ts new file mode 100644 index 0000000..ff78802 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/PlayArcConf.ts @@ -0,0 +1,420 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/PlayArcConf.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.playershared"; + +/** 播放页信息-响应: PlayArcConf */ +export interface PlayArcConf { + arcConfs: { [key: number]: ArcConf }; +} + +export interface PlayArcConf_ArcConfsEntry { + key: number; + value: ArcConf | undefined; +} + +/** ArcConf消息 */ +export interface ArcConf { + /** 是否支持 */ + isSupport: boolean; + /** 是否禁用 */ + disabled: boolean; + /** 额外内容 */ + extraContent?: + | ExtraContent + | undefined; + /** 不支持场景列表 */ + unsupportScene: number[]; +} + +/** ? 错误码补充信息 */ +export interface ExtraContent { + disableReason: string; + disableCode: bigint; +} + +function createBasePlayArcConf(): PlayArcConf { + return { arcConfs: {} }; +} + +export const PlayArcConf: MessageFns = { + encode(message: PlayArcConf, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.arcConfs).forEach(([key, value]) => { + PlayArcConf_ArcConfsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayArcConf { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayArcConf(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = PlayArcConf_ArcConfsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.arcConfs[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayArcConf { + return { + arcConfs: isObject(object.arcConfs) + ? Object.entries(object.arcConfs).reduce<{ [key: number]: ArcConf }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = ArcConf.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: PlayArcConf): unknown { + const obj: any = {}; + if (message.arcConfs) { + const entries = Object.entries(message.arcConfs); + if (entries.length > 0) { + obj.arcConfs = {}; + entries.forEach(([k, v]) => { + obj.arcConfs[k] = ArcConf.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): PlayArcConf { + return PlayArcConf.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayArcConf { + const message = createBasePlayArcConf(); + message.arcConfs = Object.entries(object.arcConfs ?? {}).reduce<{ [key: number]: ArcConf }>((acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = ArcConf.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBasePlayArcConf_ArcConfsEntry(): PlayArcConf_ArcConfsEntry { + return { key: 0, value: undefined }; +} + +export const PlayArcConf_ArcConfsEntry: MessageFns = { + encode(message: PlayArcConf_ArcConfsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).int32(message.key); + } + if (message.value !== undefined) { + ArcConf.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayArcConf_ArcConfsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayArcConf_ArcConfsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.key = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = ArcConf.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayArcConf_ArcConfsEntry { + return { + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? ArcConf.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PlayArcConf_ArcConfsEntry): unknown { + const obj: any = {}; + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = ArcConf.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): PlayArcConf_ArcConfsEntry { + return PlayArcConf_ArcConfsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayArcConf_ArcConfsEntry { + const message = createBasePlayArcConf_ArcConfsEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? ArcConf.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseArcConf(): ArcConf { + return { isSupport: false, disabled: false, unsupportScene: [] }; +} + +export const ArcConf: MessageFns = { + encode(message: ArcConf, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.isSupport !== false) { + writer.uint32(8).bool(message.isSupport); + } + if (message.disabled !== false) { + writer.uint32(16).bool(message.disabled); + } + if (message.extraContent !== undefined) { + ExtraContent.encode(message.extraContent, writer.uint32(26).fork()).join(); + } + writer.uint32(34).fork(); + for (const v of message.unsupportScene) { + writer.int32(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ArcConf { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseArcConf(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.isSupport = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.disabled = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extraContent = ExtraContent.decode(reader, reader.uint32()); + continue; + case 4: + if (tag === 32) { + message.unsupportScene.push(reader.int32()); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unsupportScene.push(reader.int32()); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ArcConf { + return { + isSupport: isSet(object.isSupport) ? globalThis.Boolean(object.isSupport) : false, + disabled: isSet(object.disabled) ? globalThis.Boolean(object.disabled) : false, + extraContent: isSet(object.extraContent) ? ExtraContent.fromJSON(object.extraContent) : undefined, + unsupportScene: globalThis.Array.isArray(object?.unsupportScene) + ? object.unsupportScene.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: ArcConf): unknown { + const obj: any = {}; + if (message.isSupport !== false) { + obj.isSupport = message.isSupport; + } + if (message.disabled !== false) { + obj.disabled = message.disabled; + } + if (message.extraContent !== undefined) { + obj.extraContent = ExtraContent.toJSON(message.extraContent); + } + if (message.unsupportScene?.length) { + obj.unsupportScene = message.unsupportScene.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): ArcConf { + return ArcConf.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ArcConf { + const message = createBaseArcConf(); + message.isSupport = object.isSupport ?? false; + message.disabled = object.disabled ?? false; + message.extraContent = (object.extraContent !== undefined && object.extraContent !== null) + ? ExtraContent.fromPartial(object.extraContent) + : undefined; + message.unsupportScene = object.unsupportScene?.map((e) => e) || []; + return message; + }, +}; + +function createBaseExtraContent(): ExtraContent { + return { disableReason: "", disableCode: 0n }; +} + +export const ExtraContent: MessageFns = { + encode(message: ExtraContent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.disableReason !== "") { + writer.uint32(10).string(message.disableReason); + } + if (message.disableCode !== 0n) { + if (BigInt.asIntN(64, message.disableCode) !== message.disableCode) { + throw new globalThis.Error("value provided for field message.disableCode of type int64 too large"); + } + writer.uint32(16).int64(message.disableCode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtraContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtraContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.disableReason = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.disableCode = reader.int64() as bigint; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtraContent { + return { + disableReason: isSet(object.disableReason) ? globalThis.String(object.disableReason) : "", + disableCode: isSet(object.disableCode) ? BigInt(object.disableCode) : 0n, + }; + }, + + toJSON(message: ExtraContent): unknown { + const obj: any = {}; + if (message.disableReason !== "") { + obj.disableReason = message.disableReason; + } + if (message.disableCode !== 0n) { + obj.disableCode = message.disableCode.toString(); + } + return obj; + }, + + create, I>>(base?: I): ExtraContent { + return ExtraContent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtraContent { + const message = createBaseExtraContent(); + message.disableReason = object.disableReason ?? ""; + message.disableCode = object.disableCode ?? 0n; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/PlayDeviceConf.proto b/src/io/com/bapis/bilibili/playershared/PlayDeviceConf.proto new file mode 100644 index 0000000..a466014 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/PlayDeviceConf.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package bilibili.playershared; + +message PlayDeviceConf { + + map device_confs = 1; +} + +message DeviceConf { + + ConfValue conf_value = 1; +} + +message ConfValue { + oneof value { + + int32 switch_val = 1; + + int32 selected_val = 2; + } +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/PlayDeviceConf.ts b/src/io/com/bapis/bilibili/playershared/PlayDeviceConf.ts new file mode 100644 index 0000000..a4ca80a --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/PlayDeviceConf.ts @@ -0,0 +1,349 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/PlayDeviceConf.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.playershared"; + +export interface PlayDeviceConf { + deviceConfs: { [key: number]: DeviceConf }; +} + +export interface PlayDeviceConf_DeviceConfsEntry { + key: number; + value: DeviceConf | undefined; +} + +export interface DeviceConf { + confValue: ConfValue | undefined; +} + +export interface ConfValue { + switchVal?: number | undefined; + selectedVal?: number | undefined; +} + +function createBasePlayDeviceConf(): PlayDeviceConf { + return { deviceConfs: {} }; +} + +export const PlayDeviceConf: MessageFns = { + encode(message: PlayDeviceConf, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + Object.entries(message.deviceConfs).forEach(([key, value]) => { + PlayDeviceConf_DeviceConfsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayDeviceConf { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayDeviceConf(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = PlayDeviceConf_DeviceConfsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.deviceConfs[entry1.key] = entry1.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayDeviceConf { + return { + deviceConfs: isObject(object.deviceConfs) + ? Object.entries(object.deviceConfs).reduce<{ [key: number]: DeviceConf }>((acc, [key, value]) => { + acc[globalThis.Number(key)] = DeviceConf.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: PlayDeviceConf): unknown { + const obj: any = {}; + if (message.deviceConfs) { + const entries = Object.entries(message.deviceConfs); + if (entries.length > 0) { + obj.deviceConfs = {}; + entries.forEach(([k, v]) => { + obj.deviceConfs[k] = DeviceConf.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): PlayDeviceConf { + return PlayDeviceConf.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayDeviceConf { + const message = createBasePlayDeviceConf(); + message.deviceConfs = Object.entries(object.deviceConfs ?? {}).reduce<{ [key: number]: DeviceConf }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[globalThis.Number(key)] = DeviceConf.fromPartial(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBasePlayDeviceConf_DeviceConfsEntry(): PlayDeviceConf_DeviceConfsEntry { + return { key: 0, value: undefined }; +} + +export const PlayDeviceConf_DeviceConfsEntry: MessageFns = { + encode(message: PlayDeviceConf_DeviceConfsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== 0) { + writer.uint32(8).int32(message.key); + } + if (message.value !== undefined) { + DeviceConf.encode(message.value, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayDeviceConf_DeviceConfsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayDeviceConf_DeviceConfsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.key = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = DeviceConf.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayDeviceConf_DeviceConfsEntry { + return { + key: isSet(object.key) ? globalThis.Number(object.key) : 0, + value: isSet(object.value) ? DeviceConf.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: PlayDeviceConf_DeviceConfsEntry): unknown { + const obj: any = {}; + if (message.key !== 0) { + obj.key = Math.round(message.key); + } + if (message.value !== undefined) { + obj.value = DeviceConf.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): PlayDeviceConf_DeviceConfsEntry { + return PlayDeviceConf_DeviceConfsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PlayDeviceConf_DeviceConfsEntry { + const message = createBasePlayDeviceConf_DeviceConfsEntry(); + message.key = object.key ?? 0; + message.value = (object.value !== undefined && object.value !== null) + ? DeviceConf.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseDeviceConf(): DeviceConf { + return { confValue: undefined }; +} + +export const DeviceConf: MessageFns = { + encode(message: DeviceConf, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.confValue !== undefined) { + ConfValue.encode(message.confValue, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeviceConf { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeviceConf(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.confValue = ConfValue.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeviceConf { + return { confValue: isSet(object.confValue) ? ConfValue.fromJSON(object.confValue) : undefined }; + }, + + toJSON(message: DeviceConf): unknown { + const obj: any = {}; + if (message.confValue !== undefined) { + obj.confValue = ConfValue.toJSON(message.confValue); + } + return obj; + }, + + create, I>>(base?: I): DeviceConf { + return DeviceConf.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeviceConf { + const message = createBaseDeviceConf(); + message.confValue = (object.confValue !== undefined && object.confValue !== null) + ? ConfValue.fromPartial(object.confValue) + : undefined; + return message; + }, +}; + +function createBaseConfValue(): ConfValue { + return {}; +} + +export const ConfValue: MessageFns = { + encode(message: ConfValue, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.switchVal !== undefined) { + writer.uint32(8).int32(message.switchVal); + } + if (message.selectedVal !== undefined) { + writer.uint32(16).int32(message.selectedVal); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.switchVal = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.selectedVal = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfValue { + return { + switchVal: isSet(object.switchVal) ? globalThis.Number(object.switchVal) : undefined, + selectedVal: isSet(object.selectedVal) ? globalThis.Number(object.selectedVal) : undefined, + }; + }, + + toJSON(message: ConfValue): unknown { + const obj: any = {}; + if (message.switchVal !== undefined) { + obj.switchVal = Math.round(message.switchVal); + } + if (message.selectedVal !== undefined) { + obj.selectedVal = Math.round(message.selectedVal); + } + return obj; + }, + + create, I>>(base?: I): ConfValue { + return ConfValue.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfValue { + const message = createBaseConfValue(); + message.switchVal = object.switchVal ?? undefined; + message.selectedVal = object.selectedVal ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/QnTrialInfo.proto b/src/io/com/bapis/bilibili/playershared/QnTrialInfo.proto new file mode 100644 index 0000000..5f67f63 --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/QnTrialInfo.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package bilibili.playershared; + +import "src/io/com/bapis/bilibili/playershared/Toast.proto"; + +// 播放页信息-响应: 高画质试看信息 +message QnTrialInfo { + /** 能否试看高画质 */ + bool trial_able = 1; + + int32 remaining_times = 2; + + int32 start = 3; + + int32 time_length = 4; + + Toast start_toast = 5; + + Toast end_toast = 6; + + Button quality_open_tip_btn = 8; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/QnTrialInfo.ts b/src/io/com/bapis/bilibili/playershared/QnTrialInfo.ts new file mode 100644 index 0000000..cea141c --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/QnTrialInfo.ts @@ -0,0 +1,211 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/QnTrialInfo.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { Button, Toast } from "./Toast"; + +export const protobufPackage = "bilibili.playershared"; + +/** 播放页信息-响应: 高画质试看信息 */ +export interface QnTrialInfo { + /** 能否试看高画质 */ + trialAble: boolean; + remainingTimes: number; + start: number; + timeLength: number; + startToast: Toast | undefined; + endToast: Toast | undefined; + qualityOpenTipBtn: Button | undefined; +} + +function createBaseQnTrialInfo(): QnTrialInfo { + return { + trialAble: false, + remainingTimes: 0, + start: 0, + timeLength: 0, + startToast: undefined, + endToast: undefined, + qualityOpenTipBtn: undefined, + }; +} + +export const QnTrialInfo: MessageFns = { + encode(message: QnTrialInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.trialAble !== false) { + writer.uint32(8).bool(message.trialAble); + } + if (message.remainingTimes !== 0) { + writer.uint32(16).int32(message.remainingTimes); + } + if (message.start !== 0) { + writer.uint32(24).int32(message.start); + } + if (message.timeLength !== 0) { + writer.uint32(32).int32(message.timeLength); + } + if (message.startToast !== undefined) { + Toast.encode(message.startToast, writer.uint32(42).fork()).join(); + } + if (message.endToast !== undefined) { + Toast.encode(message.endToast, writer.uint32(50).fork()).join(); + } + if (message.qualityOpenTipBtn !== undefined) { + Button.encode(message.qualityOpenTipBtn, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QnTrialInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQnTrialInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.trialAble = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.remainingTimes = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.start = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.timeLength = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.startToast = Toast.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.endToast = Toast.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.qualityOpenTipBtn = Button.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QnTrialInfo { + return { + trialAble: isSet(object.trialAble) ? globalThis.Boolean(object.trialAble) : false, + remainingTimes: isSet(object.remainingTimes) ? globalThis.Number(object.remainingTimes) : 0, + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + timeLength: isSet(object.timeLength) ? globalThis.Number(object.timeLength) : 0, + startToast: isSet(object.startToast) ? Toast.fromJSON(object.startToast) : undefined, + endToast: isSet(object.endToast) ? Toast.fromJSON(object.endToast) : undefined, + qualityOpenTipBtn: isSet(object.qualityOpenTipBtn) ? Button.fromJSON(object.qualityOpenTipBtn) : undefined, + }; + }, + + toJSON(message: QnTrialInfo): unknown { + const obj: any = {}; + if (message.trialAble !== false) { + obj.trialAble = message.trialAble; + } + if (message.remainingTimes !== 0) { + obj.remainingTimes = Math.round(message.remainingTimes); + } + if (message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.timeLength !== 0) { + obj.timeLength = Math.round(message.timeLength); + } + if (message.startToast !== undefined) { + obj.startToast = Toast.toJSON(message.startToast); + } + if (message.endToast !== undefined) { + obj.endToast = Toast.toJSON(message.endToast); + } + if (message.qualityOpenTipBtn !== undefined) { + obj.qualityOpenTipBtn = Button.toJSON(message.qualityOpenTipBtn); + } + return obj; + }, + + create, I>>(base?: I): QnTrialInfo { + return QnTrialInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QnTrialInfo { + const message = createBaseQnTrialInfo(); + message.trialAble = object.trialAble ?? false; + message.remainingTimes = object.remainingTimes ?? 0; + message.start = object.start ?? 0; + message.timeLength = object.timeLength ?? 0; + message.startToast = (object.startToast !== undefined && object.startToast !== null) + ? Toast.fromPartial(object.startToast) + : undefined; + message.endToast = (object.endToast !== undefined && object.endToast !== null) + ? Toast.fromPartial(object.endToast) + : undefined; + message.qualityOpenTipBtn = (object.qualityOpenTipBtn !== undefined && object.qualityOpenTipBtn !== null) + ? Button.fromPartial(object.qualityOpenTipBtn) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/src/io/com/bapis/bilibili/playershared/Toast.proto b/src/io/com/bapis/bilibili/playershared/Toast.proto new file mode 100644 index 0000000..a046cee --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/Toast.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +package bilibili.playershared; + +message Toast { + /** toast文案 */ + string text = 1; + /** toast按钮 */ + Button button = 2; +} + +/** 按钮组件 */ +message Button { + /** 按钮文本 */ + string text = 1; + /** 按钮跳转链接 */ + string link = 2; + /** 埋点上报相关 */ + map report_params = 3; +} \ No newline at end of file diff --git a/src/io/com/bapis/bilibili/playershared/Toast.ts b/src/io/com/bapis/bilibili/playershared/Toast.ts new file mode 100644 index 0000000..bdff22b --- /dev/null +++ b/src/io/com/bapis/bilibili/playershared/Toast.ts @@ -0,0 +1,322 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.2 +// source: src/io/com/bapis/bilibili/playershared/Toast.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "bilibili.playershared"; + +export interface Toast { + /** toast文案 */ + text: string; + /** toast按钮 */ + button: Button | undefined; +} + +/** 按钮组件 */ +export interface Button { + /** 按钮文本 */ + text: string; + /** 按钮跳转链接 */ + link: string; + /** 埋点上报相关 */ + reportParams: { [key: string]: string }; +} + +export interface Button_ReportParamsEntry { + key: string; + value: string; +} + +function createBaseToast(): Toast { + return { text: "", button: undefined }; +} + +export const Toast: MessageFns = { + encode(message: Toast, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + if (message.button !== undefined) { + Button.encode(message.button, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Toast { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseToast(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.button = Button.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Toast { + return { + text: isSet(object.text) ? globalThis.String(object.text) : "", + button: isSet(object.button) ? Button.fromJSON(object.button) : undefined, + }; + }, + + toJSON(message: Toast): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + if (message.button !== undefined) { + obj.button = Button.toJSON(message.button); + } + return obj; + }, + + create, I>>(base?: I): Toast { + return Toast.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Toast { + const message = createBaseToast(); + message.text = object.text ?? ""; + message.button = (object.button !== undefined && object.button !== null) + ? Button.fromPartial(object.button) + : undefined; + return message; + }, +}; + +function createBaseButton(): Button { + return { text: "", link: "", reportParams: {} }; +} + +export const Button: MessageFns