diff --git a/.npmignore b/.npmignore index a3a68dfcd7..98fb6412d3 100644 --- a/.npmignore +++ b/.npmignore @@ -3,4 +3,5 @@ src/ !dist/** !README.md +!LICENSE !bundle/** \ No newline at end of file diff --git a/dev-scripts/generate-proto.mjs b/dev-scripts/generate-proto.mjs new file mode 100644 index 0000000000..6f476d997d --- /dev/null +++ b/dev-scripts/generate-proto.mjs @@ -0,0 +1,54 @@ +import { exec } from 'child_process'; +import { existsSync, mkdirSync, readdirSync, statSync } from 'fs'; +import { join } from 'path'; +import path from 'path'; +import url from 'url'; +import os from 'os'; + +const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); + +const protoDir = './protos'; +const outDir = './protos/generated'; + +if (!existsSync(outDir)) { + mkdirSync(outDir, { recursive: true }); +} + +const protocGenTs = path.join( + __dirname, + '../node_modules', + '.bin', + os.platform() === 'win32' ? 'protoc-gen-ts_proto.cmd' : 'protoc-gen-ts_proto' +); + +function listProtoFiles(dir) { + let protoFiles = []; + const items = readdirSync(dir); + + for (const item of items) { + const fullPath = join(dir, item); + if (statSync(fullPath).isDirectory()) { + protoFiles = protoFiles.concat(listProtoFiles(fullPath)); + } else if (item.endsWith('.proto')) { + protoFiles.push(fullPath); + } + } + + return protoFiles; +} + +const protoFiles = listProtoFiles(protoDir); + +if (!protoFiles.length) { + console.log('No .proto files found.'); + process.exit(0); +} + +protoFiles.forEach((file) => { + const command = `protoc --proto_path=${protoDir} --plugin=protoc-gen-ts=${protocGenTs} --ts_opt=env=browser --ts_opt=importSuffix=.js --ts_out=${outDir} ${file}`; + exec(command, (error, _stdout, stderr) => { + if (error) { + console.error(`Error compiling ${file}:`, stderr); + } + }); +}); \ No newline at end of file diff --git a/examples/browser/web/src/main.ts b/examples/browser/web/src/main.ts index c01f7f5ae6..12dd700881 100644 --- a/examples/browser/web/src/main.ts +++ b/examples/browser/web/src/main.ts @@ -1,4 +1,4 @@ -import { Innertube, Proto, UniversalCache, Utils } from '../../../../bundle/browser'; +import { Innertube, ProtoUtils, UniversalCache, Utils } from '../../../../bundle/browser'; import BG from 'bgutils-js'; // @ts-ignore - Shaka's TS support is not the best. @@ -13,7 +13,7 @@ const form = document.querySelector('form') as HTMLFormElement; async function main() { - const visitorData = Proto.encodeVisitorData(Utils.generateRandomString(11), Math.floor(Date.now() / 1000)); + const visitorData = ProtoUtils.encodeVisitorData(Utils.generateRandomString(11), Math.floor(Date.now() / 1000)); const poToken = await getPo(visitorData); const yt = await Innertube.create({ diff --git a/package-lock.json b/package-lock.json index 3acada27ce..44f970ab8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ ], "license": "MIT", "dependencies": { + "@bufbuild/protobuf": "^2.0.0", "jintr": "^2.1.1", "tslib": "^2.5.0", "undici": "^5.19.1" @@ -27,10 +28,11 @@ "glob": "^8.0.3", "globals": "^15.9.0", "jest": "^29.7.0", - "pbkit": "^0.0.59", "replace": "^1.2.2", + "rimraf": "^6.0.1", "ts-jest": "^29.1.4", "ts-patch": "^3.0.2", + "ts-proto": "^2.2.0", "ts-transformer-inline-file": "^0.2.0", "typescript": "^5.0.0", "typescript-eslint": "^8.2.0" @@ -627,6 +629,11 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@bufbuild/protobuf": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.0.0.tgz", + "integrity": "sha512-sw2JhwJyvyL0zlhG61aDzOVryEfJg2PDZFSV7i7IdC7nAE41WuXCru3QWLGiP87At0BMzKOoKO/FqEGoKygGZQ==" + }, "node_modules/@esbuild/linux-loong64": { "version": "0.14.54", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz", @@ -780,6 +787,102 @@ "url": "https://github.com/sponsors/nzakas" } }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1786,6 +1889,16 @@ "node": ">= 8" } }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@sinclair/typebox": { "version": "0.24.51", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", @@ -1851,12 +1964,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/emscripten": { - "version": "1.39.12", - "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.39.12.tgz", - "integrity": "sha512-AQImDBgudQfMqUBfrjZYilRxoHDzTBp+ejh+g1fY67eSMalwIKtBXofjpyI0JBgNpHGzxeGAR2QDya0wxW9zbA==", - "dev": true - }, "node_modules/@types/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz", @@ -2173,44 +2280,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@yarnpkg/fslib": { - "version": "2.10.4", - "resolved": "https://registry.npmjs.org/@yarnpkg/fslib/-/fslib-2.10.4.tgz", - "integrity": "sha512-WhaLwvXEMjCjGxOraQx+Qtmst13iAPOlSElSZfQFdLohva5owlqACRapJ78zZFEW6M9ArqdQlZaHKVN5/mM+SA==", - "dev": true, - "dependencies": { - "@yarnpkg/libzip": "^2.3.0", - "tslib": "^1.13.0" - }, - "engines": { - "node": ">=12 <14 || 14.2 - 14.9 || >14.10.0" - } - }, - "node_modules/@yarnpkg/fslib/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/@yarnpkg/libzip": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@yarnpkg/libzip/-/libzip-2.3.0.tgz", - "integrity": "sha512-6xm38yGVIa6mKm/DUCF2zFFJhERh/QWp1ufm4cNUvxsONBmfPg8uZ9pZBdOmF6qFGr/HlT6ABBkCSx/dlEtvWg==", - "dev": true, - "dependencies": { - "@types/emscripten": "^1.39.6", - "tslib": "^1.13.0" - }, - "engines": { - "node": ">=12 <14 || 14.2 - 14.9 || >14.10.0" - } - }, - "node_modules/@yarnpkg/libzip/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, "node_modules/acorn": { "version": "8.12.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", @@ -2637,6 +2706,18 @@ } ] }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2770,18 +2851,6 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, - "node_modules/core-js": { - "version": "3.18.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.18.1.tgz", - "integrity": "sha512-vJlUi/7YdlCZeL6fXvWNaLUPh/id12WXj3MbkMw5uOyF0PfWPBNOCNbs53YqgrvtujLNlt9JQpruyIKkUZ+PKA==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", - "dev": true, - "hasInstallScript": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, "node_modules/cp-file": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-9.1.0.tgz", @@ -3016,6 +3085,18 @@ "node": ">=0.10.0" } }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -3046,6 +3127,21 @@ "node": ">=8" } }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "dependencies": { + "detect-libc": "^1.0.3" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/electron-to-chromium": { "version": "1.4.788", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.788.tgz", @@ -3786,6 +3882,34 @@ "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, + "node_modules/foreground-child": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3858,6 +3982,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -4322,6 +4447,24 @@ "node": ">=8" } }, + "node_modules/jackspeak": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.1.tgz", + "integrity": "sha512-cub8rahkh0Q/bw1+GxP7aeSe29hHHn2V4m29nnDlvCdlgU+3UGxkZp7Z53jLUdpX3jdTO0nJZUDl3xvbWc2Xog==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -6159,13 +6302,13 @@ "node": ">=0.10.0" } }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, "engines": { - "node": ">=4" + "node": ">=16 || 14 >=14.17" } }, "node_modules/ms": { @@ -6380,6 +6523,12 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -6443,6 +6592,31 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", + "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", + "dev": true, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -6452,22 +6626,6 @@ "node": ">=8" } }, - "node_modules/pbkit": { - "version": "0.0.59", - "resolved": "https://registry.npmjs.org/pbkit/-/pbkit-0.0.59.tgz", - "integrity": "sha512-bBivFTDbmQPqUukFegIK2ScTSNnvdp5p2ghsdpivL1ZUZ/mkzy3rGDT+PvX1enoJJTY2G6nV1Zp4G+SM5vjMJg==", - "dev": true, - "dependencies": { - "@yarnpkg/fslib": "^2.6.0-rc.8", - "@yarnpkg/libzip": "^2.2.2", - "core-js": "3.18.1", - "mri": "^1.2.0" - }, - "bin": { - "pb-gen-ts": "compat/node/cli/pb-gen-ts.js", - "pb-gen-ts-bundle": "compat/node/cli/pb-gen-ts-bundle.js" - } - }, "node_modules/picocolors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", @@ -7071,6 +7229,72 @@ "node": ">=0.10.0" } }, + "node_modules/rimraf": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", + "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", + "dev": true, + "dependencies": { + "glob": "^11.0.0", + "package-json-from-dist": "^1.0.0" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", + "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -7259,6 +7483,21 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -7271,6 +7510,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -7540,6 +7792,39 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ts-poet": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.9.0.tgz", + "integrity": "sha512-roe6W6MeZmCjRmppyfOURklO5tQFQ6Sg7swURKkwYJvV7dbGCrK28um5+51iW3twdPRKtwarqFAVMU6G1mvnuQ==", + "dev": true, + "dependencies": { + "dprint-node": "^1.0.8" + } + }, + "node_modules/ts-proto": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.2.0.tgz", + "integrity": "sha512-xzmnyrarUjPnY+Py4RyTh3lYmL9w5t/oTtRTo2rKF8laAAahpGZ/ELxkXFEZns5JVbgkYke3C17HN5iNvZOs4g==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^2.0.0", + "case-anything": "^2.1.13", + "ts-poet": "^6.7.0", + "ts-proto-descriptors": "2.0.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-2.0.0.tgz", + "integrity": "sha512-wHcTH3xIv11jxgkX5OyCSFfw27agpInAd6yh89hKG6zqIXnjW9SYqSER2CVQxdPj4czeOhGagNvZBEbJPy7qkw==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^2.0.0" + } + }, "node_modules/ts-transformer-inline-file": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/ts-transformer-inline-file/-/ts-transformer-inline-file-0.2.0.tgz", @@ -7744,6 +8029,24 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 8e990ad183..7e952a08bb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "youtubei.js", "version": "10.4.0", - "description": "A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).", + "description": "A JavaScript client for YouTube's private API, known as InnerTube.", "type": "module", "types": "./dist/src/platform/lib.d.ts", "typesVersions": { @@ -75,29 +75,37 @@ "Absidue (https://github.com/absidue)" ], "scripts": { - "test": "npx jest --verbose", - "lint": "npx eslint ./src", - "lint:fix": "npx eslint --fix ./src", - "clean": "npx rimraf ./dist/src ./dist/package.json ./bundle/browser.js ./bundle/browser.js.map ./bundle/browser.min.js ./bundle/browser.min.js.map ./bundle/node.cjs ./bundle/node.cjs.map ./bundle/cf-worker.js ./bundle/cf-worker.js.map ./bundle/react-native.js ./bundle/react-native.js.map ./deno", - "build": "npm run clean && npm run build:parser-map && npm run build:proto && npm run build:esm && npm run bundle:node && npm run bundle:browser && npm run bundle:browser:prod && npm run bundle:cf-worker && npm run bundle:react-native", + "test": "jest --verbose", + "lint": "eslint ./src", + "lint:fix": "eslint --fix ./src", + "clean": "rimraf ./dist ./bundle/browser.js ./bundle/browser.min.js ./bundle/node.cjs ./bundle/cf-worker.js ./bundle/react-native.js ./deno", + "build": "npm run clean && npm run build:parser-map && npm run build:esm && npm run bundle:node && npm run bundle:browser && npm run bundle:browser:prod && npm run bundle:cf-worker && npm run bundle:react-native", + "build:esm": "tspc", + "build:deno": "cpy ./src ./deno && cpy ./protos ./deno && esbuild ./src/utils/DashManifest.tsx --keep-names --format=esm --platform=neutral --target=es2020 --outfile=./deno/src/utils/DashManifest.js && cpy ./package.json ./deno && replace \".js';\" \".ts';\" ./deno -r && replace '.js\";' '.ts\";' ./deno -r && replace \"'./DashManifest.ts';\" \"'./DashManifest.js';\" ./deno -r && replace \"'jintr';\" \"'https://esm.sh/jintr';\" ./deno -r", + "build:proto": "rimraf ./protos/generated && node ./dev-scripts/generate-proto.mjs", "build:parser-map": "node ./dev-scripts/gen-parser-map.mjs", - "build:proto": "npx pb-gen-ts --entry-path=\"src/proto\" --out-dir=\"src/proto/generated\" --ext-in-import=\".js\"", - "build:esm": "npx tspc", - "build:deno": "npx cpy ./src ./deno && npx esbuild ./src/utils/DashManifest.tsx --keep-names --format=esm --platform=neutral --target=es2020 --outfile=./deno/src/utils/DashManifest.js && npx cpy ./package.json ./deno && npx replace \".js';\" \".ts';\" ./deno -r && npx replace '.js\";' '.ts\";' ./deno -r && npx replace \"'./DashManifest.ts';\" \"'./DashManifest.js';\" ./deno -r && npx replace \"'jintr';\" \"'https://esm.sh/jintr';\" ./deno -r", - "bundle:node": "npx esbuild ./dist/src/platform/node.js --bundle --target=node10 --keep-names --format=cjs --platform=node --outfile=./bundle/node.cjs --external:jintr --external:undici --external:linkedom --external:tslib --sourcemap --banner:js=\"/* eslint-disable */\"", - "bundle:browser": "npx esbuild ./dist/src/platform/web.js --banner:js=\"/* eslint-disable */\" --bundle --target=chrome58 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser", - "bundle:react-native": "npx esbuild ./dist/src/platform/react-native.js --bundle --target=es2020 --keep-names --format=esm --platform=neutral --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/react-native.js", + "bundle:node": "esbuild ./dist/src/platform/node.js --bundle --target=node16 --keep-names --format=cjs --platform=node --outfile=./bundle/node.cjs --external:jintr --external:undici --external:linkedom --external:tslib --banner:js=\"/* eslint-disable */\"", + "bundle:browser": "esbuild ./dist/src/platform/web.js --banner:js=\"/* eslint-disable */\" --bundle --target=chrome70 --keep-names --format=esm --define:global=globalThis --conditions=module --outfile=./bundle/browser.js --platform=browser", + "bundle:react-native": "esbuild ./dist/src/platform/react-native.js --bundle --target=es2020 --keep-names --format=esm --platform=neutral --define:global=globalThis --conditions=module --outfile=./bundle/react-native.js", "bundle:browser:prod": "npm run bundle:browser -- --outfile=./bundle/browser.min.js --minify", - "bundle:cf-worker": "npx esbuild ./dist/src/platform/cf-worker.js --banner:js=\"/* eslint-disable */\" --bundle --target=es2020 --keep-names --format=esm --sourcemap --define:global=globalThis --conditions=module --outfile=./bundle/cf-worker.js --platform=node", + "bundle:cf-worker": "esbuild ./dist/src/platform/cf-worker.js --banner:js=\"/* eslint-disable */\" --bundle --target=es2020 --keep-names --format=esm --define:global=globalThis --conditions=module --outfile=./bundle/cf-worker.js --platform=node", "prepare": "npm run build", - "watch": "npx tsc --watch" + "watch": "tspc --watch" }, "repository": { "type": "git", "url": "git+https://github.com/LuanRT/YouTube.js.git" }, + "files": [ + "dist/", + "bundle/", + "package.json", + "README.md", + "LICENSE" + ], "license": "MIT", "dependencies": { + "@bufbuild/protobuf": "^2.0.0", "jintr": "^2.1.1", "tslib": "^2.5.0", "undici": "^5.19.1" @@ -116,10 +124,11 @@ "glob": "^8.0.3", "globals": "^15.9.0", "jest": "^29.7.0", - "pbkit": "^0.0.59", "replace": "^1.2.2", + "rimraf": "^6.0.1", "ts-jest": "^29.1.4", "ts-patch": "^3.0.2", + "ts-proto": "^2.2.0", "ts-transformer-inline-file": "^0.2.0", "typescript": "^5.0.0", "typescript-eslint": "^8.2.0" @@ -129,24 +138,14 @@ }, "homepage": "https://github.com/LuanRT/YouTube.js#readme", "keywords": [ - "yt", - "dl", - "ytdl", "youtube", - "youtubedl", - "youtube-dl", - "youtube-downloader", "youtube-music", "youtube-studio", "innertube", - "unofficial", "downloader", "livechat", - "studio", - "upload", "ytmusic", - "search", - "music", + "ytdl", "api" ] } diff --git a/protos/generated/misc/common.ts b/protos/generated/misc/common.ts new file mode 100644 index 0000000000..e5fadfbbcb --- /dev/null +++ b/protos/generated/misc/common.ts @@ -0,0 +1,457 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: misc/common.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "misc"; + +export interface HttpHeader { + name?: string | undefined; + value?: string | undefined; +} + +export interface FormatId { + itag?: number | undefined; + lastModified?: number | undefined; + xtags?: string | undefined; +} + +export interface InitRange { + start?: number | undefined; + end?: number | undefined; +} + +export interface IndexRange { + start?: number | undefined; + end?: number | undefined; +} + +export interface KeyValuePair { + key?: string | undefined; + value?: string | undefined; +} + +function createBaseHttpHeader(): HttpHeader { + return { name: undefined, value: undefined }; +} + +export const HttpHeader: MessageFns = { + encode(message: HttpHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined) { + writer.uint32(10).string(message.name); + } + if (message.value !== undefined) { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HttpHeader { + return { + name: isSet(object.name) ? globalThis.String(object.name) : undefined, + value: isSet(object.value) ? globalThis.String(object.value) : undefined, + }; + }, + + toJSON(message: HttpHeader): unknown { + const obj: any = {}; + if (message.name !== undefined) { + obj.name = message.name; + } + if (message.value !== undefined) { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): HttpHeader { + return HttpHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HttpHeader { + const message = createBaseHttpHeader(); + message.name = object.name ?? undefined; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseFormatId(): FormatId { + return { itag: undefined, lastModified: undefined, xtags: undefined }; +} + +export const FormatId: MessageFns = { + encode(message: FormatId, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.itag !== undefined) { + writer.uint32(8).int32(message.itag); + } + if (message.lastModified !== undefined) { + writer.uint32(16).uint64(message.lastModified); + } + if (message.xtags !== undefined) { + writer.uint32(26).string(message.xtags); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FormatId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFormatId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.itag = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.lastModified = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.xtags = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FormatId { + return { + itag: isSet(object.itag) ? globalThis.Number(object.itag) : undefined, + lastModified: isSet(object.lastModified) ? globalThis.Number(object.lastModified) : undefined, + xtags: isSet(object.xtags) ? globalThis.String(object.xtags) : undefined, + }; + }, + + toJSON(message: FormatId): unknown { + const obj: any = {}; + if (message.itag !== undefined) { + obj.itag = Math.round(message.itag); + } + if (message.lastModified !== undefined) { + obj.lastModified = Math.round(message.lastModified); + } + if (message.xtags !== undefined) { + obj.xtags = message.xtags; + } + return obj; + }, + + create, I>>(base?: I): FormatId { + return FormatId.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FormatId { + const message = createBaseFormatId(); + message.itag = object.itag ?? undefined; + message.lastModified = object.lastModified ?? undefined; + message.xtags = object.xtags ?? undefined; + return message; + }, +}; + +function createBaseInitRange(): InitRange { + return { start: undefined, end: undefined }; +} + +export const InitRange: MessageFns = { + encode(message: InitRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InitRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInitRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InitRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : undefined, + end: isSet(object.end) ? globalThis.Number(object.end) : undefined, + }; + }, + + toJSON(message: InitRange): unknown { + const obj: any = {}; + if (message.start !== undefined) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined) { + obj.end = Math.round(message.end); + } + return obj; + }, + + create, I>>(base?: I): InitRange { + return InitRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InitRange { + const message = createBaseInitRange(); + message.start = object.start ?? undefined; + message.end = object.end ?? undefined; + return message; + }, +}; + +function createBaseIndexRange(): IndexRange { + return { start: undefined, end: undefined }; +} + +export const IndexRange: MessageFns = { + encode(message: IndexRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IndexRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIndexRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IndexRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : undefined, + end: isSet(object.end) ? globalThis.Number(object.end) : undefined, + }; + }, + + toJSON(message: IndexRange): unknown { + const obj: any = {}; + if (message.start !== undefined) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined) { + obj.end = Math.round(message.end); + } + return obj; + }, + + create, I>>(base?: I): IndexRange { + return IndexRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IndexRange { + const message = createBaseIndexRange(); + message.start = object.start ?? undefined; + message.end = object.end ?? undefined; + return message; + }, +}; + +function createBaseKeyValuePair(): KeyValuePair { + return { key: undefined, value: undefined }; +} + +export const KeyValuePair: MessageFns = { + encode(message: KeyValuePair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== undefined) { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KeyValuePair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKeyValuePair(); + 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): KeyValuePair { + return { + key: isSet(object.key) ? globalThis.String(object.key) : undefined, + value: isSet(object.value) ? globalThis.String(object.value) : undefined, + }; + }, + + toJSON(message: KeyValuePair): unknown { + const obj: any = {}; + if (message.key !== undefined) { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): KeyValuePair { + return KeyValuePair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): KeyValuePair { + const message = createBaseKeyValuePair(); + message.key = object.key ?? undefined; + message.value = object.value ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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 longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +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/protos/generated/misc/params.ts b/protos/generated/misc/params.ts new file mode 100644 index 0000000000..a0b7d22029 --- /dev/null +++ b/protos/generated/misc/params.ts @@ -0,0 +1,3340 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: misc/params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "misc"; + +export interface VisitorData { + id: string; + timestamp: number; +} + +export interface SearchFilter { + sortBy?: SearchFilter_SortBy | undefined; + filters?: SearchFilter_Filters | undefined; +} + +export enum SearchFilter_SortBy { + RELEVANCE = 0, + RATING = 1, + UPLOAD_DATE = 2, + VIEW_COUNT = 3, + UNRECOGNIZED = -1, +} + +export function searchFilter_SortByFromJSON(object: any): SearchFilter_SortBy { + switch (object) { + case 0: + case "RELEVANCE": + return SearchFilter_SortBy.RELEVANCE; + case 1: + case "RATING": + return SearchFilter_SortBy.RATING; + case 2: + case "UPLOAD_DATE": + return SearchFilter_SortBy.UPLOAD_DATE; + case 3: + case "VIEW_COUNT": + return SearchFilter_SortBy.VIEW_COUNT; + case -1: + case "UNRECOGNIZED": + default: + return SearchFilter_SortBy.UNRECOGNIZED; + } +} + +export function searchFilter_SortByToJSON(object: SearchFilter_SortBy): string { + switch (object) { + case SearchFilter_SortBy.RELEVANCE: + return "RELEVANCE"; + case SearchFilter_SortBy.RATING: + return "RATING"; + case SearchFilter_SortBy.UPLOAD_DATE: + return "UPLOAD_DATE"; + case SearchFilter_SortBy.VIEW_COUNT: + return "VIEW_COUNT"; + case SearchFilter_SortBy.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface SearchFilter_Filters { + uploadDate?: SearchFilter_Filters_UploadDate | undefined; + type?: SearchFilter_Filters_SearchType | undefined; + duration?: SearchFilter_Filters_Duration | undefined; + musicSearchType?: SearchFilter_Filters_MusicSearchType | undefined; + featuresHd?: boolean | undefined; + featuresSubtitles?: boolean | undefined; + featuresCreativeCommons?: boolean | undefined; + features3d?: boolean | undefined; + featuresLive?: boolean | undefined; + featuresPurchased?: boolean | undefined; + features4k?: boolean | undefined; + features360?: boolean | undefined; + featuresLocation?: boolean | undefined; + featuresHdr?: boolean | undefined; + featuresVr180?: boolean | undefined; +} + +export enum SearchFilter_Filters_UploadDate { + ANY_DATE = 0, + HOUR = 1, + TODAY = 2, + WEEK = 3, + MONTH = 4, + YEAR = 5, + UNRECOGNIZED = -1, +} + +export function searchFilter_Filters_UploadDateFromJSON(object: any): SearchFilter_Filters_UploadDate { + switch (object) { + case 0: + case "ANY_DATE": + return SearchFilter_Filters_UploadDate.ANY_DATE; + case 1: + case "HOUR": + return SearchFilter_Filters_UploadDate.HOUR; + case 2: + case "TODAY": + return SearchFilter_Filters_UploadDate.TODAY; + case 3: + case "WEEK": + return SearchFilter_Filters_UploadDate.WEEK; + case 4: + case "MONTH": + return SearchFilter_Filters_UploadDate.MONTH; + case 5: + case "YEAR": + return SearchFilter_Filters_UploadDate.YEAR; + case -1: + case "UNRECOGNIZED": + default: + return SearchFilter_Filters_UploadDate.UNRECOGNIZED; + } +} + +export function searchFilter_Filters_UploadDateToJSON(object: SearchFilter_Filters_UploadDate): string { + switch (object) { + case SearchFilter_Filters_UploadDate.ANY_DATE: + return "ANY_DATE"; + case SearchFilter_Filters_UploadDate.HOUR: + return "HOUR"; + case SearchFilter_Filters_UploadDate.TODAY: + return "TODAY"; + case SearchFilter_Filters_UploadDate.WEEK: + return "WEEK"; + case SearchFilter_Filters_UploadDate.MONTH: + return "MONTH"; + case SearchFilter_Filters_UploadDate.YEAR: + return "YEAR"; + case SearchFilter_Filters_UploadDate.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum SearchFilter_Filters_SearchType { + ANY_TYPE = 0, + VIDEO = 1, + CHANNEL = 2, + PLAYLIST = 3, + MOVIE = 4, + UNRECOGNIZED = -1, +} + +export function searchFilter_Filters_SearchTypeFromJSON(object: any): SearchFilter_Filters_SearchType { + switch (object) { + case 0: + case "ANY_TYPE": + return SearchFilter_Filters_SearchType.ANY_TYPE; + case 1: + case "VIDEO": + return SearchFilter_Filters_SearchType.VIDEO; + case 2: + case "CHANNEL": + return SearchFilter_Filters_SearchType.CHANNEL; + case 3: + case "PLAYLIST": + return SearchFilter_Filters_SearchType.PLAYLIST; + case 4: + case "MOVIE": + return SearchFilter_Filters_SearchType.MOVIE; + case -1: + case "UNRECOGNIZED": + default: + return SearchFilter_Filters_SearchType.UNRECOGNIZED; + } +} + +export function searchFilter_Filters_SearchTypeToJSON(object: SearchFilter_Filters_SearchType): string { + switch (object) { + case SearchFilter_Filters_SearchType.ANY_TYPE: + return "ANY_TYPE"; + case SearchFilter_Filters_SearchType.VIDEO: + return "VIDEO"; + case SearchFilter_Filters_SearchType.CHANNEL: + return "CHANNEL"; + case SearchFilter_Filters_SearchType.PLAYLIST: + return "PLAYLIST"; + case SearchFilter_Filters_SearchType.MOVIE: + return "MOVIE"; + case SearchFilter_Filters_SearchType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum SearchFilter_Filters_Duration { + ANY_DURATION = 0, + SHORT = 1, + LONG = 2, + MEDIUM = 3, + UNRECOGNIZED = -1, +} + +export function searchFilter_Filters_DurationFromJSON(object: any): SearchFilter_Filters_Duration { + switch (object) { + case 0: + case "ANY_DURATION": + return SearchFilter_Filters_Duration.ANY_DURATION; + case 1: + case "SHORT": + return SearchFilter_Filters_Duration.SHORT; + case 2: + case "LONG": + return SearchFilter_Filters_Duration.LONG; + case 3: + case "MEDIUM": + return SearchFilter_Filters_Duration.MEDIUM; + case -1: + case "UNRECOGNIZED": + default: + return SearchFilter_Filters_Duration.UNRECOGNIZED; + } +} + +export function searchFilter_Filters_DurationToJSON(object: SearchFilter_Filters_Duration): string { + switch (object) { + case SearchFilter_Filters_Duration.ANY_DURATION: + return "ANY_DURATION"; + case SearchFilter_Filters_Duration.SHORT: + return "SHORT"; + case SearchFilter_Filters_Duration.LONG: + return "LONG"; + case SearchFilter_Filters_Duration.MEDIUM: + return "MEDIUM"; + case SearchFilter_Filters_Duration.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface SearchFilter_Filters_MusicSearchType { + song?: boolean | undefined; + video?: boolean | undefined; + album?: boolean | undefined; + artist?: boolean | undefined; + playlist?: boolean | undefined; +} + +export interface ChannelAnalytics { + params: ChannelAnalytics_Params | undefined; +} + +export interface ChannelAnalytics_Params { + channelId: string; +} + +export interface SoundInfoParams { + sound: SoundInfoParams_Sound | undefined; +} + +export interface SoundInfoParams_Sound { + params: SoundInfoParams_Sound_Params | undefined; +} + +export interface SoundInfoParams_Sound_Params { + ids: SoundInfoParams_Sound_Params_Ids | undefined; +} + +export interface SoundInfoParams_Sound_Params_Ids { + id1: string; + id2: string; + id3: string; +} + +export interface NotificationPreferences { + channelId: string; + prefId: NotificationPreferences_Preference | undefined; + number0?: number | undefined; + number1?: number | undefined; +} + +export interface NotificationPreferences_Preference { + index: number; +} + +export interface LiveMessageParams { + params: LiveMessageParams_Params | undefined; + number0?: number | undefined; + number1?: number | undefined; +} + +export interface LiveMessageParams_Params { + ids: LiveMessageParams_Params_Ids | undefined; +} + +export interface LiveMessageParams_Params_Ids { + channelId: string; + videoId: string; +} + +export interface GetCommentsSectionParams { + ctx: GetCommentsSectionParams_Context | undefined; + unkParam: number; + params: GetCommentsSectionParams_Params | undefined; +} + +export interface GetCommentsSectionParams_Context { + videoId: string; +} + +export interface GetCommentsSectionParams_Params { + unkToken?: string | undefined; + opts?: GetCommentsSectionParams_Params_Options | undefined; + repliesOpts?: GetCommentsSectionParams_Params_RepliesOptions | undefined; + page?: number | undefined; + target: string; +} + +export interface GetCommentsSectionParams_Params_Options { + videoId: string; + sortBy: number; + type: number; + commentId?: string | undefined; +} + +export interface GetCommentsSectionParams_Params_RepliesOptions { + commentId: string; + unkopts: GetCommentsSectionParams_Params_RepliesOptions_UnkOpts | undefined; + channelId?: string | undefined; + videoId: string; + unkParam1: number; + unkParam2: number; +} + +export interface GetCommentsSectionParams_Params_RepliesOptions_UnkOpts { + unkParam: number; +} + +export interface CreateCommentParams { + videoId: string; + params: CreateCommentParams_Params | undefined; + number: number; +} + +export interface CreateCommentParams_Params { + index: number; +} + +export interface PeformCommentActionParams { + type: number; + commentId: string; + videoId: string; + unkNum?: number | undefined; + channelId?: string | undefined; + translateCommentParams?: PeformCommentActionParams_TranslateCommentParams | undefined; +} + +export interface PeformCommentActionParams_TranslateCommentParams { + params: PeformCommentActionParams_TranslateCommentParams_Params | undefined; + commentId: string; + targetLanguage: string; +} + +export interface PeformCommentActionParams_TranslateCommentParams_Params { + comment: PeformCommentActionParams_TranslateCommentParams_Params_Comment | undefined; +} + +export interface PeformCommentActionParams_TranslateCommentParams_Params_Comment { + text: string; +} + +export interface Hashtag { + params: Hashtag_Params | undefined; +} + +export interface Hashtag_Params { + hashtag: string; + type: number; +} + +export interface ReelSequence { + shortId: string; + params: ReelSequence_Params | undefined; + feature2: number; + feature3: number; +} + +export interface ReelSequence_Params { + number: number; +} + +export interface ShortsParam { + f1?: ShortsParam_Field1 | undefined; + p59?: number | undefined; +} + +export interface ShortsParam_Field1 { + p1?: number | undefined; +} + +function createBaseVisitorData(): VisitorData { + return { id: "", timestamp: 0 }; +} + +export const VisitorData: MessageFns = { + encode(message: VisitorData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.timestamp !== 0) { + writer.uint32(40).int32(message.timestamp); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VisitorData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVisitorData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.timestamp = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VisitorData { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + timestamp: isSet(object.timestamp) ? globalThis.Number(object.timestamp) : 0, + }; + }, + + toJSON(message: VisitorData): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.timestamp !== 0) { + obj.timestamp = Math.round(message.timestamp); + } + return obj; + }, + + create, I>>(base?: I): VisitorData { + return VisitorData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VisitorData { + const message = createBaseVisitorData(); + message.id = object.id ?? ""; + message.timestamp = object.timestamp ?? 0; + return message; + }, +}; + +function createBaseSearchFilter(): SearchFilter { + return { sortBy: undefined, filters: undefined }; +} + +export const SearchFilter: MessageFns = { + encode(message: SearchFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sortBy !== undefined) { + writer.uint32(8).int32(message.sortBy); + } + if (message.filters !== undefined) { + SearchFilter_Filters.encode(message.filters, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchFilter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchFilter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.sortBy = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.filters = SearchFilter_Filters.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchFilter { + return { + sortBy: isSet(object.sortBy) ? searchFilter_SortByFromJSON(object.sortBy) : undefined, + filters: isSet(object.filters) ? SearchFilter_Filters.fromJSON(object.filters) : undefined, + }; + }, + + toJSON(message: SearchFilter): unknown { + const obj: any = {}; + if (message.sortBy !== undefined) { + obj.sortBy = searchFilter_SortByToJSON(message.sortBy); + } + if (message.filters !== undefined) { + obj.filters = SearchFilter_Filters.toJSON(message.filters); + } + return obj; + }, + + create, I>>(base?: I): SearchFilter { + return SearchFilter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchFilter { + const message = createBaseSearchFilter(); + message.sortBy = object.sortBy ?? undefined; + message.filters = (object.filters !== undefined && object.filters !== null) + ? SearchFilter_Filters.fromPartial(object.filters) + : undefined; + return message; + }, +}; + +function createBaseSearchFilter_Filters(): SearchFilter_Filters { + return { + uploadDate: undefined, + type: undefined, + duration: undefined, + musicSearchType: undefined, + featuresHd: undefined, + featuresSubtitles: undefined, + featuresCreativeCommons: undefined, + features3d: undefined, + featuresLive: undefined, + featuresPurchased: undefined, + features4k: undefined, + features360: undefined, + featuresLocation: undefined, + featuresHdr: undefined, + featuresVr180: undefined, + }; +} + +export const SearchFilter_Filters: MessageFns = { + encode(message: SearchFilter_Filters, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.uploadDate !== undefined) { + writer.uint32(8).int32(message.uploadDate); + } + if (message.type !== undefined) { + writer.uint32(16).int32(message.type); + } + if (message.duration !== undefined) { + writer.uint32(24).int32(message.duration); + } + if (message.musicSearchType !== undefined) { + SearchFilter_Filters_MusicSearchType.encode(message.musicSearchType, writer.uint32(138).fork()).join(); + } + if (message.featuresHd !== undefined) { + writer.uint32(32).bool(message.featuresHd); + } + if (message.featuresSubtitles !== undefined) { + writer.uint32(40).bool(message.featuresSubtitles); + } + if (message.featuresCreativeCommons !== undefined) { + writer.uint32(48).bool(message.featuresCreativeCommons); + } + if (message.features3d !== undefined) { + writer.uint32(56).bool(message.features3d); + } + if (message.featuresLive !== undefined) { + writer.uint32(64).bool(message.featuresLive); + } + if (message.featuresPurchased !== undefined) { + writer.uint32(72).bool(message.featuresPurchased); + } + if (message.features4k !== undefined) { + writer.uint32(112).bool(message.features4k); + } + if (message.features360 !== undefined) { + writer.uint32(120).bool(message.features360); + } + if (message.featuresLocation !== undefined) { + writer.uint32(184).bool(message.featuresLocation); + } + if (message.featuresHdr !== undefined) { + writer.uint32(200).bool(message.featuresHdr); + } + if (message.featuresVr180 !== undefined) { + writer.uint32(208).bool(message.featuresVr180); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchFilter_Filters { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchFilter_Filters(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.uploadDate = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.duration = reader.int32() as any; + continue; + case 17: + if (tag !== 138) { + break; + } + + message.musicSearchType = SearchFilter_Filters_MusicSearchType.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.featuresHd = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.featuresSubtitles = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.featuresCreativeCommons = reader.bool(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.features3d = reader.bool(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.featuresLive = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.featuresPurchased = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.features4k = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.features360 = reader.bool(); + continue; + case 23: + if (tag !== 184) { + break; + } + + message.featuresLocation = reader.bool(); + continue; + case 25: + if (tag !== 200) { + break; + } + + message.featuresHdr = reader.bool(); + continue; + case 26: + if (tag !== 208) { + break; + } + + message.featuresVr180 = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchFilter_Filters { + return { + uploadDate: isSet(object.uploadDate) ? searchFilter_Filters_UploadDateFromJSON(object.uploadDate) : undefined, + type: isSet(object.type) ? searchFilter_Filters_SearchTypeFromJSON(object.type) : undefined, + duration: isSet(object.duration) ? searchFilter_Filters_DurationFromJSON(object.duration) : undefined, + musicSearchType: isSet(object.musicSearchType) + ? SearchFilter_Filters_MusicSearchType.fromJSON(object.musicSearchType) + : undefined, + featuresHd: isSet(object.featuresHd) ? globalThis.Boolean(object.featuresHd) : undefined, + featuresSubtitles: isSet(object.featuresSubtitles) ? globalThis.Boolean(object.featuresSubtitles) : undefined, + featuresCreativeCommons: isSet(object.featuresCreativeCommons) + ? globalThis.Boolean(object.featuresCreativeCommons) + : undefined, + features3d: isSet(object.features3d) ? globalThis.Boolean(object.features3d) : undefined, + featuresLive: isSet(object.featuresLive) ? globalThis.Boolean(object.featuresLive) : undefined, + featuresPurchased: isSet(object.featuresPurchased) ? globalThis.Boolean(object.featuresPurchased) : undefined, + features4k: isSet(object.features4k) ? globalThis.Boolean(object.features4k) : undefined, + features360: isSet(object.features360) ? globalThis.Boolean(object.features360) : undefined, + featuresLocation: isSet(object.featuresLocation) ? globalThis.Boolean(object.featuresLocation) : undefined, + featuresHdr: isSet(object.featuresHdr) ? globalThis.Boolean(object.featuresHdr) : undefined, + featuresVr180: isSet(object.featuresVr180) ? globalThis.Boolean(object.featuresVr180) : undefined, + }; + }, + + toJSON(message: SearchFilter_Filters): unknown { + const obj: any = {}; + if (message.uploadDate !== undefined) { + obj.uploadDate = searchFilter_Filters_UploadDateToJSON(message.uploadDate); + } + if (message.type !== undefined) { + obj.type = searchFilter_Filters_SearchTypeToJSON(message.type); + } + if (message.duration !== undefined) { + obj.duration = searchFilter_Filters_DurationToJSON(message.duration); + } + if (message.musicSearchType !== undefined) { + obj.musicSearchType = SearchFilter_Filters_MusicSearchType.toJSON(message.musicSearchType); + } + if (message.featuresHd !== undefined) { + obj.featuresHd = message.featuresHd; + } + if (message.featuresSubtitles !== undefined) { + obj.featuresSubtitles = message.featuresSubtitles; + } + if (message.featuresCreativeCommons !== undefined) { + obj.featuresCreativeCommons = message.featuresCreativeCommons; + } + if (message.features3d !== undefined) { + obj.features3d = message.features3d; + } + if (message.featuresLive !== undefined) { + obj.featuresLive = message.featuresLive; + } + if (message.featuresPurchased !== undefined) { + obj.featuresPurchased = message.featuresPurchased; + } + if (message.features4k !== undefined) { + obj.features4k = message.features4k; + } + if (message.features360 !== undefined) { + obj.features360 = message.features360; + } + if (message.featuresLocation !== undefined) { + obj.featuresLocation = message.featuresLocation; + } + if (message.featuresHdr !== undefined) { + obj.featuresHdr = message.featuresHdr; + } + if (message.featuresVr180 !== undefined) { + obj.featuresVr180 = message.featuresVr180; + } + return obj; + }, + + create, I>>(base?: I): SearchFilter_Filters { + return SearchFilter_Filters.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchFilter_Filters { + const message = createBaseSearchFilter_Filters(); + message.uploadDate = object.uploadDate ?? undefined; + message.type = object.type ?? undefined; + message.duration = object.duration ?? undefined; + message.musicSearchType = (object.musicSearchType !== undefined && object.musicSearchType !== null) + ? SearchFilter_Filters_MusicSearchType.fromPartial(object.musicSearchType) + : undefined; + message.featuresHd = object.featuresHd ?? undefined; + message.featuresSubtitles = object.featuresSubtitles ?? undefined; + message.featuresCreativeCommons = object.featuresCreativeCommons ?? undefined; + message.features3d = object.features3d ?? undefined; + message.featuresLive = object.featuresLive ?? undefined; + message.featuresPurchased = object.featuresPurchased ?? undefined; + message.features4k = object.features4k ?? undefined; + message.features360 = object.features360 ?? undefined; + message.featuresLocation = object.featuresLocation ?? undefined; + message.featuresHdr = object.featuresHdr ?? undefined; + message.featuresVr180 = object.featuresVr180 ?? undefined; + return message; + }, +}; + +function createBaseSearchFilter_Filters_MusicSearchType(): SearchFilter_Filters_MusicSearchType { + return { song: undefined, video: undefined, album: undefined, artist: undefined, playlist: undefined }; +} + +export const SearchFilter_Filters_MusicSearchType: MessageFns = { + encode(message: SearchFilter_Filters_MusicSearchType, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.song !== undefined) { + writer.uint32(8).bool(message.song); + } + if (message.video !== undefined) { + writer.uint32(16).bool(message.video); + } + if (message.album !== undefined) { + writer.uint32(24).bool(message.album); + } + if (message.artist !== undefined) { + writer.uint32(32).bool(message.artist); + } + if (message.playlist !== undefined) { + writer.uint32(40).bool(message.playlist); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchFilter_Filters_MusicSearchType { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchFilter_Filters_MusicSearchType(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.song = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.video = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.album = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.artist = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.playlist = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchFilter_Filters_MusicSearchType { + return { + song: isSet(object.song) ? globalThis.Boolean(object.song) : undefined, + video: isSet(object.video) ? globalThis.Boolean(object.video) : undefined, + album: isSet(object.album) ? globalThis.Boolean(object.album) : undefined, + artist: isSet(object.artist) ? globalThis.Boolean(object.artist) : undefined, + playlist: isSet(object.playlist) ? globalThis.Boolean(object.playlist) : undefined, + }; + }, + + toJSON(message: SearchFilter_Filters_MusicSearchType): unknown { + const obj: any = {}; + if (message.song !== undefined) { + obj.song = message.song; + } + if (message.video !== undefined) { + obj.video = message.video; + } + if (message.album !== undefined) { + obj.album = message.album; + } + if (message.artist !== undefined) { + obj.artist = message.artist; + } + if (message.playlist !== undefined) { + obj.playlist = message.playlist; + } + return obj; + }, + + create, I>>( + base?: I, + ): SearchFilter_Filters_MusicSearchType { + return SearchFilter_Filters_MusicSearchType.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SearchFilter_Filters_MusicSearchType { + const message = createBaseSearchFilter_Filters_MusicSearchType(); + message.song = object.song ?? undefined; + message.video = object.video ?? undefined; + message.album = object.album ?? undefined; + message.artist = object.artist ?? undefined; + message.playlist = object.playlist ?? undefined; + return message; + }, +}; + +function createBaseChannelAnalytics(): ChannelAnalytics { + return { params: undefined }; +} + +export const ChannelAnalytics: MessageFns = { + encode(message: ChannelAnalytics, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + ChannelAnalytics_Params.encode(message.params, writer.uint32(258).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChannelAnalytics { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannelAnalytics(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 32: + if (tag !== 258) { + break; + } + + message.params = ChannelAnalytics_Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChannelAnalytics { + return { params: isSet(object.params) ? ChannelAnalytics_Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: ChannelAnalytics): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = ChannelAnalytics_Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): ChannelAnalytics { + return ChannelAnalytics.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChannelAnalytics { + const message = createBaseChannelAnalytics(); + message.params = (object.params !== undefined && object.params !== null) + ? ChannelAnalytics_Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseChannelAnalytics_Params(): ChannelAnalytics_Params { + return { channelId: "" }; +} + +export const ChannelAnalytics_Params: MessageFns = { + encode(message: ChannelAnalytics_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.channelId !== "") { + writer.uint32(8010).string(message.channelId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChannelAnalytics_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannelAnalytics_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1001: + if (tag !== 8010) { + break; + } + + message.channelId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChannelAnalytics_Params { + return { channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "" }; + }, + + toJSON(message: ChannelAnalytics_Params): unknown { + const obj: any = {}; + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + return obj; + }, + + create, I>>(base?: I): ChannelAnalytics_Params { + return ChannelAnalytics_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChannelAnalytics_Params { + const message = createBaseChannelAnalytics_Params(); + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +function createBaseSoundInfoParams(): SoundInfoParams { + return { sound: undefined }; +} + +export const SoundInfoParams: MessageFns = { + encode(message: SoundInfoParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sound !== undefined) { + SoundInfoParams_Sound.encode(message.sound, writer.uint32(754).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoundInfoParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoundInfoParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 94: + if (tag !== 754) { + break; + } + + message.sound = SoundInfoParams_Sound.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoundInfoParams { + return { sound: isSet(object.sound) ? SoundInfoParams_Sound.fromJSON(object.sound) : undefined }; + }, + + toJSON(message: SoundInfoParams): unknown { + const obj: any = {}; + if (message.sound !== undefined) { + obj.sound = SoundInfoParams_Sound.toJSON(message.sound); + } + return obj; + }, + + create, I>>(base?: I): SoundInfoParams { + return SoundInfoParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SoundInfoParams { + const message = createBaseSoundInfoParams(); + message.sound = (object.sound !== undefined && object.sound !== null) + ? SoundInfoParams_Sound.fromPartial(object.sound) + : undefined; + return message; + }, +}; + +function createBaseSoundInfoParams_Sound(): SoundInfoParams_Sound { + return { params: undefined }; +} + +export const SoundInfoParams_Sound: MessageFns = { + encode(message: SoundInfoParams_Sound, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + SoundInfoParams_Sound_Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoundInfoParams_Sound { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoundInfoParams_Sound(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = SoundInfoParams_Sound_Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoundInfoParams_Sound { + return { params: isSet(object.params) ? SoundInfoParams_Sound_Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: SoundInfoParams_Sound): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = SoundInfoParams_Sound_Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): SoundInfoParams_Sound { + return SoundInfoParams_Sound.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SoundInfoParams_Sound { + const message = createBaseSoundInfoParams_Sound(); + message.params = (object.params !== undefined && object.params !== null) + ? SoundInfoParams_Sound_Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseSoundInfoParams_Sound_Params(): SoundInfoParams_Sound_Params { + return { ids: undefined }; +} + +export const SoundInfoParams_Sound_Params: MessageFns = { + encode(message: SoundInfoParams_Sound_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ids !== undefined) { + SoundInfoParams_Sound_Params_Ids.encode(message.ids, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoundInfoParams_Sound_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoundInfoParams_Sound_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.ids = SoundInfoParams_Sound_Params_Ids.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoundInfoParams_Sound_Params { + return { ids: isSet(object.ids) ? SoundInfoParams_Sound_Params_Ids.fromJSON(object.ids) : undefined }; + }, + + toJSON(message: SoundInfoParams_Sound_Params): unknown { + const obj: any = {}; + if (message.ids !== undefined) { + obj.ids = SoundInfoParams_Sound_Params_Ids.toJSON(message.ids); + } + return obj; + }, + + create, I>>(base?: I): SoundInfoParams_Sound_Params { + return SoundInfoParams_Sound_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SoundInfoParams_Sound_Params { + const message = createBaseSoundInfoParams_Sound_Params(); + message.ids = (object.ids !== undefined && object.ids !== null) + ? SoundInfoParams_Sound_Params_Ids.fromPartial(object.ids) + : undefined; + return message; + }, +}; + +function createBaseSoundInfoParams_Sound_Params_Ids(): SoundInfoParams_Sound_Params_Ids { + return { id1: "", id2: "", id3: "" }; +} + +export const SoundInfoParams_Sound_Params_Ids: MessageFns = { + encode(message: SoundInfoParams_Sound_Params_Ids, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id1 !== "") { + writer.uint32(10).string(message.id1); + } + if (message.id2 !== "") { + writer.uint32(18).string(message.id2); + } + if (message.id3 !== "") { + writer.uint32(26).string(message.id3); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoundInfoParams_Sound_Params_Ids { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoundInfoParams_Sound_Params_Ids(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id1 = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.id2 = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.id3 = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoundInfoParams_Sound_Params_Ids { + return { + id1: isSet(object.id1) ? globalThis.String(object.id1) : "", + id2: isSet(object.id2) ? globalThis.String(object.id2) : "", + id3: isSet(object.id3) ? globalThis.String(object.id3) : "", + }; + }, + + toJSON(message: SoundInfoParams_Sound_Params_Ids): unknown { + const obj: any = {}; + if (message.id1 !== "") { + obj.id1 = message.id1; + } + if (message.id2 !== "") { + obj.id2 = message.id2; + } + if (message.id3 !== "") { + obj.id3 = message.id3; + } + return obj; + }, + + create, I>>( + base?: I, + ): SoundInfoParams_Sound_Params_Ids { + return SoundInfoParams_Sound_Params_Ids.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): SoundInfoParams_Sound_Params_Ids { + const message = createBaseSoundInfoParams_Sound_Params_Ids(); + message.id1 = object.id1 ?? ""; + message.id2 = object.id2 ?? ""; + message.id3 = object.id3 ?? ""; + return message; + }, +}; + +function createBaseNotificationPreferences(): NotificationPreferences { + return { channelId: "", prefId: undefined, number0: undefined, number1: undefined }; +} + +export const NotificationPreferences: MessageFns = { + encode(message: NotificationPreferences, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + if (message.prefId !== undefined) { + NotificationPreferences_Preference.encode(message.prefId, writer.uint32(18).fork()).join(); + } + if (message.number0 !== undefined) { + writer.uint32(24).int32(message.number0); + } + if (message.number1 !== undefined) { + writer.uint32(32).int32(message.number1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NotificationPreferences { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNotificationPreferences(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.channelId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefId = NotificationPreferences_Preference.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.number0 = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.number1 = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NotificationPreferences { + return { + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + prefId: isSet(object.prefId) ? NotificationPreferences_Preference.fromJSON(object.prefId) : undefined, + number0: isSet(object.number0) ? globalThis.Number(object.number0) : undefined, + number1: isSet(object.number1) ? globalThis.Number(object.number1) : undefined, + }; + }, + + toJSON(message: NotificationPreferences): unknown { + const obj: any = {}; + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.prefId !== undefined) { + obj.prefId = NotificationPreferences_Preference.toJSON(message.prefId); + } + if (message.number0 !== undefined) { + obj.number0 = Math.round(message.number0); + } + if (message.number1 !== undefined) { + obj.number1 = Math.round(message.number1); + } + return obj; + }, + + create, I>>(base?: I): NotificationPreferences { + return NotificationPreferences.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NotificationPreferences { + const message = createBaseNotificationPreferences(); + message.channelId = object.channelId ?? ""; + message.prefId = (object.prefId !== undefined && object.prefId !== null) + ? NotificationPreferences_Preference.fromPartial(object.prefId) + : undefined; + message.number0 = object.number0 ?? undefined; + message.number1 = object.number1 ?? undefined; + return message; + }, +}; + +function createBaseNotificationPreferences_Preference(): NotificationPreferences_Preference { + return { index: 0 }; +} + +export const NotificationPreferences_Preference: MessageFns = { + encode(message: NotificationPreferences_Preference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int32(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NotificationPreferences_Preference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNotificationPreferences_Preference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NotificationPreferences_Preference { + return { index: isSet(object.index) ? globalThis.Number(object.index) : 0 }; + }, + + toJSON(message: NotificationPreferences_Preference): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>( + base?: I, + ): NotificationPreferences_Preference { + return NotificationPreferences_Preference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): NotificationPreferences_Preference { + const message = createBaseNotificationPreferences_Preference(); + message.index = object.index ?? 0; + return message; + }, +}; + +function createBaseLiveMessageParams(): LiveMessageParams { + return { params: undefined, number0: undefined, number1: undefined }; +} + +export const LiveMessageParams: MessageFns = { + encode(message: LiveMessageParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + LiveMessageParams_Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.number0 !== undefined) { + writer.uint32(16).int32(message.number0); + } + if (message.number1 !== undefined) { + writer.uint32(24).int32(message.number1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LiveMessageParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLiveMessageParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = LiveMessageParams_Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number0 = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.number1 = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LiveMessageParams { + return { + params: isSet(object.params) ? LiveMessageParams_Params.fromJSON(object.params) : undefined, + number0: isSet(object.number0) ? globalThis.Number(object.number0) : undefined, + number1: isSet(object.number1) ? globalThis.Number(object.number1) : undefined, + }; + }, + + toJSON(message: LiveMessageParams): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = LiveMessageParams_Params.toJSON(message.params); + } + if (message.number0 !== undefined) { + obj.number0 = Math.round(message.number0); + } + if (message.number1 !== undefined) { + obj.number1 = Math.round(message.number1); + } + return obj; + }, + + create, I>>(base?: I): LiveMessageParams { + return LiveMessageParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LiveMessageParams { + const message = createBaseLiveMessageParams(); + message.params = (object.params !== undefined && object.params !== null) + ? LiveMessageParams_Params.fromPartial(object.params) + : undefined; + message.number0 = object.number0 ?? undefined; + message.number1 = object.number1 ?? undefined; + return message; + }, +}; + +function createBaseLiveMessageParams_Params(): LiveMessageParams_Params { + return { ids: undefined }; +} + +export const LiveMessageParams_Params: MessageFns = { + encode(message: LiveMessageParams_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ids !== undefined) { + LiveMessageParams_Params_Ids.encode(message.ids, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LiveMessageParams_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLiveMessageParams_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + if (tag !== 42) { + break; + } + + message.ids = LiveMessageParams_Params_Ids.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LiveMessageParams_Params { + return { ids: isSet(object.ids) ? LiveMessageParams_Params_Ids.fromJSON(object.ids) : undefined }; + }, + + toJSON(message: LiveMessageParams_Params): unknown { + const obj: any = {}; + if (message.ids !== undefined) { + obj.ids = LiveMessageParams_Params_Ids.toJSON(message.ids); + } + return obj; + }, + + create, I>>(base?: I): LiveMessageParams_Params { + return LiveMessageParams_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LiveMessageParams_Params { + const message = createBaseLiveMessageParams_Params(); + message.ids = (object.ids !== undefined && object.ids !== null) + ? LiveMessageParams_Params_Ids.fromPartial(object.ids) + : undefined; + return message; + }, +}; + +function createBaseLiveMessageParams_Params_Ids(): LiveMessageParams_Params_Ids { + return { channelId: "", videoId: "" }; +} + +export const LiveMessageParams_Params_Ids: MessageFns = { + encode(message: LiveMessageParams_Params_Ids, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + if (message.videoId !== "") { + writer.uint32(18).string(message.videoId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LiveMessageParams_Params_Ids { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLiveMessageParams_Params_Ids(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.channelId = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LiveMessageParams_Params_Ids { + return { + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : "", + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "", + }; + }, + + toJSON(message: LiveMessageParams_Params_Ids): unknown { + const obj: any = {}; + if (message.channelId !== "") { + obj.channelId = message.channelId; + } + if (message.videoId !== "") { + obj.videoId = message.videoId; + } + return obj; + }, + + create, I>>(base?: I): LiveMessageParams_Params_Ids { + return LiveMessageParams_Params_Ids.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LiveMessageParams_Params_Ids { + const message = createBaseLiveMessageParams_Params_Ids(); + message.channelId = object.channelId ?? ""; + message.videoId = object.videoId ?? ""; + return message; + }, +}; + +function createBaseGetCommentsSectionParams(): GetCommentsSectionParams { + return { ctx: undefined, unkParam: 0, params: undefined }; +} + +export const GetCommentsSectionParams: MessageFns = { + encode(message: GetCommentsSectionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctx !== undefined) { + GetCommentsSectionParams_Context.encode(message.ctx, writer.uint32(18).fork()).join(); + } + if (message.unkParam !== 0) { + writer.uint32(24).int32(message.unkParam); + } + if (message.params !== undefined) { + GetCommentsSectionParams_Params.encode(message.params, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCommentsSectionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCommentsSectionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.ctx = GetCommentsSectionParams_Context.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.unkParam = reader.int32(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.params = GetCommentsSectionParams_Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCommentsSectionParams { + return { + ctx: isSet(object.ctx) ? GetCommentsSectionParams_Context.fromJSON(object.ctx) : undefined, + unkParam: isSet(object.unkParam) ? globalThis.Number(object.unkParam) : 0, + params: isSet(object.params) ? GetCommentsSectionParams_Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: GetCommentsSectionParams): unknown { + const obj: any = {}; + if (message.ctx !== undefined) { + obj.ctx = GetCommentsSectionParams_Context.toJSON(message.ctx); + } + if (message.unkParam !== 0) { + obj.unkParam = Math.round(message.unkParam); + } + if (message.params !== undefined) { + obj.params = GetCommentsSectionParams_Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): GetCommentsSectionParams { + return GetCommentsSectionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetCommentsSectionParams { + const message = createBaseGetCommentsSectionParams(); + message.ctx = (object.ctx !== undefined && object.ctx !== null) + ? GetCommentsSectionParams_Context.fromPartial(object.ctx) + : undefined; + message.unkParam = object.unkParam ?? 0; + message.params = (object.params !== undefined && object.params !== null) + ? GetCommentsSectionParams_Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseGetCommentsSectionParams_Context(): GetCommentsSectionParams_Context { + return { videoId: "" }; +} + +export const GetCommentsSectionParams_Context: MessageFns = { + encode(message: GetCommentsSectionParams_Context, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoId !== "") { + writer.uint32(18).string(message.videoId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCommentsSectionParams_Context { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCommentsSectionParams_Context(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCommentsSectionParams_Context { + return { videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "" }; + }, + + toJSON(message: GetCommentsSectionParams_Context): unknown { + const obj: any = {}; + if (message.videoId !== "") { + obj.videoId = message.videoId; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetCommentsSectionParams_Context { + return GetCommentsSectionParams_Context.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetCommentsSectionParams_Context { + const message = createBaseGetCommentsSectionParams_Context(); + message.videoId = object.videoId ?? ""; + return message; + }, +}; + +function createBaseGetCommentsSectionParams_Params(): GetCommentsSectionParams_Params { + return { unkToken: undefined, opts: undefined, repliesOpts: undefined, page: undefined, target: "" }; +} + +export const GetCommentsSectionParams_Params: MessageFns = { + encode(message: GetCommentsSectionParams_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unkToken !== undefined) { + writer.uint32(10).string(message.unkToken); + } + if (message.opts !== undefined) { + GetCommentsSectionParams_Params_Options.encode(message.opts, writer.uint32(34).fork()).join(); + } + if (message.repliesOpts !== undefined) { + GetCommentsSectionParams_Params_RepliesOptions.encode(message.repliesOpts, writer.uint32(26).fork()).join(); + } + if (message.page !== undefined) { + writer.uint32(40).int32(message.page); + } + if (message.target !== "") { + writer.uint32(66).string(message.target); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCommentsSectionParams_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCommentsSectionParams_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unkToken = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.opts = GetCommentsSectionParams_Params_Options.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.repliesOpts = GetCommentsSectionParams_Params_RepliesOptions.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.page = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.target = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCommentsSectionParams_Params { + return { + unkToken: isSet(object.unkToken) ? globalThis.String(object.unkToken) : undefined, + opts: isSet(object.opts) ? GetCommentsSectionParams_Params_Options.fromJSON(object.opts) : undefined, + repliesOpts: isSet(object.repliesOpts) + ? GetCommentsSectionParams_Params_RepliesOptions.fromJSON(object.repliesOpts) + : undefined, + page: isSet(object.page) ? globalThis.Number(object.page) : undefined, + target: isSet(object.target) ? globalThis.String(object.target) : "", + }; + }, + + toJSON(message: GetCommentsSectionParams_Params): unknown { + const obj: any = {}; + if (message.unkToken !== undefined) { + obj.unkToken = message.unkToken; + } + if (message.opts !== undefined) { + obj.opts = GetCommentsSectionParams_Params_Options.toJSON(message.opts); + } + if (message.repliesOpts !== undefined) { + obj.repliesOpts = GetCommentsSectionParams_Params_RepliesOptions.toJSON(message.repliesOpts); + } + if (message.page !== undefined) { + obj.page = Math.round(message.page); + } + if (message.target !== "") { + obj.target = message.target; + } + return obj; + }, + + create, I>>(base?: I): GetCommentsSectionParams_Params { + return GetCommentsSectionParams_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetCommentsSectionParams_Params { + const message = createBaseGetCommentsSectionParams_Params(); + message.unkToken = object.unkToken ?? undefined; + message.opts = (object.opts !== undefined && object.opts !== null) + ? GetCommentsSectionParams_Params_Options.fromPartial(object.opts) + : undefined; + message.repliesOpts = (object.repliesOpts !== undefined && object.repliesOpts !== null) + ? GetCommentsSectionParams_Params_RepliesOptions.fromPartial(object.repliesOpts) + : undefined; + message.page = object.page ?? undefined; + message.target = object.target ?? ""; + return message; + }, +}; + +function createBaseGetCommentsSectionParams_Params_Options(): GetCommentsSectionParams_Params_Options { + return { videoId: "", sortBy: 0, type: 0, commentId: undefined }; +} + +export const GetCommentsSectionParams_Params_Options: MessageFns = { + encode(message: GetCommentsSectionParams_Params_Options, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoId !== "") { + writer.uint32(34).string(message.videoId); + } + if (message.sortBy !== 0) { + writer.uint32(48).int32(message.sortBy); + } + if (message.type !== 0) { + writer.uint32(120).int32(message.type); + } + if (message.commentId !== undefined) { + writer.uint32(130).string(message.commentId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCommentsSectionParams_Params_Options { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCommentsSectionParams_Params_Options(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + if (tag !== 34) { + break; + } + + message.videoId = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.sortBy = reader.int32(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.type = reader.int32(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.commentId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCommentsSectionParams_Params_Options { + return { + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "", + sortBy: isSet(object.sortBy) ? globalThis.Number(object.sortBy) : 0, + type: isSet(object.type) ? globalThis.Number(object.type) : 0, + commentId: isSet(object.commentId) ? globalThis.String(object.commentId) : undefined, + }; + }, + + toJSON(message: GetCommentsSectionParams_Params_Options): unknown { + const obj: any = {}; + if (message.videoId !== "") { + obj.videoId = message.videoId; + } + if (message.sortBy !== 0) { + obj.sortBy = Math.round(message.sortBy); + } + if (message.type !== 0) { + obj.type = Math.round(message.type); + } + if (message.commentId !== undefined) { + obj.commentId = message.commentId; + } + return obj; + }, + + create, I>>( + base?: I, + ): GetCommentsSectionParams_Params_Options { + return GetCommentsSectionParams_Params_Options.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetCommentsSectionParams_Params_Options { + const message = createBaseGetCommentsSectionParams_Params_Options(); + message.videoId = object.videoId ?? ""; + message.sortBy = object.sortBy ?? 0; + message.type = object.type ?? 0; + message.commentId = object.commentId ?? undefined; + return message; + }, +}; + +function createBaseGetCommentsSectionParams_Params_RepliesOptions(): GetCommentsSectionParams_Params_RepliesOptions { + return { commentId: "", unkopts: undefined, channelId: undefined, videoId: "", unkParam1: 0, unkParam2: 0 }; +} + +export const GetCommentsSectionParams_Params_RepliesOptions: MessageFns< + GetCommentsSectionParams_Params_RepliesOptions +> = { + encode( + message: GetCommentsSectionParams_Params_RepliesOptions, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.commentId !== "") { + writer.uint32(18).string(message.commentId); + } + if (message.unkopts !== undefined) { + GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.encode(message.unkopts, writer.uint32(34).fork()).join(); + } + if (message.channelId !== undefined) { + writer.uint32(42).string(message.channelId); + } + if (message.videoId !== "") { + writer.uint32(50).string(message.videoId); + } + if (message.unkParam1 !== 0) { + writer.uint32(64).int32(message.unkParam1); + } + if (message.unkParam2 !== 0) { + writer.uint32(72).int32(message.unkParam2); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCommentsSectionParams_Params_RepliesOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCommentsSectionParams_Params_RepliesOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.commentId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.unkopts = GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.channelId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.videoId = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unkParam1 = reader.int32(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.unkParam2 = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCommentsSectionParams_Params_RepliesOptions { + return { + commentId: isSet(object.commentId) ? globalThis.String(object.commentId) : "", + unkopts: isSet(object.unkopts) + ? GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.fromJSON(object.unkopts) + : undefined, + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : undefined, + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "", + unkParam1: isSet(object.unkParam1) ? globalThis.Number(object.unkParam1) : 0, + unkParam2: isSet(object.unkParam2) ? globalThis.Number(object.unkParam2) : 0, + }; + }, + + toJSON(message: GetCommentsSectionParams_Params_RepliesOptions): unknown { + const obj: any = {}; + if (message.commentId !== "") { + obj.commentId = message.commentId; + } + if (message.unkopts !== undefined) { + obj.unkopts = GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.toJSON(message.unkopts); + } + if (message.channelId !== undefined) { + obj.channelId = message.channelId; + } + if (message.videoId !== "") { + obj.videoId = message.videoId; + } + if (message.unkParam1 !== 0) { + obj.unkParam1 = Math.round(message.unkParam1); + } + if (message.unkParam2 !== 0) { + obj.unkParam2 = Math.round(message.unkParam2); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetCommentsSectionParams_Params_RepliesOptions { + return GetCommentsSectionParams_Params_RepliesOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetCommentsSectionParams_Params_RepliesOptions { + const message = createBaseGetCommentsSectionParams_Params_RepliesOptions(); + message.commentId = object.commentId ?? ""; + message.unkopts = (object.unkopts !== undefined && object.unkopts !== null) + ? GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.fromPartial(object.unkopts) + : undefined; + message.channelId = object.channelId ?? undefined; + message.videoId = object.videoId ?? ""; + message.unkParam1 = object.unkParam1 ?? 0; + message.unkParam2 = object.unkParam2 ?? 0; + return message; + }, +}; + +function createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts(): GetCommentsSectionParams_Params_RepliesOptions_UnkOpts { + return { unkParam: 0 }; +} + +export const GetCommentsSectionParams_Params_RepliesOptions_UnkOpts: MessageFns< + GetCommentsSectionParams_Params_RepliesOptions_UnkOpts +> = { + encode( + message: GetCommentsSectionParams_Params_RepliesOptions_UnkOpts, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.unkParam !== 0) { + writer.uint32(8).int32(message.unkParam); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCommentsSectionParams_Params_RepliesOptions_UnkOpts { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.unkParam = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCommentsSectionParams_Params_RepliesOptions_UnkOpts { + return { unkParam: isSet(object.unkParam) ? globalThis.Number(object.unkParam) : 0 }; + }, + + toJSON(message: GetCommentsSectionParams_Params_RepliesOptions_UnkOpts): unknown { + const obj: any = {}; + if (message.unkParam !== 0) { + obj.unkParam = Math.round(message.unkParam); + } + return obj; + }, + + create, I>>( + base?: I, + ): GetCommentsSectionParams_Params_RepliesOptions_UnkOpts { + return GetCommentsSectionParams_Params_RepliesOptions_UnkOpts.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): GetCommentsSectionParams_Params_RepliesOptions_UnkOpts { + const message = createBaseGetCommentsSectionParams_Params_RepliesOptions_UnkOpts(); + message.unkParam = object.unkParam ?? 0; + return message; + }, +}; + +function createBaseCreateCommentParams(): CreateCommentParams { + return { videoId: "", params: undefined, number: 0 }; +} + +export const CreateCommentParams: MessageFns = { + encode(message: CreateCommentParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.videoId !== "") { + writer.uint32(18).string(message.videoId); + } + if (message.params !== undefined) { + CreateCommentParams_Params.encode(message.params, writer.uint32(42).fork()).join(); + } + if (message.number !== 0) { + writer.uint32(80).int32(message.number); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateCommentParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateCommentParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.params = CreateCommentParams_Params.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.number = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateCommentParams { + return { + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "", + params: isSet(object.params) ? CreateCommentParams_Params.fromJSON(object.params) : undefined, + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + }; + }, + + toJSON(message: CreateCommentParams): unknown { + const obj: any = {}; + if (message.videoId !== "") { + obj.videoId = message.videoId; + } + if (message.params !== undefined) { + obj.params = CreateCommentParams_Params.toJSON(message.params); + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + return obj; + }, + + create, I>>(base?: I): CreateCommentParams { + return CreateCommentParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateCommentParams { + const message = createBaseCreateCommentParams(); + message.videoId = object.videoId ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? CreateCommentParams_Params.fromPartial(object.params) + : undefined; + message.number = object.number ?? 0; + return message; + }, +}; + +function createBaseCreateCommentParams_Params(): CreateCommentParams_Params { + return { index: 0 }; +} + +export const CreateCommentParams_Params: MessageFns = { + encode(message: CreateCommentParams_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int32(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateCommentParams_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateCommentParams_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateCommentParams_Params { + return { index: isSet(object.index) ? globalThis.Number(object.index) : 0 }; + }, + + toJSON(message: CreateCommentParams_Params): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): CreateCommentParams_Params { + return CreateCommentParams_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CreateCommentParams_Params { + const message = createBaseCreateCommentParams_Params(); + message.index = object.index ?? 0; + return message; + }, +}; + +function createBasePeformCommentActionParams(): PeformCommentActionParams { + return { + type: 0, + commentId: "", + videoId: "", + unkNum: undefined, + channelId: undefined, + translateCommentParams: undefined, + }; +} + +export const PeformCommentActionParams: MessageFns = { + encode(message: PeformCommentActionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.commentId !== "") { + writer.uint32(26).string(message.commentId); + } + if (message.videoId !== "") { + writer.uint32(42).string(message.videoId); + } + if (message.unkNum !== undefined) { + writer.uint32(16).int32(message.unkNum); + } + if (message.channelId !== undefined) { + writer.uint32(186).string(message.channelId); + } + if (message.translateCommentParams !== undefined) { + PeformCommentActionParams_TranslateCommentParams.encode(message.translateCommentParams, writer.uint32(250).fork()) + .join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeformCommentActionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeformCommentActionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commentId = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.videoId = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.unkNum = reader.int32(); + continue; + case 23: + if (tag !== 186) { + break; + } + + message.channelId = reader.string(); + continue; + case 31: + if (tag !== 250) { + break; + } + + message.translateCommentParams = PeformCommentActionParams_TranslateCommentParams.decode( + reader, + reader.uint32(), + ); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeformCommentActionParams { + return { + type: isSet(object.type) ? globalThis.Number(object.type) : 0, + commentId: isSet(object.commentId) ? globalThis.String(object.commentId) : "", + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : "", + unkNum: isSet(object.unkNum) ? globalThis.Number(object.unkNum) : undefined, + channelId: isSet(object.channelId) ? globalThis.String(object.channelId) : undefined, + translateCommentParams: isSet(object.translateCommentParams) + ? PeformCommentActionParams_TranslateCommentParams.fromJSON(object.translateCommentParams) + : undefined, + }; + }, + + toJSON(message: PeformCommentActionParams): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = Math.round(message.type); + } + if (message.commentId !== "") { + obj.commentId = message.commentId; + } + if (message.videoId !== "") { + obj.videoId = message.videoId; + } + if (message.unkNum !== undefined) { + obj.unkNum = Math.round(message.unkNum); + } + if (message.channelId !== undefined) { + obj.channelId = message.channelId; + } + if (message.translateCommentParams !== undefined) { + obj.translateCommentParams = PeformCommentActionParams_TranslateCommentParams.toJSON( + message.translateCommentParams, + ); + } + return obj; + }, + + create, I>>(base?: I): PeformCommentActionParams { + return PeformCommentActionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeformCommentActionParams { + const message = createBasePeformCommentActionParams(); + message.type = object.type ?? 0; + message.commentId = object.commentId ?? ""; + message.videoId = object.videoId ?? ""; + message.unkNum = object.unkNum ?? undefined; + message.channelId = object.channelId ?? undefined; + message.translateCommentParams = + (object.translateCommentParams !== undefined && object.translateCommentParams !== null) + ? PeformCommentActionParams_TranslateCommentParams.fromPartial(object.translateCommentParams) + : undefined; + return message; + }, +}; + +function createBasePeformCommentActionParams_TranslateCommentParams(): PeformCommentActionParams_TranslateCommentParams { + return { params: undefined, commentId: "", targetLanguage: "" }; +} + +export const PeformCommentActionParams_TranslateCommentParams: MessageFns< + PeformCommentActionParams_TranslateCommentParams +> = { + encode( + message: PeformCommentActionParams_TranslateCommentParams, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.params !== undefined) { + PeformCommentActionParams_TranslateCommentParams_Params.encode(message.params, writer.uint32(26).fork()).join(); + } + if (message.commentId !== "") { + writer.uint32(18).string(message.commentId); + } + if (message.targetLanguage !== "") { + writer.uint32(34).string(message.targetLanguage); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeformCommentActionParams_TranslateCommentParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeformCommentActionParams_TranslateCommentParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.params = PeformCommentActionParams_TranslateCommentParams_Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commentId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.targetLanguage = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeformCommentActionParams_TranslateCommentParams { + return { + params: isSet(object.params) + ? PeformCommentActionParams_TranslateCommentParams_Params.fromJSON(object.params) + : undefined, + commentId: isSet(object.commentId) ? globalThis.String(object.commentId) : "", + targetLanguage: isSet(object.targetLanguage) ? globalThis.String(object.targetLanguage) : "", + }; + }, + + toJSON(message: PeformCommentActionParams_TranslateCommentParams): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = PeformCommentActionParams_TranslateCommentParams_Params.toJSON(message.params); + } + if (message.commentId !== "") { + obj.commentId = message.commentId; + } + if (message.targetLanguage !== "") { + obj.targetLanguage = message.targetLanguage; + } + return obj; + }, + + create, I>>( + base?: I, + ): PeformCommentActionParams_TranslateCommentParams { + return PeformCommentActionParams_TranslateCommentParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PeformCommentActionParams_TranslateCommentParams { + const message = createBasePeformCommentActionParams_TranslateCommentParams(); + message.params = (object.params !== undefined && object.params !== null) + ? PeformCommentActionParams_TranslateCommentParams_Params.fromPartial(object.params) + : undefined; + message.commentId = object.commentId ?? ""; + message.targetLanguage = object.targetLanguage ?? ""; + return message; + }, +}; + +function createBasePeformCommentActionParams_TranslateCommentParams_Params(): PeformCommentActionParams_TranslateCommentParams_Params { + return { comment: undefined }; +} + +export const PeformCommentActionParams_TranslateCommentParams_Params: MessageFns< + PeformCommentActionParams_TranslateCommentParams_Params +> = { + encode( + message: PeformCommentActionParams_TranslateCommentParams_Params, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.comment !== undefined) { + PeformCommentActionParams_TranslateCommentParams_Params_Comment.encode(message.comment, writer.uint32(10).fork()) + .join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeformCommentActionParams_TranslateCommentParams_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeformCommentActionParams_TranslateCommentParams_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.comment = PeformCommentActionParams_TranslateCommentParams_Params_Comment.decode( + reader, + reader.uint32(), + ); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeformCommentActionParams_TranslateCommentParams_Params { + return { + comment: isSet(object.comment) + ? PeformCommentActionParams_TranslateCommentParams_Params_Comment.fromJSON(object.comment) + : undefined, + }; + }, + + toJSON(message: PeformCommentActionParams_TranslateCommentParams_Params): unknown { + const obj: any = {}; + if (message.comment !== undefined) { + obj.comment = PeformCommentActionParams_TranslateCommentParams_Params_Comment.toJSON(message.comment); + } + return obj; + }, + + create, I>>( + base?: I, + ): PeformCommentActionParams_TranslateCommentParams_Params { + return PeformCommentActionParams_TranslateCommentParams_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PeformCommentActionParams_TranslateCommentParams_Params { + const message = createBasePeformCommentActionParams_TranslateCommentParams_Params(); + message.comment = (object.comment !== undefined && object.comment !== null) + ? PeformCommentActionParams_TranslateCommentParams_Params_Comment.fromPartial(object.comment) + : undefined; + return message; + }, +}; + +function createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment(): PeformCommentActionParams_TranslateCommentParams_Params_Comment { + return { text: "" }; +} + +export const PeformCommentActionParams_TranslateCommentParams_Params_Comment: MessageFns< + PeformCommentActionParams_TranslateCommentParams_Params_Comment +> = { + encode( + message: PeformCommentActionParams_TranslateCommentParams_Params_Comment, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.text !== "") { + writer.uint32(10).string(message.text); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): PeformCommentActionParams_TranslateCommentParams_Params_Comment { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.text = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeformCommentActionParams_TranslateCommentParams_Params_Comment { + return { text: isSet(object.text) ? globalThis.String(object.text) : "" }; + }, + + toJSON(message: PeformCommentActionParams_TranslateCommentParams_Params_Comment): unknown { + const obj: any = {}; + if (message.text !== "") { + obj.text = message.text; + } + return obj; + }, + + create, I>>( + base?: I, + ): PeformCommentActionParams_TranslateCommentParams_Params_Comment { + return PeformCommentActionParams_TranslateCommentParams_Params_Comment.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PeformCommentActionParams_TranslateCommentParams_Params_Comment { + const message = createBasePeformCommentActionParams_TranslateCommentParams_Params_Comment(); + message.text = object.text ?? ""; + return message; + }, +}; + +function createBaseHashtag(): Hashtag { + return { params: undefined }; +} + +export const Hashtag: MessageFns = { + encode(message: Hashtag, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Hashtag_Params.encode(message.params, writer.uint32(746).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Hashtag { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashtag(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 93: + if (tag !== 746) { + break; + } + + message.params = Hashtag_Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Hashtag { + return { params: isSet(object.params) ? Hashtag_Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: Hashtag): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Hashtag_Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): Hashtag { + return Hashtag.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Hashtag { + const message = createBaseHashtag(); + message.params = (object.params !== undefined && object.params !== null) + ? Hashtag_Params.fromPartial(object.params) + : undefined; + return message; + }, +}; + +function createBaseHashtag_Params(): Hashtag_Params { + return { hashtag: "", type: 0 }; +} + +export const Hashtag_Params: MessageFns = { + encode(message: Hashtag_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hashtag !== "") { + writer.uint32(10).string(message.hashtag); + } + if (message.type !== 0) { + writer.uint32(24).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Hashtag_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashtag_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hashtag = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.type = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Hashtag_Params { + return { + hashtag: isSet(object.hashtag) ? globalThis.String(object.hashtag) : "", + type: isSet(object.type) ? globalThis.Number(object.type) : 0, + }; + }, + + toJSON(message: Hashtag_Params): unknown { + const obj: any = {}; + if (message.hashtag !== "") { + obj.hashtag = message.hashtag; + } + if (message.type !== 0) { + obj.type = Math.round(message.type); + } + return obj; + }, + + create, I>>(base?: I): Hashtag_Params { + return Hashtag_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Hashtag_Params { + const message = createBaseHashtag_Params(); + message.hashtag = object.hashtag ?? ""; + message.type = object.type ?? 0; + return message; + }, +}; + +function createBaseReelSequence(): ReelSequence { + return { shortId: "", params: undefined, feature2: 0, feature3: 0 }; +} + +export const ReelSequence: MessageFns = { + encode(message: ReelSequence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.shortId !== "") { + writer.uint32(10).string(message.shortId); + } + if (message.params !== undefined) { + ReelSequence_Params.encode(message.params, writer.uint32(42).fork()).join(); + } + if (message.feature2 !== 0) { + writer.uint32(80).int32(message.feature2); + } + if (message.feature3 !== 0) { + writer.uint32(104).int32(message.feature3); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReelSequence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReelSequence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.shortId = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.params = ReelSequence_Params.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.feature2 = reader.int32(); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.feature3 = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReelSequence { + return { + shortId: isSet(object.shortId) ? globalThis.String(object.shortId) : "", + params: isSet(object.params) ? ReelSequence_Params.fromJSON(object.params) : undefined, + feature2: isSet(object.feature2) ? globalThis.Number(object.feature2) : 0, + feature3: isSet(object.feature3) ? globalThis.Number(object.feature3) : 0, + }; + }, + + toJSON(message: ReelSequence): unknown { + const obj: any = {}; + if (message.shortId !== "") { + obj.shortId = message.shortId; + } + if (message.params !== undefined) { + obj.params = ReelSequence_Params.toJSON(message.params); + } + if (message.feature2 !== 0) { + obj.feature2 = Math.round(message.feature2); + } + if (message.feature3 !== 0) { + obj.feature3 = Math.round(message.feature3); + } + return obj; + }, + + create, I>>(base?: I): ReelSequence { + return ReelSequence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReelSequence { + const message = createBaseReelSequence(); + message.shortId = object.shortId ?? ""; + message.params = (object.params !== undefined && object.params !== null) + ? ReelSequence_Params.fromPartial(object.params) + : undefined; + message.feature2 = object.feature2 ?? 0; + message.feature3 = object.feature3 ?? 0; + return message; + }, +}; + +function createBaseReelSequence_Params(): ReelSequence_Params { + return { number: 0 }; +} + +export const ReelSequence_Params: MessageFns = { + encode(message: ReelSequence_Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReelSequence_Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReelSequence_Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.number = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReelSequence_Params { + return { number: isSet(object.number) ? globalThis.Number(object.number) : 0 }; + }, + + toJSON(message: ReelSequence_Params): unknown { + const obj: any = {}; + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + return obj; + }, + + create, I>>(base?: I): ReelSequence_Params { + return ReelSequence_Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReelSequence_Params { + const message = createBaseReelSequence_Params(); + message.number = object.number ?? 0; + return message; + }, +}; + +function createBaseShortsParam(): ShortsParam { + return { f1: undefined, p59: undefined }; +} + +export const ShortsParam: MessageFns = { + encode(message: ShortsParam, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.f1 !== undefined) { + ShortsParam_Field1.encode(message.f1, writer.uint32(10).fork()).join(); + } + if (message.p59 !== undefined) { + writer.uint32(472).int32(message.p59); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ShortsParam { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShortsParam(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.f1 = ShortsParam_Field1.decode(reader, reader.uint32()); + continue; + case 59: + if (tag !== 472) { + break; + } + + message.p59 = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ShortsParam { + return { + f1: isSet(object.f1) ? ShortsParam_Field1.fromJSON(object.f1) : undefined, + p59: isSet(object.p59) ? globalThis.Number(object.p59) : undefined, + }; + }, + + toJSON(message: ShortsParam): unknown { + const obj: any = {}; + if (message.f1 !== undefined) { + obj.f1 = ShortsParam_Field1.toJSON(message.f1); + } + if (message.p59 !== undefined) { + obj.p59 = Math.round(message.p59); + } + return obj; + }, + + create, I>>(base?: I): ShortsParam { + return ShortsParam.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ShortsParam { + const message = createBaseShortsParam(); + message.f1 = (object.f1 !== undefined && object.f1 !== null) + ? ShortsParam_Field1.fromPartial(object.f1) + : undefined; + message.p59 = object.p59 ?? undefined; + return message; + }, +}; + +function createBaseShortsParam_Field1(): ShortsParam_Field1 { + return { p1: undefined }; +} + +export const ShortsParam_Field1: MessageFns = { + encode(message: ShortsParam_Field1, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.p1 !== undefined) { + writer.uint32(8).int32(message.p1); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ShortsParam_Field1 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseShortsParam_Field1(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.p1 = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ShortsParam_Field1 { + return { p1: isSet(object.p1) ? globalThis.Number(object.p1) : undefined }; + }, + + toJSON(message: ShortsParam_Field1): unknown { + const obj: any = {}; + if (message.p1 !== undefined) { + obj.p1 = Math.round(message.p1); + } + return obj; + }, + + create, I>>(base?: I): ShortsParam_Field1 { + return ShortsParam_Field1.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ShortsParam_Field1 { + const message = createBaseShortsParam_Field1(); + message.p1 = object.p1 ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/attestation_response_data.ts b/protos/generated/youtube/api/pfiinnertube/attestation_response_data.ts new file mode 100644 index 0000000000..690799779f --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/attestation_response_data.ts @@ -0,0 +1,302 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/attestation_response_data.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface AttestationResponseData { + challenge?: string | undefined; + webResponse?: string | undefined; + androidResponse?: string | undefined; + iosResponse?: Uint8Array | undefined; + error?: number | undefined; + adblockReporting?: AttestationResponseData_AdblockReporting | undefined; +} + +export interface AttestationResponseData_AdblockReporting { + reportingStatus?: number | undefined; + broadSpectrumDetectionResult?: number | undefined; +} + +function createBaseAttestationResponseData(): AttestationResponseData { + return { + challenge: undefined, + webResponse: undefined, + androidResponse: undefined, + iosResponse: undefined, + error: undefined, + adblockReporting: undefined, + }; +} + +export const AttestationResponseData: MessageFns = { + encode(message: AttestationResponseData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.challenge !== undefined) { + writer.uint32(10).string(message.challenge); + } + if (message.webResponse !== undefined) { + writer.uint32(18).string(message.webResponse); + } + if (message.androidResponse !== undefined) { + writer.uint32(26).string(message.androidResponse); + } + if (message.iosResponse !== undefined) { + writer.uint32(34).bytes(message.iosResponse); + } + if (message.error !== undefined) { + writer.uint32(40).int32(message.error); + } + if (message.adblockReporting !== undefined) { + AttestationResponseData_AdblockReporting.encode(message.adblockReporting, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttestationResponseData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttestationResponseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.challenge = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.webResponse = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.androidResponse = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.iosResponse = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.error = reader.int32(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.adblockReporting = AttestationResponseData_AdblockReporting.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AttestationResponseData { + return { + challenge: isSet(object.challenge) ? globalThis.String(object.challenge) : undefined, + webResponse: isSet(object.webResponse) ? globalThis.String(object.webResponse) : undefined, + androidResponse: isSet(object.androidResponse) ? globalThis.String(object.androidResponse) : undefined, + iosResponse: isSet(object.iosResponse) ? bytesFromBase64(object.iosResponse) : undefined, + error: isSet(object.error) ? globalThis.Number(object.error) : undefined, + adblockReporting: isSet(object.adblockReporting) + ? AttestationResponseData_AdblockReporting.fromJSON(object.adblockReporting) + : undefined, + }; + }, + + toJSON(message: AttestationResponseData): unknown { + const obj: any = {}; + if (message.challenge !== undefined) { + obj.challenge = message.challenge; + } + if (message.webResponse !== undefined) { + obj.webResponse = message.webResponse; + } + if (message.androidResponse !== undefined) { + obj.androidResponse = message.androidResponse; + } + if (message.iosResponse !== undefined) { + obj.iosResponse = base64FromBytes(message.iosResponse); + } + if (message.error !== undefined) { + obj.error = Math.round(message.error); + } + if (message.adblockReporting !== undefined) { + obj.adblockReporting = AttestationResponseData_AdblockReporting.toJSON(message.adblockReporting); + } + return obj; + }, + + create, I>>(base?: I): AttestationResponseData { + return AttestationResponseData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AttestationResponseData { + const message = createBaseAttestationResponseData(); + message.challenge = object.challenge ?? undefined; + message.webResponse = object.webResponse ?? undefined; + message.androidResponse = object.androidResponse ?? undefined; + message.iosResponse = object.iosResponse ?? undefined; + message.error = object.error ?? undefined; + message.adblockReporting = (object.adblockReporting !== undefined && object.adblockReporting !== null) + ? AttestationResponseData_AdblockReporting.fromPartial(object.adblockReporting) + : undefined; + return message; + }, +}; + +function createBaseAttestationResponseData_AdblockReporting(): AttestationResponseData_AdblockReporting { + return { reportingStatus: undefined, broadSpectrumDetectionResult: undefined }; +} + +export const AttestationResponseData_AdblockReporting: MessageFns = { + encode(message: AttestationResponseData_AdblockReporting, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reportingStatus !== undefined) { + writer.uint32(8).uint64(message.reportingStatus); + } + if (message.broadSpectrumDetectionResult !== undefined) { + writer.uint32(16).uint64(message.broadSpectrumDetectionResult); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttestationResponseData_AdblockReporting { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttestationResponseData_AdblockReporting(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.reportingStatus = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.broadSpectrumDetectionResult = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AttestationResponseData_AdblockReporting { + return { + reportingStatus: isSet(object.reportingStatus) ? globalThis.Number(object.reportingStatus) : undefined, + broadSpectrumDetectionResult: isSet(object.broadSpectrumDetectionResult) + ? globalThis.Number(object.broadSpectrumDetectionResult) + : undefined, + }; + }, + + toJSON(message: AttestationResponseData_AdblockReporting): unknown { + const obj: any = {}; + if (message.reportingStatus !== undefined) { + obj.reportingStatus = Math.round(message.reportingStatus); + } + if (message.broadSpectrumDetectionResult !== undefined) { + obj.broadSpectrumDetectionResult = Math.round(message.broadSpectrumDetectionResult); + } + return obj; + }, + + create, I>>( + base?: I, + ): AttestationResponseData_AdblockReporting { + return AttestationResponseData_AdblockReporting.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): AttestationResponseData_AdblockReporting { + const message = createBaseAttestationResponseData_AdblockReporting(); + message.reportingStatus = object.reportingStatus ?? undefined; + message.broadSpectrumDetectionResult = object.broadSpectrumDetectionResult ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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 longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +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/protos/generated/youtube/api/pfiinnertube/capability_info.ts b/protos/generated/youtube/api/pfiinnertube/capability_info.ts new file mode 100644 index 0000000000..7ee1598910 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/capability_info.ts @@ -0,0 +1,245 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/capability_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface CapabilityInfo { + profile?: string | undefined; + supportedCapabilities: InnerTubeCapability[]; + disabledCapabilities: InnerTubeCapability[]; + snapshot?: string | undefined; +} + +export interface InnerTubeCapability { + capability?: number | undefined; + features?: number | undefined; + experimentFlags?: string | undefined; +} + +function createBaseCapabilityInfo(): CapabilityInfo { + return { profile: undefined, supportedCapabilities: [], disabledCapabilities: [], snapshot: undefined }; +} + +export const CapabilityInfo: MessageFns = { + encode(message: CapabilityInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.profile !== undefined) { + writer.uint32(10).string(message.profile); + } + for (const v of message.supportedCapabilities) { + InnerTubeCapability.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.disabledCapabilities) { + InnerTubeCapability.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.snapshot !== undefined) { + writer.uint32(42).string(message.snapshot); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CapabilityInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapabilityInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.profile = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.supportedCapabilities.push(InnerTubeCapability.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.disabledCapabilities.push(InnerTubeCapability.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.snapshot = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CapabilityInfo { + return { + profile: isSet(object.profile) ? globalThis.String(object.profile) : undefined, + supportedCapabilities: globalThis.Array.isArray(object?.supportedCapabilities) + ? object.supportedCapabilities.map((e: any) => InnerTubeCapability.fromJSON(e)) + : [], + disabledCapabilities: globalThis.Array.isArray(object?.disabledCapabilities) + ? object.disabledCapabilities.map((e: any) => InnerTubeCapability.fromJSON(e)) + : [], + snapshot: isSet(object.snapshot) ? globalThis.String(object.snapshot) : undefined, + }; + }, + + toJSON(message: CapabilityInfo): unknown { + const obj: any = {}; + if (message.profile !== undefined) { + obj.profile = message.profile; + } + if (message.supportedCapabilities?.length) { + obj.supportedCapabilities = message.supportedCapabilities.map((e) => InnerTubeCapability.toJSON(e)); + } + if (message.disabledCapabilities?.length) { + obj.disabledCapabilities = message.disabledCapabilities.map((e) => InnerTubeCapability.toJSON(e)); + } + if (message.snapshot !== undefined) { + obj.snapshot = message.snapshot; + } + return obj; + }, + + create, I>>(base?: I): CapabilityInfo { + return CapabilityInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CapabilityInfo { + const message = createBaseCapabilityInfo(); + message.profile = object.profile ?? undefined; + message.supportedCapabilities = object.supportedCapabilities?.map((e) => InnerTubeCapability.fromPartial(e)) || []; + message.disabledCapabilities = object.disabledCapabilities?.map((e) => InnerTubeCapability.fromPartial(e)) || []; + message.snapshot = object.snapshot ?? undefined; + return message; + }, +}; + +function createBaseInnerTubeCapability(): InnerTubeCapability { + return { capability: undefined, features: undefined, experimentFlags: undefined }; +} + +export const InnerTubeCapability: MessageFns = { + encode(message: InnerTubeCapability, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.capability !== undefined) { + writer.uint32(8).uint32(message.capability); + } + if (message.features !== undefined) { + writer.uint32(16).uint32(message.features); + } + if (message.experimentFlags !== undefined) { + writer.uint32(50).string(message.experimentFlags); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerTubeCapability { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerTubeCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.capability = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.features = reader.uint32(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.experimentFlags = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerTubeCapability { + return { + capability: isSet(object.capability) ? globalThis.Number(object.capability) : undefined, + features: isSet(object.features) ? globalThis.Number(object.features) : undefined, + experimentFlags: isSet(object.experimentFlags) ? globalThis.String(object.experimentFlags) : undefined, + }; + }, + + toJSON(message: InnerTubeCapability): unknown { + const obj: any = {}; + if (message.capability !== undefined) { + obj.capability = Math.round(message.capability); + } + if (message.features !== undefined) { + obj.features = Math.round(message.features); + } + if (message.experimentFlags !== undefined) { + obj.experimentFlags = message.experimentFlags; + } + return obj; + }, + + create, I>>(base?: I): InnerTubeCapability { + return InnerTubeCapability.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InnerTubeCapability { + const message = createBaseInnerTubeCapability(); + message.capability = object.capability ?? undefined; + message.features = object.features ?? undefined; + message.experimentFlags = object.experimentFlags ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/client_info.ts b/protos/generated/youtube/api/pfiinnertube/client_info.ts new file mode 100644 index 0000000000..b9102fd95e --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/client_info.ts @@ -0,0 +1,4707 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/client_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface ClientInfo { + hl?: string | undefined; + gl?: string | undefined; + remoteHost?: string | undefined; + deviceId?: string | undefined; + debugDeviceIdOverride?: string | undefined; + carrierGeo?: string | undefined; + crackedHl?: boolean | undefined; + deviceMake?: string | undefined; + deviceModel?: string | undefined; + visitorData?: string | undefined; + userAgent?: string | undefined; + clientName?: number | undefined; + clientVersion?: string | undefined; + osName?: string | undefined; + osVersion?: string | undefined; + projectId?: string | undefined; + acceptLanguage?: string | undefined; + acceptRegion?: string | undefined; + originalUrl?: string | undefined; + rawDeviceId?: string | undefined; + configData?: string | undefined; + spacecastToken?: string | undefined; + internalGeo?: string | undefined; + screenWidthPoints?: number | undefined; + screenHeightPoints?: number | undefined; + screenWidthInches?: number | undefined; + screenHeightInches?: number | undefined; + screenPixelDensity?: number | undefined; + platform?: number | undefined; + spacecastClientInfo?: ClientInfo_SpacecastClientInfo | undefined; + clientFormFactor?: ClientInfo_ClientFormFactor | undefined; + forwardedFor?: string | undefined; + mobileDataPlanInfo?: + | ClientInfo_MobileDataPlanInfo + | undefined; + /** e.g. 241757026 */ + gmscoreVersionCode?: number | undefined; + webpSupport?: boolean | undefined; + cameraType?: ClientInfo_CameraType | undefined; + experimentsToken?: string | undefined; + windowWidthPoints?: number | undefined; + windowHeightPoints?: number | undefined; + configInfo?: ClientInfo_ConfigGroupsClientInfo | undefined; + unpluggedLocationInfo?: ClientInfo_UnpluggedLocationInfo | undefined; + androidSdkVersion?: number | undefined; + screenDensityFloat?: number | undefined; + firstTimeSignInExperimentIds?: number | undefined; + utcOffsetMinutes?: number | undefined; + animatedWebpSupport?: boolean | undefined; + kidsAppInfo?: ClientInfo_KidsAppInfo | undefined; + musicAppInfo?: ClientInfo_MusicAppInfo | undefined; + tvAppInfo?: ClientInfo_TvAppInfo | undefined; + internalGeoIp?: string | undefined; + unpluggedAppInfo?: ClientInfo_UnpluggedAppInfo | undefined; + locationInfo?: ClientInfo_LocationInfo | undefined; + contentSizeCategory?: string | undefined; + fontScale?: number | undefined; + userInterfaceTheme?: ClientInfo_UserInterfaceTheme | undefined; + timeZone?: string | undefined; + homeGroupInfo?: ClientInfo_HomeGroupInfo | undefined; + emlTemplateContext?: Uint8Array | undefined; + coldAppBundleConfigData?: + | Uint8Array + | undefined; + /** repeated ExperimentsHeterodyne.ExperimentIds heterodyne_ids = 86; */ + browserName?: string | undefined; + browserVersion?: string | undefined; + locationPlayabilityToken?: + | string + | undefined; + /** e.g. "qcom;taro" */ + chipset?: string | undefined; + firmwareVersion?: string | undefined; + memoryTotalKbytes?: number | undefined; + mainAppWebInfo?: ClientInfo_MainAppWebInfo | undefined; + notificationPermissionInfo?: ClientInfo_NotificationPermissionInfo | undefined; + deviceBrand?: + | string + | undefined; + /** + * optional ClientStoreInfo client_store_info = 99; + * optional SRSDataPushVersion srs_datapush_build_ids = 100; + * optional PlayerDataPushVersion player_datapush_build_ids = 101; + */ + glDeviceInfo?: ClientInfo_GLDeviceInfo | undefined; +} + +export enum ClientInfo_ClientFormFactor { + /** UNKNOWN_FORM_FACTOR - @TODO: Check these. */ + UNKNOWN_FORM_FACTOR = 0, + FORM_FACTOR_VAL1 = 1, + FORM_FACTOR_VAL2 = 2, + UNRECOGNIZED = -1, +} + +export function clientInfo_ClientFormFactorFromJSON(object: any): ClientInfo_ClientFormFactor { + switch (object) { + case 0: + case "UNKNOWN_FORM_FACTOR": + return ClientInfo_ClientFormFactor.UNKNOWN_FORM_FACTOR; + case 1: + case "FORM_FACTOR_VAL1": + return ClientInfo_ClientFormFactor.FORM_FACTOR_VAL1; + case 2: + case "FORM_FACTOR_VAL2": + return ClientInfo_ClientFormFactor.FORM_FACTOR_VAL2; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_ClientFormFactor.UNRECOGNIZED; + } +} + +export function clientInfo_ClientFormFactorToJSON(object: ClientInfo_ClientFormFactor): string { + switch (object) { + case ClientInfo_ClientFormFactor.UNKNOWN_FORM_FACTOR: + return "UNKNOWN_FORM_FACTOR"; + case ClientInfo_ClientFormFactor.FORM_FACTOR_VAL1: + return "FORM_FACTOR_VAL1"; + case ClientInfo_ClientFormFactor.FORM_FACTOR_VAL2: + return "FORM_FACTOR_VAL2"; + case ClientInfo_ClientFormFactor.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_CameraType { + UNKNOWN_CAMERA_TYPE = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_CameraTypeFromJSON(object: any): ClientInfo_CameraType { + switch (object) { + case 0: + case "UNKNOWN_CAMERA_TYPE": + return ClientInfo_CameraType.UNKNOWN_CAMERA_TYPE; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_CameraType.UNRECOGNIZED; + } +} + +export function clientInfo_CameraTypeToJSON(object: ClientInfo_CameraType): string { + switch (object) { + case ClientInfo_CameraType.UNKNOWN_CAMERA_TYPE: + return "UNKNOWN_CAMERA_TYPE"; + case ClientInfo_CameraType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_UserInterfaceTheme { + USER_INTERFACE_THEME_DARK = 0, + USER_INTERFACE_THEME_LIGHT = 1, + UNRECOGNIZED = -1, +} + +export function clientInfo_UserInterfaceThemeFromJSON(object: any): ClientInfo_UserInterfaceTheme { + switch (object) { + case 0: + case "USER_INTERFACE_THEME_DARK": + return ClientInfo_UserInterfaceTheme.USER_INTERFACE_THEME_DARK; + case 1: + case "USER_INTERFACE_THEME_LIGHT": + return ClientInfo_UserInterfaceTheme.USER_INTERFACE_THEME_LIGHT; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_UserInterfaceTheme.UNRECOGNIZED; + } +} + +export function clientInfo_UserInterfaceThemeToJSON(object: ClientInfo_UserInterfaceTheme): string { + switch (object) { + case ClientInfo_UserInterfaceTheme.USER_INTERFACE_THEME_DARK: + return "USER_INTERFACE_THEME_DARK"; + case ClientInfo_UserInterfaceTheme.USER_INTERFACE_THEME_LIGHT: + return "USER_INTERFACE_THEME_LIGHT"; + case ClientInfo_UserInterfaceTheme.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_MainAppWebInfo { + graftUrl?: string | undefined; + pwaInstallabilityStatus?: ClientInfo_MainAppWebInfo_PwaInstallabilityStatus | undefined; + webDisplayMode?: ClientInfo_MainAppWebInfo_WebDisplayMode | undefined; + isWebNativeShareAvailable?: boolean | undefined; + storeDigitalGoodsApiSupportStatus?: ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus | undefined; +} + +export enum ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus { + STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0 = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatusFromJSON( + object: any, +): ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus { + switch (object) { + case 0: + case "STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0": + return ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus.STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus.UNRECOGNIZED; + } +} + +export function clientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatusToJSON( + object: ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus, +): string { + switch (object) { + case ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus.STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0: + return "STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0"; + case ClientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MainAppWebInfo_PwaInstallabilityStatus { + PWA_INSTALLABILITY_STATUS_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MainAppWebInfo_PwaInstallabilityStatusFromJSON( + object: any, +): ClientInfo_MainAppWebInfo_PwaInstallabilityStatus { + switch (object) { + case 0: + case "PWA_INSTALLABILITY_STATUS_UNKNOWN": + return ClientInfo_MainAppWebInfo_PwaInstallabilityStatus.PWA_INSTALLABILITY_STATUS_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MainAppWebInfo_PwaInstallabilityStatus.UNRECOGNIZED; + } +} + +export function clientInfo_MainAppWebInfo_PwaInstallabilityStatusToJSON( + object: ClientInfo_MainAppWebInfo_PwaInstallabilityStatus, +): string { + switch (object) { + case ClientInfo_MainAppWebInfo_PwaInstallabilityStatus.PWA_INSTALLABILITY_STATUS_UNKNOWN: + return "PWA_INSTALLABILITY_STATUS_UNKNOWN"; + case ClientInfo_MainAppWebInfo_PwaInstallabilityStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MainAppWebInfo_WebDisplayMode { + WEB_DISPLAY_MODE_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MainAppWebInfo_WebDisplayModeFromJSON( + object: any, +): ClientInfo_MainAppWebInfo_WebDisplayMode { + switch (object) { + case 0: + case "WEB_DISPLAY_MODE_UNKNOWN": + return ClientInfo_MainAppWebInfo_WebDisplayMode.WEB_DISPLAY_MODE_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MainAppWebInfo_WebDisplayMode.UNRECOGNIZED; + } +} + +export function clientInfo_MainAppWebInfo_WebDisplayModeToJSON( + object: ClientInfo_MainAppWebInfo_WebDisplayMode, +): string { + switch (object) { + case ClientInfo_MainAppWebInfo_WebDisplayMode.WEB_DISPLAY_MODE_UNKNOWN: + return "WEB_DISPLAY_MODE_UNKNOWN"; + case ClientInfo_MainAppWebInfo_WebDisplayMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_NotificationPermissionInfo { + notificationsSetting?: ClientInfo_NotificationPermissionInfo_NotificationsSetting | undefined; + lastDeviceOptInChangeTimeAgoSec?: number | undefined; +} + +export enum ClientInfo_NotificationPermissionInfo_NotificationsSetting { + NOTIFICATIONS_SETTING_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_NotificationPermissionInfo_NotificationsSettingFromJSON( + object: any, +): ClientInfo_NotificationPermissionInfo_NotificationsSetting { + switch (object) { + case 0: + case "NOTIFICATIONS_SETTING_UNKNOWN": + return ClientInfo_NotificationPermissionInfo_NotificationsSetting.NOTIFICATIONS_SETTING_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_NotificationPermissionInfo_NotificationsSetting.UNRECOGNIZED; + } +} + +export function clientInfo_NotificationPermissionInfo_NotificationsSettingToJSON( + object: ClientInfo_NotificationPermissionInfo_NotificationsSetting, +): string { + switch (object) { + case ClientInfo_NotificationPermissionInfo_NotificationsSetting.NOTIFICATIONS_SETTING_UNKNOWN: + return "NOTIFICATIONS_SETTING_UNKNOWN"; + case ClientInfo_NotificationPermissionInfo_NotificationsSetting.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_GLDeviceInfo { + glRenderer?: string | undefined; + glEsVersionMajor?: number | undefined; + glEsVersionMinor?: number | undefined; +} + +export interface ClientInfo_SpacecastClientInfo { + appliances?: ClientInfo_SpacecastClientInfo_SpacecastAppliance | undefined; + interactionLevel?: ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel | undefined; +} + +export enum ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel { + UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_SpacecastClientInfo_SpacecastInteractionLevelFromJSON( + object: any, +): ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel { + switch (object) { + case 0: + case "UNKNOWN": + return ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel.UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel.UNRECOGNIZED; + } +} + +export function clientInfo_SpacecastClientInfo_SpacecastInteractionLevelToJSON( + object: ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel, +): string { + switch (object) { + case ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel.UNKNOWN: + return "UNKNOWN"; + case ClientInfo_SpacecastClientInfo_SpacecastInteractionLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_SpacecastClientInfo_SpacecastAppliance { + contentProfileToken?: Uint8Array | undefined; + status?: ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus | undefined; + hostname?: string | undefined; + active?: boolean | undefined; + deviceId?: string | undefined; +} + +export enum ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus { + UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatusFromJSON( + object: any, +): ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus.UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus.UNRECOGNIZED; + } +} + +export function clientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatusToJSON( + object: ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus, +): string { + switch (object) { + case ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus.UNKNOWN: + return "UNKNOWN"; + case ClientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_MobileDataPlanInfo { + cpid?: string | undefined; + serializedDataPlanStatus?: string | undefined; + dataSavingQualityPickerEnabled?: boolean | undefined; + mccmnc?: string | undefined; +} + +export interface ClientInfo_ConfigGroupsClientInfo { + coldConfigData?: string | undefined; + coldHashData?: string | undefined; + hotHashData?: string | undefined; + appInstallData?: string | undefined; +} + +export interface ClientInfo_UnpluggedLocationInfo { + latitudeE7?: number | undefined; + longitudeE7?: number | undefined; + localTimestampMs?: number | undefined; + ipAddress?: string | undefined; + timezone?: string | undefined; + prefer24HourTime?: boolean | undefined; + locationRadiusMeters?: number | undefined; + isInitialLoad?: boolean | undefined; + browserPermissionGranted?: boolean | undefined; + clientPermissionState?: number | undefined; + locationOverrideToken?: string | undefined; +} + +export interface ClientInfo_KidsAppInfo { + contentSettings?: ClientInfo_KidsAppInfo_KidsContentSettings | undefined; + parentCurationMode?: ClientInfo_KidsAppInfo_KidsParentCurationMode | undefined; + categorySettings?: ClientInfo_KidsAppInfo_KidsCategorySettings | undefined; + userEducationSettings?: ClientInfo_KidsAppInfo_KidsUserEducationSettings | undefined; +} + +export enum ClientInfo_KidsAppInfo_KidsParentCurationMode { + KPCM_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_KidsAppInfo_KidsParentCurationModeFromJSON( + object: any, +): ClientInfo_KidsAppInfo_KidsParentCurationMode { + switch (object) { + case 0: + case "KPCM_UNKNOWN": + return ClientInfo_KidsAppInfo_KidsParentCurationMode.KPCM_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_KidsAppInfo_KidsParentCurationMode.UNRECOGNIZED; + } +} + +export function clientInfo_KidsAppInfo_KidsParentCurationModeToJSON( + object: ClientInfo_KidsAppInfo_KidsParentCurationMode, +): string { + switch (object) { + case ClientInfo_KidsAppInfo_KidsParentCurationMode.KPCM_UNKNOWN: + return "KPCM_UNKNOWN"; + case ClientInfo_KidsAppInfo_KidsParentCurationMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_KidsAppInfo_KidsContentSettings { + kidsNoSearchMode?: ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode | undefined; + ageUpMode?: ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode | undefined; + contentDensity?: ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity | undefined; +} + +export enum ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode { + YT_KIDS_NO_SEARCH_MODE_OFF = 0, + YT_KIDS_NO_SEARCH_MODE_ON = 1, + UNRECOGNIZED = -1, +} + +export function clientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchModeFromJSON( + object: any, +): ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode { + switch (object) { + case 0: + case "YT_KIDS_NO_SEARCH_MODE_OFF": + return ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode.YT_KIDS_NO_SEARCH_MODE_OFF; + case 1: + case "YT_KIDS_NO_SEARCH_MODE_ON": + return ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode.YT_KIDS_NO_SEARCH_MODE_ON; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode.UNRECOGNIZED; + } +} + +export function clientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchModeToJSON( + object: ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode, +): string { + switch (object) { + case ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode.YT_KIDS_NO_SEARCH_MODE_OFF: + return "YT_KIDS_NO_SEARCH_MODE_OFF"; + case ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode.YT_KIDS_NO_SEARCH_MODE_ON: + return "YT_KIDS_NO_SEARCH_MODE_ON"; + case ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode { + YT_KIDS_AGE_UP_MODE_OFF = 0, + YT_KIDS_AGE_UP_MODE_ON = 1, + UNRECOGNIZED = -1, +} + +export function clientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpModeFromJSON( + object: any, +): ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode { + switch (object) { + case 0: + case "YT_KIDS_AGE_UP_MODE_OFF": + return ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode.YT_KIDS_AGE_UP_MODE_OFF; + case 1: + case "YT_KIDS_AGE_UP_MODE_ON": + return ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode.YT_KIDS_AGE_UP_MODE_ON; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode.UNRECOGNIZED; + } +} + +export function clientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpModeToJSON( + object: ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode, +): string { + switch (object) { + case ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode.YT_KIDS_AGE_UP_MODE_OFF: + return "YT_KIDS_AGE_UP_MODE_OFF"; + case ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode.YT_KIDS_AGE_UP_MODE_ON: + return "YT_KIDS_AGE_UP_MODE_ON"; + case ClientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity { + /** YT_KIDS_CONTENT_DENSITY_VAL1 - @TODO: Check these. */ + YT_KIDS_CONTENT_DENSITY_VAL1 = 0, + YT_KIDS_CONTENT_DENSITY_VAL2 = 1, + YT_KIDS_CONTENT_DENSITY_VAL3 = 2, + UNRECOGNIZED = -1, +} + +export function clientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensityFromJSON( + object: any, +): ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity { + switch (object) { + case 0: + case "YT_KIDS_CONTENT_DENSITY_VAL1": + return ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.YT_KIDS_CONTENT_DENSITY_VAL1; + case 1: + case "YT_KIDS_CONTENT_DENSITY_VAL2": + return ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.YT_KIDS_CONTENT_DENSITY_VAL2; + case 2: + case "YT_KIDS_CONTENT_DENSITY_VAL3": + return ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.YT_KIDS_CONTENT_DENSITY_VAL3; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.UNRECOGNIZED; + } +} + +export function clientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensityToJSON( + object: ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity, +): string { + switch (object) { + case ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.YT_KIDS_CONTENT_DENSITY_VAL1: + return "YT_KIDS_CONTENT_DENSITY_VAL1"; + case ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.YT_KIDS_CONTENT_DENSITY_VAL2: + return "YT_KIDS_CONTENT_DENSITY_VAL2"; + case ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.YT_KIDS_CONTENT_DENSITY_VAL3: + return "YT_KIDS_CONTENT_DENSITY_VAL3"; + case ClientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensity.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_KidsAppInfo_KidsCategorySettings { + enabledCategories?: string | undefined; +} + +export interface ClientInfo_KidsAppInfo_KidsUserEducationSettings { + hasSeenHomeChipBarUserEducation?: boolean | undefined; + hasSeenHomePivotBarUserEducation?: boolean | undefined; + hasSeenParentMuirUserEducation?: boolean | undefined; +} + +export interface ClientInfo_MusicAppInfo { + playBackMode?: ClientInfo_MusicAppInfo_MusicPlayBackMode | undefined; + musicLocationMasterSwitch?: ClientInfo_MusicAppInfo_MusicLocationMasterSwitch | undefined; + musicActivityMasterSwitch?: ClientInfo_MusicAppInfo_MusicActivityMasterSwitch | undefined; + offlineMixtapeEnabled?: boolean | undefined; + autoOfflineEnabled?: boolean | undefined; + iosBackgroundRefreshStatus?: ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus | undefined; + smartDownloadsSongLimit?: number | undefined; + transitionedFromMixtapeToSmartDownloads?: boolean | undefined; + pwaInstallabilityStatus?: ClientInfo_MusicAppInfo_PwaInstallabilityStatus | undefined; + webDisplayMode?: ClientInfo_MusicAppInfo_WebDisplayMode | undefined; + musicTier?: ClientInfo_MusicAppInfo_MusicTier | undefined; + storeDigitalGoodsApiSupportStatus?: ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus | undefined; + smartDownloadsTimeSinceLastOptOutSec?: number | undefined; +} + +export enum ClientInfo_MusicAppInfo_MusicPlayBackMode { + MPBM_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_MusicPlayBackModeFromJSON( + object: any, +): ClientInfo_MusicAppInfo_MusicPlayBackMode { + switch (object) { + case 0: + case "MPBM_UNKNOWN": + return ClientInfo_MusicAppInfo_MusicPlayBackMode.MPBM_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_MusicPlayBackMode.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_MusicPlayBackModeToJSON( + object: ClientInfo_MusicAppInfo_MusicPlayBackMode, +): string { + switch (object) { + case ClientInfo_MusicAppInfo_MusicPlayBackMode.MPBM_UNKNOWN: + return "MPBM_UNKNOWN"; + case ClientInfo_MusicAppInfo_MusicPlayBackMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_MusicLocationMasterSwitch { + MLMS_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_MusicLocationMasterSwitchFromJSON( + object: any, +): ClientInfo_MusicAppInfo_MusicLocationMasterSwitch { + switch (object) { + case 0: + case "MLMS_UNKNOWN": + return ClientInfo_MusicAppInfo_MusicLocationMasterSwitch.MLMS_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_MusicLocationMasterSwitch.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_MusicLocationMasterSwitchToJSON( + object: ClientInfo_MusicAppInfo_MusicLocationMasterSwitch, +): string { + switch (object) { + case ClientInfo_MusicAppInfo_MusicLocationMasterSwitch.MLMS_UNKNOWN: + return "MLMS_UNKNOWN"; + case ClientInfo_MusicAppInfo_MusicLocationMasterSwitch.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_MusicActivityMasterSwitch { + MAMS_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_MusicActivityMasterSwitchFromJSON( + object: any, +): ClientInfo_MusicAppInfo_MusicActivityMasterSwitch { + switch (object) { + case 0: + case "MAMS_UNKNOWN": + return ClientInfo_MusicAppInfo_MusicActivityMasterSwitch.MAMS_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_MusicActivityMasterSwitch.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_MusicActivityMasterSwitchToJSON( + object: ClientInfo_MusicAppInfo_MusicActivityMasterSwitch, +): string { + switch (object) { + case ClientInfo_MusicAppInfo_MusicActivityMasterSwitch.MAMS_UNKNOWN: + return "MAMS_UNKNOWN"; + case ClientInfo_MusicAppInfo_MusicActivityMasterSwitch.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus { + UNKNOWN_STATUS = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_IosBackgroundRefreshStatusFromJSON( + object: any, +): ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus { + switch (object) { + case 0: + case "UNKNOWN_STATUS": + return ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus.UNKNOWN_STATUS; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_IosBackgroundRefreshStatusToJSON( + object: ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus, +): string { + switch (object) { + case ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus.UNKNOWN_STATUS: + return "UNKNOWN_STATUS"; + case ClientInfo_MusicAppInfo_IosBackgroundRefreshStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_PwaInstallabilityStatus { + PIS_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_PwaInstallabilityStatusFromJSON( + object: any, +): ClientInfo_MusicAppInfo_PwaInstallabilityStatus { + switch (object) { + case 0: + case "PIS_UNKNOWN": + return ClientInfo_MusicAppInfo_PwaInstallabilityStatus.PIS_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_PwaInstallabilityStatus.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_PwaInstallabilityStatusToJSON( + object: ClientInfo_MusicAppInfo_PwaInstallabilityStatus, +): string { + switch (object) { + case ClientInfo_MusicAppInfo_PwaInstallabilityStatus.PIS_UNKNOWN: + return "PIS_UNKNOWN"; + case ClientInfo_MusicAppInfo_PwaInstallabilityStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_WebDisplayMode { + WDM_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_WebDisplayModeFromJSON(object: any): ClientInfo_MusicAppInfo_WebDisplayMode { + switch (object) { + case 0: + case "WDM_UNKNOWN": + return ClientInfo_MusicAppInfo_WebDisplayMode.WDM_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_WebDisplayMode.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_WebDisplayModeToJSON(object: ClientInfo_MusicAppInfo_WebDisplayMode): string { + switch (object) { + case ClientInfo_MusicAppInfo_WebDisplayMode.WDM_UNKNOWN: + return "WDM_UNKNOWN"; + case ClientInfo_MusicAppInfo_WebDisplayMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_MusicTier { + UNKNOWN_TIER = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_MusicTierFromJSON(object: any): ClientInfo_MusicAppInfo_MusicTier { + switch (object) { + case 0: + case "UNKNOWN_TIER": + return ClientInfo_MusicAppInfo_MusicTier.UNKNOWN_TIER; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_MusicTier.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_MusicTierToJSON(object: ClientInfo_MusicAppInfo_MusicTier): string { + switch (object) { + case ClientInfo_MusicAppInfo_MusicTier.UNKNOWN_TIER: + return "UNKNOWN_TIER"; + case ClientInfo_MusicAppInfo_MusicTier.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export enum ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus { + SDGAS_UNKNOWN = 0, + UNRECOGNIZED = -1, +} + +export function clientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatusFromJSON( + object: any, +): ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus { + switch (object) { + case 0: + case "SDGAS_UNKNOWN": + return ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus.SDGAS_UNKNOWN; + case -1: + case "UNRECOGNIZED": + default: + return ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus.UNRECOGNIZED; + } +} + +export function clientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatusToJSON( + object: ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus, +): string { + switch (object) { + case ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus.SDGAS_UNKNOWN: + return "SDGAS_UNKNOWN"; + case ClientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export interface ClientInfo_TvAppInfo { + mdxImpactedSessionsServerEvents?: string | undefined; + enablePrivacyFilter?: boolean | undefined; + zylonLeftNav?: boolean | undefined; + certificationScope?: string | undefined; + livingRoomPoTokenId?: string | undefined; + jsEngineString?: string | undefined; + voiceCapability?: ClientInfo_TvAppInfo_VoiceCapability | undefined; + systemIntegrator?: string | undefined; + androidBuildFingerprint?: string | undefined; + cobaltAppVersion?: string | undefined; + cobaltStarboardVersion?: string | undefined; + useStartPlaybackPreviewCommand?: boolean | undefined; + shouldShowPersistentSigninOnHome?: boolean | undefined; + androidPlayServicesVersion?: string | undefined; +} + +export interface ClientInfo_TvAppInfo_VoiceCapability { + hasSoftMicSupport?: boolean | undefined; + hasHardMicSupport?: boolean | undefined; +} + +export interface ClientInfo_UnpluggedAppInfo { + enableFilterMode?: boolean | undefined; + iosNotificationPermission?: boolean | undefined; + forceEnableEpg3?: boolean | undefined; +} + +export interface ClientInfo_LocationInfo { + locationInfoStatus?: number | undefined; + ulrStatus?: ClientInfo_LocationInfo_UrlStatus | undefined; + latitudeE7?: string | undefined; + longitudeE7?: string | undefined; + horizontalAccuracyMeters?: string | undefined; + locationFreshnessMs?: string | undefined; + locationPermissionAuthorizationStatus?: number | undefined; + locationOverrideToken?: string | undefined; + forceLocationPlayabilityTokenRefresh?: boolean | undefined; +} + +export interface ClientInfo_LocationInfo_UrlStatus { + reportingEnabledSetting?: number | undefined; + historyEnabledSetting?: number | undefined; + isAllowed?: boolean | undefined; + isActive?: boolean | undefined; +} + +export interface ClientInfo_HomeGroupInfo { + isPartOfGroup?: boolean | undefined; + isGroup?: boolean | undefined; +} + +function createBaseClientInfo(): ClientInfo { + return { + hl: undefined, + gl: undefined, + remoteHost: undefined, + deviceId: undefined, + debugDeviceIdOverride: undefined, + carrierGeo: undefined, + crackedHl: undefined, + deviceMake: undefined, + deviceModel: undefined, + visitorData: undefined, + userAgent: undefined, + clientName: undefined, + clientVersion: undefined, + osName: undefined, + osVersion: undefined, + projectId: undefined, + acceptLanguage: undefined, + acceptRegion: undefined, + originalUrl: undefined, + rawDeviceId: undefined, + configData: undefined, + spacecastToken: undefined, + internalGeo: undefined, + screenWidthPoints: undefined, + screenHeightPoints: undefined, + screenWidthInches: undefined, + screenHeightInches: undefined, + screenPixelDensity: undefined, + platform: undefined, + spacecastClientInfo: undefined, + clientFormFactor: undefined, + forwardedFor: undefined, + mobileDataPlanInfo: undefined, + gmscoreVersionCode: undefined, + webpSupport: undefined, + cameraType: undefined, + experimentsToken: undefined, + windowWidthPoints: undefined, + windowHeightPoints: undefined, + configInfo: undefined, + unpluggedLocationInfo: undefined, + androidSdkVersion: undefined, + screenDensityFloat: undefined, + firstTimeSignInExperimentIds: undefined, + utcOffsetMinutes: undefined, + animatedWebpSupport: undefined, + kidsAppInfo: undefined, + musicAppInfo: undefined, + tvAppInfo: undefined, + internalGeoIp: undefined, + unpluggedAppInfo: undefined, + locationInfo: undefined, + contentSizeCategory: undefined, + fontScale: undefined, + userInterfaceTheme: undefined, + timeZone: undefined, + homeGroupInfo: undefined, + emlTemplateContext: undefined, + coldAppBundleConfigData: undefined, + browserName: undefined, + browserVersion: undefined, + locationPlayabilityToken: undefined, + chipset: undefined, + firmwareVersion: undefined, + memoryTotalKbytes: undefined, + mainAppWebInfo: undefined, + notificationPermissionInfo: undefined, + deviceBrand: undefined, + glDeviceInfo: undefined, + }; +} + +export const ClientInfo: MessageFns = { + encode(message: ClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hl !== undefined) { + writer.uint32(10).string(message.hl); + } + if (message.gl !== undefined) { + writer.uint32(18).string(message.gl); + } + if (message.remoteHost !== undefined) { + writer.uint32(34).string(message.remoteHost); + } + if (message.deviceId !== undefined) { + writer.uint32(50).string(message.deviceId); + } + if (message.debugDeviceIdOverride !== undefined) { + writer.uint32(66).string(message.debugDeviceIdOverride); + } + if (message.carrierGeo !== undefined) { + writer.uint32(82).string(message.carrierGeo); + } + if (message.crackedHl !== undefined) { + writer.uint32(88).bool(message.crackedHl); + } + if (message.deviceMake !== undefined) { + writer.uint32(98).string(message.deviceMake); + } + if (message.deviceModel !== undefined) { + writer.uint32(106).string(message.deviceModel); + } + if (message.visitorData !== undefined) { + writer.uint32(114).string(message.visitorData); + } + if (message.userAgent !== undefined) { + writer.uint32(122).string(message.userAgent); + } + if (message.clientName !== undefined) { + writer.uint32(128).int32(message.clientName); + } + if (message.clientVersion !== undefined) { + writer.uint32(138).string(message.clientVersion); + } + if (message.osName !== undefined) { + writer.uint32(146).string(message.osName); + } + if (message.osVersion !== undefined) { + writer.uint32(154).string(message.osVersion); + } + if (message.projectId !== undefined) { + writer.uint32(162).string(message.projectId); + } + if (message.acceptLanguage !== undefined) { + writer.uint32(170).string(message.acceptLanguage); + } + if (message.acceptRegion !== undefined) { + writer.uint32(178).string(message.acceptRegion); + } + if (message.originalUrl !== undefined) { + writer.uint32(186).string(message.originalUrl); + } + if (message.rawDeviceId !== undefined) { + writer.uint32(202).string(message.rawDeviceId); + } + if (message.configData !== undefined) { + writer.uint32(218).string(message.configData); + } + if (message.spacecastToken !== undefined) { + writer.uint32(250).string(message.spacecastToken); + } + if (message.internalGeo !== undefined) { + writer.uint32(274).string(message.internalGeo); + } + if (message.screenWidthPoints !== undefined) { + writer.uint32(296).int32(message.screenWidthPoints); + } + if (message.screenHeightPoints !== undefined) { + writer.uint32(304).int32(message.screenHeightPoints); + } + if (message.screenWidthInches !== undefined) { + writer.uint32(317).float(message.screenWidthInches); + } + if (message.screenHeightInches !== undefined) { + writer.uint32(325).float(message.screenHeightInches); + } + if (message.screenPixelDensity !== undefined) { + writer.uint32(328).int32(message.screenPixelDensity); + } + if (message.platform !== undefined) { + writer.uint32(336).int32(message.platform); + } + if (message.spacecastClientInfo !== undefined) { + ClientInfo_SpacecastClientInfo.encode(message.spacecastClientInfo, writer.uint32(362).fork()).join(); + } + if (message.clientFormFactor !== undefined) { + writer.uint32(368).int32(message.clientFormFactor); + } + if (message.forwardedFor !== undefined) { + writer.uint32(386).string(message.forwardedFor); + } + if (message.mobileDataPlanInfo !== undefined) { + ClientInfo_MobileDataPlanInfo.encode(message.mobileDataPlanInfo, writer.uint32(394).fork()).join(); + } + if (message.gmscoreVersionCode !== undefined) { + writer.uint32(400).int32(message.gmscoreVersionCode); + } + if (message.webpSupport !== undefined) { + writer.uint32(408).bool(message.webpSupport); + } + if (message.cameraType !== undefined) { + writer.uint32(416).int32(message.cameraType); + } + if (message.experimentsToken !== undefined) { + writer.uint32(434).string(message.experimentsToken); + } + if (message.windowWidthPoints !== undefined) { + writer.uint32(440).int32(message.windowWidthPoints); + } + if (message.windowHeightPoints !== undefined) { + writer.uint32(448).int32(message.windowHeightPoints); + } + if (message.configInfo !== undefined) { + ClientInfo_ConfigGroupsClientInfo.encode(message.configInfo, writer.uint32(498).fork()).join(); + } + if (message.unpluggedLocationInfo !== undefined) { + ClientInfo_UnpluggedLocationInfo.encode(message.unpluggedLocationInfo, writer.uint32(506).fork()).join(); + } + if (message.androidSdkVersion !== undefined) { + writer.uint32(512).int32(message.androidSdkVersion); + } + if (message.screenDensityFloat !== undefined) { + writer.uint32(525).float(message.screenDensityFloat); + } + if (message.firstTimeSignInExperimentIds !== undefined) { + writer.uint32(528).int32(message.firstTimeSignInExperimentIds); + } + if (message.utcOffsetMinutes !== undefined) { + writer.uint32(536).int32(message.utcOffsetMinutes); + } + if (message.animatedWebpSupport !== undefined) { + writer.uint32(544).bool(message.animatedWebpSupport); + } + if (message.kidsAppInfo !== undefined) { + ClientInfo_KidsAppInfo.encode(message.kidsAppInfo, writer.uint32(554).fork()).join(); + } + if (message.musicAppInfo !== undefined) { + ClientInfo_MusicAppInfo.encode(message.musicAppInfo, writer.uint32(562).fork()).join(); + } + if (message.tvAppInfo !== undefined) { + ClientInfo_TvAppInfo.encode(message.tvAppInfo, writer.uint32(570).fork()).join(); + } + if (message.internalGeoIp !== undefined) { + writer.uint32(578).string(message.internalGeoIp); + } + if (message.unpluggedAppInfo !== undefined) { + ClientInfo_UnpluggedAppInfo.encode(message.unpluggedAppInfo, writer.uint32(586).fork()).join(); + } + if (message.locationInfo !== undefined) { + ClientInfo_LocationInfo.encode(message.locationInfo, writer.uint32(594).fork()).join(); + } + if (message.contentSizeCategory !== undefined) { + writer.uint32(610).string(message.contentSizeCategory); + } + if (message.fontScale !== undefined) { + writer.uint32(621).float(message.fontScale); + } + if (message.userInterfaceTheme !== undefined) { + writer.uint32(624).int32(message.userInterfaceTheme); + } + if (message.timeZone !== undefined) { + writer.uint32(642).string(message.timeZone); + } + if (message.homeGroupInfo !== undefined) { + ClientInfo_HomeGroupInfo.encode(message.homeGroupInfo, writer.uint32(650).fork()).join(); + } + if (message.emlTemplateContext !== undefined) { + writer.uint32(674).bytes(message.emlTemplateContext); + } + if (message.coldAppBundleConfigData !== undefined) { + writer.uint32(682).bytes(message.coldAppBundleConfigData); + } + if (message.browserName !== undefined) { + writer.uint32(698).string(message.browserName); + } + if (message.browserVersion !== undefined) { + writer.uint32(706).string(message.browserVersion); + } + if (message.locationPlayabilityToken !== undefined) { + writer.uint32(714).string(message.locationPlayabilityToken); + } + if (message.chipset !== undefined) { + writer.uint32(738).string(message.chipset); + } + if (message.firmwareVersion !== undefined) { + writer.uint32(746).string(message.firmwareVersion); + } + if (message.memoryTotalKbytes !== undefined) { + writer.uint32(760).int64(message.memoryTotalKbytes); + } + if (message.mainAppWebInfo !== undefined) { + ClientInfo_MainAppWebInfo.encode(message.mainAppWebInfo, writer.uint32(770).fork()).join(); + } + if (message.notificationPermissionInfo !== undefined) { + ClientInfo_NotificationPermissionInfo.encode(message.notificationPermissionInfo, writer.uint32(778).fork()) + .join(); + } + if (message.deviceBrand !== undefined) { + writer.uint32(786).string(message.deviceBrand); + } + if (message.glDeviceInfo !== undefined) { + ClientInfo_GLDeviceInfo.encode(message.glDeviceInfo, writer.uint32(818).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.gl = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.remoteHost = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deviceId = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.debugDeviceIdOverride = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.carrierGeo = reader.string(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.crackedHl = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.deviceMake = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.deviceModel = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.visitorData = reader.string(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.userAgent = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.clientName = reader.int32(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.clientVersion = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.osName = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.osVersion = reader.string(); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.projectId = reader.string(); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.acceptLanguage = reader.string(); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.acceptRegion = reader.string(); + continue; + case 23: + if (tag !== 186) { + break; + } + + message.originalUrl = reader.string(); + continue; + case 25: + if (tag !== 202) { + break; + } + + message.rawDeviceId = reader.string(); + continue; + case 27: + if (tag !== 218) { + break; + } + + message.configData = reader.string(); + continue; + case 31: + if (tag !== 250) { + break; + } + + message.spacecastToken = reader.string(); + continue; + case 34: + if (tag !== 274) { + break; + } + + message.internalGeo = reader.string(); + continue; + case 37: + if (tag !== 296) { + break; + } + + message.screenWidthPoints = reader.int32(); + continue; + case 38: + if (tag !== 304) { + break; + } + + message.screenHeightPoints = reader.int32(); + continue; + case 39: + if (tag !== 317) { + break; + } + + message.screenWidthInches = reader.float(); + continue; + case 40: + if (tag !== 325) { + break; + } + + message.screenHeightInches = reader.float(); + continue; + case 41: + if (tag !== 328) { + break; + } + + message.screenPixelDensity = reader.int32(); + continue; + case 42: + if (tag !== 336) { + break; + } + + message.platform = reader.int32(); + continue; + case 45: + if (tag !== 362) { + break; + } + + message.spacecastClientInfo = ClientInfo_SpacecastClientInfo.decode(reader, reader.uint32()); + continue; + case 46: + if (tag !== 368) { + break; + } + + message.clientFormFactor = reader.int32() as any; + continue; + case 48: + if (tag !== 386) { + break; + } + + message.forwardedFor = reader.string(); + continue; + case 49: + if (tag !== 394) { + break; + } + + message.mobileDataPlanInfo = ClientInfo_MobileDataPlanInfo.decode(reader, reader.uint32()); + continue; + case 50: + if (tag !== 400) { + break; + } + + message.gmscoreVersionCode = reader.int32(); + continue; + case 51: + if (tag !== 408) { + break; + } + + message.webpSupport = reader.bool(); + continue; + case 52: + if (tag !== 416) { + break; + } + + message.cameraType = reader.int32() as any; + continue; + case 54: + if (tag !== 434) { + break; + } + + message.experimentsToken = reader.string(); + continue; + case 55: + if (tag !== 440) { + break; + } + + message.windowWidthPoints = reader.int32(); + continue; + case 56: + if (tag !== 448) { + break; + } + + message.windowHeightPoints = reader.int32(); + continue; + case 62: + if (tag !== 498) { + break; + } + + message.configInfo = ClientInfo_ConfigGroupsClientInfo.decode(reader, reader.uint32()); + continue; + case 63: + if (tag !== 506) { + break; + } + + message.unpluggedLocationInfo = ClientInfo_UnpluggedLocationInfo.decode(reader, reader.uint32()); + continue; + case 64: + if (tag !== 512) { + break; + } + + message.androidSdkVersion = reader.int32(); + continue; + case 65: + if (tag !== 525) { + break; + } + + message.screenDensityFloat = reader.float(); + continue; + case 66: + if (tag !== 528) { + break; + } + + message.firstTimeSignInExperimentIds = reader.int32(); + continue; + case 67: + if (tag !== 536) { + break; + } + + message.utcOffsetMinutes = reader.int32(); + continue; + case 68: + if (tag !== 544) { + break; + } + + message.animatedWebpSupport = reader.bool(); + continue; + case 69: + if (tag !== 554) { + break; + } + + message.kidsAppInfo = ClientInfo_KidsAppInfo.decode(reader, reader.uint32()); + continue; + case 70: + if (tag !== 562) { + break; + } + + message.musicAppInfo = ClientInfo_MusicAppInfo.decode(reader, reader.uint32()); + continue; + case 71: + if (tag !== 570) { + break; + } + + message.tvAppInfo = ClientInfo_TvAppInfo.decode(reader, reader.uint32()); + continue; + case 72: + if (tag !== 578) { + break; + } + + message.internalGeoIp = reader.string(); + continue; + case 73: + if (tag !== 586) { + break; + } + + message.unpluggedAppInfo = ClientInfo_UnpluggedAppInfo.decode(reader, reader.uint32()); + continue; + case 74: + if (tag !== 594) { + break; + } + + message.locationInfo = ClientInfo_LocationInfo.decode(reader, reader.uint32()); + continue; + case 76: + if (tag !== 610) { + break; + } + + message.contentSizeCategory = reader.string(); + continue; + case 77: + if (tag !== 621) { + break; + } + + message.fontScale = reader.float(); + continue; + case 78: + if (tag !== 624) { + break; + } + + message.userInterfaceTheme = reader.int32() as any; + continue; + case 80: + if (tag !== 642) { + break; + } + + message.timeZone = reader.string(); + continue; + case 81: + if (tag !== 650) { + break; + } + + message.homeGroupInfo = ClientInfo_HomeGroupInfo.decode(reader, reader.uint32()); + continue; + case 84: + if (tag !== 674) { + break; + } + + message.emlTemplateContext = reader.bytes(); + continue; + case 85: + if (tag !== 682) { + break; + } + + message.coldAppBundleConfigData = reader.bytes(); + continue; + case 87: + if (tag !== 698) { + break; + } + + message.browserName = reader.string(); + continue; + case 88: + if (tag !== 706) { + break; + } + + message.browserVersion = reader.string(); + continue; + case 89: + if (tag !== 714) { + break; + } + + message.locationPlayabilityToken = reader.string(); + continue; + case 92: + if (tag !== 738) { + break; + } + + message.chipset = reader.string(); + continue; + case 93: + if (tag !== 746) { + break; + } + + message.firmwareVersion = reader.string(); + continue; + case 95: + if (tag !== 760) { + break; + } + + message.memoryTotalKbytes = longToNumber(reader.int64()); + continue; + case 96: + if (tag !== 770) { + break; + } + + message.mainAppWebInfo = ClientInfo_MainAppWebInfo.decode(reader, reader.uint32()); + continue; + case 97: + if (tag !== 778) { + break; + } + + message.notificationPermissionInfo = ClientInfo_NotificationPermissionInfo.decode(reader, reader.uint32()); + continue; + case 98: + if (tag !== 786) { + break; + } + + message.deviceBrand = reader.string(); + continue; + case 102: + if (tag !== 818) { + break; + } + + message.glDeviceInfo = ClientInfo_GLDeviceInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo { + return { + hl: isSet(object.hl) ? globalThis.String(object.hl) : undefined, + gl: isSet(object.gl) ? globalThis.String(object.gl) : undefined, + remoteHost: isSet(object.remoteHost) ? globalThis.String(object.remoteHost) : undefined, + deviceId: isSet(object.deviceId) ? globalThis.String(object.deviceId) : undefined, + debugDeviceIdOverride: isSet(object.debugDeviceIdOverride) + ? globalThis.String(object.debugDeviceIdOverride) + : undefined, + carrierGeo: isSet(object.carrierGeo) ? globalThis.String(object.carrierGeo) : undefined, + crackedHl: isSet(object.crackedHl) ? globalThis.Boolean(object.crackedHl) : undefined, + deviceMake: isSet(object.deviceMake) ? globalThis.String(object.deviceMake) : undefined, + deviceModel: isSet(object.deviceModel) ? globalThis.String(object.deviceModel) : undefined, + visitorData: isSet(object.visitorData) ? globalThis.String(object.visitorData) : undefined, + userAgent: isSet(object.userAgent) ? globalThis.String(object.userAgent) : undefined, + clientName: isSet(object.clientName) ? globalThis.Number(object.clientName) : undefined, + clientVersion: isSet(object.clientVersion) ? globalThis.String(object.clientVersion) : undefined, + osName: isSet(object.osName) ? globalThis.String(object.osName) : undefined, + osVersion: isSet(object.osVersion) ? globalThis.String(object.osVersion) : undefined, + projectId: isSet(object.projectId) ? globalThis.String(object.projectId) : undefined, + acceptLanguage: isSet(object.acceptLanguage) ? globalThis.String(object.acceptLanguage) : undefined, + acceptRegion: isSet(object.acceptRegion) ? globalThis.String(object.acceptRegion) : undefined, + originalUrl: isSet(object.originalUrl) ? globalThis.String(object.originalUrl) : undefined, + rawDeviceId: isSet(object.rawDeviceId) ? globalThis.String(object.rawDeviceId) : undefined, + configData: isSet(object.configData) ? globalThis.String(object.configData) : undefined, + spacecastToken: isSet(object.spacecastToken) ? globalThis.String(object.spacecastToken) : undefined, + internalGeo: isSet(object.internalGeo) ? globalThis.String(object.internalGeo) : undefined, + screenWidthPoints: isSet(object.screenWidthPoints) ? globalThis.Number(object.screenWidthPoints) : undefined, + screenHeightPoints: isSet(object.screenHeightPoints) ? globalThis.Number(object.screenHeightPoints) : undefined, + screenWidthInches: isSet(object.screenWidthInches) ? globalThis.Number(object.screenWidthInches) : undefined, + screenHeightInches: isSet(object.screenHeightInches) ? globalThis.Number(object.screenHeightInches) : undefined, + screenPixelDensity: isSet(object.screenPixelDensity) ? globalThis.Number(object.screenPixelDensity) : undefined, + platform: isSet(object.platform) ? globalThis.Number(object.platform) : undefined, + spacecastClientInfo: isSet(object.spacecastClientInfo) + ? ClientInfo_SpacecastClientInfo.fromJSON(object.spacecastClientInfo) + : undefined, + clientFormFactor: isSet(object.clientFormFactor) + ? clientInfo_ClientFormFactorFromJSON(object.clientFormFactor) + : undefined, + forwardedFor: isSet(object.forwardedFor) ? globalThis.String(object.forwardedFor) : undefined, + mobileDataPlanInfo: isSet(object.mobileDataPlanInfo) + ? ClientInfo_MobileDataPlanInfo.fromJSON(object.mobileDataPlanInfo) + : undefined, + gmscoreVersionCode: isSet(object.gmscoreVersionCode) ? globalThis.Number(object.gmscoreVersionCode) : undefined, + webpSupport: isSet(object.webpSupport) ? globalThis.Boolean(object.webpSupport) : undefined, + cameraType: isSet(object.cameraType) ? clientInfo_CameraTypeFromJSON(object.cameraType) : undefined, + experimentsToken: isSet(object.experimentsToken) ? globalThis.String(object.experimentsToken) : undefined, + windowWidthPoints: isSet(object.windowWidthPoints) ? globalThis.Number(object.windowWidthPoints) : undefined, + windowHeightPoints: isSet(object.windowHeightPoints) ? globalThis.Number(object.windowHeightPoints) : undefined, + configInfo: isSet(object.configInfo) ? ClientInfo_ConfigGroupsClientInfo.fromJSON(object.configInfo) : undefined, + unpluggedLocationInfo: isSet(object.unpluggedLocationInfo) + ? ClientInfo_UnpluggedLocationInfo.fromJSON(object.unpluggedLocationInfo) + : undefined, + androidSdkVersion: isSet(object.androidSdkVersion) ? globalThis.Number(object.androidSdkVersion) : undefined, + screenDensityFloat: isSet(object.screenDensityFloat) ? globalThis.Number(object.screenDensityFloat) : undefined, + firstTimeSignInExperimentIds: isSet(object.firstTimeSignInExperimentIds) + ? globalThis.Number(object.firstTimeSignInExperimentIds) + : undefined, + utcOffsetMinutes: isSet(object.utcOffsetMinutes) ? globalThis.Number(object.utcOffsetMinutes) : undefined, + animatedWebpSupport: isSet(object.animatedWebpSupport) + ? globalThis.Boolean(object.animatedWebpSupport) + : undefined, + kidsAppInfo: isSet(object.kidsAppInfo) ? ClientInfo_KidsAppInfo.fromJSON(object.kidsAppInfo) : undefined, + musicAppInfo: isSet(object.musicAppInfo) ? ClientInfo_MusicAppInfo.fromJSON(object.musicAppInfo) : undefined, + tvAppInfo: isSet(object.tvAppInfo) ? ClientInfo_TvAppInfo.fromJSON(object.tvAppInfo) : undefined, + internalGeoIp: isSet(object.internalGeoIp) ? globalThis.String(object.internalGeoIp) : undefined, + unpluggedAppInfo: isSet(object.unpluggedAppInfo) + ? ClientInfo_UnpluggedAppInfo.fromJSON(object.unpluggedAppInfo) + : undefined, + locationInfo: isSet(object.locationInfo) ? ClientInfo_LocationInfo.fromJSON(object.locationInfo) : undefined, + contentSizeCategory: isSet(object.contentSizeCategory) + ? globalThis.String(object.contentSizeCategory) + : undefined, + fontScale: isSet(object.fontScale) ? globalThis.Number(object.fontScale) : undefined, + userInterfaceTheme: isSet(object.userInterfaceTheme) + ? clientInfo_UserInterfaceThemeFromJSON(object.userInterfaceTheme) + : undefined, + timeZone: isSet(object.timeZone) ? globalThis.String(object.timeZone) : undefined, + homeGroupInfo: isSet(object.homeGroupInfo) ? ClientInfo_HomeGroupInfo.fromJSON(object.homeGroupInfo) : undefined, + emlTemplateContext: isSet(object.emlTemplateContext) ? bytesFromBase64(object.emlTemplateContext) : undefined, + coldAppBundleConfigData: isSet(object.coldAppBundleConfigData) + ? bytesFromBase64(object.coldAppBundleConfigData) + : undefined, + browserName: isSet(object.browserName) ? globalThis.String(object.browserName) : undefined, + browserVersion: isSet(object.browserVersion) ? globalThis.String(object.browserVersion) : undefined, + locationPlayabilityToken: isSet(object.locationPlayabilityToken) + ? globalThis.String(object.locationPlayabilityToken) + : undefined, + chipset: isSet(object.chipset) ? globalThis.String(object.chipset) : undefined, + firmwareVersion: isSet(object.firmwareVersion) ? globalThis.String(object.firmwareVersion) : undefined, + memoryTotalKbytes: isSet(object.memoryTotalKbytes) ? globalThis.Number(object.memoryTotalKbytes) : undefined, + mainAppWebInfo: isSet(object.mainAppWebInfo) + ? ClientInfo_MainAppWebInfo.fromJSON(object.mainAppWebInfo) + : undefined, + notificationPermissionInfo: isSet(object.notificationPermissionInfo) + ? ClientInfo_NotificationPermissionInfo.fromJSON(object.notificationPermissionInfo) + : undefined, + deviceBrand: isSet(object.deviceBrand) ? globalThis.String(object.deviceBrand) : undefined, + glDeviceInfo: isSet(object.glDeviceInfo) ? ClientInfo_GLDeviceInfo.fromJSON(object.glDeviceInfo) : undefined, + }; + }, + + toJSON(message: ClientInfo): unknown { + const obj: any = {}; + if (message.hl !== undefined) { + obj.hl = message.hl; + } + if (message.gl !== undefined) { + obj.gl = message.gl; + } + if (message.remoteHost !== undefined) { + obj.remoteHost = message.remoteHost; + } + if (message.deviceId !== undefined) { + obj.deviceId = message.deviceId; + } + if (message.debugDeviceIdOverride !== undefined) { + obj.debugDeviceIdOverride = message.debugDeviceIdOverride; + } + if (message.carrierGeo !== undefined) { + obj.carrierGeo = message.carrierGeo; + } + if (message.crackedHl !== undefined) { + obj.crackedHl = message.crackedHl; + } + if (message.deviceMake !== undefined) { + obj.deviceMake = message.deviceMake; + } + if (message.deviceModel !== undefined) { + obj.deviceModel = message.deviceModel; + } + if (message.visitorData !== undefined) { + obj.visitorData = message.visitorData; + } + if (message.userAgent !== undefined) { + obj.userAgent = message.userAgent; + } + if (message.clientName !== undefined) { + obj.clientName = Math.round(message.clientName); + } + if (message.clientVersion !== undefined) { + obj.clientVersion = message.clientVersion; + } + if (message.osName !== undefined) { + obj.osName = message.osName; + } + if (message.osVersion !== undefined) { + obj.osVersion = message.osVersion; + } + if (message.projectId !== undefined) { + obj.projectId = message.projectId; + } + if (message.acceptLanguage !== undefined) { + obj.acceptLanguage = message.acceptLanguage; + } + if (message.acceptRegion !== undefined) { + obj.acceptRegion = message.acceptRegion; + } + if (message.originalUrl !== undefined) { + obj.originalUrl = message.originalUrl; + } + if (message.rawDeviceId !== undefined) { + obj.rawDeviceId = message.rawDeviceId; + } + if (message.configData !== undefined) { + obj.configData = message.configData; + } + if (message.spacecastToken !== undefined) { + obj.spacecastToken = message.spacecastToken; + } + if (message.internalGeo !== undefined) { + obj.internalGeo = message.internalGeo; + } + if (message.screenWidthPoints !== undefined) { + obj.screenWidthPoints = Math.round(message.screenWidthPoints); + } + if (message.screenHeightPoints !== undefined) { + obj.screenHeightPoints = Math.round(message.screenHeightPoints); + } + if (message.screenWidthInches !== undefined) { + obj.screenWidthInches = message.screenWidthInches; + } + if (message.screenHeightInches !== undefined) { + obj.screenHeightInches = message.screenHeightInches; + } + if (message.screenPixelDensity !== undefined) { + obj.screenPixelDensity = Math.round(message.screenPixelDensity); + } + if (message.platform !== undefined) { + obj.platform = Math.round(message.platform); + } + if (message.spacecastClientInfo !== undefined) { + obj.spacecastClientInfo = ClientInfo_SpacecastClientInfo.toJSON(message.spacecastClientInfo); + } + if (message.clientFormFactor !== undefined) { + obj.clientFormFactor = clientInfo_ClientFormFactorToJSON(message.clientFormFactor); + } + if (message.forwardedFor !== undefined) { + obj.forwardedFor = message.forwardedFor; + } + if (message.mobileDataPlanInfo !== undefined) { + obj.mobileDataPlanInfo = ClientInfo_MobileDataPlanInfo.toJSON(message.mobileDataPlanInfo); + } + if (message.gmscoreVersionCode !== undefined) { + obj.gmscoreVersionCode = Math.round(message.gmscoreVersionCode); + } + if (message.webpSupport !== undefined) { + obj.webpSupport = message.webpSupport; + } + if (message.cameraType !== undefined) { + obj.cameraType = clientInfo_CameraTypeToJSON(message.cameraType); + } + if (message.experimentsToken !== undefined) { + obj.experimentsToken = message.experimentsToken; + } + if (message.windowWidthPoints !== undefined) { + obj.windowWidthPoints = Math.round(message.windowWidthPoints); + } + if (message.windowHeightPoints !== undefined) { + obj.windowHeightPoints = Math.round(message.windowHeightPoints); + } + if (message.configInfo !== undefined) { + obj.configInfo = ClientInfo_ConfigGroupsClientInfo.toJSON(message.configInfo); + } + if (message.unpluggedLocationInfo !== undefined) { + obj.unpluggedLocationInfo = ClientInfo_UnpluggedLocationInfo.toJSON(message.unpluggedLocationInfo); + } + if (message.androidSdkVersion !== undefined) { + obj.androidSdkVersion = Math.round(message.androidSdkVersion); + } + if (message.screenDensityFloat !== undefined) { + obj.screenDensityFloat = message.screenDensityFloat; + } + if (message.firstTimeSignInExperimentIds !== undefined) { + obj.firstTimeSignInExperimentIds = Math.round(message.firstTimeSignInExperimentIds); + } + if (message.utcOffsetMinutes !== undefined) { + obj.utcOffsetMinutes = Math.round(message.utcOffsetMinutes); + } + if (message.animatedWebpSupport !== undefined) { + obj.animatedWebpSupport = message.animatedWebpSupport; + } + if (message.kidsAppInfo !== undefined) { + obj.kidsAppInfo = ClientInfo_KidsAppInfo.toJSON(message.kidsAppInfo); + } + if (message.musicAppInfo !== undefined) { + obj.musicAppInfo = ClientInfo_MusicAppInfo.toJSON(message.musicAppInfo); + } + if (message.tvAppInfo !== undefined) { + obj.tvAppInfo = ClientInfo_TvAppInfo.toJSON(message.tvAppInfo); + } + if (message.internalGeoIp !== undefined) { + obj.internalGeoIp = message.internalGeoIp; + } + if (message.unpluggedAppInfo !== undefined) { + obj.unpluggedAppInfo = ClientInfo_UnpluggedAppInfo.toJSON(message.unpluggedAppInfo); + } + if (message.locationInfo !== undefined) { + obj.locationInfo = ClientInfo_LocationInfo.toJSON(message.locationInfo); + } + if (message.contentSizeCategory !== undefined) { + obj.contentSizeCategory = message.contentSizeCategory; + } + if (message.fontScale !== undefined) { + obj.fontScale = message.fontScale; + } + if (message.userInterfaceTheme !== undefined) { + obj.userInterfaceTheme = clientInfo_UserInterfaceThemeToJSON(message.userInterfaceTheme); + } + if (message.timeZone !== undefined) { + obj.timeZone = message.timeZone; + } + if (message.homeGroupInfo !== undefined) { + obj.homeGroupInfo = ClientInfo_HomeGroupInfo.toJSON(message.homeGroupInfo); + } + if (message.emlTemplateContext !== undefined) { + obj.emlTemplateContext = base64FromBytes(message.emlTemplateContext); + } + if (message.coldAppBundleConfigData !== undefined) { + obj.coldAppBundleConfigData = base64FromBytes(message.coldAppBundleConfigData); + } + if (message.browserName !== undefined) { + obj.browserName = message.browserName; + } + if (message.browserVersion !== undefined) { + obj.browserVersion = message.browserVersion; + } + if (message.locationPlayabilityToken !== undefined) { + obj.locationPlayabilityToken = message.locationPlayabilityToken; + } + if (message.chipset !== undefined) { + obj.chipset = message.chipset; + } + if (message.firmwareVersion !== undefined) { + obj.firmwareVersion = message.firmwareVersion; + } + if (message.memoryTotalKbytes !== undefined) { + obj.memoryTotalKbytes = Math.round(message.memoryTotalKbytes); + } + if (message.mainAppWebInfo !== undefined) { + obj.mainAppWebInfo = ClientInfo_MainAppWebInfo.toJSON(message.mainAppWebInfo); + } + if (message.notificationPermissionInfo !== undefined) { + obj.notificationPermissionInfo = ClientInfo_NotificationPermissionInfo.toJSON(message.notificationPermissionInfo); + } + if (message.deviceBrand !== undefined) { + obj.deviceBrand = message.deviceBrand; + } + if (message.glDeviceInfo !== undefined) { + obj.glDeviceInfo = ClientInfo_GLDeviceInfo.toJSON(message.glDeviceInfo); + } + return obj; + }, + + create, I>>(base?: I): ClientInfo { + return ClientInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo { + const message = createBaseClientInfo(); + message.hl = object.hl ?? undefined; + message.gl = object.gl ?? undefined; + message.remoteHost = object.remoteHost ?? undefined; + message.deviceId = object.deviceId ?? undefined; + message.debugDeviceIdOverride = object.debugDeviceIdOverride ?? undefined; + message.carrierGeo = object.carrierGeo ?? undefined; + message.crackedHl = object.crackedHl ?? undefined; + message.deviceMake = object.deviceMake ?? undefined; + message.deviceModel = object.deviceModel ?? undefined; + message.visitorData = object.visitorData ?? undefined; + message.userAgent = object.userAgent ?? undefined; + message.clientName = object.clientName ?? undefined; + message.clientVersion = object.clientVersion ?? undefined; + message.osName = object.osName ?? undefined; + message.osVersion = object.osVersion ?? undefined; + message.projectId = object.projectId ?? undefined; + message.acceptLanguage = object.acceptLanguage ?? undefined; + message.acceptRegion = object.acceptRegion ?? undefined; + message.originalUrl = object.originalUrl ?? undefined; + message.rawDeviceId = object.rawDeviceId ?? undefined; + message.configData = object.configData ?? undefined; + message.spacecastToken = object.spacecastToken ?? undefined; + message.internalGeo = object.internalGeo ?? undefined; + message.screenWidthPoints = object.screenWidthPoints ?? undefined; + message.screenHeightPoints = object.screenHeightPoints ?? undefined; + message.screenWidthInches = object.screenWidthInches ?? undefined; + message.screenHeightInches = object.screenHeightInches ?? undefined; + message.screenPixelDensity = object.screenPixelDensity ?? undefined; + message.platform = object.platform ?? undefined; + message.spacecastClientInfo = (object.spacecastClientInfo !== undefined && object.spacecastClientInfo !== null) + ? ClientInfo_SpacecastClientInfo.fromPartial(object.spacecastClientInfo) + : undefined; + message.clientFormFactor = object.clientFormFactor ?? undefined; + message.forwardedFor = object.forwardedFor ?? undefined; + message.mobileDataPlanInfo = (object.mobileDataPlanInfo !== undefined && object.mobileDataPlanInfo !== null) + ? ClientInfo_MobileDataPlanInfo.fromPartial(object.mobileDataPlanInfo) + : undefined; + message.gmscoreVersionCode = object.gmscoreVersionCode ?? undefined; + message.webpSupport = object.webpSupport ?? undefined; + message.cameraType = object.cameraType ?? undefined; + message.experimentsToken = object.experimentsToken ?? undefined; + message.windowWidthPoints = object.windowWidthPoints ?? undefined; + message.windowHeightPoints = object.windowHeightPoints ?? undefined; + message.configInfo = (object.configInfo !== undefined && object.configInfo !== null) + ? ClientInfo_ConfigGroupsClientInfo.fromPartial(object.configInfo) + : undefined; + message.unpluggedLocationInfo = + (object.unpluggedLocationInfo !== undefined && object.unpluggedLocationInfo !== null) + ? ClientInfo_UnpluggedLocationInfo.fromPartial(object.unpluggedLocationInfo) + : undefined; + message.androidSdkVersion = object.androidSdkVersion ?? undefined; + message.screenDensityFloat = object.screenDensityFloat ?? undefined; + message.firstTimeSignInExperimentIds = object.firstTimeSignInExperimentIds ?? undefined; + message.utcOffsetMinutes = object.utcOffsetMinutes ?? undefined; + message.animatedWebpSupport = object.animatedWebpSupport ?? undefined; + message.kidsAppInfo = (object.kidsAppInfo !== undefined && object.kidsAppInfo !== null) + ? ClientInfo_KidsAppInfo.fromPartial(object.kidsAppInfo) + : undefined; + message.musicAppInfo = (object.musicAppInfo !== undefined && object.musicAppInfo !== null) + ? ClientInfo_MusicAppInfo.fromPartial(object.musicAppInfo) + : undefined; + message.tvAppInfo = (object.tvAppInfo !== undefined && object.tvAppInfo !== null) + ? ClientInfo_TvAppInfo.fromPartial(object.tvAppInfo) + : undefined; + message.internalGeoIp = object.internalGeoIp ?? undefined; + message.unpluggedAppInfo = (object.unpluggedAppInfo !== undefined && object.unpluggedAppInfo !== null) + ? ClientInfo_UnpluggedAppInfo.fromPartial(object.unpluggedAppInfo) + : undefined; + message.locationInfo = (object.locationInfo !== undefined && object.locationInfo !== null) + ? ClientInfo_LocationInfo.fromPartial(object.locationInfo) + : undefined; + message.contentSizeCategory = object.contentSizeCategory ?? undefined; + message.fontScale = object.fontScale ?? undefined; + message.userInterfaceTheme = object.userInterfaceTheme ?? undefined; + message.timeZone = object.timeZone ?? undefined; + message.homeGroupInfo = (object.homeGroupInfo !== undefined && object.homeGroupInfo !== null) + ? ClientInfo_HomeGroupInfo.fromPartial(object.homeGroupInfo) + : undefined; + message.emlTemplateContext = object.emlTemplateContext ?? undefined; + message.coldAppBundleConfigData = object.coldAppBundleConfigData ?? undefined; + message.browserName = object.browserName ?? undefined; + message.browserVersion = object.browserVersion ?? undefined; + message.locationPlayabilityToken = object.locationPlayabilityToken ?? undefined; + message.chipset = object.chipset ?? undefined; + message.firmwareVersion = object.firmwareVersion ?? undefined; + message.memoryTotalKbytes = object.memoryTotalKbytes ?? undefined; + message.mainAppWebInfo = (object.mainAppWebInfo !== undefined && object.mainAppWebInfo !== null) + ? ClientInfo_MainAppWebInfo.fromPartial(object.mainAppWebInfo) + : undefined; + message.notificationPermissionInfo = + (object.notificationPermissionInfo !== undefined && object.notificationPermissionInfo !== null) + ? ClientInfo_NotificationPermissionInfo.fromPartial(object.notificationPermissionInfo) + : undefined; + message.deviceBrand = object.deviceBrand ?? undefined; + message.glDeviceInfo = (object.glDeviceInfo !== undefined && object.glDeviceInfo !== null) + ? ClientInfo_GLDeviceInfo.fromPartial(object.glDeviceInfo) + : undefined; + return message; + }, +}; + +function createBaseClientInfo_MainAppWebInfo(): ClientInfo_MainAppWebInfo { + return { + graftUrl: undefined, + pwaInstallabilityStatus: undefined, + webDisplayMode: undefined, + isWebNativeShareAvailable: undefined, + storeDigitalGoodsApiSupportStatus: undefined, + }; +} + +export const ClientInfo_MainAppWebInfo: MessageFns = { + encode(message: ClientInfo_MainAppWebInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.graftUrl !== undefined) { + writer.uint32(10).string(message.graftUrl); + } + if (message.pwaInstallabilityStatus !== undefined) { + writer.uint32(16).int32(message.pwaInstallabilityStatus); + } + if (message.webDisplayMode !== undefined) { + writer.uint32(24).int32(message.webDisplayMode); + } + if (message.isWebNativeShareAvailable !== undefined) { + writer.uint32(32).bool(message.isWebNativeShareAvailable); + } + if (message.storeDigitalGoodsApiSupportStatus !== undefined) { + writer.uint32(40).int32(message.storeDigitalGoodsApiSupportStatus); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_MainAppWebInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_MainAppWebInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.graftUrl = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.pwaInstallabilityStatus = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.webDisplayMode = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isWebNativeShareAvailable = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.storeDigitalGoodsApiSupportStatus = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_MainAppWebInfo { + return { + graftUrl: isSet(object.graftUrl) ? globalThis.String(object.graftUrl) : undefined, + pwaInstallabilityStatus: isSet(object.pwaInstallabilityStatus) + ? clientInfo_MainAppWebInfo_PwaInstallabilityStatusFromJSON(object.pwaInstallabilityStatus) + : undefined, + webDisplayMode: isSet(object.webDisplayMode) + ? clientInfo_MainAppWebInfo_WebDisplayModeFromJSON(object.webDisplayMode) + : undefined, + isWebNativeShareAvailable: isSet(object.isWebNativeShareAvailable) + ? globalThis.Boolean(object.isWebNativeShareAvailable) + : undefined, + storeDigitalGoodsApiSupportStatus: isSet(object.storeDigitalGoodsApiSupportStatus) + ? clientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatusFromJSON(object.storeDigitalGoodsApiSupportStatus) + : undefined, + }; + }, + + toJSON(message: ClientInfo_MainAppWebInfo): unknown { + const obj: any = {}; + if (message.graftUrl !== undefined) { + obj.graftUrl = message.graftUrl; + } + if (message.pwaInstallabilityStatus !== undefined) { + obj.pwaInstallabilityStatus = clientInfo_MainAppWebInfo_PwaInstallabilityStatusToJSON( + message.pwaInstallabilityStatus, + ); + } + if (message.webDisplayMode !== undefined) { + obj.webDisplayMode = clientInfo_MainAppWebInfo_WebDisplayModeToJSON(message.webDisplayMode); + } + if (message.isWebNativeShareAvailable !== undefined) { + obj.isWebNativeShareAvailable = message.isWebNativeShareAvailable; + } + if (message.storeDigitalGoodsApiSupportStatus !== undefined) { + obj.storeDigitalGoodsApiSupportStatus = clientInfo_MainAppWebInfo_StoreDigitalGoodsApiSupportStatusToJSON( + message.storeDigitalGoodsApiSupportStatus, + ); + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_MainAppWebInfo { + return ClientInfo_MainAppWebInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_MainAppWebInfo { + const message = createBaseClientInfo_MainAppWebInfo(); + message.graftUrl = object.graftUrl ?? undefined; + message.pwaInstallabilityStatus = object.pwaInstallabilityStatus ?? undefined; + message.webDisplayMode = object.webDisplayMode ?? undefined; + message.isWebNativeShareAvailable = object.isWebNativeShareAvailable ?? undefined; + message.storeDigitalGoodsApiSupportStatus = object.storeDigitalGoodsApiSupportStatus ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_NotificationPermissionInfo(): ClientInfo_NotificationPermissionInfo { + return { notificationsSetting: undefined, lastDeviceOptInChangeTimeAgoSec: undefined }; +} + +export const ClientInfo_NotificationPermissionInfo: MessageFns = { + encode(message: ClientInfo_NotificationPermissionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.notificationsSetting !== undefined) { + writer.uint32(8).int32(message.notificationsSetting); + } + if (message.lastDeviceOptInChangeTimeAgoSec !== undefined) { + writer.uint32(16).int64(message.lastDeviceOptInChangeTimeAgoSec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_NotificationPermissionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_NotificationPermissionInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.notificationsSetting = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.lastDeviceOptInChangeTimeAgoSec = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_NotificationPermissionInfo { + return { + notificationsSetting: isSet(object.notificationsSetting) + ? clientInfo_NotificationPermissionInfo_NotificationsSettingFromJSON(object.notificationsSetting) + : undefined, + lastDeviceOptInChangeTimeAgoSec: isSet(object.lastDeviceOptInChangeTimeAgoSec) + ? globalThis.Number(object.lastDeviceOptInChangeTimeAgoSec) + : undefined, + }; + }, + + toJSON(message: ClientInfo_NotificationPermissionInfo): unknown { + const obj: any = {}; + if (message.notificationsSetting !== undefined) { + obj.notificationsSetting = clientInfo_NotificationPermissionInfo_NotificationsSettingToJSON( + message.notificationsSetting, + ); + } + if (message.lastDeviceOptInChangeTimeAgoSec !== undefined) { + obj.lastDeviceOptInChangeTimeAgoSec = Math.round(message.lastDeviceOptInChangeTimeAgoSec); + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_NotificationPermissionInfo { + return ClientInfo_NotificationPermissionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_NotificationPermissionInfo { + const message = createBaseClientInfo_NotificationPermissionInfo(); + message.notificationsSetting = object.notificationsSetting ?? undefined; + message.lastDeviceOptInChangeTimeAgoSec = object.lastDeviceOptInChangeTimeAgoSec ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_GLDeviceInfo(): ClientInfo_GLDeviceInfo { + return { glRenderer: undefined, glEsVersionMajor: undefined, glEsVersionMinor: undefined }; +} + +export const ClientInfo_GLDeviceInfo: MessageFns = { + encode(message: ClientInfo_GLDeviceInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.glRenderer !== undefined) { + writer.uint32(10).string(message.glRenderer); + } + if (message.glEsVersionMajor !== undefined) { + writer.uint32(16).int32(message.glEsVersionMajor); + } + if (message.glEsVersionMinor !== undefined) { + writer.uint32(24).int32(message.glEsVersionMinor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_GLDeviceInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_GLDeviceInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.glRenderer = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.glEsVersionMajor = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.glEsVersionMinor = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_GLDeviceInfo { + return { + glRenderer: isSet(object.glRenderer) ? globalThis.String(object.glRenderer) : undefined, + glEsVersionMajor: isSet(object.glEsVersionMajor) ? globalThis.Number(object.glEsVersionMajor) : undefined, + glEsVersionMinor: isSet(object.glEsVersionMinor) ? globalThis.Number(object.glEsVersionMinor) : undefined, + }; + }, + + toJSON(message: ClientInfo_GLDeviceInfo): unknown { + const obj: any = {}; + if (message.glRenderer !== undefined) { + obj.glRenderer = message.glRenderer; + } + if (message.glEsVersionMajor !== undefined) { + obj.glEsVersionMajor = Math.round(message.glEsVersionMajor); + } + if (message.glEsVersionMinor !== undefined) { + obj.glEsVersionMinor = Math.round(message.glEsVersionMinor); + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_GLDeviceInfo { + return ClientInfo_GLDeviceInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_GLDeviceInfo { + const message = createBaseClientInfo_GLDeviceInfo(); + message.glRenderer = object.glRenderer ?? undefined; + message.glEsVersionMajor = object.glEsVersionMajor ?? undefined; + message.glEsVersionMinor = object.glEsVersionMinor ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_SpacecastClientInfo(): ClientInfo_SpacecastClientInfo { + return { appliances: undefined, interactionLevel: undefined }; +} + +export const ClientInfo_SpacecastClientInfo: MessageFns = { + encode(message: ClientInfo_SpacecastClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.appliances !== undefined) { + ClientInfo_SpacecastClientInfo_SpacecastAppliance.encode(message.appliances, writer.uint32(10).fork()).join(); + } + if (message.interactionLevel !== undefined) { + writer.uint32(16).int32(message.interactionLevel); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_SpacecastClientInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_SpacecastClientInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.appliances = ClientInfo_SpacecastClientInfo_SpacecastAppliance.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.interactionLevel = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_SpacecastClientInfo { + return { + appliances: isSet(object.appliances) + ? ClientInfo_SpacecastClientInfo_SpacecastAppliance.fromJSON(object.appliances) + : undefined, + interactionLevel: isSet(object.interactionLevel) + ? clientInfo_SpacecastClientInfo_SpacecastInteractionLevelFromJSON(object.interactionLevel) + : undefined, + }; + }, + + toJSON(message: ClientInfo_SpacecastClientInfo): unknown { + const obj: any = {}; + if (message.appliances !== undefined) { + obj.appliances = ClientInfo_SpacecastClientInfo_SpacecastAppliance.toJSON(message.appliances); + } + if (message.interactionLevel !== undefined) { + obj.interactionLevel = clientInfo_SpacecastClientInfo_SpacecastInteractionLevelToJSON(message.interactionLevel); + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_SpacecastClientInfo { + return ClientInfo_SpacecastClientInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_SpacecastClientInfo { + const message = createBaseClientInfo_SpacecastClientInfo(); + message.appliances = (object.appliances !== undefined && object.appliances !== null) + ? ClientInfo_SpacecastClientInfo_SpacecastAppliance.fromPartial(object.appliances) + : undefined; + message.interactionLevel = object.interactionLevel ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_SpacecastClientInfo_SpacecastAppliance(): ClientInfo_SpacecastClientInfo_SpacecastAppliance { + return { + contentProfileToken: undefined, + status: undefined, + hostname: undefined, + active: undefined, + deviceId: undefined, + }; +} + +export const ClientInfo_SpacecastClientInfo_SpacecastAppliance: MessageFns< + ClientInfo_SpacecastClientInfo_SpacecastAppliance +> = { + encode( + message: ClientInfo_SpacecastClientInfo_SpacecastAppliance, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.contentProfileToken !== undefined) { + writer.uint32(10).bytes(message.contentProfileToken); + } + if (message.status !== undefined) { + writer.uint32(16).int32(message.status); + } + if (message.hostname !== undefined) { + writer.uint32(26).string(message.hostname); + } + if (message.active !== undefined) { + writer.uint32(32).bool(message.active); + } + if (message.deviceId !== undefined) { + writer.uint32(42).string(message.deviceId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_SpacecastClientInfo_SpacecastAppliance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_SpacecastClientInfo_SpacecastAppliance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contentProfileToken = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.status = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.hostname = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.active = reader.bool(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deviceId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_SpacecastClientInfo_SpacecastAppliance { + return { + contentProfileToken: isSet(object.contentProfileToken) ? bytesFromBase64(object.contentProfileToken) : undefined, + status: isSet(object.status) + ? clientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatusFromJSON(object.status) + : undefined, + hostname: isSet(object.hostname) ? globalThis.String(object.hostname) : undefined, + active: isSet(object.active) ? globalThis.Boolean(object.active) : undefined, + deviceId: isSet(object.deviceId) ? globalThis.String(object.deviceId) : undefined, + }; + }, + + toJSON(message: ClientInfo_SpacecastClientInfo_SpacecastAppliance): unknown { + const obj: any = {}; + if (message.contentProfileToken !== undefined) { + obj.contentProfileToken = base64FromBytes(message.contentProfileToken); + } + if (message.status !== undefined) { + obj.status = clientInfo_SpacecastClientInfo_SpacecastAppliance_OperationalStatusToJSON(message.status); + } + if (message.hostname !== undefined) { + obj.hostname = message.hostname; + } + if (message.active !== undefined) { + obj.active = message.active; + } + if (message.deviceId !== undefined) { + obj.deviceId = message.deviceId; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_SpacecastClientInfo_SpacecastAppliance { + return ClientInfo_SpacecastClientInfo_SpacecastAppliance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_SpacecastClientInfo_SpacecastAppliance { + const message = createBaseClientInfo_SpacecastClientInfo_SpacecastAppliance(); + message.contentProfileToken = object.contentProfileToken ?? undefined; + message.status = object.status ?? undefined; + message.hostname = object.hostname ?? undefined; + message.active = object.active ?? undefined; + message.deviceId = object.deviceId ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_MobileDataPlanInfo(): ClientInfo_MobileDataPlanInfo { + return { + cpid: undefined, + serializedDataPlanStatus: undefined, + dataSavingQualityPickerEnabled: undefined, + mccmnc: undefined, + }; +} + +export const ClientInfo_MobileDataPlanInfo: MessageFns = { + encode(message: ClientInfo_MobileDataPlanInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cpid !== undefined) { + writer.uint32(394).string(message.cpid); + } + if (message.serializedDataPlanStatus !== undefined) { + writer.uint32(402).string(message.serializedDataPlanStatus); + } + if (message.dataSavingQualityPickerEnabled !== undefined) { + writer.uint32(416).bool(message.dataSavingQualityPickerEnabled); + } + if (message.mccmnc !== undefined) { + writer.uint32(426).string(message.mccmnc); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_MobileDataPlanInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_MobileDataPlanInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 49: + if (tag !== 394) { + break; + } + + message.cpid = reader.string(); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.serializedDataPlanStatus = reader.string(); + continue; + case 52: + if (tag !== 416) { + break; + } + + message.dataSavingQualityPickerEnabled = reader.bool(); + continue; + case 53: + if (tag !== 426) { + break; + } + + message.mccmnc = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_MobileDataPlanInfo { + return { + cpid: isSet(object.cpid) ? globalThis.String(object.cpid) : undefined, + serializedDataPlanStatus: isSet(object.serializedDataPlanStatus) + ? globalThis.String(object.serializedDataPlanStatus) + : undefined, + dataSavingQualityPickerEnabled: isSet(object.dataSavingQualityPickerEnabled) + ? globalThis.Boolean(object.dataSavingQualityPickerEnabled) + : undefined, + mccmnc: isSet(object.mccmnc) ? globalThis.String(object.mccmnc) : undefined, + }; + }, + + toJSON(message: ClientInfo_MobileDataPlanInfo): unknown { + const obj: any = {}; + if (message.cpid !== undefined) { + obj.cpid = message.cpid; + } + if (message.serializedDataPlanStatus !== undefined) { + obj.serializedDataPlanStatus = message.serializedDataPlanStatus; + } + if (message.dataSavingQualityPickerEnabled !== undefined) { + obj.dataSavingQualityPickerEnabled = message.dataSavingQualityPickerEnabled; + } + if (message.mccmnc !== undefined) { + obj.mccmnc = message.mccmnc; + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_MobileDataPlanInfo { + return ClientInfo_MobileDataPlanInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_MobileDataPlanInfo { + const message = createBaseClientInfo_MobileDataPlanInfo(); + message.cpid = object.cpid ?? undefined; + message.serializedDataPlanStatus = object.serializedDataPlanStatus ?? undefined; + message.dataSavingQualityPickerEnabled = object.dataSavingQualityPickerEnabled ?? undefined; + message.mccmnc = object.mccmnc ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_ConfigGroupsClientInfo(): ClientInfo_ConfigGroupsClientInfo { + return { coldConfigData: undefined, coldHashData: undefined, hotHashData: undefined, appInstallData: undefined }; +} + +export const ClientInfo_ConfigGroupsClientInfo: MessageFns = { + encode(message: ClientInfo_ConfigGroupsClientInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.coldConfigData !== undefined) { + writer.uint32(10).string(message.coldConfigData); + } + if (message.coldHashData !== undefined) { + writer.uint32(26).string(message.coldHashData); + } + if (message.hotHashData !== undefined) { + writer.uint32(42).string(message.hotHashData); + } + if (message.appInstallData !== undefined) { + writer.uint32(50).string(message.appInstallData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_ConfigGroupsClientInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_ConfigGroupsClientInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.coldConfigData = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.coldHashData = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.hotHashData = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.appInstallData = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_ConfigGroupsClientInfo { + return { + coldConfigData: isSet(object.coldConfigData) ? globalThis.String(object.coldConfigData) : undefined, + coldHashData: isSet(object.coldHashData) ? globalThis.String(object.coldHashData) : undefined, + hotHashData: isSet(object.hotHashData) ? globalThis.String(object.hotHashData) : undefined, + appInstallData: isSet(object.appInstallData) ? globalThis.String(object.appInstallData) : undefined, + }; + }, + + toJSON(message: ClientInfo_ConfigGroupsClientInfo): unknown { + const obj: any = {}; + if (message.coldConfigData !== undefined) { + obj.coldConfigData = message.coldConfigData; + } + if (message.coldHashData !== undefined) { + obj.coldHashData = message.coldHashData; + } + if (message.hotHashData !== undefined) { + obj.hotHashData = message.hotHashData; + } + if (message.appInstallData !== undefined) { + obj.appInstallData = message.appInstallData; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_ConfigGroupsClientInfo { + return ClientInfo_ConfigGroupsClientInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_ConfigGroupsClientInfo { + const message = createBaseClientInfo_ConfigGroupsClientInfo(); + message.coldConfigData = object.coldConfigData ?? undefined; + message.coldHashData = object.coldHashData ?? undefined; + message.hotHashData = object.hotHashData ?? undefined; + message.appInstallData = object.appInstallData ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_UnpluggedLocationInfo(): ClientInfo_UnpluggedLocationInfo { + return { + latitudeE7: undefined, + longitudeE7: undefined, + localTimestampMs: undefined, + ipAddress: undefined, + timezone: undefined, + prefer24HourTime: undefined, + locationRadiusMeters: undefined, + isInitialLoad: undefined, + browserPermissionGranted: undefined, + clientPermissionState: undefined, + locationOverrideToken: undefined, + }; +} + +export const ClientInfo_UnpluggedLocationInfo: MessageFns = { + encode(message: ClientInfo_UnpluggedLocationInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.latitudeE7 !== undefined) { + writer.uint32(8).int32(message.latitudeE7); + } + if (message.longitudeE7 !== undefined) { + writer.uint32(16).int32(message.longitudeE7); + } + if (message.localTimestampMs !== undefined) { + writer.uint32(24).int64(message.localTimestampMs); + } + if (message.ipAddress !== undefined) { + writer.uint32(34).string(message.ipAddress); + } + if (message.timezone !== undefined) { + writer.uint32(42).string(message.timezone); + } + if (message.prefer24HourTime !== undefined) { + writer.uint32(48).bool(message.prefer24HourTime); + } + if (message.locationRadiusMeters !== undefined) { + writer.uint32(56).int32(message.locationRadiusMeters); + } + if (message.isInitialLoad !== undefined) { + writer.uint32(64).bool(message.isInitialLoad); + } + if (message.browserPermissionGranted !== undefined) { + writer.uint32(72).bool(message.browserPermissionGranted); + } + if (message.clientPermissionState !== undefined) { + writer.uint32(80).int32(message.clientPermissionState); + } + if (message.locationOverrideToken !== undefined) { + writer.uint32(90).string(message.locationOverrideToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_UnpluggedLocationInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_UnpluggedLocationInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.latitudeE7 = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.longitudeE7 = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.localTimestampMs = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ipAddress = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timezone = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.prefer24HourTime = reader.bool(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.locationRadiusMeters = reader.int32(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.isInitialLoad = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.browserPermissionGranted = reader.bool(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.clientPermissionState = reader.int32(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.locationOverrideToken = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_UnpluggedLocationInfo { + return { + latitudeE7: isSet(object.latitudeE7) ? globalThis.Number(object.latitudeE7) : undefined, + longitudeE7: isSet(object.longitudeE7) ? globalThis.Number(object.longitudeE7) : undefined, + localTimestampMs: isSet(object.localTimestampMs) ? globalThis.Number(object.localTimestampMs) : undefined, + ipAddress: isSet(object.ipAddress) ? globalThis.String(object.ipAddress) : undefined, + timezone: isSet(object.timezone) ? globalThis.String(object.timezone) : undefined, + prefer24HourTime: isSet(object.prefer24HourTime) ? globalThis.Boolean(object.prefer24HourTime) : undefined, + locationRadiusMeters: isSet(object.locationRadiusMeters) + ? globalThis.Number(object.locationRadiusMeters) + : undefined, + isInitialLoad: isSet(object.isInitialLoad) ? globalThis.Boolean(object.isInitialLoad) : undefined, + browserPermissionGranted: isSet(object.browserPermissionGranted) + ? globalThis.Boolean(object.browserPermissionGranted) + : undefined, + clientPermissionState: isSet(object.clientPermissionState) + ? globalThis.Number(object.clientPermissionState) + : undefined, + locationOverrideToken: isSet(object.locationOverrideToken) + ? globalThis.String(object.locationOverrideToken) + : undefined, + }; + }, + + toJSON(message: ClientInfo_UnpluggedLocationInfo): unknown { + const obj: any = {}; + if (message.latitudeE7 !== undefined) { + obj.latitudeE7 = Math.round(message.latitudeE7); + } + if (message.longitudeE7 !== undefined) { + obj.longitudeE7 = Math.round(message.longitudeE7); + } + if (message.localTimestampMs !== undefined) { + obj.localTimestampMs = Math.round(message.localTimestampMs); + } + if (message.ipAddress !== undefined) { + obj.ipAddress = message.ipAddress; + } + if (message.timezone !== undefined) { + obj.timezone = message.timezone; + } + if (message.prefer24HourTime !== undefined) { + obj.prefer24HourTime = message.prefer24HourTime; + } + if (message.locationRadiusMeters !== undefined) { + obj.locationRadiusMeters = Math.round(message.locationRadiusMeters); + } + if (message.isInitialLoad !== undefined) { + obj.isInitialLoad = message.isInitialLoad; + } + if (message.browserPermissionGranted !== undefined) { + obj.browserPermissionGranted = message.browserPermissionGranted; + } + if (message.clientPermissionState !== undefined) { + obj.clientPermissionState = Math.round(message.clientPermissionState); + } + if (message.locationOverrideToken !== undefined) { + obj.locationOverrideToken = message.locationOverrideToken; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_UnpluggedLocationInfo { + return ClientInfo_UnpluggedLocationInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_UnpluggedLocationInfo { + const message = createBaseClientInfo_UnpluggedLocationInfo(); + message.latitudeE7 = object.latitudeE7 ?? undefined; + message.longitudeE7 = object.longitudeE7 ?? undefined; + message.localTimestampMs = object.localTimestampMs ?? undefined; + message.ipAddress = object.ipAddress ?? undefined; + message.timezone = object.timezone ?? undefined; + message.prefer24HourTime = object.prefer24HourTime ?? undefined; + message.locationRadiusMeters = object.locationRadiusMeters ?? undefined; + message.isInitialLoad = object.isInitialLoad ?? undefined; + message.browserPermissionGranted = object.browserPermissionGranted ?? undefined; + message.clientPermissionState = object.clientPermissionState ?? undefined; + message.locationOverrideToken = object.locationOverrideToken ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_KidsAppInfo(): ClientInfo_KidsAppInfo { + return { + contentSettings: undefined, + parentCurationMode: undefined, + categorySettings: undefined, + userEducationSettings: undefined, + }; +} + +export const ClientInfo_KidsAppInfo: MessageFns = { + encode(message: ClientInfo_KidsAppInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.contentSettings !== undefined) { + ClientInfo_KidsAppInfo_KidsContentSettings.encode(message.contentSettings, writer.uint32(10).fork()).join(); + } + if (message.parentCurationMode !== undefined) { + writer.uint32(16).int32(message.parentCurationMode); + } + if (message.categorySettings !== undefined) { + ClientInfo_KidsAppInfo_KidsCategorySettings.encode(message.categorySettings, writer.uint32(26).fork()).join(); + } + if (message.userEducationSettings !== undefined) { + ClientInfo_KidsAppInfo_KidsUserEducationSettings.encode(message.userEducationSettings, writer.uint32(34).fork()) + .join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_KidsAppInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_KidsAppInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contentSettings = ClientInfo_KidsAppInfo_KidsContentSettings.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.parentCurationMode = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.categorySettings = ClientInfo_KidsAppInfo_KidsCategorySettings.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.userEducationSettings = ClientInfo_KidsAppInfo_KidsUserEducationSettings.decode( + reader, + reader.uint32(), + ); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_KidsAppInfo { + return { + contentSettings: isSet(object.contentSettings) + ? ClientInfo_KidsAppInfo_KidsContentSettings.fromJSON(object.contentSettings) + : undefined, + parentCurationMode: isSet(object.parentCurationMode) + ? clientInfo_KidsAppInfo_KidsParentCurationModeFromJSON(object.parentCurationMode) + : undefined, + categorySettings: isSet(object.categorySettings) + ? ClientInfo_KidsAppInfo_KidsCategorySettings.fromJSON(object.categorySettings) + : undefined, + userEducationSettings: isSet(object.userEducationSettings) + ? ClientInfo_KidsAppInfo_KidsUserEducationSettings.fromJSON(object.userEducationSettings) + : undefined, + }; + }, + + toJSON(message: ClientInfo_KidsAppInfo): unknown { + const obj: any = {}; + if (message.contentSettings !== undefined) { + obj.contentSettings = ClientInfo_KidsAppInfo_KidsContentSettings.toJSON(message.contentSettings); + } + if (message.parentCurationMode !== undefined) { + obj.parentCurationMode = clientInfo_KidsAppInfo_KidsParentCurationModeToJSON(message.parentCurationMode); + } + if (message.categorySettings !== undefined) { + obj.categorySettings = ClientInfo_KidsAppInfo_KidsCategorySettings.toJSON(message.categorySettings); + } + if (message.userEducationSettings !== undefined) { + obj.userEducationSettings = ClientInfo_KidsAppInfo_KidsUserEducationSettings.toJSON( + message.userEducationSettings, + ); + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_KidsAppInfo { + return ClientInfo_KidsAppInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_KidsAppInfo { + const message = createBaseClientInfo_KidsAppInfo(); + message.contentSettings = (object.contentSettings !== undefined && object.contentSettings !== null) + ? ClientInfo_KidsAppInfo_KidsContentSettings.fromPartial(object.contentSettings) + : undefined; + message.parentCurationMode = object.parentCurationMode ?? undefined; + message.categorySettings = (object.categorySettings !== undefined && object.categorySettings !== null) + ? ClientInfo_KidsAppInfo_KidsCategorySettings.fromPartial(object.categorySettings) + : undefined; + message.userEducationSettings = + (object.userEducationSettings !== undefined && object.userEducationSettings !== null) + ? ClientInfo_KidsAppInfo_KidsUserEducationSettings.fromPartial(object.userEducationSettings) + : undefined; + return message; + }, +}; + +function createBaseClientInfo_KidsAppInfo_KidsContentSettings(): ClientInfo_KidsAppInfo_KidsContentSettings { + return { kidsNoSearchMode: undefined, ageUpMode: undefined, contentDensity: undefined }; +} + +export const ClientInfo_KidsAppInfo_KidsContentSettings: MessageFns = { + encode(message: ClientInfo_KidsAppInfo_KidsContentSettings, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kidsNoSearchMode !== undefined) { + writer.uint32(8).int32(message.kidsNoSearchMode); + } + if (message.ageUpMode !== undefined) { + writer.uint32(16).int32(message.ageUpMode); + } + if (message.contentDensity !== undefined) { + writer.uint32(24).int32(message.contentDensity); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_KidsAppInfo_KidsContentSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_KidsAppInfo_KidsContentSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.kidsNoSearchMode = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.ageUpMode = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.contentDensity = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_KidsAppInfo_KidsContentSettings { + return { + kidsNoSearchMode: isSet(object.kidsNoSearchMode) + ? clientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchModeFromJSON(object.kidsNoSearchMode) + : undefined, + ageUpMode: isSet(object.ageUpMode) + ? clientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpModeFromJSON(object.ageUpMode) + : undefined, + contentDensity: isSet(object.contentDensity) + ? clientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensityFromJSON(object.contentDensity) + : undefined, + }; + }, + + toJSON(message: ClientInfo_KidsAppInfo_KidsContentSettings): unknown { + const obj: any = {}; + if (message.kidsNoSearchMode !== undefined) { + obj.kidsNoSearchMode = clientInfo_KidsAppInfo_KidsContentSettings_YTKidsNoSearchModeToJSON( + message.kidsNoSearchMode, + ); + } + if (message.ageUpMode !== undefined) { + obj.ageUpMode = clientInfo_KidsAppInfo_KidsContentSettings_YTKidsAgeUpModeToJSON(message.ageUpMode); + } + if (message.contentDensity !== undefined) { + obj.contentDensity = clientInfo_KidsAppInfo_KidsContentSettings_KidsContentDensityToJSON(message.contentDensity); + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_KidsAppInfo_KidsContentSettings { + return ClientInfo_KidsAppInfo_KidsContentSettings.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_KidsAppInfo_KidsContentSettings { + const message = createBaseClientInfo_KidsAppInfo_KidsContentSettings(); + message.kidsNoSearchMode = object.kidsNoSearchMode ?? undefined; + message.ageUpMode = object.ageUpMode ?? undefined; + message.contentDensity = object.contentDensity ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_KidsAppInfo_KidsCategorySettings(): ClientInfo_KidsAppInfo_KidsCategorySettings { + return { enabledCategories: undefined }; +} + +export const ClientInfo_KidsAppInfo_KidsCategorySettings: MessageFns = { + encode( + message: ClientInfo_KidsAppInfo_KidsCategorySettings, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.enabledCategories !== undefined) { + writer.uint32(10).string(message.enabledCategories); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_KidsAppInfo_KidsCategorySettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_KidsAppInfo_KidsCategorySettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.enabledCategories = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_KidsAppInfo_KidsCategorySettings { + return { + enabledCategories: isSet(object.enabledCategories) ? globalThis.String(object.enabledCategories) : undefined, + }; + }, + + toJSON(message: ClientInfo_KidsAppInfo_KidsCategorySettings): unknown { + const obj: any = {}; + if (message.enabledCategories !== undefined) { + obj.enabledCategories = message.enabledCategories; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_KidsAppInfo_KidsCategorySettings { + return ClientInfo_KidsAppInfo_KidsCategorySettings.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_KidsAppInfo_KidsCategorySettings { + const message = createBaseClientInfo_KidsAppInfo_KidsCategorySettings(); + message.enabledCategories = object.enabledCategories ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_KidsAppInfo_KidsUserEducationSettings(): ClientInfo_KidsAppInfo_KidsUserEducationSettings { + return { + hasSeenHomeChipBarUserEducation: undefined, + hasSeenHomePivotBarUserEducation: undefined, + hasSeenParentMuirUserEducation: undefined, + }; +} + +export const ClientInfo_KidsAppInfo_KidsUserEducationSettings: MessageFns< + ClientInfo_KidsAppInfo_KidsUserEducationSettings +> = { + encode( + message: ClientInfo_KidsAppInfo_KidsUserEducationSettings, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.hasSeenHomeChipBarUserEducation !== undefined) { + writer.uint32(8).bool(message.hasSeenHomeChipBarUserEducation); + } + if (message.hasSeenHomePivotBarUserEducation !== undefined) { + writer.uint32(16).bool(message.hasSeenHomePivotBarUserEducation); + } + if (message.hasSeenParentMuirUserEducation !== undefined) { + writer.uint32(24).bool(message.hasSeenParentMuirUserEducation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_KidsAppInfo_KidsUserEducationSettings { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_KidsAppInfo_KidsUserEducationSettings(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.hasSeenHomeChipBarUserEducation = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.hasSeenHomePivotBarUserEducation = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.hasSeenParentMuirUserEducation = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_KidsAppInfo_KidsUserEducationSettings { + return { + hasSeenHomeChipBarUserEducation: isSet(object.hasSeenHomeChipBarUserEducation) + ? globalThis.Boolean(object.hasSeenHomeChipBarUserEducation) + : undefined, + hasSeenHomePivotBarUserEducation: isSet(object.hasSeenHomePivotBarUserEducation) + ? globalThis.Boolean(object.hasSeenHomePivotBarUserEducation) + : undefined, + hasSeenParentMuirUserEducation: isSet(object.hasSeenParentMuirUserEducation) + ? globalThis.Boolean(object.hasSeenParentMuirUserEducation) + : undefined, + }; + }, + + toJSON(message: ClientInfo_KidsAppInfo_KidsUserEducationSettings): unknown { + const obj: any = {}; + if (message.hasSeenHomeChipBarUserEducation !== undefined) { + obj.hasSeenHomeChipBarUserEducation = message.hasSeenHomeChipBarUserEducation; + } + if (message.hasSeenHomePivotBarUserEducation !== undefined) { + obj.hasSeenHomePivotBarUserEducation = message.hasSeenHomePivotBarUserEducation; + } + if (message.hasSeenParentMuirUserEducation !== undefined) { + obj.hasSeenParentMuirUserEducation = message.hasSeenParentMuirUserEducation; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_KidsAppInfo_KidsUserEducationSettings { + return ClientInfo_KidsAppInfo_KidsUserEducationSettings.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_KidsAppInfo_KidsUserEducationSettings { + const message = createBaseClientInfo_KidsAppInfo_KidsUserEducationSettings(); + message.hasSeenHomeChipBarUserEducation = object.hasSeenHomeChipBarUserEducation ?? undefined; + message.hasSeenHomePivotBarUserEducation = object.hasSeenHomePivotBarUserEducation ?? undefined; + message.hasSeenParentMuirUserEducation = object.hasSeenParentMuirUserEducation ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_MusicAppInfo(): ClientInfo_MusicAppInfo { + return { + playBackMode: undefined, + musicLocationMasterSwitch: undefined, + musicActivityMasterSwitch: undefined, + offlineMixtapeEnabled: undefined, + autoOfflineEnabled: undefined, + iosBackgroundRefreshStatus: undefined, + smartDownloadsSongLimit: undefined, + transitionedFromMixtapeToSmartDownloads: undefined, + pwaInstallabilityStatus: undefined, + webDisplayMode: undefined, + musicTier: undefined, + storeDigitalGoodsApiSupportStatus: undefined, + smartDownloadsTimeSinceLastOptOutSec: undefined, + }; +} + +export const ClientInfo_MusicAppInfo: MessageFns = { + encode(message: ClientInfo_MusicAppInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.playBackMode !== undefined) { + writer.uint32(8).int32(message.playBackMode); + } + if (message.musicLocationMasterSwitch !== undefined) { + writer.uint32(16).int32(message.musicLocationMasterSwitch); + } + if (message.musicActivityMasterSwitch !== undefined) { + writer.uint32(24).int32(message.musicActivityMasterSwitch); + } + if (message.offlineMixtapeEnabled !== undefined) { + writer.uint32(32).bool(message.offlineMixtapeEnabled); + } + if (message.autoOfflineEnabled !== undefined) { + writer.uint32(40).bool(message.autoOfflineEnabled); + } + if (message.iosBackgroundRefreshStatus !== undefined) { + writer.uint32(48).int32(message.iosBackgroundRefreshStatus); + } + if (message.smartDownloadsSongLimit !== undefined) { + writer.uint32(56).int32(message.smartDownloadsSongLimit); + } + if (message.transitionedFromMixtapeToSmartDownloads !== undefined) { + writer.uint32(64).bool(message.transitionedFromMixtapeToSmartDownloads); + } + if (message.pwaInstallabilityStatus !== undefined) { + writer.uint32(72).int32(message.pwaInstallabilityStatus); + } + if (message.webDisplayMode !== undefined) { + writer.uint32(80).int32(message.webDisplayMode); + } + if (message.musicTier !== undefined) { + writer.uint32(88).int32(message.musicTier); + } + if (message.storeDigitalGoodsApiSupportStatus !== undefined) { + writer.uint32(96).int32(message.storeDigitalGoodsApiSupportStatus); + } + if (message.smartDownloadsTimeSinceLastOptOutSec !== undefined) { + writer.uint32(104).int64(message.smartDownloadsTimeSinceLastOptOutSec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_MusicAppInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_MusicAppInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.playBackMode = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.musicLocationMasterSwitch = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.musicActivityMasterSwitch = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.offlineMixtapeEnabled = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.autoOfflineEnabled = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.iosBackgroundRefreshStatus = reader.int32() as any; + continue; + case 7: + if (tag !== 56) { + break; + } + + message.smartDownloadsSongLimit = reader.int32(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.transitionedFromMixtapeToSmartDownloads = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.pwaInstallabilityStatus = reader.int32() as any; + continue; + case 10: + if (tag !== 80) { + break; + } + + message.webDisplayMode = reader.int32() as any; + continue; + case 11: + if (tag !== 88) { + break; + } + + message.musicTier = reader.int32() as any; + continue; + case 12: + if (tag !== 96) { + break; + } + + message.storeDigitalGoodsApiSupportStatus = reader.int32() as any; + continue; + case 13: + if (tag !== 104) { + break; + } + + message.smartDownloadsTimeSinceLastOptOutSec = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_MusicAppInfo { + return { + playBackMode: isSet(object.playBackMode) + ? clientInfo_MusicAppInfo_MusicPlayBackModeFromJSON(object.playBackMode) + : undefined, + musicLocationMasterSwitch: isSet(object.musicLocationMasterSwitch) + ? clientInfo_MusicAppInfo_MusicLocationMasterSwitchFromJSON(object.musicLocationMasterSwitch) + : undefined, + musicActivityMasterSwitch: isSet(object.musicActivityMasterSwitch) + ? clientInfo_MusicAppInfo_MusicActivityMasterSwitchFromJSON(object.musicActivityMasterSwitch) + : undefined, + offlineMixtapeEnabled: isSet(object.offlineMixtapeEnabled) + ? globalThis.Boolean(object.offlineMixtapeEnabled) + : undefined, + autoOfflineEnabled: isSet(object.autoOfflineEnabled) ? globalThis.Boolean(object.autoOfflineEnabled) : undefined, + iosBackgroundRefreshStatus: isSet(object.iosBackgroundRefreshStatus) + ? clientInfo_MusicAppInfo_IosBackgroundRefreshStatusFromJSON(object.iosBackgroundRefreshStatus) + : undefined, + smartDownloadsSongLimit: isSet(object.smartDownloadsSongLimit) + ? globalThis.Number(object.smartDownloadsSongLimit) + : undefined, + transitionedFromMixtapeToSmartDownloads: isSet(object.transitionedFromMixtapeToSmartDownloads) + ? globalThis.Boolean(object.transitionedFromMixtapeToSmartDownloads) + : undefined, + pwaInstallabilityStatus: isSet(object.pwaInstallabilityStatus) + ? clientInfo_MusicAppInfo_PwaInstallabilityStatusFromJSON(object.pwaInstallabilityStatus) + : undefined, + webDisplayMode: isSet(object.webDisplayMode) + ? clientInfo_MusicAppInfo_WebDisplayModeFromJSON(object.webDisplayMode) + : undefined, + musicTier: isSet(object.musicTier) ? clientInfo_MusicAppInfo_MusicTierFromJSON(object.musicTier) : undefined, + storeDigitalGoodsApiSupportStatus: isSet(object.storeDigitalGoodsApiSupportStatus) + ? clientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatusFromJSON(object.storeDigitalGoodsApiSupportStatus) + : undefined, + smartDownloadsTimeSinceLastOptOutSec: isSet(object.smartDownloadsTimeSinceLastOptOutSec) + ? globalThis.Number(object.smartDownloadsTimeSinceLastOptOutSec) + : undefined, + }; + }, + + toJSON(message: ClientInfo_MusicAppInfo): unknown { + const obj: any = {}; + if (message.playBackMode !== undefined) { + obj.playBackMode = clientInfo_MusicAppInfo_MusicPlayBackModeToJSON(message.playBackMode); + } + if (message.musicLocationMasterSwitch !== undefined) { + obj.musicLocationMasterSwitch = clientInfo_MusicAppInfo_MusicLocationMasterSwitchToJSON( + message.musicLocationMasterSwitch, + ); + } + if (message.musicActivityMasterSwitch !== undefined) { + obj.musicActivityMasterSwitch = clientInfo_MusicAppInfo_MusicActivityMasterSwitchToJSON( + message.musicActivityMasterSwitch, + ); + } + if (message.offlineMixtapeEnabled !== undefined) { + obj.offlineMixtapeEnabled = message.offlineMixtapeEnabled; + } + if (message.autoOfflineEnabled !== undefined) { + obj.autoOfflineEnabled = message.autoOfflineEnabled; + } + if (message.iosBackgroundRefreshStatus !== undefined) { + obj.iosBackgroundRefreshStatus = clientInfo_MusicAppInfo_IosBackgroundRefreshStatusToJSON( + message.iosBackgroundRefreshStatus, + ); + } + if (message.smartDownloadsSongLimit !== undefined) { + obj.smartDownloadsSongLimit = Math.round(message.smartDownloadsSongLimit); + } + if (message.transitionedFromMixtapeToSmartDownloads !== undefined) { + obj.transitionedFromMixtapeToSmartDownloads = message.transitionedFromMixtapeToSmartDownloads; + } + if (message.pwaInstallabilityStatus !== undefined) { + obj.pwaInstallabilityStatus = clientInfo_MusicAppInfo_PwaInstallabilityStatusToJSON( + message.pwaInstallabilityStatus, + ); + } + if (message.webDisplayMode !== undefined) { + obj.webDisplayMode = clientInfo_MusicAppInfo_WebDisplayModeToJSON(message.webDisplayMode); + } + if (message.musicTier !== undefined) { + obj.musicTier = clientInfo_MusicAppInfo_MusicTierToJSON(message.musicTier); + } + if (message.storeDigitalGoodsApiSupportStatus !== undefined) { + obj.storeDigitalGoodsApiSupportStatus = clientInfo_MusicAppInfo_StoreDigitalGoodsApiSupportStatusToJSON( + message.storeDigitalGoodsApiSupportStatus, + ); + } + if (message.smartDownloadsTimeSinceLastOptOutSec !== undefined) { + obj.smartDownloadsTimeSinceLastOptOutSec = Math.round(message.smartDownloadsTimeSinceLastOptOutSec); + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_MusicAppInfo { + return ClientInfo_MusicAppInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_MusicAppInfo { + const message = createBaseClientInfo_MusicAppInfo(); + message.playBackMode = object.playBackMode ?? undefined; + message.musicLocationMasterSwitch = object.musicLocationMasterSwitch ?? undefined; + message.musicActivityMasterSwitch = object.musicActivityMasterSwitch ?? undefined; + message.offlineMixtapeEnabled = object.offlineMixtapeEnabled ?? undefined; + message.autoOfflineEnabled = object.autoOfflineEnabled ?? undefined; + message.iosBackgroundRefreshStatus = object.iosBackgroundRefreshStatus ?? undefined; + message.smartDownloadsSongLimit = object.smartDownloadsSongLimit ?? undefined; + message.transitionedFromMixtapeToSmartDownloads = object.transitionedFromMixtapeToSmartDownloads ?? undefined; + message.pwaInstallabilityStatus = object.pwaInstallabilityStatus ?? undefined; + message.webDisplayMode = object.webDisplayMode ?? undefined; + message.musicTier = object.musicTier ?? undefined; + message.storeDigitalGoodsApiSupportStatus = object.storeDigitalGoodsApiSupportStatus ?? undefined; + message.smartDownloadsTimeSinceLastOptOutSec = object.smartDownloadsTimeSinceLastOptOutSec ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_TvAppInfo(): ClientInfo_TvAppInfo { + return { + mdxImpactedSessionsServerEvents: undefined, + enablePrivacyFilter: undefined, + zylonLeftNav: undefined, + certificationScope: undefined, + livingRoomPoTokenId: undefined, + jsEngineString: undefined, + voiceCapability: undefined, + systemIntegrator: undefined, + androidBuildFingerprint: undefined, + cobaltAppVersion: undefined, + cobaltStarboardVersion: undefined, + useStartPlaybackPreviewCommand: undefined, + shouldShowPersistentSigninOnHome: undefined, + androidPlayServicesVersion: undefined, + }; +} + +export const ClientInfo_TvAppInfo: MessageFns = { + encode(message: ClientInfo_TvAppInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mdxImpactedSessionsServerEvents !== undefined) { + writer.uint32(26).string(message.mdxImpactedSessionsServerEvents); + } + if (message.enablePrivacyFilter !== undefined) { + writer.uint32(48).bool(message.enablePrivacyFilter); + } + if (message.zylonLeftNav !== undefined) { + writer.uint32(56).bool(message.zylonLeftNav); + } + if (message.certificationScope !== undefined) { + writer.uint32(74).string(message.certificationScope); + } + if (message.livingRoomPoTokenId !== undefined) { + writer.uint32(82).string(message.livingRoomPoTokenId); + } + if (message.jsEngineString !== undefined) { + writer.uint32(98).string(message.jsEngineString); + } + if (message.voiceCapability !== undefined) { + ClientInfo_TvAppInfo_VoiceCapability.encode(message.voiceCapability, writer.uint32(106).fork()).join(); + } + if (message.systemIntegrator !== undefined) { + writer.uint32(114).string(message.systemIntegrator); + } + if (message.androidBuildFingerprint !== undefined) { + writer.uint32(146).string(message.androidBuildFingerprint); + } + if (message.cobaltAppVersion !== undefined) { + writer.uint32(154).string(message.cobaltAppVersion); + } + if (message.cobaltStarboardVersion !== undefined) { + writer.uint32(162).string(message.cobaltStarboardVersion); + } + if (message.useStartPlaybackPreviewCommand !== undefined) { + writer.uint32(176).bool(message.useStartPlaybackPreviewCommand); + } + if (message.shouldShowPersistentSigninOnHome !== undefined) { + writer.uint32(184).bool(message.shouldShowPersistentSigninOnHome); + } + if (message.androidPlayServicesVersion !== undefined) { + writer.uint32(194).string(message.androidPlayServicesVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_TvAppInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_TvAppInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.mdxImpactedSessionsServerEvents = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.enablePrivacyFilter = reader.bool(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.zylonLeftNav = reader.bool(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.certificationScope = reader.string(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.livingRoomPoTokenId = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.jsEngineString = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.voiceCapability = ClientInfo_TvAppInfo_VoiceCapability.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.systemIntegrator = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.androidBuildFingerprint = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.cobaltAppVersion = reader.string(); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.cobaltStarboardVersion = reader.string(); + continue; + case 22: + if (tag !== 176) { + break; + } + + message.useStartPlaybackPreviewCommand = reader.bool(); + continue; + case 23: + if (tag !== 184) { + break; + } + + message.shouldShowPersistentSigninOnHome = reader.bool(); + continue; + case 24: + if (tag !== 194) { + break; + } + + message.androidPlayServicesVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_TvAppInfo { + return { + mdxImpactedSessionsServerEvents: isSet(object.mdxImpactedSessionsServerEvents) + ? globalThis.String(object.mdxImpactedSessionsServerEvents) + : undefined, + enablePrivacyFilter: isSet(object.enablePrivacyFilter) + ? globalThis.Boolean(object.enablePrivacyFilter) + : undefined, + zylonLeftNav: isSet(object.zylonLeftNav) ? globalThis.Boolean(object.zylonLeftNav) : undefined, + certificationScope: isSet(object.certificationScope) ? globalThis.String(object.certificationScope) : undefined, + livingRoomPoTokenId: isSet(object.livingRoomPoTokenId) + ? globalThis.String(object.livingRoomPoTokenId) + : undefined, + jsEngineString: isSet(object.jsEngineString) ? globalThis.String(object.jsEngineString) : undefined, + voiceCapability: isSet(object.voiceCapability) + ? ClientInfo_TvAppInfo_VoiceCapability.fromJSON(object.voiceCapability) + : undefined, + systemIntegrator: isSet(object.systemIntegrator) ? globalThis.String(object.systemIntegrator) : undefined, + androidBuildFingerprint: isSet(object.androidBuildFingerprint) + ? globalThis.String(object.androidBuildFingerprint) + : undefined, + cobaltAppVersion: isSet(object.cobaltAppVersion) ? globalThis.String(object.cobaltAppVersion) : undefined, + cobaltStarboardVersion: isSet(object.cobaltStarboardVersion) + ? globalThis.String(object.cobaltStarboardVersion) + : undefined, + useStartPlaybackPreviewCommand: isSet(object.useStartPlaybackPreviewCommand) + ? globalThis.Boolean(object.useStartPlaybackPreviewCommand) + : undefined, + shouldShowPersistentSigninOnHome: isSet(object.shouldShowPersistentSigninOnHome) + ? globalThis.Boolean(object.shouldShowPersistentSigninOnHome) + : undefined, + androidPlayServicesVersion: isSet(object.androidPlayServicesVersion) + ? globalThis.String(object.androidPlayServicesVersion) + : undefined, + }; + }, + + toJSON(message: ClientInfo_TvAppInfo): unknown { + const obj: any = {}; + if (message.mdxImpactedSessionsServerEvents !== undefined) { + obj.mdxImpactedSessionsServerEvents = message.mdxImpactedSessionsServerEvents; + } + if (message.enablePrivacyFilter !== undefined) { + obj.enablePrivacyFilter = message.enablePrivacyFilter; + } + if (message.zylonLeftNav !== undefined) { + obj.zylonLeftNav = message.zylonLeftNav; + } + if (message.certificationScope !== undefined) { + obj.certificationScope = message.certificationScope; + } + if (message.livingRoomPoTokenId !== undefined) { + obj.livingRoomPoTokenId = message.livingRoomPoTokenId; + } + if (message.jsEngineString !== undefined) { + obj.jsEngineString = message.jsEngineString; + } + if (message.voiceCapability !== undefined) { + obj.voiceCapability = ClientInfo_TvAppInfo_VoiceCapability.toJSON(message.voiceCapability); + } + if (message.systemIntegrator !== undefined) { + obj.systemIntegrator = message.systemIntegrator; + } + if (message.androidBuildFingerprint !== undefined) { + obj.androidBuildFingerprint = message.androidBuildFingerprint; + } + if (message.cobaltAppVersion !== undefined) { + obj.cobaltAppVersion = message.cobaltAppVersion; + } + if (message.cobaltStarboardVersion !== undefined) { + obj.cobaltStarboardVersion = message.cobaltStarboardVersion; + } + if (message.useStartPlaybackPreviewCommand !== undefined) { + obj.useStartPlaybackPreviewCommand = message.useStartPlaybackPreviewCommand; + } + if (message.shouldShowPersistentSigninOnHome !== undefined) { + obj.shouldShowPersistentSigninOnHome = message.shouldShowPersistentSigninOnHome; + } + if (message.androidPlayServicesVersion !== undefined) { + obj.androidPlayServicesVersion = message.androidPlayServicesVersion; + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_TvAppInfo { + return ClientInfo_TvAppInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_TvAppInfo { + const message = createBaseClientInfo_TvAppInfo(); + message.mdxImpactedSessionsServerEvents = object.mdxImpactedSessionsServerEvents ?? undefined; + message.enablePrivacyFilter = object.enablePrivacyFilter ?? undefined; + message.zylonLeftNav = object.zylonLeftNav ?? undefined; + message.certificationScope = object.certificationScope ?? undefined; + message.livingRoomPoTokenId = object.livingRoomPoTokenId ?? undefined; + message.jsEngineString = object.jsEngineString ?? undefined; + message.voiceCapability = (object.voiceCapability !== undefined && object.voiceCapability !== null) + ? ClientInfo_TvAppInfo_VoiceCapability.fromPartial(object.voiceCapability) + : undefined; + message.systemIntegrator = object.systemIntegrator ?? undefined; + message.androidBuildFingerprint = object.androidBuildFingerprint ?? undefined; + message.cobaltAppVersion = object.cobaltAppVersion ?? undefined; + message.cobaltStarboardVersion = object.cobaltStarboardVersion ?? undefined; + message.useStartPlaybackPreviewCommand = object.useStartPlaybackPreviewCommand ?? undefined; + message.shouldShowPersistentSigninOnHome = object.shouldShowPersistentSigninOnHome ?? undefined; + message.androidPlayServicesVersion = object.androidPlayServicesVersion ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_TvAppInfo_VoiceCapability(): ClientInfo_TvAppInfo_VoiceCapability { + return { hasSoftMicSupport: undefined, hasHardMicSupport: undefined }; +} + +export const ClientInfo_TvAppInfo_VoiceCapability: MessageFns = { + encode(message: ClientInfo_TvAppInfo_VoiceCapability, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hasSoftMicSupport !== undefined) { + writer.uint32(8).bool(message.hasSoftMicSupport); + } + if (message.hasHardMicSupport !== undefined) { + writer.uint32(16).bool(message.hasHardMicSupport); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_TvAppInfo_VoiceCapability { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_TvAppInfo_VoiceCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.hasSoftMicSupport = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.hasHardMicSupport = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_TvAppInfo_VoiceCapability { + return { + hasSoftMicSupport: isSet(object.hasSoftMicSupport) ? globalThis.Boolean(object.hasSoftMicSupport) : undefined, + hasHardMicSupport: isSet(object.hasHardMicSupport) ? globalThis.Boolean(object.hasHardMicSupport) : undefined, + }; + }, + + toJSON(message: ClientInfo_TvAppInfo_VoiceCapability): unknown { + const obj: any = {}; + if (message.hasSoftMicSupport !== undefined) { + obj.hasSoftMicSupport = message.hasSoftMicSupport; + } + if (message.hasHardMicSupport !== undefined) { + obj.hasHardMicSupport = message.hasHardMicSupport; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_TvAppInfo_VoiceCapability { + return ClientInfo_TvAppInfo_VoiceCapability.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_TvAppInfo_VoiceCapability { + const message = createBaseClientInfo_TvAppInfo_VoiceCapability(); + message.hasSoftMicSupport = object.hasSoftMicSupport ?? undefined; + message.hasHardMicSupport = object.hasHardMicSupport ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_UnpluggedAppInfo(): ClientInfo_UnpluggedAppInfo { + return { enableFilterMode: undefined, iosNotificationPermission: undefined, forceEnableEpg3: undefined }; +} + +export const ClientInfo_UnpluggedAppInfo: MessageFns = { + encode(message: ClientInfo_UnpluggedAppInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.enableFilterMode !== undefined) { + writer.uint32(16).bool(message.enableFilterMode); + } + if (message.iosNotificationPermission !== undefined) { + writer.uint32(24).bool(message.iosNotificationPermission); + } + if (message.forceEnableEpg3 !== undefined) { + writer.uint32(56).bool(message.forceEnableEpg3); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_UnpluggedAppInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_UnpluggedAppInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.enableFilterMode = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.iosNotificationPermission = reader.bool(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.forceEnableEpg3 = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_UnpluggedAppInfo { + return { + enableFilterMode: isSet(object.enableFilterMode) ? globalThis.Boolean(object.enableFilterMode) : undefined, + iosNotificationPermission: isSet(object.iosNotificationPermission) + ? globalThis.Boolean(object.iosNotificationPermission) + : undefined, + forceEnableEpg3: isSet(object.forceEnableEpg3) ? globalThis.Boolean(object.forceEnableEpg3) : undefined, + }; + }, + + toJSON(message: ClientInfo_UnpluggedAppInfo): unknown { + const obj: any = {}; + if (message.enableFilterMode !== undefined) { + obj.enableFilterMode = message.enableFilterMode; + } + if (message.iosNotificationPermission !== undefined) { + obj.iosNotificationPermission = message.iosNotificationPermission; + } + if (message.forceEnableEpg3 !== undefined) { + obj.forceEnableEpg3 = message.forceEnableEpg3; + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_UnpluggedAppInfo { + return ClientInfo_UnpluggedAppInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_UnpluggedAppInfo { + const message = createBaseClientInfo_UnpluggedAppInfo(); + message.enableFilterMode = object.enableFilterMode ?? undefined; + message.iosNotificationPermission = object.iosNotificationPermission ?? undefined; + message.forceEnableEpg3 = object.forceEnableEpg3 ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_LocationInfo(): ClientInfo_LocationInfo { + return { + locationInfoStatus: undefined, + ulrStatus: undefined, + latitudeE7: undefined, + longitudeE7: undefined, + horizontalAccuracyMeters: undefined, + locationFreshnessMs: undefined, + locationPermissionAuthorizationStatus: undefined, + locationOverrideToken: undefined, + forceLocationPlayabilityTokenRefresh: undefined, + }; +} + +export const ClientInfo_LocationInfo: MessageFns = { + encode(message: ClientInfo_LocationInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.locationInfoStatus !== undefined) { + writer.uint32(8).int32(message.locationInfoStatus); + } + if (message.ulrStatus !== undefined) { + ClientInfo_LocationInfo_UrlStatus.encode(message.ulrStatus, writer.uint32(18).fork()).join(); + } + if (message.latitudeE7 !== undefined) { + writer.uint32(26).string(message.latitudeE7); + } + if (message.longitudeE7 !== undefined) { + writer.uint32(34).string(message.longitudeE7); + } + if (message.horizontalAccuracyMeters !== undefined) { + writer.uint32(42).string(message.horizontalAccuracyMeters); + } + if (message.locationFreshnessMs !== undefined) { + writer.uint32(50).string(message.locationFreshnessMs); + } + if (message.locationPermissionAuthorizationStatus !== undefined) { + writer.uint32(56).int32(message.locationPermissionAuthorizationStatus); + } + if (message.locationOverrideToken !== undefined) { + writer.uint32(66).string(message.locationOverrideToken); + } + if (message.forceLocationPlayabilityTokenRefresh !== undefined) { + writer.uint32(72).bool(message.forceLocationPlayabilityTokenRefresh); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_LocationInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_LocationInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.locationInfoStatus = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.ulrStatus = ClientInfo_LocationInfo_UrlStatus.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.latitudeE7 = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.longitudeE7 = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.horizontalAccuracyMeters = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.locationFreshnessMs = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.locationPermissionAuthorizationStatus = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.locationOverrideToken = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.forceLocationPlayabilityTokenRefresh = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_LocationInfo { + return { + locationInfoStatus: isSet(object.locationInfoStatus) ? globalThis.Number(object.locationInfoStatus) : undefined, + ulrStatus: isSet(object.ulrStatus) ? ClientInfo_LocationInfo_UrlStatus.fromJSON(object.ulrStatus) : undefined, + latitudeE7: isSet(object.latitudeE7) ? globalThis.String(object.latitudeE7) : undefined, + longitudeE7: isSet(object.longitudeE7) ? globalThis.String(object.longitudeE7) : undefined, + horizontalAccuracyMeters: isSet(object.horizontalAccuracyMeters) + ? globalThis.String(object.horizontalAccuracyMeters) + : undefined, + locationFreshnessMs: isSet(object.locationFreshnessMs) + ? globalThis.String(object.locationFreshnessMs) + : undefined, + locationPermissionAuthorizationStatus: isSet(object.locationPermissionAuthorizationStatus) + ? globalThis.Number(object.locationPermissionAuthorizationStatus) + : undefined, + locationOverrideToken: isSet(object.locationOverrideToken) + ? globalThis.String(object.locationOverrideToken) + : undefined, + forceLocationPlayabilityTokenRefresh: isSet(object.forceLocationPlayabilityTokenRefresh) + ? globalThis.Boolean(object.forceLocationPlayabilityTokenRefresh) + : undefined, + }; + }, + + toJSON(message: ClientInfo_LocationInfo): unknown { + const obj: any = {}; + if (message.locationInfoStatus !== undefined) { + obj.locationInfoStatus = Math.round(message.locationInfoStatus); + } + if (message.ulrStatus !== undefined) { + obj.ulrStatus = ClientInfo_LocationInfo_UrlStatus.toJSON(message.ulrStatus); + } + if (message.latitudeE7 !== undefined) { + obj.latitudeE7 = message.latitudeE7; + } + if (message.longitudeE7 !== undefined) { + obj.longitudeE7 = message.longitudeE7; + } + if (message.horizontalAccuracyMeters !== undefined) { + obj.horizontalAccuracyMeters = message.horizontalAccuracyMeters; + } + if (message.locationFreshnessMs !== undefined) { + obj.locationFreshnessMs = message.locationFreshnessMs; + } + if (message.locationPermissionAuthorizationStatus !== undefined) { + obj.locationPermissionAuthorizationStatus = Math.round(message.locationPermissionAuthorizationStatus); + } + if (message.locationOverrideToken !== undefined) { + obj.locationOverrideToken = message.locationOverrideToken; + } + if (message.forceLocationPlayabilityTokenRefresh !== undefined) { + obj.forceLocationPlayabilityTokenRefresh = message.forceLocationPlayabilityTokenRefresh; + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_LocationInfo { + return ClientInfo_LocationInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_LocationInfo { + const message = createBaseClientInfo_LocationInfo(); + message.locationInfoStatus = object.locationInfoStatus ?? undefined; + message.ulrStatus = (object.ulrStatus !== undefined && object.ulrStatus !== null) + ? ClientInfo_LocationInfo_UrlStatus.fromPartial(object.ulrStatus) + : undefined; + message.latitudeE7 = object.latitudeE7 ?? undefined; + message.longitudeE7 = object.longitudeE7 ?? undefined; + message.horizontalAccuracyMeters = object.horizontalAccuracyMeters ?? undefined; + message.locationFreshnessMs = object.locationFreshnessMs ?? undefined; + message.locationPermissionAuthorizationStatus = object.locationPermissionAuthorizationStatus ?? undefined; + message.locationOverrideToken = object.locationOverrideToken ?? undefined; + message.forceLocationPlayabilityTokenRefresh = object.forceLocationPlayabilityTokenRefresh ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_LocationInfo_UrlStatus(): ClientInfo_LocationInfo_UrlStatus { + return { + reportingEnabledSetting: undefined, + historyEnabledSetting: undefined, + isAllowed: undefined, + isActive: undefined, + }; +} + +export const ClientInfo_LocationInfo_UrlStatus: MessageFns = { + encode(message: ClientInfo_LocationInfo_UrlStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reportingEnabledSetting !== undefined) { + writer.uint32(8).int32(message.reportingEnabledSetting); + } + if (message.historyEnabledSetting !== undefined) { + writer.uint32(16).int32(message.historyEnabledSetting); + } + if (message.isAllowed !== undefined) { + writer.uint32(24).bool(message.isAllowed); + } + if (message.isActive !== undefined) { + writer.uint32(32).bool(message.isActive); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_LocationInfo_UrlStatus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_LocationInfo_UrlStatus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.reportingEnabledSetting = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.historyEnabledSetting = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.isAllowed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.isActive = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_LocationInfo_UrlStatus { + return { + reportingEnabledSetting: isSet(object.reportingEnabledSetting) + ? globalThis.Number(object.reportingEnabledSetting) + : undefined, + historyEnabledSetting: isSet(object.historyEnabledSetting) + ? globalThis.Number(object.historyEnabledSetting) + : undefined, + isAllowed: isSet(object.isAllowed) ? globalThis.Boolean(object.isAllowed) : undefined, + isActive: isSet(object.isActive) ? globalThis.Boolean(object.isActive) : undefined, + }; + }, + + toJSON(message: ClientInfo_LocationInfo_UrlStatus): unknown { + const obj: any = {}; + if (message.reportingEnabledSetting !== undefined) { + obj.reportingEnabledSetting = Math.round(message.reportingEnabledSetting); + } + if (message.historyEnabledSetting !== undefined) { + obj.historyEnabledSetting = Math.round(message.historyEnabledSetting); + } + if (message.isAllowed !== undefined) { + obj.isAllowed = message.isAllowed; + } + if (message.isActive !== undefined) { + obj.isActive = message.isActive; + } + return obj; + }, + + create, I>>( + base?: I, + ): ClientInfo_LocationInfo_UrlStatus { + return ClientInfo_LocationInfo_UrlStatus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ClientInfo_LocationInfo_UrlStatus { + const message = createBaseClientInfo_LocationInfo_UrlStatus(); + message.reportingEnabledSetting = object.reportingEnabledSetting ?? undefined; + message.historyEnabledSetting = object.historyEnabledSetting ?? undefined; + message.isAllowed = object.isAllowed ?? undefined; + message.isActive = object.isActive ?? undefined; + return message; + }, +}; + +function createBaseClientInfo_HomeGroupInfo(): ClientInfo_HomeGroupInfo { + return { isPartOfGroup: undefined, isGroup: undefined }; +} + +export const ClientInfo_HomeGroupInfo: MessageFns = { + encode(message: ClientInfo_HomeGroupInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.isPartOfGroup !== undefined) { + writer.uint32(8).bool(message.isPartOfGroup); + } + if (message.isGroup !== undefined) { + writer.uint32(24).bool(message.isGroup); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClientInfo_HomeGroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientInfo_HomeGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.isPartOfGroup = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.isGroup = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClientInfo_HomeGroupInfo { + return { + isPartOfGroup: isSet(object.isPartOfGroup) ? globalThis.Boolean(object.isPartOfGroup) : undefined, + isGroup: isSet(object.isGroup) ? globalThis.Boolean(object.isGroup) : undefined, + }; + }, + + toJSON(message: ClientInfo_HomeGroupInfo): unknown { + const obj: any = {}; + if (message.isPartOfGroup !== undefined) { + obj.isPartOfGroup = message.isPartOfGroup; + } + if (message.isGroup !== undefined) { + obj.isGroup = message.isGroup; + } + return obj; + }, + + create, I>>(base?: I): ClientInfo_HomeGroupInfo { + return ClientInfo_HomeGroupInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ClientInfo_HomeGroupInfo { + const message = createBaseClientInfo_HomeGroupInfo(); + message.isPartOfGroup = object.isPartOfGroup ?? undefined; + message.isGroup = object.isGroup ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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 longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +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/protos/generated/youtube/api/pfiinnertube/get_watch_request.ts b/protos/generated/youtube/api/pfiinnertube/get_watch_request.ts new file mode 100644 index 0000000000..30ad1fbfd2 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/get_watch_request.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.0 +// source: youtube/api/pfiinnertube/get_watch_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { InnerTubeContext } from "./innertube_context.js"; +import { PlayerRequest } from "./player_request.js"; +import { ReelItemWatchRequest } from "./reel_item_watch_request.js"; +import { WatchNextRequest } from "./watch_next_request.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface GetWatchRequest { + context?: InnerTubeContext | undefined; + playerRequest?: PlayerRequest | undefined; + watchNextRequest?: WatchNextRequest | undefined; + reelItemWatchRequest?: ReelItemWatchRequest | undefined; +} + +function createBaseGetWatchRequest(): GetWatchRequest { + return { context: undefined, playerRequest: undefined, watchNextRequest: undefined, reelItemWatchRequest: undefined }; +} + +export const GetWatchRequest: MessageFns = { + encode(message: GetWatchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.context !== undefined) { + InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join(); + } + if (message.playerRequest !== undefined) { + PlayerRequest.encode(message.playerRequest, writer.uint32(18).fork()).join(); + } + if (message.watchNextRequest !== undefined) { + WatchNextRequest.encode(message.watchNextRequest, writer.uint32(26).fork()).join(); + } + if (message.reelItemWatchRequest !== undefined) { + ReelItemWatchRequest.encode(message.reelItemWatchRequest, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetWatchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetWatchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.context = InnerTubeContext.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.playerRequest = PlayerRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.watchNextRequest = WatchNextRequest.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.reelItemWatchRequest = ReelItemWatchRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetWatchRequest { + return { + context: isSet(object.context) ? InnerTubeContext.fromJSON(object.context) : undefined, + playerRequest: isSet(object.playerRequest) ? PlayerRequest.fromJSON(object.playerRequest) : undefined, + watchNextRequest: isSet(object.watchNextRequest) ? WatchNextRequest.fromJSON(object.watchNextRequest) : undefined, + reelItemWatchRequest: isSet(object.reelItemWatchRequest) + ? ReelItemWatchRequest.fromJSON(object.reelItemWatchRequest) + : undefined, + }; + }, + + toJSON(message: GetWatchRequest): unknown { + const obj: any = {}; + if (message.context !== undefined) { + obj.context = InnerTubeContext.toJSON(message.context); + } + if (message.playerRequest !== undefined) { + obj.playerRequest = PlayerRequest.toJSON(message.playerRequest); + } + if (message.watchNextRequest !== undefined) { + obj.watchNextRequest = WatchNextRequest.toJSON(message.watchNextRequest); + } + if (message.reelItemWatchRequest !== undefined) { + obj.reelItemWatchRequest = ReelItemWatchRequest.toJSON(message.reelItemWatchRequest); + } + return obj; + }, + + create, I>>(base?: I): GetWatchRequest { + return GetWatchRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetWatchRequest { + const message = createBaseGetWatchRequest(); + message.context = (object.context !== undefined && object.context !== null) + ? InnerTubeContext.fromPartial(object.context) + : undefined; + message.playerRequest = (object.playerRequest !== undefined && object.playerRequest !== null) + ? PlayerRequest.fromPartial(object.playerRequest) + : undefined; + message.watchNextRequest = (object.watchNextRequest !== undefined && object.watchNextRequest !== null) + ? WatchNextRequest.fromPartial(object.watchNextRequest) + : undefined; + message.reelItemWatchRequest = (object.reelItemWatchRequest !== undefined && object.reelItemWatchRequest !== null) + ? ReelItemWatchRequest.fromPartial(object.reelItemWatchRequest) + : undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/innertube_context.ts b/protos/generated/youtube/api/pfiinnertube/innertube_context.ts new file mode 100644 index 0000000000..370014d92c --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/innertube_context.ts @@ -0,0 +1,689 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/innertube_context.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { KeyValuePair } from "../../../misc/common.js"; +import { CapabilityInfo } from "./capability_info.js"; +import { ClientInfo } from "./client_info.js"; +import { RequestInfo } from "./request_info.js"; +import { ThirdPartyInfo } from "./third_party_info.js"; +import { UserInfo } from "./user_info.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface InnerTubeContext { + client?: ClientInfo | undefined; + user?: UserInfo | undefined; + capabilities?: CapabilityInfo | undefined; + request?: RequestInfo | undefined; + clickTracking?: InnerTubeContext_ClickTrackingInfo | undefined; + thirdParty?: ThirdPartyInfo | undefined; + remoteClient?: ClientInfo | undefined; + adSignalsInfo?: InnerTubeContext_AdSignalsInfo | undefined; + experimentalData?: InnerTubeContext_ExperimentalData | undefined; + clientScreenNonce?: string | undefined; + activePlayers: InnerTubeContext_ActivePlayerInfo[]; +} + +export interface InnerTubeContext_ExperimentalData { + params: KeyValuePair[]; +} + +export interface InnerTubeContext_ActivePlayerInfo { + playerContextParams?: Uint8Array | undefined; +} + +export interface InnerTubeContext_ClickTrackingInfo { + clickTrackingParams?: Uint8Array | undefined; +} + +export interface InnerTubeContext_AdSignalsInfo { + params: KeyValuePair[]; + bid?: string | undefined; + mutsuId?: string | undefined; + consentBumpState?: string | undefined; + advertisingId?: string | undefined; + limitAdTracking?: boolean | undefined; + attributionOsSupportedVersion?: string | undefined; +} + +function createBaseInnerTubeContext(): InnerTubeContext { + return { + client: undefined, + user: undefined, + capabilities: undefined, + request: undefined, + clickTracking: undefined, + thirdParty: undefined, + remoteClient: undefined, + adSignalsInfo: undefined, + experimentalData: undefined, + clientScreenNonce: undefined, + activePlayers: [], + }; +} + +export const InnerTubeContext: MessageFns = { + encode(message: InnerTubeContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.client !== undefined) { + ClientInfo.encode(message.client, writer.uint32(10).fork()).join(); + } + if (message.user !== undefined) { + UserInfo.encode(message.user, writer.uint32(26).fork()).join(); + } + if (message.capabilities !== undefined) { + CapabilityInfo.encode(message.capabilities, writer.uint32(34).fork()).join(); + } + if (message.request !== undefined) { + RequestInfo.encode(message.request, writer.uint32(42).fork()).join(); + } + if (message.clickTracking !== undefined) { + InnerTubeContext_ClickTrackingInfo.encode(message.clickTracking, writer.uint32(50).fork()).join(); + } + if (message.thirdParty !== undefined) { + ThirdPartyInfo.encode(message.thirdParty, writer.uint32(58).fork()).join(); + } + if (message.remoteClient !== undefined) { + ClientInfo.encode(message.remoteClient, writer.uint32(66).fork()).join(); + } + if (message.adSignalsInfo !== undefined) { + InnerTubeContext_AdSignalsInfo.encode(message.adSignalsInfo, writer.uint32(74).fork()).join(); + } + if (message.experimentalData !== undefined) { + InnerTubeContext_ExperimentalData.encode(message.experimentalData, writer.uint32(82).fork()).join(); + } + if (message.clientScreenNonce !== undefined) { + writer.uint32(90).string(message.clientScreenNonce); + } + for (const v of message.activePlayers) { + InnerTubeContext_ActivePlayerInfo.encode(v!, writer.uint32(98).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerTubeContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerTubeContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.client = ClientInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.user = UserInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.capabilities = CapabilityInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.request = RequestInfo.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.clickTracking = InnerTubeContext_ClickTrackingInfo.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.thirdParty = ThirdPartyInfo.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.remoteClient = ClientInfo.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.adSignalsInfo = InnerTubeContext_AdSignalsInfo.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.experimentalData = InnerTubeContext_ExperimentalData.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.clientScreenNonce = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.activePlayers.push(InnerTubeContext_ActivePlayerInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerTubeContext { + return { + client: isSet(object.client) ? ClientInfo.fromJSON(object.client) : undefined, + user: isSet(object.user) ? UserInfo.fromJSON(object.user) : undefined, + capabilities: isSet(object.capabilities) ? CapabilityInfo.fromJSON(object.capabilities) : undefined, + request: isSet(object.request) ? RequestInfo.fromJSON(object.request) : undefined, + clickTracking: isSet(object.clickTracking) + ? InnerTubeContext_ClickTrackingInfo.fromJSON(object.clickTracking) + : undefined, + thirdParty: isSet(object.thirdParty) ? ThirdPartyInfo.fromJSON(object.thirdParty) : undefined, + remoteClient: isSet(object.remoteClient) ? ClientInfo.fromJSON(object.remoteClient) : undefined, + adSignalsInfo: isSet(object.adSignalsInfo) + ? InnerTubeContext_AdSignalsInfo.fromJSON(object.adSignalsInfo) + : undefined, + experimentalData: isSet(object.experimentalData) + ? InnerTubeContext_ExperimentalData.fromJSON(object.experimentalData) + : undefined, + clientScreenNonce: isSet(object.clientScreenNonce) ? globalThis.String(object.clientScreenNonce) : undefined, + activePlayers: globalThis.Array.isArray(object?.activePlayers) + ? object.activePlayers.map((e: any) => InnerTubeContext_ActivePlayerInfo.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InnerTubeContext): unknown { + const obj: any = {}; + if (message.client !== undefined) { + obj.client = ClientInfo.toJSON(message.client); + } + if (message.user !== undefined) { + obj.user = UserInfo.toJSON(message.user); + } + if (message.capabilities !== undefined) { + obj.capabilities = CapabilityInfo.toJSON(message.capabilities); + } + if (message.request !== undefined) { + obj.request = RequestInfo.toJSON(message.request); + } + if (message.clickTracking !== undefined) { + obj.clickTracking = InnerTubeContext_ClickTrackingInfo.toJSON(message.clickTracking); + } + if (message.thirdParty !== undefined) { + obj.thirdParty = ThirdPartyInfo.toJSON(message.thirdParty); + } + if (message.remoteClient !== undefined) { + obj.remoteClient = ClientInfo.toJSON(message.remoteClient); + } + if (message.adSignalsInfo !== undefined) { + obj.adSignalsInfo = InnerTubeContext_AdSignalsInfo.toJSON(message.adSignalsInfo); + } + if (message.experimentalData !== undefined) { + obj.experimentalData = InnerTubeContext_ExperimentalData.toJSON(message.experimentalData); + } + if (message.clientScreenNonce !== undefined) { + obj.clientScreenNonce = message.clientScreenNonce; + } + if (message.activePlayers?.length) { + obj.activePlayers = message.activePlayers.map((e) => InnerTubeContext_ActivePlayerInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InnerTubeContext { + return InnerTubeContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InnerTubeContext { + const message = createBaseInnerTubeContext(); + message.client = (object.client !== undefined && object.client !== null) + ? ClientInfo.fromPartial(object.client) + : undefined; + message.user = (object.user !== undefined && object.user !== null) ? UserInfo.fromPartial(object.user) : undefined; + message.capabilities = (object.capabilities !== undefined && object.capabilities !== null) + ? CapabilityInfo.fromPartial(object.capabilities) + : undefined; + message.request = (object.request !== undefined && object.request !== null) + ? RequestInfo.fromPartial(object.request) + : undefined; + message.clickTracking = (object.clickTracking !== undefined && object.clickTracking !== null) + ? InnerTubeContext_ClickTrackingInfo.fromPartial(object.clickTracking) + : undefined; + message.thirdParty = (object.thirdParty !== undefined && object.thirdParty !== null) + ? ThirdPartyInfo.fromPartial(object.thirdParty) + : undefined; + message.remoteClient = (object.remoteClient !== undefined && object.remoteClient !== null) + ? ClientInfo.fromPartial(object.remoteClient) + : undefined; + message.adSignalsInfo = (object.adSignalsInfo !== undefined && object.adSignalsInfo !== null) + ? InnerTubeContext_AdSignalsInfo.fromPartial(object.adSignalsInfo) + : undefined; + message.experimentalData = (object.experimentalData !== undefined && object.experimentalData !== null) + ? InnerTubeContext_ExperimentalData.fromPartial(object.experimentalData) + : undefined; + message.clientScreenNonce = object.clientScreenNonce ?? undefined; + message.activePlayers = object.activePlayers?.map((e) => InnerTubeContext_ActivePlayerInfo.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInnerTubeContext_ExperimentalData(): InnerTubeContext_ExperimentalData { + return { params: [] }; +} + +export const InnerTubeContext_ExperimentalData: MessageFns = { + encode(message: InnerTubeContext_ExperimentalData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.params) { + KeyValuePair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerTubeContext_ExperimentalData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerTubeContext_ExperimentalData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params.push(KeyValuePair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerTubeContext_ExperimentalData { + return { + params: globalThis.Array.isArray(object?.params) ? object.params.map((e: any) => KeyValuePair.fromJSON(e)) : [], + }; + }, + + toJSON(message: InnerTubeContext_ExperimentalData): unknown { + const obj: any = {}; + if (message.params?.length) { + obj.params = message.params.map((e) => KeyValuePair.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I, + ): InnerTubeContext_ExperimentalData { + return InnerTubeContext_ExperimentalData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InnerTubeContext_ExperimentalData { + const message = createBaseInnerTubeContext_ExperimentalData(); + message.params = object.params?.map((e) => KeyValuePair.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseInnerTubeContext_ActivePlayerInfo(): InnerTubeContext_ActivePlayerInfo { + return { playerContextParams: undefined }; +} + +export const InnerTubeContext_ActivePlayerInfo: MessageFns = { + encode(message: InnerTubeContext_ActivePlayerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.playerContextParams !== undefined) { + writer.uint32(10).bytes(message.playerContextParams); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerTubeContext_ActivePlayerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerTubeContext_ActivePlayerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.playerContextParams = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerTubeContext_ActivePlayerInfo { + return { + playerContextParams: isSet(object.playerContextParams) ? bytesFromBase64(object.playerContextParams) : undefined, + }; + }, + + toJSON(message: InnerTubeContext_ActivePlayerInfo): unknown { + const obj: any = {}; + if (message.playerContextParams !== undefined) { + obj.playerContextParams = base64FromBytes(message.playerContextParams); + } + return obj; + }, + + create, I>>( + base?: I, + ): InnerTubeContext_ActivePlayerInfo { + return InnerTubeContext_ActivePlayerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InnerTubeContext_ActivePlayerInfo { + const message = createBaseInnerTubeContext_ActivePlayerInfo(); + message.playerContextParams = object.playerContextParams ?? undefined; + return message; + }, +}; + +function createBaseInnerTubeContext_ClickTrackingInfo(): InnerTubeContext_ClickTrackingInfo { + return { clickTrackingParams: undefined }; +} + +export const InnerTubeContext_ClickTrackingInfo: MessageFns = { + encode(message: InnerTubeContext_ClickTrackingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.clickTrackingParams !== undefined) { + writer.uint32(18).bytes(message.clickTrackingParams); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerTubeContext_ClickTrackingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerTubeContext_ClickTrackingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.clickTrackingParams = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerTubeContext_ClickTrackingInfo { + return { + clickTrackingParams: isSet(object.clickTrackingParams) ? bytesFromBase64(object.clickTrackingParams) : undefined, + }; + }, + + toJSON(message: InnerTubeContext_ClickTrackingInfo): unknown { + const obj: any = {}; + if (message.clickTrackingParams !== undefined) { + obj.clickTrackingParams = base64FromBytes(message.clickTrackingParams); + } + return obj; + }, + + create, I>>( + base?: I, + ): InnerTubeContext_ClickTrackingInfo { + return InnerTubeContext_ClickTrackingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InnerTubeContext_ClickTrackingInfo { + const message = createBaseInnerTubeContext_ClickTrackingInfo(); + message.clickTrackingParams = object.clickTrackingParams ?? undefined; + return message; + }, +}; + +function createBaseInnerTubeContext_AdSignalsInfo(): InnerTubeContext_AdSignalsInfo { + return { + params: [], + bid: undefined, + mutsuId: undefined, + consentBumpState: undefined, + advertisingId: undefined, + limitAdTracking: undefined, + attributionOsSupportedVersion: undefined, + }; +} + +export const InnerTubeContext_AdSignalsInfo: MessageFns = { + encode(message: InnerTubeContext_AdSignalsInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.params) { + KeyValuePair.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.bid !== undefined) { + writer.uint32(18).string(message.bid); + } + if (message.mutsuId !== undefined) { + writer.uint32(26).string(message.mutsuId); + } + if (message.consentBumpState !== undefined) { + writer.uint32(34).string(message.consentBumpState); + } + if (message.advertisingId !== undefined) { + writer.uint32(58).string(message.advertisingId); + } + if (message.limitAdTracking !== undefined) { + writer.uint32(72).bool(message.limitAdTracking); + } + if (message.attributionOsSupportedVersion !== undefined) { + writer.uint32(82).string(message.attributionOsSupportedVersion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerTubeContext_AdSignalsInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerTubeContext_AdSignalsInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params.push(KeyValuePair.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bid = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.mutsuId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consentBumpState = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.advertisingId = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.limitAdTracking = reader.bool(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.attributionOsSupportedVersion = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerTubeContext_AdSignalsInfo { + return { + params: globalThis.Array.isArray(object?.params) ? object.params.map((e: any) => KeyValuePair.fromJSON(e)) : [], + bid: isSet(object.bid) ? globalThis.String(object.bid) : undefined, + mutsuId: isSet(object.mutsuId) ? globalThis.String(object.mutsuId) : undefined, + consentBumpState: isSet(object.consentBumpState) ? globalThis.String(object.consentBumpState) : undefined, + advertisingId: isSet(object.advertisingId) ? globalThis.String(object.advertisingId) : undefined, + limitAdTracking: isSet(object.limitAdTracking) ? globalThis.Boolean(object.limitAdTracking) : undefined, + attributionOsSupportedVersion: isSet(object.attributionOsSupportedVersion) + ? globalThis.String(object.attributionOsSupportedVersion) + : undefined, + }; + }, + + toJSON(message: InnerTubeContext_AdSignalsInfo): unknown { + const obj: any = {}; + if (message.params?.length) { + obj.params = message.params.map((e) => KeyValuePair.toJSON(e)); + } + if (message.bid !== undefined) { + obj.bid = message.bid; + } + if (message.mutsuId !== undefined) { + obj.mutsuId = message.mutsuId; + } + if (message.consentBumpState !== undefined) { + obj.consentBumpState = message.consentBumpState; + } + if (message.advertisingId !== undefined) { + obj.advertisingId = message.advertisingId; + } + if (message.limitAdTracking !== undefined) { + obj.limitAdTracking = message.limitAdTracking; + } + if (message.attributionOsSupportedVersion !== undefined) { + obj.attributionOsSupportedVersion = message.attributionOsSupportedVersion; + } + return obj; + }, + + create, I>>(base?: I): InnerTubeContext_AdSignalsInfo { + return InnerTubeContext_AdSignalsInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): InnerTubeContext_AdSignalsInfo { + const message = createBaseInnerTubeContext_AdSignalsInfo(); + message.params = object.params?.map((e) => KeyValuePair.fromPartial(e)) || []; + message.bid = object.bid ?? undefined; + message.mutsuId = object.mutsuId ?? undefined; + message.consentBumpState = object.consentBumpState ?? undefined; + message.advertisingId = object.advertisingId ?? undefined; + message.limitAdTracking = object.limitAdTracking ?? undefined; + message.attributionOsSupportedVersion = object.attributionOsSupportedVersion ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/metadata_update_request.ts b/protos/generated/youtube/api/pfiinnertube/metadata_update_request.ts new file mode 100644 index 0000000000..a4aa2f3929 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/metadata_update_request.ts @@ -0,0 +1,1409 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/metadata_update_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { InnerTubeContext } from "./innertube_context.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface MetadataUpdateRequest { + context?: InnerTubeContext | undefined; + encryptedVideoId?: string | undefined; + title?: MetadataUpdateRequest_MdeTitleUpdateRequest | undefined; + description?: MetadataUpdateRequest_MdeDescriptionUpdateRequest | undefined; + privacy?: MetadataUpdateRequest_MdePrivacyUpdateRequest | undefined; + tags?: MetadataUpdateRequest_MdeTagsUpdateRequest | undefined; + category?: MetadataUpdateRequest_MdeCategoryUpdateRequest | undefined; + license?: MetadataUpdateRequest_MdeLicenseUpdateRequest | undefined; + ageRestriction?: MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest | undefined; + videoStill?: MetadataUpdateRequest_MdeVideoStillRequestParams | undefined; + madeForKids?: MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams | undefined; + racy?: MetadataUpdateRequest_MdeRacyRequestParams | undefined; +} + +export interface MetadataUpdateRequest_MdeTitleUpdateRequest { + newTitle?: string | undefined; +} + +export interface MetadataUpdateRequest_MdeDescriptionUpdateRequest { + newDescription?: string | undefined; +} + +export interface MetadataUpdateRequest_MdePrivacyUpdateRequest { + newPrivacy?: number | undefined; + clearPrivacyDraft?: boolean | undefined; +} + +export interface MetadataUpdateRequest_MdeTagsUpdateRequest { + newTags: string[]; +} + +export interface MetadataUpdateRequest_MdeCategoryUpdateRequest { + newCategoryId?: number | undefined; +} + +export interface MetadataUpdateRequest_MdeLicenseUpdateRequest { + newLicenseId?: string | undefined; +} + +export interface MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams { + operation?: number | undefined; + newMfk?: number | undefined; +} + +export interface MetadataUpdateRequest_MdeRacyRequestParams { + operation?: number | undefined; + newRacy?: number | undefined; +} + +export interface MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest { + newIsAgeRestricted?: boolean | undefined; +} + +export interface MetadataUpdateRequest_MdeVideoStillRequestParams { + operation?: number | undefined; + newStillId?: number | undefined; + image?: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage | undefined; + testImage?: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage | undefined; + experimentImage: MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData[]; +} + +export interface MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData { + image?: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage | undefined; +} + +export interface MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage { + rawBytes?: Uint8Array | undefined; + dataUri?: string | undefined; + frameTimestampUs?: number | undefined; + isVertical?: boolean | undefined; +} + +function createBaseMetadataUpdateRequest(): MetadataUpdateRequest { + return { + context: undefined, + encryptedVideoId: undefined, + title: undefined, + description: undefined, + privacy: undefined, + tags: undefined, + category: undefined, + license: undefined, + ageRestriction: undefined, + videoStill: undefined, + madeForKids: undefined, + racy: undefined, + }; +} + +export const MetadataUpdateRequest: MessageFns = { + encode(message: MetadataUpdateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.context !== undefined) { + InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join(); + } + if (message.encryptedVideoId !== undefined) { + writer.uint32(18).string(message.encryptedVideoId); + } + if (message.title !== undefined) { + MetadataUpdateRequest_MdeTitleUpdateRequest.encode(message.title, writer.uint32(26).fork()).join(); + } + if (message.description !== undefined) { + MetadataUpdateRequest_MdeDescriptionUpdateRequest.encode(message.description, writer.uint32(34).fork()).join(); + } + if (message.privacy !== undefined) { + MetadataUpdateRequest_MdePrivacyUpdateRequest.encode(message.privacy, writer.uint32(42).fork()).join(); + } + if (message.tags !== undefined) { + MetadataUpdateRequest_MdeTagsUpdateRequest.encode(message.tags, writer.uint32(50).fork()).join(); + } + if (message.category !== undefined) { + MetadataUpdateRequest_MdeCategoryUpdateRequest.encode(message.category, writer.uint32(58).fork()).join(); + } + if (message.license !== undefined) { + MetadataUpdateRequest_MdeLicenseUpdateRequest.encode(message.license, writer.uint32(66).fork()).join(); + } + if (message.ageRestriction !== undefined) { + MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.encode(message.ageRestriction, writer.uint32(90).fork()) + .join(); + } + if (message.videoStill !== undefined) { + MetadataUpdateRequest_MdeVideoStillRequestParams.encode(message.videoStill, writer.uint32(162).fork()).join(); + } + if (message.madeForKids !== undefined) { + MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.encode(message.madeForKids, writer.uint32(546).fork()) + .join(); + } + if (message.racy !== undefined) { + MetadataUpdateRequest_MdeRacyRequestParams.encode(message.racy, writer.uint32(554).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.context = InnerTubeContext.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.encryptedVideoId = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.title = MetadataUpdateRequest_MdeTitleUpdateRequest.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.description = MetadataUpdateRequest_MdeDescriptionUpdateRequest.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.privacy = MetadataUpdateRequest_MdePrivacyUpdateRequest.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tags = MetadataUpdateRequest_MdeTagsUpdateRequest.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.category = MetadataUpdateRequest_MdeCategoryUpdateRequest.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.license = MetadataUpdateRequest_MdeLicenseUpdateRequest.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.ageRestriction = MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.videoStill = MetadataUpdateRequest_MdeVideoStillRequestParams.decode(reader, reader.uint32()); + continue; + case 68: + if (tag !== 546) { + break; + } + + message.madeForKids = MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.decode(reader, reader.uint32()); + continue; + case 69: + if (tag !== 554) { + break; + } + + message.racy = MetadataUpdateRequest_MdeRacyRequestParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest { + return { + context: isSet(object.context) ? InnerTubeContext.fromJSON(object.context) : undefined, + encryptedVideoId: isSet(object.encryptedVideoId) ? globalThis.String(object.encryptedVideoId) : undefined, + title: isSet(object.title) ? MetadataUpdateRequest_MdeTitleUpdateRequest.fromJSON(object.title) : undefined, + description: isSet(object.description) + ? MetadataUpdateRequest_MdeDescriptionUpdateRequest.fromJSON(object.description) + : undefined, + privacy: isSet(object.privacy) + ? MetadataUpdateRequest_MdePrivacyUpdateRequest.fromJSON(object.privacy) + : undefined, + tags: isSet(object.tags) ? MetadataUpdateRequest_MdeTagsUpdateRequest.fromJSON(object.tags) : undefined, + category: isSet(object.category) + ? MetadataUpdateRequest_MdeCategoryUpdateRequest.fromJSON(object.category) + : undefined, + license: isSet(object.license) + ? MetadataUpdateRequest_MdeLicenseUpdateRequest.fromJSON(object.license) + : undefined, + ageRestriction: isSet(object.ageRestriction) + ? MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.fromJSON(object.ageRestriction) + : undefined, + videoStill: isSet(object.videoStill) + ? MetadataUpdateRequest_MdeVideoStillRequestParams.fromJSON(object.videoStill) + : undefined, + madeForKids: isSet(object.madeForKids) + ? MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.fromJSON(object.madeForKids) + : undefined, + racy: isSet(object.racy) ? MetadataUpdateRequest_MdeRacyRequestParams.fromJSON(object.racy) : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest): unknown { + const obj: any = {}; + if (message.context !== undefined) { + obj.context = InnerTubeContext.toJSON(message.context); + } + if (message.encryptedVideoId !== undefined) { + obj.encryptedVideoId = message.encryptedVideoId; + } + if (message.title !== undefined) { + obj.title = MetadataUpdateRequest_MdeTitleUpdateRequest.toJSON(message.title); + } + if (message.description !== undefined) { + obj.description = MetadataUpdateRequest_MdeDescriptionUpdateRequest.toJSON(message.description); + } + if (message.privacy !== undefined) { + obj.privacy = MetadataUpdateRequest_MdePrivacyUpdateRequest.toJSON(message.privacy); + } + if (message.tags !== undefined) { + obj.tags = MetadataUpdateRequest_MdeTagsUpdateRequest.toJSON(message.tags); + } + if (message.category !== undefined) { + obj.category = MetadataUpdateRequest_MdeCategoryUpdateRequest.toJSON(message.category); + } + if (message.license !== undefined) { + obj.license = MetadataUpdateRequest_MdeLicenseUpdateRequest.toJSON(message.license); + } + if (message.ageRestriction !== undefined) { + obj.ageRestriction = MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.toJSON(message.ageRestriction); + } + if (message.videoStill !== undefined) { + obj.videoStill = MetadataUpdateRequest_MdeVideoStillRequestParams.toJSON(message.videoStill); + } + if (message.madeForKids !== undefined) { + obj.madeForKids = MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.toJSON(message.madeForKids); + } + if (message.racy !== undefined) { + obj.racy = MetadataUpdateRequest_MdeRacyRequestParams.toJSON(message.racy); + } + return obj; + }, + + create, I>>(base?: I): MetadataUpdateRequest { + return MetadataUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MetadataUpdateRequest { + const message = createBaseMetadataUpdateRequest(); + message.context = (object.context !== undefined && object.context !== null) + ? InnerTubeContext.fromPartial(object.context) + : undefined; + message.encryptedVideoId = object.encryptedVideoId ?? undefined; + message.title = (object.title !== undefined && object.title !== null) + ? MetadataUpdateRequest_MdeTitleUpdateRequest.fromPartial(object.title) + : undefined; + message.description = (object.description !== undefined && object.description !== null) + ? MetadataUpdateRequest_MdeDescriptionUpdateRequest.fromPartial(object.description) + : undefined; + message.privacy = (object.privacy !== undefined && object.privacy !== null) + ? MetadataUpdateRequest_MdePrivacyUpdateRequest.fromPartial(object.privacy) + : undefined; + message.tags = (object.tags !== undefined && object.tags !== null) + ? MetadataUpdateRequest_MdeTagsUpdateRequest.fromPartial(object.tags) + : undefined; + message.category = (object.category !== undefined && object.category !== null) + ? MetadataUpdateRequest_MdeCategoryUpdateRequest.fromPartial(object.category) + : undefined; + message.license = (object.license !== undefined && object.license !== null) + ? MetadataUpdateRequest_MdeLicenseUpdateRequest.fromPartial(object.license) + : undefined; + message.ageRestriction = (object.ageRestriction !== undefined && object.ageRestriction !== null) + ? MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.fromPartial(object.ageRestriction) + : undefined; + message.videoStill = (object.videoStill !== undefined && object.videoStill !== null) + ? MetadataUpdateRequest_MdeVideoStillRequestParams.fromPartial(object.videoStill) + : undefined; + message.madeForKids = (object.madeForKids !== undefined && object.madeForKids !== null) + ? MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.fromPartial(object.madeForKids) + : undefined; + message.racy = (object.racy !== undefined && object.racy !== null) + ? MetadataUpdateRequest_MdeRacyRequestParams.fromPartial(object.racy) + : undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeTitleUpdateRequest(): MetadataUpdateRequest_MdeTitleUpdateRequest { + return { newTitle: undefined }; +} + +export const MetadataUpdateRequest_MdeTitleUpdateRequest: MessageFns = { + encode( + message: MetadataUpdateRequest_MdeTitleUpdateRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.newTitle !== undefined) { + writer.uint32(10).string(message.newTitle); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeTitleUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeTitleUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.newTitle = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeTitleUpdateRequest { + return { newTitle: isSet(object.newTitle) ? globalThis.String(object.newTitle) : undefined }; + }, + + toJSON(message: MetadataUpdateRequest_MdeTitleUpdateRequest): unknown { + const obj: any = {}; + if (message.newTitle !== undefined) { + obj.newTitle = message.newTitle; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeTitleUpdateRequest { + return MetadataUpdateRequest_MdeTitleUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeTitleUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdeTitleUpdateRequest(); + message.newTitle = object.newTitle ?? undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeDescriptionUpdateRequest(): MetadataUpdateRequest_MdeDescriptionUpdateRequest { + return { newDescription: undefined }; +} + +export const MetadataUpdateRequest_MdeDescriptionUpdateRequest: MessageFns< + MetadataUpdateRequest_MdeDescriptionUpdateRequest +> = { + encode( + message: MetadataUpdateRequest_MdeDescriptionUpdateRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.newDescription !== undefined) { + writer.uint32(10).string(message.newDescription); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeDescriptionUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeDescriptionUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.newDescription = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeDescriptionUpdateRequest { + return { newDescription: isSet(object.newDescription) ? globalThis.String(object.newDescription) : undefined }; + }, + + toJSON(message: MetadataUpdateRequest_MdeDescriptionUpdateRequest): unknown { + const obj: any = {}; + if (message.newDescription !== undefined) { + obj.newDescription = message.newDescription; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeDescriptionUpdateRequest { + return MetadataUpdateRequest_MdeDescriptionUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeDescriptionUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdeDescriptionUpdateRequest(); + message.newDescription = object.newDescription ?? undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdePrivacyUpdateRequest(): MetadataUpdateRequest_MdePrivacyUpdateRequest { + return { newPrivacy: undefined, clearPrivacyDraft: undefined }; +} + +export const MetadataUpdateRequest_MdePrivacyUpdateRequest: MessageFns = + { + encode( + message: MetadataUpdateRequest_MdePrivacyUpdateRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.newPrivacy !== undefined) { + writer.uint32(8).int32(message.newPrivacy); + } + if (message.clearPrivacyDraft !== undefined) { + writer.uint32(16).bool(message.clearPrivacyDraft); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdePrivacyUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdePrivacyUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.newPrivacy = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.clearPrivacyDraft = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdePrivacyUpdateRequest { + return { + newPrivacy: isSet(object.newPrivacy) ? globalThis.Number(object.newPrivacy) : undefined, + clearPrivacyDraft: isSet(object.clearPrivacyDraft) ? globalThis.Boolean(object.clearPrivacyDraft) : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest_MdePrivacyUpdateRequest): unknown { + const obj: any = {}; + if (message.newPrivacy !== undefined) { + obj.newPrivacy = Math.round(message.newPrivacy); + } + if (message.clearPrivacyDraft !== undefined) { + obj.clearPrivacyDraft = message.clearPrivacyDraft; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdePrivacyUpdateRequest { + return MetadataUpdateRequest_MdePrivacyUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdePrivacyUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdePrivacyUpdateRequest(); + message.newPrivacy = object.newPrivacy ?? undefined; + message.clearPrivacyDraft = object.clearPrivacyDraft ?? undefined; + return message; + }, + }; + +function createBaseMetadataUpdateRequest_MdeTagsUpdateRequest(): MetadataUpdateRequest_MdeTagsUpdateRequest { + return { newTags: [] }; +} + +export const MetadataUpdateRequest_MdeTagsUpdateRequest: MessageFns = { + encode(message: MetadataUpdateRequest_MdeTagsUpdateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.newTags) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeTagsUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeTagsUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.newTags.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeTagsUpdateRequest { + return { + newTags: globalThis.Array.isArray(object?.newTags) ? object.newTags.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeTagsUpdateRequest): unknown { + const obj: any = {}; + if (message.newTags?.length) { + obj.newTags = message.newTags; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeTagsUpdateRequest { + return MetadataUpdateRequest_MdeTagsUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeTagsUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdeTagsUpdateRequest(); + message.newTags = object.newTags?.map((e) => e) || []; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeCategoryUpdateRequest(): MetadataUpdateRequest_MdeCategoryUpdateRequest { + return { newCategoryId: undefined }; +} + +export const MetadataUpdateRequest_MdeCategoryUpdateRequest: MessageFns< + MetadataUpdateRequest_MdeCategoryUpdateRequest +> = { + encode( + message: MetadataUpdateRequest_MdeCategoryUpdateRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.newCategoryId !== undefined) { + writer.uint32(8).int32(message.newCategoryId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeCategoryUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeCategoryUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.newCategoryId = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeCategoryUpdateRequest { + return { newCategoryId: isSet(object.newCategoryId) ? globalThis.Number(object.newCategoryId) : undefined }; + }, + + toJSON(message: MetadataUpdateRequest_MdeCategoryUpdateRequest): unknown { + const obj: any = {}; + if (message.newCategoryId !== undefined) { + obj.newCategoryId = Math.round(message.newCategoryId); + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeCategoryUpdateRequest { + return MetadataUpdateRequest_MdeCategoryUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeCategoryUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdeCategoryUpdateRequest(); + message.newCategoryId = object.newCategoryId ?? undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeLicenseUpdateRequest(): MetadataUpdateRequest_MdeLicenseUpdateRequest { + return { newLicenseId: undefined }; +} + +export const MetadataUpdateRequest_MdeLicenseUpdateRequest: MessageFns = + { + encode( + message: MetadataUpdateRequest_MdeLicenseUpdateRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.newLicenseId !== undefined) { + writer.uint32(10).string(message.newLicenseId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeLicenseUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeLicenseUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.newLicenseId = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeLicenseUpdateRequest { + return { newLicenseId: isSet(object.newLicenseId) ? globalThis.String(object.newLicenseId) : undefined }; + }, + + toJSON(message: MetadataUpdateRequest_MdeLicenseUpdateRequest): unknown { + const obj: any = {}; + if (message.newLicenseId !== undefined) { + obj.newLicenseId = message.newLicenseId; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeLicenseUpdateRequest { + return MetadataUpdateRequest_MdeLicenseUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeLicenseUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdeLicenseUpdateRequest(); + message.newLicenseId = object.newLicenseId ?? undefined; + return message; + }, + }; + +function createBaseMetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams(): MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams { + return { operation: undefined, newMfk: undefined }; +} + +export const MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams: MessageFns< + MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams +> = { + encode( + message: MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.operation !== undefined) { + writer.uint32(8).int32(message.operation); + } + if (message.newMfk !== undefined) { + writer.uint32(16).int32(message.newMfk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.operation = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.newMfk = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams { + return { + operation: isSet(object.operation) ? globalThis.Number(object.operation) : undefined, + newMfk: isSet(object.newMfk) ? globalThis.Number(object.newMfk) : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams): unknown { + const obj: any = {}; + if (message.operation !== undefined) { + obj.operation = Math.round(message.operation); + } + if (message.newMfk !== undefined) { + obj.newMfk = Math.round(message.newMfk); + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams { + return MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams { + const message = createBaseMetadataUpdateRequest_MdeMadeForKidsUpdateRequestParams(); + message.operation = object.operation ?? undefined; + message.newMfk = object.newMfk ?? undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeRacyRequestParams(): MetadataUpdateRequest_MdeRacyRequestParams { + return { operation: undefined, newRacy: undefined }; +} + +export const MetadataUpdateRequest_MdeRacyRequestParams: MessageFns = { + encode(message: MetadataUpdateRequest_MdeRacyRequestParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operation !== undefined) { + writer.uint32(8).int32(message.operation); + } + if (message.newRacy !== undefined) { + writer.uint32(16).int32(message.newRacy); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeRacyRequestParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeRacyRequestParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.operation = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.newRacy = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeRacyRequestParams { + return { + operation: isSet(object.operation) ? globalThis.Number(object.operation) : undefined, + newRacy: isSet(object.newRacy) ? globalThis.Number(object.newRacy) : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeRacyRequestParams): unknown { + const obj: any = {}; + if (message.operation !== undefined) { + obj.operation = Math.round(message.operation); + } + if (message.newRacy !== undefined) { + obj.newRacy = Math.round(message.newRacy); + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeRacyRequestParams { + return MetadataUpdateRequest_MdeRacyRequestParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeRacyRequestParams { + const message = createBaseMetadataUpdateRequest_MdeRacyRequestParams(); + message.operation = object.operation ?? undefined; + message.newRacy = object.newRacy ?? undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeAgeRestrictionUpdateRequest(): MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest { + return { newIsAgeRestricted: undefined }; +} + +export const MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest: MessageFns< + MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest +> = { + encode( + message: MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.newIsAgeRestricted !== undefined) { + writer.uint32(8).bool(message.newIsAgeRestricted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeAgeRestrictionUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.newIsAgeRestricted = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest { + return { + newIsAgeRestricted: isSet(object.newIsAgeRestricted) ? globalThis.Boolean(object.newIsAgeRestricted) : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest): unknown { + const obj: any = {}; + if (message.newIsAgeRestricted !== undefined) { + obj.newIsAgeRestricted = message.newIsAgeRestricted; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest { + return MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeAgeRestrictionUpdateRequest { + const message = createBaseMetadataUpdateRequest_MdeAgeRestrictionUpdateRequest(); + message.newIsAgeRestricted = object.newIsAgeRestricted ?? undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeVideoStillRequestParams(): MetadataUpdateRequest_MdeVideoStillRequestParams { + return { operation: undefined, newStillId: undefined, image: undefined, testImage: undefined, experimentImage: [] }; +} + +export const MetadataUpdateRequest_MdeVideoStillRequestParams: MessageFns< + MetadataUpdateRequest_MdeVideoStillRequestParams +> = { + encode( + message: MetadataUpdateRequest_MdeVideoStillRequestParams, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.operation !== undefined) { + writer.uint32(8).int32(message.operation); + } + if (message.newStillId !== undefined) { + writer.uint32(16).int32(message.newStillId); + } + if (message.image !== undefined) { + MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.encode( + message.image, + writer.uint32(26).fork(), + ).join(); + } + if (message.testImage !== undefined) { + MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.encode( + message.testImage, + writer.uint32(34).fork(), + ).join(); + } + for (const v of message.experimentImage) { + MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.encode(v!, writer.uint32(50).fork()) + .join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MetadataUpdateRequest_MdeVideoStillRequestParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.operation = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.newStillId = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.image = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.decode( + reader, + reader.uint32(), + ); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.testImage = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.decode( + reader, + reader.uint32(), + ); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.experimentImage.push( + MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.decode( + reader, + reader.uint32(), + ), + ); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeVideoStillRequestParams { + return { + operation: isSet(object.operation) ? globalThis.Number(object.operation) : undefined, + newStillId: isSet(object.newStillId) ? globalThis.Number(object.newStillId) : undefined, + image: isSet(object.image) + ? MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromJSON(object.image) + : undefined, + testImage: isSet(object.testImage) + ? MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromJSON(object.testImage) + : undefined, + experimentImage: globalThis.Array.isArray(object?.experimentImage) + ? object.experimentImage.map((e: any) => + MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.fromJSON(e) + ) + : [], + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeVideoStillRequestParams): unknown { + const obj: any = {}; + if (message.operation !== undefined) { + obj.operation = Math.round(message.operation); + } + if (message.newStillId !== undefined) { + obj.newStillId = Math.round(message.newStillId); + } + if (message.image !== undefined) { + obj.image = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.toJSON(message.image); + } + if (message.testImage !== undefined) { + obj.testImage = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.toJSON(message.testImage); + } + if (message.experimentImage?.length) { + obj.experimentImage = message.experimentImage.map((e) => + MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.toJSON(e) + ); + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeVideoStillRequestParams { + return MetadataUpdateRequest_MdeVideoStillRequestParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeVideoStillRequestParams { + const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams(); + message.operation = object.operation ?? undefined; + message.newStillId = object.newStillId ?? undefined; + message.image = (object.image !== undefined && object.image !== null) + ? MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromPartial(object.image) + : undefined; + message.testImage = (object.testImage !== undefined && object.testImage !== null) + ? MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromPartial(object.testImage) + : undefined; + message.experimentImage = + object.experimentImage?.map((e) => + MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.fromPartial(e) + ) || []; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData(): MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData { + return { image: undefined }; +} + +export const MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData: MessageFns< + MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData +> = { + encode( + message: MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.image !== undefined) { + MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.encode( + message.image, + writer.uint32(10).fork(), + ).join(); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.image = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.decode( + reader, + reader.uint32(), + ); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData { + return { + image: isSet(object.image) + ? MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromJSON(object.image) + : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData): unknown { + const obj: any = {}; + if (message.image !== undefined) { + obj.image = MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.toJSON(message.image); + } + return obj; + }, + + create< + I extends Exact, I>, + >(base?: I): MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData { + return MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData.fromPartial( + base ?? ({} as any), + ); + }, + fromPartial< + I extends Exact, I>, + >(object: I): MetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData { + const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_ThumbnailExperimentImageData(); + message.image = (object.image !== undefined && object.image !== null) + ? MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromPartial(object.image) + : undefined; + return message; + }, +}; + +function createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage(): MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage { + return { rawBytes: undefined, dataUri: undefined, frameTimestampUs: undefined, isVertical: undefined }; +} + +export const MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage: MessageFns< + MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage +> = { + encode( + message: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.rawBytes !== undefined) { + writer.uint32(10).bytes(message.rawBytes); + } + if (message.dataUri !== undefined) { + writer.uint32(18).string(message.dataUri); + } + if (message.frameTimestampUs !== undefined) { + writer.uint32(32).int64(message.frameTimestampUs); + } + if (message.isVertical !== undefined) { + writer.uint32(40).bool(message.isVertical); + } + return writer; + }, + + decode( + input: BinaryReader | Uint8Array, + length?: number, + ): MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rawBytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.dataUri = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.frameTimestampUs = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.isVertical = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage { + return { + rawBytes: isSet(object.rawBytes) ? bytesFromBase64(object.rawBytes) : undefined, + dataUri: isSet(object.dataUri) ? globalThis.String(object.dataUri) : undefined, + frameTimestampUs: isSet(object.frameTimestampUs) ? globalThis.Number(object.frameTimestampUs) : undefined, + isVertical: isSet(object.isVertical) ? globalThis.Boolean(object.isVertical) : undefined, + }; + }, + + toJSON(message: MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage): unknown { + const obj: any = {}; + if (message.rawBytes !== undefined) { + obj.rawBytes = base64FromBytes(message.rawBytes); + } + if (message.dataUri !== undefined) { + obj.dataUri = message.dataUri; + } + if (message.frameTimestampUs !== undefined) { + obj.frameTimestampUs = Math.round(message.frameTimestampUs); + } + if (message.isVertical !== undefined) { + obj.isVertical = message.isVertical; + } + return obj; + }, + + create, I>>( + base?: I, + ): MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage { + return MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage { + const message = createBaseMetadataUpdateRequest_MdeVideoStillRequestParams_CustomThumbnailImage(); + message.rawBytes = object.rawBytes ?? undefined; + message.dataUri = object.dataUri ?? undefined; + message.frameTimestampUs = object.frameTimestampUs ?? undefined; + message.isVertical = object.isVertical ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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 longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +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/protos/generated/youtube/api/pfiinnertube/playback_context.ts b/protos/generated/youtube/api/pfiinnertube/playback_context.ts new file mode 100644 index 0000000000..dea76cde20 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/playback_context.ts @@ -0,0 +1,728 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/playback_context.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface PlaybackContext { + contentPlaybackContext?: PlaybackContext_ContentPlaybackContext | undefined; +} + +export interface PlaybackContext_ContentPlaybackContext { + deviceSignals?: string | undefined; + revShareClientId?: string | undefined; + timeSinceLastAdSeconds?: number | undefined; + lactMilliseconds?: number | undefined; + autoplaysSinceLastAd?: number | undefined; + vis?: number | undefined; + fling?: boolean | undefined; + splay?: boolean | undefined; + autoplay?: boolean | undefined; + timeOfLastInstreamPrerollAd?: number | undefined; + currentUrl?: string | undefined; + referer?: string | undefined; + loadAnnotationsByDemand?: boolean | undefined; + autoCaptionsDefaultOn?: + | boolean + | undefined; + /** optional ForceAdParameters force_ad_parameters = 25; */ + slicedBread?: boolean | undefined; + autonav?: boolean | undefined; + trailer?: + | boolean + | undefined; + /** + * optional MdxPlaybackContext mdx_context = 31; + * optional LivePlaybackContext live_context = 32; + */ + playerWidthPixels?: number | undefined; + playerHeightPixels?: + | number + | undefined; + /** optional Html5Preference html5_preference = 36; */ + snd?: number | undefined; + vnd?: + | number + | undefined; + /** optional UnpluggedContentPlaybackContext unplugged_context = 40; */ + uao?: number | undefined; + mutedAutoplay?: + | boolean + | undefined; + /** optional AutonavSettingsState autonav_state = 45; */ + enablePrivacyFilter?: boolean | undefined; + isLivingRoomDeeplink?: boolean | undefined; + signatureTimestamp?: + | number + | undefined; + /** optional TrailerPlaybackContext trailer_context = 49; */ + isInlinePlaybackNoAd?: boolean | undefined; + isInlineUnmutedPlayback?: + | boolean + | undefined; + /** + * optional CustomTabContext custom_tab_context = 52; + * optional VideoPlaybackPosition player_playback_position = 54; + */ + playPackageVersion?: + | number + | undefined; + /** + * optional CoWatchPlaybackContext co_watch_context = 56; + * optional WatchAmbientModePlaybackContext watch_ambient_mode_context = 57; + * optional CompositeVideoPlaybackContext composite_video_context = 58; + */ + isSequenceEntry?: boolean | undefined; +} + +function createBasePlaybackContext(): PlaybackContext { + return { contentPlaybackContext: undefined }; +} + +export const PlaybackContext: MessageFns = { + encode(message: PlaybackContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.contentPlaybackContext !== undefined) { + PlaybackContext_ContentPlaybackContext.encode(message.contentPlaybackContext, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlaybackContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlaybackContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contentPlaybackContext = PlaybackContext_ContentPlaybackContext.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlaybackContext { + return { + contentPlaybackContext: isSet(object.contentPlaybackContext) + ? PlaybackContext_ContentPlaybackContext.fromJSON(object.contentPlaybackContext) + : undefined, + }; + }, + + toJSON(message: PlaybackContext): unknown { + const obj: any = {}; + if (message.contentPlaybackContext !== undefined) { + obj.contentPlaybackContext = PlaybackContext_ContentPlaybackContext.toJSON(message.contentPlaybackContext); + } + return obj; + }, + + create, I>>(base?: I): PlaybackContext { + return PlaybackContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlaybackContext { + const message = createBasePlaybackContext(); + message.contentPlaybackContext = + (object.contentPlaybackContext !== undefined && object.contentPlaybackContext !== null) + ? PlaybackContext_ContentPlaybackContext.fromPartial(object.contentPlaybackContext) + : undefined; + return message; + }, +}; + +function createBasePlaybackContext_ContentPlaybackContext(): PlaybackContext_ContentPlaybackContext { + return { + deviceSignals: undefined, + revShareClientId: undefined, + timeSinceLastAdSeconds: undefined, + lactMilliseconds: undefined, + autoplaysSinceLastAd: undefined, + vis: undefined, + fling: undefined, + splay: undefined, + autoplay: undefined, + timeOfLastInstreamPrerollAd: undefined, + currentUrl: undefined, + referer: undefined, + loadAnnotationsByDemand: undefined, + autoCaptionsDefaultOn: undefined, + slicedBread: undefined, + autonav: undefined, + trailer: undefined, + playerWidthPixels: undefined, + playerHeightPixels: undefined, + snd: undefined, + vnd: undefined, + uao: undefined, + mutedAutoplay: undefined, + enablePrivacyFilter: undefined, + isLivingRoomDeeplink: undefined, + signatureTimestamp: undefined, + isInlinePlaybackNoAd: undefined, + isInlineUnmutedPlayback: undefined, + playPackageVersion: undefined, + isSequenceEntry: undefined, + }; +} + +export const PlaybackContext_ContentPlaybackContext: MessageFns = { + encode(message: PlaybackContext_ContentPlaybackContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deviceSignals !== undefined) { + writer.uint32(10).string(message.deviceSignals); + } + if (message.revShareClientId !== undefined) { + writer.uint32(26).string(message.revShareClientId); + } + if (message.timeSinceLastAdSeconds !== undefined) { + writer.uint32(32).uint32(message.timeSinceLastAdSeconds); + } + if (message.lactMilliseconds !== undefined) { + writer.uint32(40).int64(message.lactMilliseconds); + } + if (message.autoplaysSinceLastAd !== undefined) { + writer.uint32(48).uint32(message.autoplaysSinceLastAd); + } + if (message.vis !== undefined) { + writer.uint32(64).uint32(message.vis); + } + if (message.fling !== undefined) { + writer.uint32(72).bool(message.fling); + } + if (message.splay !== undefined) { + writer.uint32(80).bool(message.splay); + } + if (message.autoplay !== undefined) { + writer.uint32(88).bool(message.autoplay); + } + if (message.timeOfLastInstreamPrerollAd !== undefined) { + writer.uint32(104).uint64(message.timeOfLastInstreamPrerollAd); + } + if (message.currentUrl !== undefined) { + writer.uint32(122).string(message.currentUrl); + } + if (message.referer !== undefined) { + writer.uint32(130).string(message.referer); + } + if (message.loadAnnotationsByDemand !== undefined) { + writer.uint32(184).bool(message.loadAnnotationsByDemand); + } + if (message.autoCaptionsDefaultOn !== undefined) { + writer.uint32(192).bool(message.autoCaptionsDefaultOn); + } + if (message.slicedBread !== undefined) { + writer.uint32(216).bool(message.slicedBread); + } + if (message.autonav !== undefined) { + writer.uint32(232).bool(message.autonav); + } + if (message.trailer !== undefined) { + writer.uint32(240).bool(message.trailer); + } + if (message.playerWidthPixels !== undefined) { + writer.uint32(272).int32(message.playerWidthPixels); + } + if (message.playerHeightPixels !== undefined) { + writer.uint32(280).int32(message.playerHeightPixels); + } + if (message.snd !== undefined) { + writer.uint32(296).int32(message.snd); + } + if (message.vnd !== undefined) { + writer.uint32(304).int32(message.vnd); + } + if (message.uao !== undefined) { + writer.uint32(328).int32(message.uao); + } + if (message.mutedAutoplay !== undefined) { + writer.uint32(352).bool(message.mutedAutoplay); + } + if (message.enablePrivacyFilter !== undefined) { + writer.uint32(368).bool(message.enablePrivacyFilter); + } + if (message.isLivingRoomDeeplink !== undefined) { + writer.uint32(376).bool(message.isLivingRoomDeeplink); + } + if (message.signatureTimestamp !== undefined) { + writer.uint32(384).uint32(message.signatureTimestamp); + } + if (message.isInlinePlaybackNoAd !== undefined) { + writer.uint32(400).bool(message.isInlinePlaybackNoAd); + } + if (message.isInlineUnmutedPlayback !== undefined) { + writer.uint32(408).bool(message.isInlineUnmutedPlayback); + } + if (message.playPackageVersion !== undefined) { + writer.uint32(440).int64(message.playPackageVersion); + } + if (message.isSequenceEntry !== undefined) { + writer.uint32(480).bool(message.isSequenceEntry); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlaybackContext_ContentPlaybackContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlaybackContext_ContentPlaybackContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deviceSignals = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.revShareClientId = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.timeSinceLastAdSeconds = reader.uint32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.lactMilliseconds = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.autoplaysSinceLastAd = reader.uint32(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.vis = reader.uint32(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.fling = reader.bool(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.splay = reader.bool(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.autoplay = reader.bool(); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.timeOfLastInstreamPrerollAd = longToNumber(reader.uint64()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.currentUrl = reader.string(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.referer = reader.string(); + continue; + case 23: + if (tag !== 184) { + break; + } + + message.loadAnnotationsByDemand = reader.bool(); + continue; + case 24: + if (tag !== 192) { + break; + } + + message.autoCaptionsDefaultOn = reader.bool(); + continue; + case 27: + if (tag !== 216) { + break; + } + + message.slicedBread = reader.bool(); + continue; + case 29: + if (tag !== 232) { + break; + } + + message.autonav = reader.bool(); + continue; + case 30: + if (tag !== 240) { + break; + } + + message.trailer = reader.bool(); + continue; + case 34: + if (tag !== 272) { + break; + } + + message.playerWidthPixels = reader.int32(); + continue; + case 35: + if (tag !== 280) { + break; + } + + message.playerHeightPixels = reader.int32(); + continue; + case 37: + if (tag !== 296) { + break; + } + + message.snd = reader.int32(); + continue; + case 38: + if (tag !== 304) { + break; + } + + message.vnd = reader.int32(); + continue; + case 41: + if (tag !== 328) { + break; + } + + message.uao = reader.int32(); + continue; + case 44: + if (tag !== 352) { + break; + } + + message.mutedAutoplay = reader.bool(); + continue; + case 46: + if (tag !== 368) { + break; + } + + message.enablePrivacyFilter = reader.bool(); + continue; + case 47: + if (tag !== 376) { + break; + } + + message.isLivingRoomDeeplink = reader.bool(); + continue; + case 48: + if (tag !== 384) { + break; + } + + message.signatureTimestamp = reader.uint32(); + continue; + case 50: + if (tag !== 400) { + break; + } + + message.isInlinePlaybackNoAd = reader.bool(); + continue; + case 51: + if (tag !== 408) { + break; + } + + message.isInlineUnmutedPlayback = reader.bool(); + continue; + case 55: + if (tag !== 440) { + break; + } + + message.playPackageVersion = longToNumber(reader.int64()); + continue; + case 60: + if (tag !== 480) { + break; + } + + message.isSequenceEntry = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlaybackContext_ContentPlaybackContext { + return { + deviceSignals: isSet(object.deviceSignals) ? globalThis.String(object.deviceSignals) : undefined, + revShareClientId: isSet(object.revShareClientId) ? globalThis.String(object.revShareClientId) : undefined, + timeSinceLastAdSeconds: isSet(object.timeSinceLastAdSeconds) + ? globalThis.Number(object.timeSinceLastAdSeconds) + : undefined, + lactMilliseconds: isSet(object.lactMilliseconds) ? globalThis.Number(object.lactMilliseconds) : undefined, + autoplaysSinceLastAd: isSet(object.autoplaysSinceLastAd) + ? globalThis.Number(object.autoplaysSinceLastAd) + : undefined, + vis: isSet(object.vis) ? globalThis.Number(object.vis) : undefined, + fling: isSet(object.fling) ? globalThis.Boolean(object.fling) : undefined, + splay: isSet(object.splay) ? globalThis.Boolean(object.splay) : undefined, + autoplay: isSet(object.autoplay) ? globalThis.Boolean(object.autoplay) : undefined, + timeOfLastInstreamPrerollAd: isSet(object.timeOfLastInstreamPrerollAd) + ? globalThis.Number(object.timeOfLastInstreamPrerollAd) + : undefined, + currentUrl: isSet(object.currentUrl) ? globalThis.String(object.currentUrl) : undefined, + referer: isSet(object.referer) ? globalThis.String(object.referer) : undefined, + loadAnnotationsByDemand: isSet(object.loadAnnotationsByDemand) + ? globalThis.Boolean(object.loadAnnotationsByDemand) + : undefined, + autoCaptionsDefaultOn: isSet(object.autoCaptionsDefaultOn) + ? globalThis.Boolean(object.autoCaptionsDefaultOn) + : undefined, + slicedBread: isSet(object.slicedBread) ? globalThis.Boolean(object.slicedBread) : undefined, + autonav: isSet(object.autonav) ? globalThis.Boolean(object.autonav) : undefined, + trailer: isSet(object.trailer) ? globalThis.Boolean(object.trailer) : undefined, + playerWidthPixels: isSet(object.playerWidthPixels) ? globalThis.Number(object.playerWidthPixels) : undefined, + playerHeightPixels: isSet(object.playerHeightPixels) ? globalThis.Number(object.playerHeightPixels) : undefined, + snd: isSet(object.snd) ? globalThis.Number(object.snd) : undefined, + vnd: isSet(object.vnd) ? globalThis.Number(object.vnd) : undefined, + uao: isSet(object.uao) ? globalThis.Number(object.uao) : undefined, + mutedAutoplay: isSet(object.mutedAutoplay) ? globalThis.Boolean(object.mutedAutoplay) : undefined, + enablePrivacyFilter: isSet(object.enablePrivacyFilter) + ? globalThis.Boolean(object.enablePrivacyFilter) + : undefined, + isLivingRoomDeeplink: isSet(object.isLivingRoomDeeplink) + ? globalThis.Boolean(object.isLivingRoomDeeplink) + : undefined, + signatureTimestamp: isSet(object.signatureTimestamp) ? globalThis.Number(object.signatureTimestamp) : undefined, + isInlinePlaybackNoAd: isSet(object.isInlinePlaybackNoAd) + ? globalThis.Boolean(object.isInlinePlaybackNoAd) + : undefined, + isInlineUnmutedPlayback: isSet(object.isInlineUnmutedPlayback) + ? globalThis.Boolean(object.isInlineUnmutedPlayback) + : undefined, + playPackageVersion: isSet(object.playPackageVersion) ? globalThis.Number(object.playPackageVersion) : undefined, + isSequenceEntry: isSet(object.isSequenceEntry) ? globalThis.Boolean(object.isSequenceEntry) : undefined, + }; + }, + + toJSON(message: PlaybackContext_ContentPlaybackContext): unknown { + const obj: any = {}; + if (message.deviceSignals !== undefined) { + obj.deviceSignals = message.deviceSignals; + } + if (message.revShareClientId !== undefined) { + obj.revShareClientId = message.revShareClientId; + } + if (message.timeSinceLastAdSeconds !== undefined) { + obj.timeSinceLastAdSeconds = Math.round(message.timeSinceLastAdSeconds); + } + if (message.lactMilliseconds !== undefined) { + obj.lactMilliseconds = Math.round(message.lactMilliseconds); + } + if (message.autoplaysSinceLastAd !== undefined) { + obj.autoplaysSinceLastAd = Math.round(message.autoplaysSinceLastAd); + } + if (message.vis !== undefined) { + obj.vis = Math.round(message.vis); + } + if (message.fling !== undefined) { + obj.fling = message.fling; + } + if (message.splay !== undefined) { + obj.splay = message.splay; + } + if (message.autoplay !== undefined) { + obj.autoplay = message.autoplay; + } + if (message.timeOfLastInstreamPrerollAd !== undefined) { + obj.timeOfLastInstreamPrerollAd = Math.round(message.timeOfLastInstreamPrerollAd); + } + if (message.currentUrl !== undefined) { + obj.currentUrl = message.currentUrl; + } + if (message.referer !== undefined) { + obj.referer = message.referer; + } + if (message.loadAnnotationsByDemand !== undefined) { + obj.loadAnnotationsByDemand = message.loadAnnotationsByDemand; + } + if (message.autoCaptionsDefaultOn !== undefined) { + obj.autoCaptionsDefaultOn = message.autoCaptionsDefaultOn; + } + if (message.slicedBread !== undefined) { + obj.slicedBread = message.slicedBread; + } + if (message.autonav !== undefined) { + obj.autonav = message.autonav; + } + if (message.trailer !== undefined) { + obj.trailer = message.trailer; + } + if (message.playerWidthPixels !== undefined) { + obj.playerWidthPixels = Math.round(message.playerWidthPixels); + } + if (message.playerHeightPixels !== undefined) { + obj.playerHeightPixels = Math.round(message.playerHeightPixels); + } + if (message.snd !== undefined) { + obj.snd = Math.round(message.snd); + } + if (message.vnd !== undefined) { + obj.vnd = Math.round(message.vnd); + } + if (message.uao !== undefined) { + obj.uao = Math.round(message.uao); + } + if (message.mutedAutoplay !== undefined) { + obj.mutedAutoplay = message.mutedAutoplay; + } + if (message.enablePrivacyFilter !== undefined) { + obj.enablePrivacyFilter = message.enablePrivacyFilter; + } + if (message.isLivingRoomDeeplink !== undefined) { + obj.isLivingRoomDeeplink = message.isLivingRoomDeeplink; + } + if (message.signatureTimestamp !== undefined) { + obj.signatureTimestamp = Math.round(message.signatureTimestamp); + } + if (message.isInlinePlaybackNoAd !== undefined) { + obj.isInlinePlaybackNoAd = message.isInlinePlaybackNoAd; + } + if (message.isInlineUnmutedPlayback !== undefined) { + obj.isInlineUnmutedPlayback = message.isInlineUnmutedPlayback; + } + if (message.playPackageVersion !== undefined) { + obj.playPackageVersion = Math.round(message.playPackageVersion); + } + if (message.isSequenceEntry !== undefined) { + obj.isSequenceEntry = message.isSequenceEntry; + } + return obj; + }, + + create, I>>( + base?: I, + ): PlaybackContext_ContentPlaybackContext { + return PlaybackContext_ContentPlaybackContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PlaybackContext_ContentPlaybackContext { + const message = createBasePlaybackContext_ContentPlaybackContext(); + message.deviceSignals = object.deviceSignals ?? undefined; + message.revShareClientId = object.revShareClientId ?? undefined; + message.timeSinceLastAdSeconds = object.timeSinceLastAdSeconds ?? undefined; + message.lactMilliseconds = object.lactMilliseconds ?? undefined; + message.autoplaysSinceLastAd = object.autoplaysSinceLastAd ?? undefined; + message.vis = object.vis ?? undefined; + message.fling = object.fling ?? undefined; + message.splay = object.splay ?? undefined; + message.autoplay = object.autoplay ?? undefined; + message.timeOfLastInstreamPrerollAd = object.timeOfLastInstreamPrerollAd ?? undefined; + message.currentUrl = object.currentUrl ?? undefined; + message.referer = object.referer ?? undefined; + message.loadAnnotationsByDemand = object.loadAnnotationsByDemand ?? undefined; + message.autoCaptionsDefaultOn = object.autoCaptionsDefaultOn ?? undefined; + message.slicedBread = object.slicedBread ?? undefined; + message.autonav = object.autonav ?? undefined; + message.trailer = object.trailer ?? undefined; + message.playerWidthPixels = object.playerWidthPixels ?? undefined; + message.playerHeightPixels = object.playerHeightPixels ?? undefined; + message.snd = object.snd ?? undefined; + message.vnd = object.vnd ?? undefined; + message.uao = object.uao ?? undefined; + message.mutedAutoplay = object.mutedAutoplay ?? undefined; + message.enablePrivacyFilter = object.enablePrivacyFilter ?? undefined; + message.isLivingRoomDeeplink = object.isLivingRoomDeeplink ?? undefined; + message.signatureTimestamp = object.signatureTimestamp ?? undefined; + message.isInlinePlaybackNoAd = object.isInlinePlaybackNoAd ?? undefined; + message.isInlineUnmutedPlayback = object.isInlineUnmutedPlayback ?? undefined; + message.playPackageVersion = object.playPackageVersion ?? undefined; + message.isSequenceEntry = object.isSequenceEntry ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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 longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +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/protos/generated/youtube/api/pfiinnertube/player_attestation_request_data.ts b/protos/generated/youtube/api/pfiinnertube/player_attestation_request_data.ts new file mode 100644 index 0000000000..a783fafe73 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/player_attestation_request_data.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.0 +// source: youtube/api/pfiinnertube/player_attestation_request_data.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface PlayerAttestationRequestData { + iosguardRequest?: PlayerAttestationRequestData_IosguardChallengeRequestData | undefined; + omitBotguardData?: boolean | undefined; +} + +export interface PlayerAttestationRequestData_IosguardChallengeRequestData { + challengeRequest?: Uint8Array | undefined; +} + +function createBasePlayerAttestationRequestData(): PlayerAttestationRequestData { + return { iosguardRequest: undefined, omitBotguardData: undefined }; +} + +export const PlayerAttestationRequestData: MessageFns = { + encode(message: PlayerAttestationRequestData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.iosguardRequest !== undefined) { + PlayerAttestationRequestData_IosguardChallengeRequestData.encode( + message.iosguardRequest, + writer.uint32(10).fork(), + ).join(); + } + if (message.omitBotguardData !== undefined) { + writer.uint32(16).bool(message.omitBotguardData); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayerAttestationRequestData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayerAttestationRequestData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.iosguardRequest = PlayerAttestationRequestData_IosguardChallengeRequestData.decode( + reader, + reader.uint32(), + ); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.omitBotguardData = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayerAttestationRequestData { + return { + iosguardRequest: isSet(object.iosguardRequest) + ? PlayerAttestationRequestData_IosguardChallengeRequestData.fromJSON(object.iosguardRequest) + : undefined, + omitBotguardData: isSet(object.omitBotguardData) ? globalThis.Boolean(object.omitBotguardData) : undefined, + }; + }, + + toJSON(message: PlayerAttestationRequestData): unknown { + const obj: any = {}; + if (message.iosguardRequest !== undefined) { + obj.iosguardRequest = PlayerAttestationRequestData_IosguardChallengeRequestData.toJSON(message.iosguardRequest); + } + if (message.omitBotguardData !== undefined) { + obj.omitBotguardData = message.omitBotguardData; + } + return obj; + }, + + create, I>>(base?: I): PlayerAttestationRequestData { + return PlayerAttestationRequestData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayerAttestationRequestData { + const message = createBasePlayerAttestationRequestData(); + message.iosguardRequest = (object.iosguardRequest !== undefined && object.iosguardRequest !== null) + ? PlayerAttestationRequestData_IosguardChallengeRequestData.fromPartial(object.iosguardRequest) + : undefined; + message.omitBotguardData = object.omitBotguardData ?? undefined; + return message; + }, +}; + +function createBasePlayerAttestationRequestData_IosguardChallengeRequestData(): PlayerAttestationRequestData_IosguardChallengeRequestData { + return { challengeRequest: undefined }; +} + +export const PlayerAttestationRequestData_IosguardChallengeRequestData: MessageFns< + PlayerAttestationRequestData_IosguardChallengeRequestData +> = { + encode( + message: PlayerAttestationRequestData_IosguardChallengeRequestData, + writer: BinaryWriter = new BinaryWriter(), + ): BinaryWriter { + if (message.challengeRequest !== undefined) { + writer.uint32(10).bytes(message.challengeRequest); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayerAttestationRequestData_IosguardChallengeRequestData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayerAttestationRequestData_IosguardChallengeRequestData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.challengeRequest = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayerAttestationRequestData_IosguardChallengeRequestData { + return { challengeRequest: isSet(object.challengeRequest) ? bytesFromBase64(object.challengeRequest) : undefined }; + }, + + toJSON(message: PlayerAttestationRequestData_IosguardChallengeRequestData): unknown { + const obj: any = {}; + if (message.challengeRequest !== undefined) { + obj.challengeRequest = base64FromBytes(message.challengeRequest); + } + return obj; + }, + + create, I>>( + base?: I, + ): PlayerAttestationRequestData_IosguardChallengeRequestData { + return PlayerAttestationRequestData_IosguardChallengeRequestData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): PlayerAttestationRequestData_IosguardChallengeRequestData { + const message = createBasePlayerAttestationRequestData_IosguardChallengeRequestData(); + message.challengeRequest = object.challengeRequest ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/player_request.ts b/protos/generated/youtube/api/pfiinnertube/player_request.ts new file mode 100644 index 0000000000..358ebe4a19 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/player_request.ts @@ -0,0 +1,539 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/player_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { InnerTubeContext } from "./innertube_context.js"; +import { PlaybackContext } from "./playback_context.js"; +import { PlayerAttestationRequestData } from "./player_attestation_request_data.js"; +import { PlayerRequestCaptionParams } from "./player_request_caption_params.js"; +import { ServiceIntegrityDimensions } from "./service_integrity_dimensions.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface PlayerRequest { + context?: InnerTubeContext | undefined; + videoId?: string | undefined; + contentCheckOk?: boolean | undefined; + playbackContext?: PlaybackContext | undefined; + racyCheckOk?: boolean | undefined; + id?: string | undefined; + t?: string | undefined; + forOffline?: boolean | undefined; + playlistId?: string | undefined; + playlistIndex?: number | undefined; + startTimeSecs?: number | undefined; + params?: string | undefined; + offlineSharingWrappedKey?: Uint8Array | undefined; + attestationRequest?: PlayerAttestationRequestData | undefined; + referringApp?: string | undefined; + referrer?: string | undefined; + serializedThirdPartyEmbedConfig?: string | undefined; + proxiedByOnesie?: boolean | undefined; + hostAppToken?: string | undefined; + cpn?: string | undefined; + overrideMutedAtStart?: boolean | undefined; + captionParams?: PlayerRequestCaptionParams | undefined; + serviceIntegrityDimensions?: + | ServiceIntegrityDimensions + | undefined; + /** optional VideoQualitySetting video_quality_setting_params = 28; */ + deferredPlayerToken?: Uint8Array | undefined; +} + +function createBasePlayerRequest(): PlayerRequest { + return { + context: undefined, + videoId: undefined, + contentCheckOk: undefined, + playbackContext: undefined, + racyCheckOk: undefined, + id: undefined, + t: undefined, + forOffline: undefined, + playlistId: undefined, + playlistIndex: undefined, + startTimeSecs: undefined, + params: undefined, + offlineSharingWrappedKey: undefined, + attestationRequest: undefined, + referringApp: undefined, + referrer: undefined, + serializedThirdPartyEmbedConfig: undefined, + proxiedByOnesie: undefined, + hostAppToken: undefined, + cpn: undefined, + overrideMutedAtStart: undefined, + captionParams: undefined, + serviceIntegrityDimensions: undefined, + deferredPlayerToken: undefined, + }; +} + +export const PlayerRequest: MessageFns = { + encode(message: PlayerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.context !== undefined) { + InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join(); + } + if (message.videoId !== undefined) { + writer.uint32(18).string(message.videoId); + } + if (message.contentCheckOk !== undefined) { + writer.uint32(24).bool(message.contentCheckOk); + } + if (message.playbackContext !== undefined) { + PlaybackContext.encode(message.playbackContext, writer.uint32(34).fork()).join(); + } + if (message.racyCheckOk !== undefined) { + writer.uint32(40).bool(message.racyCheckOk); + } + if (message.id !== undefined) { + writer.uint32(50).string(message.id); + } + if (message.t !== undefined) { + writer.uint32(58).string(message.t); + } + if (message.forOffline !== undefined) { + writer.uint32(64).bool(message.forOffline); + } + if (message.playlistId !== undefined) { + writer.uint32(74).string(message.playlistId); + } + if (message.playlistIndex !== undefined) { + writer.uint32(80).int32(message.playlistIndex); + } + if (message.startTimeSecs !== undefined) { + writer.uint32(88).uint32(message.startTimeSecs); + } + if (message.params !== undefined) { + writer.uint32(98).string(message.params); + } + if (message.offlineSharingWrappedKey !== undefined) { + writer.uint32(114).bytes(message.offlineSharingWrappedKey); + } + if (message.attestationRequest !== undefined) { + PlayerAttestationRequestData.encode(message.attestationRequest, writer.uint32(130).fork()).join(); + } + if (message.referringApp !== undefined) { + writer.uint32(138).string(message.referringApp); + } + if (message.referrer !== undefined) { + writer.uint32(146).string(message.referrer); + } + if (message.serializedThirdPartyEmbedConfig !== undefined) { + writer.uint32(154).string(message.serializedThirdPartyEmbedConfig); + } + if (message.proxiedByOnesie !== undefined) { + writer.uint32(160).bool(message.proxiedByOnesie); + } + if (message.hostAppToken !== undefined) { + writer.uint32(178).string(message.hostAppToken); + } + if (message.cpn !== undefined) { + writer.uint32(186).string(message.cpn); + } + if (message.overrideMutedAtStart !== undefined) { + writer.uint32(200).bool(message.overrideMutedAtStart); + } + if (message.captionParams !== undefined) { + PlayerRequestCaptionParams.encode(message.captionParams, writer.uint32(210).fork()).join(); + } + if (message.serviceIntegrityDimensions !== undefined) { + ServiceIntegrityDimensions.encode(message.serviceIntegrityDimensions, writer.uint32(218).fork()).join(); + } + if (message.deferredPlayerToken !== undefined) { + writer.uint32(234).bytes(message.deferredPlayerToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.context = InnerTubeContext.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.contentCheckOk = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.playbackContext = PlaybackContext.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.racyCheckOk = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.id = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.t = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.forOffline = reader.bool(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.playlistId = reader.string(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.playlistIndex = reader.int32(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.startTimeSecs = reader.uint32(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.params = reader.string(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.offlineSharingWrappedKey = reader.bytes(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.attestationRequest = PlayerAttestationRequestData.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.referringApp = reader.string(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.referrer = reader.string(); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.serializedThirdPartyEmbedConfig = reader.string(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.proxiedByOnesie = reader.bool(); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.hostAppToken = reader.string(); + continue; + case 23: + if (tag !== 186) { + break; + } + + message.cpn = reader.string(); + continue; + case 25: + if (tag !== 200) { + break; + } + + message.overrideMutedAtStart = reader.bool(); + continue; + case 26: + if (tag !== 210) { + break; + } + + message.captionParams = PlayerRequestCaptionParams.decode(reader, reader.uint32()); + continue; + case 27: + if (tag !== 218) { + break; + } + + message.serviceIntegrityDimensions = ServiceIntegrityDimensions.decode(reader, reader.uint32()); + continue; + case 29: + if (tag !== 234) { + break; + } + + message.deferredPlayerToken = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayerRequest { + return { + context: isSet(object.context) ? InnerTubeContext.fromJSON(object.context) : undefined, + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : undefined, + contentCheckOk: isSet(object.contentCheckOk) ? globalThis.Boolean(object.contentCheckOk) : undefined, + playbackContext: isSet(object.playbackContext) ? PlaybackContext.fromJSON(object.playbackContext) : undefined, + racyCheckOk: isSet(object.racyCheckOk) ? globalThis.Boolean(object.racyCheckOk) : undefined, + id: isSet(object.id) ? globalThis.String(object.id) : undefined, + t: isSet(object.t) ? globalThis.String(object.t) : undefined, + forOffline: isSet(object.forOffline) ? globalThis.Boolean(object.forOffline) : undefined, + playlistId: isSet(object.playlistId) ? globalThis.String(object.playlistId) : undefined, + playlistIndex: isSet(object.playlistIndex) ? globalThis.Number(object.playlistIndex) : undefined, + startTimeSecs: isSet(object.startTimeSecs) ? globalThis.Number(object.startTimeSecs) : undefined, + params: isSet(object.params) ? globalThis.String(object.params) : undefined, + offlineSharingWrappedKey: isSet(object.offlineSharingWrappedKey) + ? bytesFromBase64(object.offlineSharingWrappedKey) + : undefined, + attestationRequest: isSet(object.attestationRequest) + ? PlayerAttestationRequestData.fromJSON(object.attestationRequest) + : undefined, + referringApp: isSet(object.referringApp) ? globalThis.String(object.referringApp) : undefined, + referrer: isSet(object.referrer) ? globalThis.String(object.referrer) : undefined, + serializedThirdPartyEmbedConfig: isSet(object.serializedThirdPartyEmbedConfig) + ? globalThis.String(object.serializedThirdPartyEmbedConfig) + : undefined, + proxiedByOnesie: isSet(object.proxiedByOnesie) ? globalThis.Boolean(object.proxiedByOnesie) : undefined, + hostAppToken: isSet(object.hostAppToken) ? globalThis.String(object.hostAppToken) : undefined, + cpn: isSet(object.cpn) ? globalThis.String(object.cpn) : undefined, + overrideMutedAtStart: isSet(object.overrideMutedAtStart) + ? globalThis.Boolean(object.overrideMutedAtStart) + : undefined, + captionParams: isSet(object.captionParams) + ? PlayerRequestCaptionParams.fromJSON(object.captionParams) + : undefined, + serviceIntegrityDimensions: isSet(object.serviceIntegrityDimensions) + ? ServiceIntegrityDimensions.fromJSON(object.serviceIntegrityDimensions) + : undefined, + deferredPlayerToken: isSet(object.deferredPlayerToken) ? bytesFromBase64(object.deferredPlayerToken) : undefined, + }; + }, + + toJSON(message: PlayerRequest): unknown { + const obj: any = {}; + if (message.context !== undefined) { + obj.context = InnerTubeContext.toJSON(message.context); + } + if (message.videoId !== undefined) { + obj.videoId = message.videoId; + } + if (message.contentCheckOk !== undefined) { + obj.contentCheckOk = message.contentCheckOk; + } + if (message.playbackContext !== undefined) { + obj.playbackContext = PlaybackContext.toJSON(message.playbackContext); + } + if (message.racyCheckOk !== undefined) { + obj.racyCheckOk = message.racyCheckOk; + } + if (message.id !== undefined) { + obj.id = message.id; + } + if (message.t !== undefined) { + obj.t = message.t; + } + if (message.forOffline !== undefined) { + obj.forOffline = message.forOffline; + } + if (message.playlistId !== undefined) { + obj.playlistId = message.playlistId; + } + if (message.playlistIndex !== undefined) { + obj.playlistIndex = Math.round(message.playlistIndex); + } + if (message.startTimeSecs !== undefined) { + obj.startTimeSecs = Math.round(message.startTimeSecs); + } + if (message.params !== undefined) { + obj.params = message.params; + } + if (message.offlineSharingWrappedKey !== undefined) { + obj.offlineSharingWrappedKey = base64FromBytes(message.offlineSharingWrappedKey); + } + if (message.attestationRequest !== undefined) { + obj.attestationRequest = PlayerAttestationRequestData.toJSON(message.attestationRequest); + } + if (message.referringApp !== undefined) { + obj.referringApp = message.referringApp; + } + if (message.referrer !== undefined) { + obj.referrer = message.referrer; + } + if (message.serializedThirdPartyEmbedConfig !== undefined) { + obj.serializedThirdPartyEmbedConfig = message.serializedThirdPartyEmbedConfig; + } + if (message.proxiedByOnesie !== undefined) { + obj.proxiedByOnesie = message.proxiedByOnesie; + } + if (message.hostAppToken !== undefined) { + obj.hostAppToken = message.hostAppToken; + } + if (message.cpn !== undefined) { + obj.cpn = message.cpn; + } + if (message.overrideMutedAtStart !== undefined) { + obj.overrideMutedAtStart = message.overrideMutedAtStart; + } + if (message.captionParams !== undefined) { + obj.captionParams = PlayerRequestCaptionParams.toJSON(message.captionParams); + } + if (message.serviceIntegrityDimensions !== undefined) { + obj.serviceIntegrityDimensions = ServiceIntegrityDimensions.toJSON(message.serviceIntegrityDimensions); + } + if (message.deferredPlayerToken !== undefined) { + obj.deferredPlayerToken = base64FromBytes(message.deferredPlayerToken); + } + return obj; + }, + + create, I>>(base?: I): PlayerRequest { + return PlayerRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayerRequest { + const message = createBasePlayerRequest(); + message.context = (object.context !== undefined && object.context !== null) + ? InnerTubeContext.fromPartial(object.context) + : undefined; + message.videoId = object.videoId ?? undefined; + message.contentCheckOk = object.contentCheckOk ?? undefined; + message.playbackContext = (object.playbackContext !== undefined && object.playbackContext !== null) + ? PlaybackContext.fromPartial(object.playbackContext) + : undefined; + message.racyCheckOk = object.racyCheckOk ?? undefined; + message.id = object.id ?? undefined; + message.t = object.t ?? undefined; + message.forOffline = object.forOffline ?? undefined; + message.playlistId = object.playlistId ?? undefined; + message.playlistIndex = object.playlistIndex ?? undefined; + message.startTimeSecs = object.startTimeSecs ?? undefined; + message.params = object.params ?? undefined; + message.offlineSharingWrappedKey = object.offlineSharingWrappedKey ?? undefined; + message.attestationRequest = (object.attestationRequest !== undefined && object.attestationRequest !== null) + ? PlayerAttestationRequestData.fromPartial(object.attestationRequest) + : undefined; + message.referringApp = object.referringApp ?? undefined; + message.referrer = object.referrer ?? undefined; + message.serializedThirdPartyEmbedConfig = object.serializedThirdPartyEmbedConfig ?? undefined; + message.proxiedByOnesie = object.proxiedByOnesie ?? undefined; + message.hostAppToken = object.hostAppToken ?? undefined; + message.cpn = object.cpn ?? undefined; + message.overrideMutedAtStart = object.overrideMutedAtStart ?? undefined; + message.captionParams = (object.captionParams !== undefined && object.captionParams !== null) + ? PlayerRequestCaptionParams.fromPartial(object.captionParams) + : undefined; + message.serviceIntegrityDimensions = + (object.serviceIntegrityDimensions !== undefined && object.serviceIntegrityDimensions !== null) + ? ServiceIntegrityDimensions.fromPartial(object.serviceIntegrityDimensions) + : undefined; + message.deferredPlayerToken = object.deferredPlayerToken ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/player_request_caption_params.ts b/protos/generated/youtube/api/pfiinnertube/player_request_caption_params.ts new file mode 100644 index 0000000000..9dcab3ad82 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/player_request_caption_params.ts @@ -0,0 +1,172 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/player_request_caption_params.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface PlayerRequestCaptionParams { + deviceCaptionsOn?: boolean | undefined; + deviceCaptionsLangPref?: string | undefined; + viewerSelectedCaptionLangs?: string | undefined; + ccLangPref?: string | undefined; + ccLoadPolicyOn?: boolean | undefined; +} + +function createBasePlayerRequestCaptionParams(): PlayerRequestCaptionParams { + return { + deviceCaptionsOn: undefined, + deviceCaptionsLangPref: undefined, + viewerSelectedCaptionLangs: undefined, + ccLangPref: undefined, + ccLoadPolicyOn: undefined, + }; +} + +export const PlayerRequestCaptionParams: MessageFns = { + encode(message: PlayerRequestCaptionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deviceCaptionsOn !== undefined) { + writer.uint32(8).bool(message.deviceCaptionsOn); + } + if (message.deviceCaptionsLangPref !== undefined) { + writer.uint32(18).string(message.deviceCaptionsLangPref); + } + if (message.viewerSelectedCaptionLangs !== undefined) { + writer.uint32(26).string(message.viewerSelectedCaptionLangs); + } + if (message.ccLangPref !== undefined) { + writer.uint32(34).string(message.ccLangPref); + } + if (message.ccLoadPolicyOn !== undefined) { + writer.uint32(40).bool(message.ccLoadPolicyOn); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PlayerRequestCaptionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlayerRequestCaptionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.deviceCaptionsOn = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deviceCaptionsLangPref = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.viewerSelectedCaptionLangs = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.ccLangPref = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.ccLoadPolicyOn = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PlayerRequestCaptionParams { + return { + deviceCaptionsOn: isSet(object.deviceCaptionsOn) ? globalThis.Boolean(object.deviceCaptionsOn) : undefined, + deviceCaptionsLangPref: isSet(object.deviceCaptionsLangPref) + ? globalThis.String(object.deviceCaptionsLangPref) + : undefined, + viewerSelectedCaptionLangs: isSet(object.viewerSelectedCaptionLangs) + ? globalThis.String(object.viewerSelectedCaptionLangs) + : undefined, + ccLangPref: isSet(object.ccLangPref) ? globalThis.String(object.ccLangPref) : undefined, + ccLoadPolicyOn: isSet(object.ccLoadPolicyOn) ? globalThis.Boolean(object.ccLoadPolicyOn) : undefined, + }; + }, + + toJSON(message: PlayerRequestCaptionParams): unknown { + const obj: any = {}; + if (message.deviceCaptionsOn !== undefined) { + obj.deviceCaptionsOn = message.deviceCaptionsOn; + } + if (message.deviceCaptionsLangPref !== undefined) { + obj.deviceCaptionsLangPref = message.deviceCaptionsLangPref; + } + if (message.viewerSelectedCaptionLangs !== undefined) { + obj.viewerSelectedCaptionLangs = message.viewerSelectedCaptionLangs; + } + if (message.ccLangPref !== undefined) { + obj.ccLangPref = message.ccLangPref; + } + if (message.ccLoadPolicyOn !== undefined) { + obj.ccLoadPolicyOn = message.ccLoadPolicyOn; + } + return obj; + }, + + create, I>>(base?: I): PlayerRequestCaptionParams { + return PlayerRequestCaptionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PlayerRequestCaptionParams { + const message = createBasePlayerRequestCaptionParams(); + message.deviceCaptionsOn = object.deviceCaptionsOn ?? undefined; + message.deviceCaptionsLangPref = object.deviceCaptionsLangPref ?? undefined; + message.viewerSelectedCaptionLangs = object.viewerSelectedCaptionLangs ?? undefined; + message.ccLangPref = object.ccLangPref ?? undefined; + message.ccLoadPolicyOn = object.ccLoadPolicyOn ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/reel_item_watch_request.ts b/protos/generated/youtube/api/pfiinnertube/reel_item_watch_request.ts new file mode 100644 index 0000000000..637fcda4bd --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/reel_item_watch_request.ts @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/reel_item_watch_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { InnerTubeContext } from "./innertube_context.js"; +import { PlayerRequest } from "./player_request.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface ReelItemWatchRequest { + context?: InnerTubeContext | undefined; + playerRequest?: PlayerRequest | undefined; + params?: string | undefined; + disablePlayerResponse?: boolean | undefined; +} + +function createBaseReelItemWatchRequest(): ReelItemWatchRequest { + return { context: undefined, playerRequest: undefined, params: undefined, disablePlayerResponse: undefined }; +} + +export const ReelItemWatchRequest: MessageFns = { + encode(message: ReelItemWatchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.context !== undefined) { + InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join(); + } + if (message.playerRequest !== undefined) { + PlayerRequest.encode(message.playerRequest, writer.uint32(18).fork()).join(); + } + if (message.params !== undefined) { + writer.uint32(26).string(message.params); + } + if (message.disablePlayerResponse !== undefined) { + writer.uint32(32).bool(message.disablePlayerResponse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReelItemWatchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReelItemWatchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.context = InnerTubeContext.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.playerRequest = PlayerRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.params = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.disablePlayerResponse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReelItemWatchRequest { + return { + context: isSet(object.context) ? InnerTubeContext.fromJSON(object.context) : undefined, + playerRequest: isSet(object.playerRequest) ? PlayerRequest.fromJSON(object.playerRequest) : undefined, + params: isSet(object.params) ? globalThis.String(object.params) : undefined, + disablePlayerResponse: isSet(object.disablePlayerResponse) + ? globalThis.Boolean(object.disablePlayerResponse) + : undefined, + }; + }, + + toJSON(message: ReelItemWatchRequest): unknown { + const obj: any = {}; + if (message.context !== undefined) { + obj.context = InnerTubeContext.toJSON(message.context); + } + if (message.playerRequest !== undefined) { + obj.playerRequest = PlayerRequest.toJSON(message.playerRequest); + } + if (message.params !== undefined) { + obj.params = message.params; + } + if (message.disablePlayerResponse !== undefined) { + obj.disablePlayerResponse = message.disablePlayerResponse; + } + return obj; + }, + + create, I>>(base?: I): ReelItemWatchRequest { + return ReelItemWatchRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ReelItemWatchRequest { + const message = createBaseReelItemWatchRequest(); + message.context = (object.context !== undefined && object.context !== null) + ? InnerTubeContext.fromPartial(object.context) + : undefined; + message.playerRequest = (object.playerRequest !== undefined && object.playerRequest !== null) + ? PlayerRequest.fromPartial(object.playerRequest) + : undefined; + message.params = object.params ?? undefined; + message.disablePlayerResponse = object.disablePlayerResponse ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/request_info.ts b/protos/generated/youtube/api/pfiinnertube/request_info.ts new file mode 100644 index 0000000000..bb9767e085 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/request_info.ts @@ -0,0 +1,688 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/request_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { KeyValuePair } from "../../../misc/common.js"; +import { AttestationResponseData } from "./attestation_response_data.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface RequestInfo { + thirdPartyDigest?: string | undefined; + useSsl?: boolean | undefined; + returnErrorDetail?: + | boolean + | undefined; + /** "If-None-Match" HTTP header? */ + ifNoneMatch?: string | undefined; + returnLogEntry?: boolean | undefined; + isPrefetch?: boolean | undefined; + internalExperimentFlags: KeyValuePair[]; + returnDebugData?: boolean | undefined; + innertubez?: string | undefined; + traceProto?: boolean | undefined; + returnLogEntryJson?: boolean | undefined; + sherlogUsername?: + | string + | undefined; + /** repeated ConsistencyTokenJar consistency_token_jars = 26; */ + reauthRequestInfo?: RequestInfo_ReauthRequestInfo | undefined; + sessionInfo?: RequestInfo_SessionInfo | undefined; + returnLogEntryProto?: + | boolean + | undefined; + /** External pre-request context as a string */ + externalPrequestContext?: + | string + | undefined; + /** + * repeated InnerTubeTokenJar innertube_token_jar = 33; + * Would a botguard/droidguard response here allow playback? + */ + attestationResponseData?: AttestationResponseData | undefined; + eats?: Uint8Array | undefined; + requestQos?: RequestInfo_RequestQoS | undefined; +} + +export enum RequestInfo_Criticality { + CRITICALITY_UNSPECIFIED = 0, + CRITICALITY_CRITICAL = 1, + CRITICALITY_NON_CRITICAL = 2, + UNRECOGNIZED = -1, +} + +export function requestInfo_CriticalityFromJSON(object: any): RequestInfo_Criticality { + switch (object) { + case 0: + case "CRITICALITY_UNSPECIFIED": + return RequestInfo_Criticality.CRITICALITY_UNSPECIFIED; + case 1: + case "CRITICALITY_CRITICAL": + return RequestInfo_Criticality.CRITICALITY_CRITICAL; + case 2: + case "CRITICALITY_NON_CRITICAL": + return RequestInfo_Criticality.CRITICALITY_NON_CRITICAL; + case -1: + case "UNRECOGNIZED": + default: + return RequestInfo_Criticality.UNRECOGNIZED; + } +} + +export function requestInfo_CriticalityToJSON(object: RequestInfo_Criticality): string { + switch (object) { + case RequestInfo_Criticality.CRITICALITY_UNSPECIFIED: + return "CRITICALITY_UNSPECIFIED"; + case RequestInfo_Criticality.CRITICALITY_CRITICAL: + return "CRITICALITY_CRITICAL"; + case RequestInfo_Criticality.CRITICALITY_NON_CRITICAL: + return "CRITICALITY_NON_CRITICAL"; + case RequestInfo_Criticality.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** Quality of Service? */ +export interface RequestInfo_RequestQoS { + criticality?: RequestInfo_Criticality | undefined; +} + +export interface RequestInfo_SessionInfo { + token?: string | undefined; +} + +export interface RequestInfo_ReauthRequestInfo { + encodedReauthProofToken?: string | undefined; +} + +function createBaseRequestInfo(): RequestInfo { + return { + thirdPartyDigest: undefined, + useSsl: undefined, + returnErrorDetail: undefined, + ifNoneMatch: undefined, + returnLogEntry: undefined, + isPrefetch: undefined, + internalExperimentFlags: [], + returnDebugData: undefined, + innertubez: undefined, + traceProto: undefined, + returnLogEntryJson: undefined, + sherlogUsername: undefined, + reauthRequestInfo: undefined, + sessionInfo: undefined, + returnLogEntryProto: undefined, + externalPrequestContext: undefined, + attestationResponseData: undefined, + eats: undefined, + requestQos: undefined, + }; +} + +export const RequestInfo: MessageFns = { + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.thirdPartyDigest !== undefined) { + writer.uint32(50).string(message.thirdPartyDigest); + } + if (message.useSsl !== undefined) { + writer.uint32(56).bool(message.useSsl); + } + if (message.returnErrorDetail !== undefined) { + writer.uint32(72).bool(message.returnErrorDetail); + } + if (message.ifNoneMatch !== undefined) { + writer.uint32(98).string(message.ifNoneMatch); + } + if (message.returnLogEntry !== undefined) { + writer.uint32(104).bool(message.returnLogEntry); + } + if (message.isPrefetch !== undefined) { + writer.uint32(112).bool(message.isPrefetch); + } + for (const v of message.internalExperimentFlags) { + KeyValuePair.encode(v!, writer.uint32(122).fork()).join(); + } + if (message.returnDebugData !== undefined) { + writer.uint32(128).bool(message.returnDebugData); + } + if (message.innertubez !== undefined) { + writer.uint32(146).string(message.innertubez); + } + if (message.traceProto !== undefined) { + writer.uint32(184).bool(message.traceProto); + } + if (message.returnLogEntryJson !== undefined) { + writer.uint32(192).bool(message.returnLogEntryJson); + } + if (message.sherlogUsername !== undefined) { + writer.uint32(202).string(message.sherlogUsername); + } + if (message.reauthRequestInfo !== undefined) { + RequestInfo_ReauthRequestInfo.encode(message.reauthRequestInfo, writer.uint32(234).fork()).join(); + } + if (message.sessionInfo !== undefined) { + RequestInfo_SessionInfo.encode(message.sessionInfo, writer.uint32(242).fork()).join(); + } + if (message.returnLogEntryProto !== undefined) { + writer.uint32(248).bool(message.returnLogEntryProto); + } + if (message.externalPrequestContext !== undefined) { + writer.uint32(258).string(message.externalPrequestContext); + } + if (message.attestationResponseData !== undefined) { + AttestationResponseData.encode(message.attestationResponseData, writer.uint32(274).fork()).join(); + } + if (message.eats !== undefined) { + writer.uint32(282).bytes(message.eats); + } + if (message.requestQos !== undefined) { + RequestInfo_RequestQoS.encode(message.requestQos, writer.uint32(290).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 6: + if (tag !== 50) { + break; + } + + message.thirdPartyDigest = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.useSsl = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.returnErrorDetail = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.ifNoneMatch = reader.string(); + continue; + case 13: + if (tag !== 104) { + break; + } + + message.returnLogEntry = reader.bool(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.isPrefetch = reader.bool(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.internalExperimentFlags.push(KeyValuePair.decode(reader, reader.uint32())); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.returnDebugData = reader.bool(); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.innertubez = reader.string(); + continue; + case 23: + if (tag !== 184) { + break; + } + + message.traceProto = reader.bool(); + continue; + case 24: + if (tag !== 192) { + break; + } + + message.returnLogEntryJson = reader.bool(); + continue; + case 25: + if (tag !== 202) { + break; + } + + message.sherlogUsername = reader.string(); + continue; + case 29: + if (tag !== 234) { + break; + } + + message.reauthRequestInfo = RequestInfo_ReauthRequestInfo.decode(reader, reader.uint32()); + continue; + case 30: + if (tag !== 242) { + break; + } + + message.sessionInfo = RequestInfo_SessionInfo.decode(reader, reader.uint32()); + continue; + case 31: + if (tag !== 248) { + break; + } + + message.returnLogEntryProto = reader.bool(); + continue; + case 32: + if (tag !== 258) { + break; + } + + message.externalPrequestContext = reader.string(); + continue; + case 34: + if (tag !== 274) { + break; + } + + message.attestationResponseData = AttestationResponseData.decode(reader, reader.uint32()); + continue; + case 35: + if (tag !== 282) { + break; + } + + message.eats = reader.bytes(); + continue; + case 36: + if (tag !== 290) { + break; + } + + message.requestQos = RequestInfo_RequestQoS.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + thirdPartyDigest: isSet(object.thirdPartyDigest) ? globalThis.String(object.thirdPartyDigest) : undefined, + useSsl: isSet(object.useSsl) ? globalThis.Boolean(object.useSsl) : undefined, + returnErrorDetail: isSet(object.returnErrorDetail) ? globalThis.Boolean(object.returnErrorDetail) : undefined, + ifNoneMatch: isSet(object.ifNoneMatch) ? globalThis.String(object.ifNoneMatch) : undefined, + returnLogEntry: isSet(object.returnLogEntry) ? globalThis.Boolean(object.returnLogEntry) : undefined, + isPrefetch: isSet(object.isPrefetch) ? globalThis.Boolean(object.isPrefetch) : undefined, + internalExperimentFlags: globalThis.Array.isArray(object?.internalExperimentFlags) + ? object.internalExperimentFlags.map((e: any) => KeyValuePair.fromJSON(e)) + : [], + returnDebugData: isSet(object.returnDebugData) ? globalThis.Boolean(object.returnDebugData) : undefined, + innertubez: isSet(object.innertubez) ? globalThis.String(object.innertubez) : undefined, + traceProto: isSet(object.traceProto) ? globalThis.Boolean(object.traceProto) : undefined, + returnLogEntryJson: isSet(object.returnLogEntryJson) ? globalThis.Boolean(object.returnLogEntryJson) : undefined, + sherlogUsername: isSet(object.sherlogUsername) ? globalThis.String(object.sherlogUsername) : undefined, + reauthRequestInfo: isSet(object.reauthRequestInfo) + ? RequestInfo_ReauthRequestInfo.fromJSON(object.reauthRequestInfo) + : undefined, + sessionInfo: isSet(object.sessionInfo) ? RequestInfo_SessionInfo.fromJSON(object.sessionInfo) : undefined, + returnLogEntryProto: isSet(object.returnLogEntryProto) + ? globalThis.Boolean(object.returnLogEntryProto) + : undefined, + externalPrequestContext: isSet(object.externalPrequestContext) + ? globalThis.String(object.externalPrequestContext) + : undefined, + attestationResponseData: isSet(object.attestationResponseData) + ? AttestationResponseData.fromJSON(object.attestationResponseData) + : undefined, + eats: isSet(object.eats) ? bytesFromBase64(object.eats) : undefined, + requestQos: isSet(object.requestQos) ? RequestInfo_RequestQoS.fromJSON(object.requestQos) : undefined, + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.thirdPartyDigest !== undefined) { + obj.thirdPartyDigest = message.thirdPartyDigest; + } + if (message.useSsl !== undefined) { + obj.useSsl = message.useSsl; + } + if (message.returnErrorDetail !== undefined) { + obj.returnErrorDetail = message.returnErrorDetail; + } + if (message.ifNoneMatch !== undefined) { + obj.ifNoneMatch = message.ifNoneMatch; + } + if (message.returnLogEntry !== undefined) { + obj.returnLogEntry = message.returnLogEntry; + } + if (message.isPrefetch !== undefined) { + obj.isPrefetch = message.isPrefetch; + } + if (message.internalExperimentFlags?.length) { + obj.internalExperimentFlags = message.internalExperimentFlags.map((e) => KeyValuePair.toJSON(e)); + } + if (message.returnDebugData !== undefined) { + obj.returnDebugData = message.returnDebugData; + } + if (message.innertubez !== undefined) { + obj.innertubez = message.innertubez; + } + if (message.traceProto !== undefined) { + obj.traceProto = message.traceProto; + } + if (message.returnLogEntryJson !== undefined) { + obj.returnLogEntryJson = message.returnLogEntryJson; + } + if (message.sherlogUsername !== undefined) { + obj.sherlogUsername = message.sherlogUsername; + } + if (message.reauthRequestInfo !== undefined) { + obj.reauthRequestInfo = RequestInfo_ReauthRequestInfo.toJSON(message.reauthRequestInfo); + } + if (message.sessionInfo !== undefined) { + obj.sessionInfo = RequestInfo_SessionInfo.toJSON(message.sessionInfo); + } + if (message.returnLogEntryProto !== undefined) { + obj.returnLogEntryProto = message.returnLogEntryProto; + } + if (message.externalPrequestContext !== undefined) { + obj.externalPrequestContext = message.externalPrequestContext; + } + if (message.attestationResponseData !== undefined) { + obj.attestationResponseData = AttestationResponseData.toJSON(message.attestationResponseData); + } + if (message.eats !== undefined) { + obj.eats = base64FromBytes(message.eats); + } + if (message.requestQos !== undefined) { + obj.requestQos = RequestInfo_RequestQoS.toJSON(message.requestQos); + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.thirdPartyDigest = object.thirdPartyDigest ?? undefined; + message.useSsl = object.useSsl ?? undefined; + message.returnErrorDetail = object.returnErrorDetail ?? undefined; + message.ifNoneMatch = object.ifNoneMatch ?? undefined; + message.returnLogEntry = object.returnLogEntry ?? undefined; + message.isPrefetch = object.isPrefetch ?? undefined; + message.internalExperimentFlags = object.internalExperimentFlags?.map((e) => KeyValuePair.fromPartial(e)) || []; + message.returnDebugData = object.returnDebugData ?? undefined; + message.innertubez = object.innertubez ?? undefined; + message.traceProto = object.traceProto ?? undefined; + message.returnLogEntryJson = object.returnLogEntryJson ?? undefined; + message.sherlogUsername = object.sherlogUsername ?? undefined; + message.reauthRequestInfo = (object.reauthRequestInfo !== undefined && object.reauthRequestInfo !== null) + ? RequestInfo_ReauthRequestInfo.fromPartial(object.reauthRequestInfo) + : undefined; + message.sessionInfo = (object.sessionInfo !== undefined && object.sessionInfo !== null) + ? RequestInfo_SessionInfo.fromPartial(object.sessionInfo) + : undefined; + message.returnLogEntryProto = object.returnLogEntryProto ?? undefined; + message.externalPrequestContext = object.externalPrequestContext ?? undefined; + message.attestationResponseData = + (object.attestationResponseData !== undefined && object.attestationResponseData !== null) + ? AttestationResponseData.fromPartial(object.attestationResponseData) + : undefined; + message.eats = object.eats ?? undefined; + message.requestQos = (object.requestQos !== undefined && object.requestQos !== null) + ? RequestInfo_RequestQoS.fromPartial(object.requestQos) + : undefined; + return message; + }, +}; + +function createBaseRequestInfo_RequestQoS(): RequestInfo_RequestQoS { + return { criticality: undefined }; +} + +export const RequestInfo_RequestQoS: MessageFns = { + encode(message: RequestInfo_RequestQoS, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.criticality !== undefined) { + writer.uint32(8).int32(message.criticality); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo_RequestQoS { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo_RequestQoS(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.criticality = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo_RequestQoS { + return { criticality: isSet(object.criticality) ? requestInfo_CriticalityFromJSON(object.criticality) : undefined }; + }, + + toJSON(message: RequestInfo_RequestQoS): unknown { + const obj: any = {}; + if (message.criticality !== undefined) { + obj.criticality = requestInfo_CriticalityToJSON(message.criticality); + } + return obj; + }, + + create, I>>(base?: I): RequestInfo_RequestQoS { + return RequestInfo_RequestQoS.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo_RequestQoS { + const message = createBaseRequestInfo_RequestQoS(); + message.criticality = object.criticality ?? undefined; + return message; + }, +}; + +function createBaseRequestInfo_SessionInfo(): RequestInfo_SessionInfo { + return { token: undefined }; +} + +export const RequestInfo_SessionInfo: MessageFns = { + encode(message: RequestInfo_SessionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.token !== undefined) { + writer.uint32(10).string(message.token); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo_SessionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo_SessionInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.token = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo_SessionInfo { + return { token: isSet(object.token) ? globalThis.String(object.token) : undefined }; + }, + + toJSON(message: RequestInfo_SessionInfo): unknown { + const obj: any = {}; + if (message.token !== undefined) { + obj.token = message.token; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo_SessionInfo { + return RequestInfo_SessionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo_SessionInfo { + const message = createBaseRequestInfo_SessionInfo(); + message.token = object.token ?? undefined; + return message; + }, +}; + +function createBaseRequestInfo_ReauthRequestInfo(): RequestInfo_ReauthRequestInfo { + return { encodedReauthProofToken: undefined }; +} + +export const RequestInfo_ReauthRequestInfo: MessageFns = { + encode(message: RequestInfo_ReauthRequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.encodedReauthProofToken !== undefined) { + writer.uint32(10).string(message.encodedReauthProofToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo_ReauthRequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo_ReauthRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.encodedReauthProofToken = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo_ReauthRequestInfo { + return { + encodedReauthProofToken: isSet(object.encodedReauthProofToken) + ? globalThis.String(object.encodedReauthProofToken) + : undefined, + }; + }, + + toJSON(message: RequestInfo_ReauthRequestInfo): unknown { + const obj: any = {}; + if (message.encodedReauthProofToken !== undefined) { + obj.encodedReauthProofToken = message.encodedReauthProofToken; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo_ReauthRequestInfo { + return RequestInfo_ReauthRequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): RequestInfo_ReauthRequestInfo { + const message = createBaseRequestInfo_ReauthRequestInfo(); + message.encodedReauthProofToken = object.encodedReauthProofToken ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/service_integrity_dimensions.ts b/protos/generated/youtube/api/pfiinnertube/service_integrity_dimensions.ts new file mode 100644 index 0000000000..077e46fad3 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/service_integrity_dimensions.ts @@ -0,0 +1,113 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/service_integrity_dimensions.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface ServiceIntegrityDimensions { + poToken?: Uint8Array | undefined; +} + +function createBaseServiceIntegrityDimensions(): ServiceIntegrityDimensions { + return { poToken: undefined }; +} + +export const ServiceIntegrityDimensions: MessageFns = { + encode(message: ServiceIntegrityDimensions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.poToken !== undefined) { + writer.uint32(10).bytes(message.poToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceIntegrityDimensions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceIntegrityDimensions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.poToken = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceIntegrityDimensions { + return { poToken: isSet(object.poToken) ? bytesFromBase64(object.poToken) : undefined }; + }, + + toJSON(message: ServiceIntegrityDimensions): unknown { + const obj: any = {}; + if (message.poToken !== undefined) { + obj.poToken = base64FromBytes(message.poToken); + } + return obj; + }, + + create, I>>(base?: I): ServiceIntegrityDimensions { + return ServiceIntegrityDimensions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceIntegrityDimensions { + const message = createBaseServiceIntegrityDimensions(); + message.poToken = object.poToken ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/third_party_info.ts b/protos/generated/youtube/api/pfiinnertube/third_party_info.ts new file mode 100644 index 0000000000..8d673d6b00 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/third_party_info.ts @@ -0,0 +1,293 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/third_party_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface ThirdPartyInfo { + developerKey?: string | undefined; + appName?: string | undefined; + appPublisher?: string | undefined; + embedUrl?: string | undefined; + appVersion?: string | undefined; + embeddedPlayerContext?: ThirdPartyInfo_EmbeddedPlayerContext | undefined; +} + +export interface ThirdPartyInfo_EmbeddedPlayerContext { + ancestorOrigins?: string | undefined; + embeddedPlayerEncryptedContext?: string | undefined; + ancestorOriginsSupported?: boolean | undefined; +} + +function createBaseThirdPartyInfo(): ThirdPartyInfo { + return { + developerKey: undefined, + appName: undefined, + appPublisher: undefined, + embedUrl: undefined, + appVersion: undefined, + embeddedPlayerContext: undefined, + }; +} + +export const ThirdPartyInfo: MessageFns = { + encode(message: ThirdPartyInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.developerKey !== undefined) { + writer.uint32(10).string(message.developerKey); + } + if (message.appName !== undefined) { + writer.uint32(18).string(message.appName); + } + if (message.appPublisher !== undefined) { + writer.uint32(26).string(message.appPublisher); + } + if (message.embedUrl !== undefined) { + writer.uint32(34).string(message.embedUrl); + } + if (message.appVersion !== undefined) { + writer.uint32(50).string(message.appVersion); + } + if (message.embeddedPlayerContext !== undefined) { + ThirdPartyInfo_EmbeddedPlayerContext.encode(message.embeddedPlayerContext, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThirdPartyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThirdPartyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.developerKey = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.appName = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.appPublisher = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.embedUrl = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.appVersion = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.embeddedPlayerContext = ThirdPartyInfo_EmbeddedPlayerContext.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThirdPartyInfo { + return { + developerKey: isSet(object.developerKey) ? globalThis.String(object.developerKey) : undefined, + appName: isSet(object.appName) ? globalThis.String(object.appName) : undefined, + appPublisher: isSet(object.appPublisher) ? globalThis.String(object.appPublisher) : undefined, + embedUrl: isSet(object.embedUrl) ? globalThis.String(object.embedUrl) : undefined, + appVersion: isSet(object.appVersion) ? globalThis.String(object.appVersion) : undefined, + embeddedPlayerContext: isSet(object.embeddedPlayerContext) + ? ThirdPartyInfo_EmbeddedPlayerContext.fromJSON(object.embeddedPlayerContext) + : undefined, + }; + }, + + toJSON(message: ThirdPartyInfo): unknown { + const obj: any = {}; + if (message.developerKey !== undefined) { + obj.developerKey = message.developerKey; + } + if (message.appName !== undefined) { + obj.appName = message.appName; + } + if (message.appPublisher !== undefined) { + obj.appPublisher = message.appPublisher; + } + if (message.embedUrl !== undefined) { + obj.embedUrl = message.embedUrl; + } + if (message.appVersion !== undefined) { + obj.appVersion = message.appVersion; + } + if (message.embeddedPlayerContext !== undefined) { + obj.embeddedPlayerContext = ThirdPartyInfo_EmbeddedPlayerContext.toJSON(message.embeddedPlayerContext); + } + return obj; + }, + + create, I>>(base?: I): ThirdPartyInfo { + return ThirdPartyInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ThirdPartyInfo { + const message = createBaseThirdPartyInfo(); + message.developerKey = object.developerKey ?? undefined; + message.appName = object.appName ?? undefined; + message.appPublisher = object.appPublisher ?? undefined; + message.embedUrl = object.embedUrl ?? undefined; + message.appVersion = object.appVersion ?? undefined; + message.embeddedPlayerContext = + (object.embeddedPlayerContext !== undefined && object.embeddedPlayerContext !== null) + ? ThirdPartyInfo_EmbeddedPlayerContext.fromPartial(object.embeddedPlayerContext) + : undefined; + return message; + }, +}; + +function createBaseThirdPartyInfo_EmbeddedPlayerContext(): ThirdPartyInfo_EmbeddedPlayerContext { + return { ancestorOrigins: undefined, embeddedPlayerEncryptedContext: undefined, ancestorOriginsSupported: undefined }; +} + +export const ThirdPartyInfo_EmbeddedPlayerContext: MessageFns = { + encode(message: ThirdPartyInfo_EmbeddedPlayerContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ancestorOrigins !== undefined) { + writer.uint32(10).string(message.ancestorOrigins); + } + if (message.embeddedPlayerEncryptedContext !== undefined) { + writer.uint32(18).string(message.embeddedPlayerEncryptedContext); + } + if (message.ancestorOriginsSupported !== undefined) { + writer.uint32(24).bool(message.ancestorOriginsSupported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ThirdPartyInfo_EmbeddedPlayerContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThirdPartyInfo_EmbeddedPlayerContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ancestorOrigins = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.embeddedPlayerEncryptedContext = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.ancestorOriginsSupported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ThirdPartyInfo_EmbeddedPlayerContext { + return { + ancestorOrigins: isSet(object.ancestorOrigins) ? globalThis.String(object.ancestorOrigins) : undefined, + embeddedPlayerEncryptedContext: isSet(object.embeddedPlayerEncryptedContext) + ? globalThis.String(object.embeddedPlayerEncryptedContext) + : undefined, + ancestorOriginsSupported: isSet(object.ancestorOriginsSupported) + ? globalThis.Boolean(object.ancestorOriginsSupported) + : undefined, + }; + }, + + toJSON(message: ThirdPartyInfo_EmbeddedPlayerContext): unknown { + const obj: any = {}; + if (message.ancestorOrigins !== undefined) { + obj.ancestorOrigins = message.ancestorOrigins; + } + if (message.embeddedPlayerEncryptedContext !== undefined) { + obj.embeddedPlayerEncryptedContext = message.embeddedPlayerEncryptedContext; + } + if (message.ancestorOriginsSupported !== undefined) { + obj.ancestorOriginsSupported = message.ancestorOriginsSupported; + } + return obj; + }, + + create, I>>( + base?: I, + ): ThirdPartyInfo_EmbeddedPlayerContext { + return ThirdPartyInfo_EmbeddedPlayerContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): ThirdPartyInfo_EmbeddedPlayerContext { + const message = createBaseThirdPartyInfo_EmbeddedPlayerContext(); + message.ancestorOrigins = object.ancestorOrigins ?? undefined; + message.embeddedPlayerEncryptedContext = object.embeddedPlayerEncryptedContext ?? undefined; + message.ancestorOriginsSupported = object.ancestorOriginsSupported ?? undefined; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/user_info.ts b/protos/generated/youtube/api/pfiinnertube/user_info.ts new file mode 100644 index 0000000000..8cc3556592 --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/user_info.ts @@ -0,0 +1,441 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/user_info.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface UserInfo { + onBehalfOfUser?: string | undefined; + enableSafetyMode?: boolean | undefined; + credentialTransferTokens: UserInfo_CredentialTransferToken[]; + delegatePurchases?: UserInfo_DelegatePurchases | undefined; + kidsParent?: UserInfo_KidsParent | undefined; + isIncognito?: boolean | undefined; + lockedSafetyMode?: boolean | undefined; + delegationContext?: UserInfo_DelegationContext | undefined; + serializedDelegationContext?: string | undefined; +} + +export interface UserInfo_KidsParent { +} + +export interface UserInfo_DelegatePurchases { +} + +export interface UserInfo_DelegationContext { +} + +export interface UserInfo_CredentialTransferToken { +} + +function createBaseUserInfo(): UserInfo { + return { + onBehalfOfUser: undefined, + enableSafetyMode: undefined, + credentialTransferTokens: [], + delegatePurchases: undefined, + kidsParent: undefined, + isIncognito: undefined, + lockedSafetyMode: undefined, + delegationContext: undefined, + serializedDelegationContext: undefined, + }; +} + +export const UserInfo: MessageFns = { + encode(message: UserInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.onBehalfOfUser !== undefined) { + writer.uint32(26).string(message.onBehalfOfUser); + } + if (message.enableSafetyMode !== undefined) { + writer.uint32(56).bool(message.enableSafetyMode); + } + for (const v of message.credentialTransferTokens) { + UserInfo_CredentialTransferToken.encode(v!, writer.uint32(98).fork()).join(); + } + if (message.delegatePurchases !== undefined) { + UserInfo_DelegatePurchases.encode(message.delegatePurchases, writer.uint32(106).fork()).join(); + } + if (message.kidsParent !== undefined) { + UserInfo_KidsParent.encode(message.kidsParent, writer.uint32(114).fork()).join(); + } + if (message.isIncognito !== undefined) { + writer.uint32(120).bool(message.isIncognito); + } + if (message.lockedSafetyMode !== undefined) { + writer.uint32(128).bool(message.lockedSafetyMode); + } + if (message.delegationContext !== undefined) { + UserInfo_DelegationContext.encode(message.delegationContext, writer.uint32(138).fork()).join(); + } + if (message.serializedDelegationContext !== undefined) { + writer.uint32(146).string(message.serializedDelegationContext); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.onBehalfOfUser = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.enableSafetyMode = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.credentialTransferTokens.push(UserInfo_CredentialTransferToken.decode(reader, reader.uint32())); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.delegatePurchases = UserInfo_DelegatePurchases.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.kidsParent = UserInfo_KidsParent.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.isIncognito = reader.bool(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.lockedSafetyMode = reader.bool(); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.delegationContext = UserInfo_DelegationContext.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.serializedDelegationContext = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UserInfo { + return { + onBehalfOfUser: isSet(object.onBehalfOfUser) ? globalThis.String(object.onBehalfOfUser) : undefined, + enableSafetyMode: isSet(object.enableSafetyMode) ? globalThis.Boolean(object.enableSafetyMode) : undefined, + credentialTransferTokens: globalThis.Array.isArray(object?.credentialTransferTokens) + ? object.credentialTransferTokens.map((e: any) => UserInfo_CredentialTransferToken.fromJSON(e)) + : [], + delegatePurchases: isSet(object.delegatePurchases) + ? UserInfo_DelegatePurchases.fromJSON(object.delegatePurchases) + : undefined, + kidsParent: isSet(object.kidsParent) ? UserInfo_KidsParent.fromJSON(object.kidsParent) : undefined, + isIncognito: isSet(object.isIncognito) ? globalThis.Boolean(object.isIncognito) : undefined, + lockedSafetyMode: isSet(object.lockedSafetyMode) ? globalThis.Boolean(object.lockedSafetyMode) : undefined, + delegationContext: isSet(object.delegationContext) + ? UserInfo_DelegationContext.fromJSON(object.delegationContext) + : undefined, + serializedDelegationContext: isSet(object.serializedDelegationContext) + ? globalThis.String(object.serializedDelegationContext) + : undefined, + }; + }, + + toJSON(message: UserInfo): unknown { + const obj: any = {}; + if (message.onBehalfOfUser !== undefined) { + obj.onBehalfOfUser = message.onBehalfOfUser; + } + if (message.enableSafetyMode !== undefined) { + obj.enableSafetyMode = message.enableSafetyMode; + } + if (message.credentialTransferTokens?.length) { + obj.credentialTransferTokens = message.credentialTransferTokens.map((e) => + UserInfo_CredentialTransferToken.toJSON(e) + ); + } + if (message.delegatePurchases !== undefined) { + obj.delegatePurchases = UserInfo_DelegatePurchases.toJSON(message.delegatePurchases); + } + if (message.kidsParent !== undefined) { + obj.kidsParent = UserInfo_KidsParent.toJSON(message.kidsParent); + } + if (message.isIncognito !== undefined) { + obj.isIncognito = message.isIncognito; + } + if (message.lockedSafetyMode !== undefined) { + obj.lockedSafetyMode = message.lockedSafetyMode; + } + if (message.delegationContext !== undefined) { + obj.delegationContext = UserInfo_DelegationContext.toJSON(message.delegationContext); + } + if (message.serializedDelegationContext !== undefined) { + obj.serializedDelegationContext = message.serializedDelegationContext; + } + return obj; + }, + + create, I>>(base?: I): UserInfo { + return UserInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UserInfo { + const message = createBaseUserInfo(); + message.onBehalfOfUser = object.onBehalfOfUser ?? undefined; + message.enableSafetyMode = object.enableSafetyMode ?? undefined; + message.credentialTransferTokens = + object.credentialTransferTokens?.map((e) => UserInfo_CredentialTransferToken.fromPartial(e)) || []; + message.delegatePurchases = (object.delegatePurchases !== undefined && object.delegatePurchases !== null) + ? UserInfo_DelegatePurchases.fromPartial(object.delegatePurchases) + : undefined; + message.kidsParent = (object.kidsParent !== undefined && object.kidsParent !== null) + ? UserInfo_KidsParent.fromPartial(object.kidsParent) + : undefined; + message.isIncognito = object.isIncognito ?? undefined; + message.lockedSafetyMode = object.lockedSafetyMode ?? undefined; + message.delegationContext = (object.delegationContext !== undefined && object.delegationContext !== null) + ? UserInfo_DelegationContext.fromPartial(object.delegationContext) + : undefined; + message.serializedDelegationContext = object.serializedDelegationContext ?? undefined; + return message; + }, +}; + +function createBaseUserInfo_KidsParent(): UserInfo_KidsParent { + return {}; +} + +export const UserInfo_KidsParent: MessageFns = { + encode(_: UserInfo_KidsParent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo_KidsParent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo_KidsParent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): UserInfo_KidsParent { + return {}; + }, + + toJSON(_: UserInfo_KidsParent): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): UserInfo_KidsParent { + return UserInfo_KidsParent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): UserInfo_KidsParent { + const message = createBaseUserInfo_KidsParent(); + return message; + }, +}; + +function createBaseUserInfo_DelegatePurchases(): UserInfo_DelegatePurchases { + return {}; +} + +export const UserInfo_DelegatePurchases: MessageFns = { + encode(_: UserInfo_DelegatePurchases, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo_DelegatePurchases { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo_DelegatePurchases(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): UserInfo_DelegatePurchases { + return {}; + }, + + toJSON(_: UserInfo_DelegatePurchases): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): UserInfo_DelegatePurchases { + return UserInfo_DelegatePurchases.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): UserInfo_DelegatePurchases { + const message = createBaseUserInfo_DelegatePurchases(); + return message; + }, +}; + +function createBaseUserInfo_DelegationContext(): UserInfo_DelegationContext { + return {}; +} + +export const UserInfo_DelegationContext: MessageFns = { + encode(_: UserInfo_DelegationContext, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo_DelegationContext { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo_DelegationContext(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): UserInfo_DelegationContext { + return {}; + }, + + toJSON(_: UserInfo_DelegationContext): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): UserInfo_DelegationContext { + return UserInfo_DelegationContext.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): UserInfo_DelegationContext { + const message = createBaseUserInfo_DelegationContext(); + return message; + }, +}; + +function createBaseUserInfo_CredentialTransferToken(): UserInfo_CredentialTransferToken { + return {}; +} + +export const UserInfo_CredentialTransferToken: MessageFns = { + encode(_: UserInfo_CredentialTransferToken, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UserInfo_CredentialTransferToken { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUserInfo_CredentialTransferToken(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): UserInfo_CredentialTransferToken { + return {}; + }, + + toJSON(_: UserInfo_CredentialTransferToken): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>( + base?: I, + ): UserInfo_CredentialTransferToken { + return UserInfo_CredentialTransferToken.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + _: I, + ): UserInfo_CredentialTransferToken { + const message = createBaseUserInfo_CredentialTransferToken(); + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/generated/youtube/api/pfiinnertube/watch_next_request.ts b/protos/generated/youtube/api/pfiinnertube/watch_next_request.ts new file mode 100644 index 0000000000..305ae950bb --- /dev/null +++ b/protos/generated/youtube/api/pfiinnertube/watch_next_request.ts @@ -0,0 +1,612 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.2.0 +// protoc v5.28.0 +// source: youtube/api/pfiinnertube/watch_next_request.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { InnerTubeContext } from "./innertube_context.js"; + +export const protobufPackage = "youtube.api.pfiinnertube"; + +export interface WatchNextRequest { + context?: InnerTubeContext | undefined; + videoId?: string | undefined; + playlistId?: string | undefined; + params?: string | undefined; + continuation?: string | undefined; + isAdPlayback?: boolean | undefined; + mdxUseDevServer?: boolean | undefined; + referrer?: string | undefined; + referringApp?: string | undefined; + adParams?: string | undefined; + requestMusicSequence?: boolean | undefined; + enableMdxAutoplay?: boolean | undefined; + isMdxPlayback?: boolean | undefined; + racyCheckOk?: boolean | undefined; + contentCheckOk?: boolean | undefined; + isAudioOnly?: boolean | undefined; + autonavEnabled?: boolean | undefined; + enablePersistentPlaylistPanel?: boolean | undefined; + playlistSetVideoId?: string | undefined; + showRuInvalidTokenMessage?: boolean | undefined; + serializedThirdPartyEmbedConfig?: string | undefined; + showContentOwnerOnly?: boolean | undefined; + isEmbedPreview?: boolean | undefined; + lastScrubbedInlinePlaybackVideoId?: string | undefined; + lastAudioTurnedOnInlinePlaybackVideoId?: string | undefined; + lastAudioTurnedOffInlinePlaybackVideoId?: string | undefined; + captionsRequested?: boolean | undefined; + queueContextParams?: Uint8Array | undefined; + showShortsOnly?: boolean | undefined; +} + +function createBaseWatchNextRequest(): WatchNextRequest { + return { + context: undefined, + videoId: undefined, + playlistId: undefined, + params: undefined, + continuation: undefined, + isAdPlayback: undefined, + mdxUseDevServer: undefined, + referrer: undefined, + referringApp: undefined, + adParams: undefined, + requestMusicSequence: undefined, + enableMdxAutoplay: undefined, + isMdxPlayback: undefined, + racyCheckOk: undefined, + contentCheckOk: undefined, + isAudioOnly: undefined, + autonavEnabled: undefined, + enablePersistentPlaylistPanel: undefined, + playlistSetVideoId: undefined, + showRuInvalidTokenMessage: undefined, + serializedThirdPartyEmbedConfig: undefined, + showContentOwnerOnly: undefined, + isEmbedPreview: undefined, + lastScrubbedInlinePlaybackVideoId: undefined, + lastAudioTurnedOnInlinePlaybackVideoId: undefined, + lastAudioTurnedOffInlinePlaybackVideoId: undefined, + captionsRequested: undefined, + queueContextParams: undefined, + showShortsOnly: undefined, + }; +} + +export const WatchNextRequest: MessageFns = { + encode(message: WatchNextRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.context !== undefined) { + InnerTubeContext.encode(message.context, writer.uint32(10).fork()).join(); + } + if (message.videoId !== undefined) { + writer.uint32(18).string(message.videoId); + } + if (message.playlistId !== undefined) { + writer.uint32(34).string(message.playlistId); + } + if (message.params !== undefined) { + writer.uint32(50).string(message.params); + } + if (message.continuation !== undefined) { + writer.uint32(66).string(message.continuation); + } + if (message.isAdPlayback !== undefined) { + writer.uint32(72).bool(message.isAdPlayback); + } + if (message.mdxUseDevServer !== undefined) { + writer.uint32(80).bool(message.mdxUseDevServer); + } + if (message.referrer !== undefined) { + writer.uint32(98).string(message.referrer); + } + if (message.referringApp !== undefined) { + writer.uint32(106).string(message.referringApp); + } + if (message.adParams !== undefined) { + writer.uint32(130).string(message.adParams); + } + if (message.requestMusicSequence !== undefined) { + writer.uint32(144).bool(message.requestMusicSequence); + } + if (message.enableMdxAutoplay !== undefined) { + writer.uint32(168).bool(message.enableMdxAutoplay); + } + if (message.isMdxPlayback !== undefined) { + writer.uint32(176).bool(message.isMdxPlayback); + } + if (message.racyCheckOk !== undefined) { + writer.uint32(192).bool(message.racyCheckOk); + } + if (message.contentCheckOk !== undefined) { + writer.uint32(200).bool(message.contentCheckOk); + } + if (message.isAudioOnly !== undefined) { + writer.uint32(208).bool(message.isAudioOnly); + } + if (message.autonavEnabled !== undefined) { + writer.uint32(216).bool(message.autonavEnabled); + } + if (message.enablePersistentPlaylistPanel !== undefined) { + writer.uint32(240).bool(message.enablePersistentPlaylistPanel); + } + if (message.playlistSetVideoId !== undefined) { + writer.uint32(250).string(message.playlistSetVideoId); + } + if (message.showRuInvalidTokenMessage !== undefined) { + writer.uint32(280).bool(message.showRuInvalidTokenMessage); + } + if (message.serializedThirdPartyEmbedConfig !== undefined) { + writer.uint32(298).string(message.serializedThirdPartyEmbedConfig); + } + if (message.showContentOwnerOnly !== undefined) { + writer.uint32(304).bool(message.showContentOwnerOnly); + } + if (message.isEmbedPreview !== undefined) { + writer.uint32(336).bool(message.isEmbedPreview); + } + if (message.lastScrubbedInlinePlaybackVideoId !== undefined) { + writer.uint32(346).string(message.lastScrubbedInlinePlaybackVideoId); + } + if (message.lastAudioTurnedOnInlinePlaybackVideoId !== undefined) { + writer.uint32(354).string(message.lastAudioTurnedOnInlinePlaybackVideoId); + } + if (message.lastAudioTurnedOffInlinePlaybackVideoId !== undefined) { + writer.uint32(362).string(message.lastAudioTurnedOffInlinePlaybackVideoId); + } + if (message.captionsRequested !== undefined) { + writer.uint32(376).bool(message.captionsRequested); + } + if (message.queueContextParams !== undefined) { + writer.uint32(402).bytes(message.queueContextParams); + } + if (message.showShortsOnly !== undefined) { + writer.uint32(440).bool(message.showShortsOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WatchNextRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWatchNextRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.context = InnerTubeContext.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.videoId = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.playlistId = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.params = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.continuation = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.isAdPlayback = reader.bool(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.mdxUseDevServer = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.referrer = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.referringApp = reader.string(); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.adParams = reader.string(); + continue; + case 18: + if (tag !== 144) { + break; + } + + message.requestMusicSequence = reader.bool(); + continue; + case 21: + if (tag !== 168) { + break; + } + + message.enableMdxAutoplay = reader.bool(); + continue; + case 22: + if (tag !== 176) { + break; + } + + message.isMdxPlayback = reader.bool(); + continue; + case 24: + if (tag !== 192) { + break; + } + + message.racyCheckOk = reader.bool(); + continue; + case 25: + if (tag !== 200) { + break; + } + + message.contentCheckOk = reader.bool(); + continue; + case 26: + if (tag !== 208) { + break; + } + + message.isAudioOnly = reader.bool(); + continue; + case 27: + if (tag !== 216) { + break; + } + + message.autonavEnabled = reader.bool(); + continue; + case 30: + if (tag !== 240) { + break; + } + + message.enablePersistentPlaylistPanel = reader.bool(); + continue; + case 31: + if (tag !== 250) { + break; + } + + message.playlistSetVideoId = reader.string(); + continue; + case 35: + if (tag !== 280) { + break; + } + + message.showRuInvalidTokenMessage = reader.bool(); + continue; + case 37: + if (tag !== 298) { + break; + } + + message.serializedThirdPartyEmbedConfig = reader.string(); + continue; + case 38: + if (tag !== 304) { + break; + } + + message.showContentOwnerOnly = reader.bool(); + continue; + case 42: + if (tag !== 336) { + break; + } + + message.isEmbedPreview = reader.bool(); + continue; + case 43: + if (tag !== 346) { + break; + } + + message.lastScrubbedInlinePlaybackVideoId = reader.string(); + continue; + case 44: + if (tag !== 354) { + break; + } + + message.lastAudioTurnedOnInlinePlaybackVideoId = reader.string(); + continue; + case 45: + if (tag !== 362) { + break; + } + + message.lastAudioTurnedOffInlinePlaybackVideoId = reader.string(); + continue; + case 47: + if (tag !== 376) { + break; + } + + message.captionsRequested = reader.bool(); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.queueContextParams = reader.bytes(); + continue; + case 55: + if (tag !== 440) { + break; + } + + message.showShortsOnly = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WatchNextRequest { + return { + context: isSet(object.context) ? InnerTubeContext.fromJSON(object.context) : undefined, + videoId: isSet(object.videoId) ? globalThis.String(object.videoId) : undefined, + playlistId: isSet(object.playlistId) ? globalThis.String(object.playlistId) : undefined, + params: isSet(object.params) ? globalThis.String(object.params) : undefined, + continuation: isSet(object.continuation) ? globalThis.String(object.continuation) : undefined, + isAdPlayback: isSet(object.isAdPlayback) ? globalThis.Boolean(object.isAdPlayback) : undefined, + mdxUseDevServer: isSet(object.mdxUseDevServer) ? globalThis.Boolean(object.mdxUseDevServer) : undefined, + referrer: isSet(object.referrer) ? globalThis.String(object.referrer) : undefined, + referringApp: isSet(object.referringApp) ? globalThis.String(object.referringApp) : undefined, + adParams: isSet(object.adParams) ? globalThis.String(object.adParams) : undefined, + requestMusicSequence: isSet(object.requestMusicSequence) + ? globalThis.Boolean(object.requestMusicSequence) + : undefined, + enableMdxAutoplay: isSet(object.enableMdxAutoplay) ? globalThis.Boolean(object.enableMdxAutoplay) : undefined, + isMdxPlayback: isSet(object.isMdxPlayback) ? globalThis.Boolean(object.isMdxPlayback) : undefined, + racyCheckOk: isSet(object.racyCheckOk) ? globalThis.Boolean(object.racyCheckOk) : undefined, + contentCheckOk: isSet(object.contentCheckOk) ? globalThis.Boolean(object.contentCheckOk) : undefined, + isAudioOnly: isSet(object.isAudioOnly) ? globalThis.Boolean(object.isAudioOnly) : undefined, + autonavEnabled: isSet(object.autonavEnabled) ? globalThis.Boolean(object.autonavEnabled) : undefined, + enablePersistentPlaylistPanel: isSet(object.enablePersistentPlaylistPanel) + ? globalThis.Boolean(object.enablePersistentPlaylistPanel) + : undefined, + playlistSetVideoId: isSet(object.playlistSetVideoId) ? globalThis.String(object.playlistSetVideoId) : undefined, + showRuInvalidTokenMessage: isSet(object.showRuInvalidTokenMessage) + ? globalThis.Boolean(object.showRuInvalidTokenMessage) + : undefined, + serializedThirdPartyEmbedConfig: isSet(object.serializedThirdPartyEmbedConfig) + ? globalThis.String(object.serializedThirdPartyEmbedConfig) + : undefined, + showContentOwnerOnly: isSet(object.showContentOwnerOnly) + ? globalThis.Boolean(object.showContentOwnerOnly) + : undefined, + isEmbedPreview: isSet(object.isEmbedPreview) ? globalThis.Boolean(object.isEmbedPreview) : undefined, + lastScrubbedInlinePlaybackVideoId: isSet(object.lastScrubbedInlinePlaybackVideoId) + ? globalThis.String(object.lastScrubbedInlinePlaybackVideoId) + : undefined, + lastAudioTurnedOnInlinePlaybackVideoId: isSet(object.lastAudioTurnedOnInlinePlaybackVideoId) + ? globalThis.String(object.lastAudioTurnedOnInlinePlaybackVideoId) + : undefined, + lastAudioTurnedOffInlinePlaybackVideoId: isSet(object.lastAudioTurnedOffInlinePlaybackVideoId) + ? globalThis.String(object.lastAudioTurnedOffInlinePlaybackVideoId) + : undefined, + captionsRequested: isSet(object.captionsRequested) ? globalThis.Boolean(object.captionsRequested) : undefined, + queueContextParams: isSet(object.queueContextParams) ? bytesFromBase64(object.queueContextParams) : undefined, + showShortsOnly: isSet(object.showShortsOnly) ? globalThis.Boolean(object.showShortsOnly) : undefined, + }; + }, + + toJSON(message: WatchNextRequest): unknown { + const obj: any = {}; + if (message.context !== undefined) { + obj.context = InnerTubeContext.toJSON(message.context); + } + if (message.videoId !== undefined) { + obj.videoId = message.videoId; + } + if (message.playlistId !== undefined) { + obj.playlistId = message.playlistId; + } + if (message.params !== undefined) { + obj.params = message.params; + } + if (message.continuation !== undefined) { + obj.continuation = message.continuation; + } + if (message.isAdPlayback !== undefined) { + obj.isAdPlayback = message.isAdPlayback; + } + if (message.mdxUseDevServer !== undefined) { + obj.mdxUseDevServer = message.mdxUseDevServer; + } + if (message.referrer !== undefined) { + obj.referrer = message.referrer; + } + if (message.referringApp !== undefined) { + obj.referringApp = message.referringApp; + } + if (message.adParams !== undefined) { + obj.adParams = message.adParams; + } + if (message.requestMusicSequence !== undefined) { + obj.requestMusicSequence = message.requestMusicSequence; + } + if (message.enableMdxAutoplay !== undefined) { + obj.enableMdxAutoplay = message.enableMdxAutoplay; + } + if (message.isMdxPlayback !== undefined) { + obj.isMdxPlayback = message.isMdxPlayback; + } + if (message.racyCheckOk !== undefined) { + obj.racyCheckOk = message.racyCheckOk; + } + if (message.contentCheckOk !== undefined) { + obj.contentCheckOk = message.contentCheckOk; + } + if (message.isAudioOnly !== undefined) { + obj.isAudioOnly = message.isAudioOnly; + } + if (message.autonavEnabled !== undefined) { + obj.autonavEnabled = message.autonavEnabled; + } + if (message.enablePersistentPlaylistPanel !== undefined) { + obj.enablePersistentPlaylistPanel = message.enablePersistentPlaylistPanel; + } + if (message.playlistSetVideoId !== undefined) { + obj.playlistSetVideoId = message.playlistSetVideoId; + } + if (message.showRuInvalidTokenMessage !== undefined) { + obj.showRuInvalidTokenMessage = message.showRuInvalidTokenMessage; + } + if (message.serializedThirdPartyEmbedConfig !== undefined) { + obj.serializedThirdPartyEmbedConfig = message.serializedThirdPartyEmbedConfig; + } + if (message.showContentOwnerOnly !== undefined) { + obj.showContentOwnerOnly = message.showContentOwnerOnly; + } + if (message.isEmbedPreview !== undefined) { + obj.isEmbedPreview = message.isEmbedPreview; + } + if (message.lastScrubbedInlinePlaybackVideoId !== undefined) { + obj.lastScrubbedInlinePlaybackVideoId = message.lastScrubbedInlinePlaybackVideoId; + } + if (message.lastAudioTurnedOnInlinePlaybackVideoId !== undefined) { + obj.lastAudioTurnedOnInlinePlaybackVideoId = message.lastAudioTurnedOnInlinePlaybackVideoId; + } + if (message.lastAudioTurnedOffInlinePlaybackVideoId !== undefined) { + obj.lastAudioTurnedOffInlinePlaybackVideoId = message.lastAudioTurnedOffInlinePlaybackVideoId; + } + if (message.captionsRequested !== undefined) { + obj.captionsRequested = message.captionsRequested; + } + if (message.queueContextParams !== undefined) { + obj.queueContextParams = base64FromBytes(message.queueContextParams); + } + if (message.showShortsOnly !== undefined) { + obj.showShortsOnly = message.showShortsOnly; + } + return obj; + }, + + create, I>>(base?: I): WatchNextRequest { + return WatchNextRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WatchNextRequest { + const message = createBaseWatchNextRequest(); + message.context = (object.context !== undefined && object.context !== null) + ? InnerTubeContext.fromPartial(object.context) + : undefined; + message.videoId = object.videoId ?? undefined; + message.playlistId = object.playlistId ?? undefined; + message.params = object.params ?? undefined; + message.continuation = object.continuation ?? undefined; + message.isAdPlayback = object.isAdPlayback ?? undefined; + message.mdxUseDevServer = object.mdxUseDevServer ?? undefined; + message.referrer = object.referrer ?? undefined; + message.referringApp = object.referringApp ?? undefined; + message.adParams = object.adParams ?? undefined; + message.requestMusicSequence = object.requestMusicSequence ?? undefined; + message.enableMdxAutoplay = object.enableMdxAutoplay ?? undefined; + message.isMdxPlayback = object.isMdxPlayback ?? undefined; + message.racyCheckOk = object.racyCheckOk ?? undefined; + message.contentCheckOk = object.contentCheckOk ?? undefined; + message.isAudioOnly = object.isAudioOnly ?? undefined; + message.autonavEnabled = object.autonavEnabled ?? undefined; + message.enablePersistentPlaylistPanel = object.enablePersistentPlaylistPanel ?? undefined; + message.playlistSetVideoId = object.playlistSetVideoId ?? undefined; + message.showRuInvalidTokenMessage = object.showRuInvalidTokenMessage ?? undefined; + message.serializedThirdPartyEmbedConfig = object.serializedThirdPartyEmbedConfig ?? undefined; + message.showContentOwnerOnly = object.showContentOwnerOnly ?? undefined; + message.isEmbedPreview = object.isEmbedPreview ?? undefined; + message.lastScrubbedInlinePlaybackVideoId = object.lastScrubbedInlinePlaybackVideoId ?? undefined; + message.lastAudioTurnedOnInlinePlaybackVideoId = object.lastAudioTurnedOnInlinePlaybackVideoId ?? undefined; + message.lastAudioTurnedOffInlinePlaybackVideoId = object.lastAudioTurnedOffInlinePlaybackVideoId ?? undefined; + message.captionsRequested = object.captionsRequested ?? undefined; + message.queueContextParams = object.queueContextParams ?? undefined; + message.showShortsOnly = object.showShortsOnly ?? undefined; + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +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/protos/misc/common.proto b/protos/misc/common.proto new file mode 100644 index 0000000000..d8ebecc8cf --- /dev/null +++ b/protos/misc/common.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package misc; + +message HttpHeader { + optional string name = 1; + optional string value = 2; +} + +message FormatId { + optional int32 itag = 1; + optional uint64 last_modified = 2; + optional string xtags = 3; +} + +message InitRange { + optional int32 start = 1; + optional int32 end = 2; +} + +message IndexRange { + optional int32 start = 1; + optional int32 end = 2; +} + +message KeyValuePair { + optional string key = 1; + optional string value = 2; +} \ No newline at end of file diff --git a/protos/misc/params.proto b/protos/misc/params.proto new file mode 100644 index 0000000000..93c04093c1 --- /dev/null +++ b/protos/misc/params.proto @@ -0,0 +1,227 @@ +syntax = "proto3"; +package misc; + +message VisitorData { + string id = 1; + int32 timestamp = 5; +} + +message SearchFilter { + optional SortBy sort_by = 1; + + enum SortBy { + RELEVANCE = 0; + RATING = 1; + UPLOAD_DATE = 2; + VIEW_COUNT = 3; + } + + message Filters { + optional UploadDate upload_date = 1; + optional SearchType type = 2; + optional Duration duration = 3; + optional MusicSearchType music_search_type = 17; + + optional bool features_hd = 4; + optional bool features_subtitles = 5; + optional bool features_creative_commons = 6; + optional bool features_3d = 7; + optional bool features_live = 8; + optional bool features_purchased = 9; + optional bool features_4k = 14; + optional bool features_360 = 15; + optional bool features_location = 23; + optional bool features_hdr = 25; + optional bool features_vr180 = 26; + + enum UploadDate { + ANY_DATE = 0; + HOUR = 1; + TODAY = 2; + WEEK = 3; + MONTH = 4; + YEAR = 5; + } + + enum SearchType { + ANY_TYPE = 0; + VIDEO = 1; + CHANNEL = 2; + PLAYLIST = 3; + MOVIE = 4; + } + + enum Duration { + ANY_DURATION = 0; + SHORT = 1; + LONG = 2; + MEDIUM = 3; + } + + message MusicSearchType { + optional bool song = 1; + optional bool video = 2; + optional bool album = 3; + optional bool artist = 4; + optional bool playlist = 5; + } + } + + optional Filters filters = 2; +} + +message ChannelAnalytics { + message Params { + string channel_id = 1001; + } + + Params params = 32; +} + +message SoundInfoParams { + message Sound { + message Params { + message Ids { + string id_1 = 1; + string id_2 = 2; + string id_3 = 3; + } + Ids ids = 2; + } + Params params = 1; + } + + Sound sound = 94; +} + +message NotificationPreferences { + string channel_id = 1; + + message Preference { + int32 index = 1; + } + + Preference pref_id = 2; + + optional int32 number_0 = 3; + optional int32 number_1 = 4; +} + +message LiveMessageParams { + message Params { + message Ids { + string channel_id = 1; + string video_id = 2; + } + Ids ids = 5; + } + + Params params = 1; + + optional int32 number_0 = 2; + optional int32 number_1 = 3; +} + +message GetCommentsSectionParams { + message Context { + string video_id = 2; + } + Context ctx = 2; + + int32 unk_param = 3; + + message Params { + optional string unk_token = 1; + + message Options { + string video_id = 4; + int32 sort_by = 6; + int32 type = 15; + optional string comment_id = 16; + } + + message RepliesOptions { + string comment_id = 2; + + message UnkOpts { + int32 unk_param = 1; + } + UnkOpts unkopts = 4; + + optional string channel_id = 5; + string video_id = 6; + + int32 unk_param_1 = 8; + int32 unk_param_2 = 9; + } + + optional Options opts = 4; + optional RepliesOptions replies_opts = 3; + + optional int32 page = 5; + string target = 8; + } + + Params params = 6; +} + +message CreateCommentParams { + string video_id = 2; + message Params { + int32 index = 1; + } + Params params = 5; + int32 number = 10; +} + +message PeformCommentActionParams { + int32 type = 1; + string comment_id = 3; + string video_id = 5; + + optional int32 unk_num = 2; + optional string channel_id = 23; + + message TranslateCommentParams { + message Params { + message Comment { + string text = 1; + } + Comment comment = 1; + } + Params params = 3; + + string comment_id = 2; + string target_language = 4; + } + + optional TranslateCommentParams translate_comment_params = 31; +} + +message Hashtag { + message Params { + string hashtag = 1; + int32 type = 3; + } + + Params params = 93; +} + +message ReelSequence { + string short_id = 1; + message Params { + int32 number = 3; + } + + Params params = 5; + int32 feature_2 = 10; + int32 feature_3 = 13; +} + +message ShortsParam { + message Field1 { + optional int32 p1 = 1; + } + optional Field1 f1 = 1; + optional int32 p59 = 59; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/attestation_response_data.proto b/protos/youtube/api/pfiinnertube/attestation_response_data.proto new file mode 100644 index 0000000000..3b2b2bd501 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/attestation_response_data.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message AttestationResponseData { + optional string challenge = 1; + optional string web_response = 2; + optional string android_response = 3; + optional bytes ios_response = 4; + optional int32 error = 5; + optional AdblockReporting adblock_reporting = 6; + + message AdblockReporting { + optional uint64 reporting_status = 1; + optional uint64 broad_spectrum_detection_result = 2; + } +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/capability_info.proto b/protos/youtube/api/pfiinnertube/capability_info.proto new file mode 100644 index 0000000000..54e33ff12d --- /dev/null +++ b/protos/youtube/api/pfiinnertube/capability_info.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message CapabilityInfo { + optional string profile = 1; + repeated InnerTubeCapability supported_capabilities = 2; + repeated InnerTubeCapability disabled_capabilities = 3; + optional string snapshot = 5; +} + +message InnerTubeCapability { + optional uint32 capability = 1; + optional uint32 features = 2; + optional string experiment_flags = 6; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/client_info.proto b/protos/youtube/api/pfiinnertube/client_info.proto new file mode 100644 index 0000000000..ab34efa424 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/client_info.proto @@ -0,0 +1,282 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message ClientInfo { + optional string hl = 1; + optional string gl = 2; + optional string remote_host = 4; + optional string device_id = 6; + optional string debug_device_id_override = 8; + optional string carrier_geo = 10; + optional bool cracked_hl = 11; + optional string device_make = 12; + optional string device_model = 13; + optional string visitor_data = 14; + optional string user_agent = 15; + optional int32 client_name = 16; + optional string client_version = 17; + optional string os_name = 18; + optional string os_version = 19; + optional string project_id = 20; + optional string accept_language = 21; + optional string accept_region = 22; + optional string original_url = 23; + optional string raw_device_id = 25; + optional string config_data = 27; + optional string spacecast_token = 31; + optional string internal_geo = 34; + optional int32 screen_width_points = 37; + optional int32 screen_height_points = 38; + optional float screen_width_inches = 39; + optional float screen_height_inches = 40; + optional int32 screen_pixel_density = 41; + optional int32 platform = 42; + optional SpacecastClientInfo spacecast_client_info = 45; + optional ClientFormFactor client_form_factor = 46; + optional string forwarded_for = 48; + optional MobileDataPlanInfo mobile_data_plan_info = 49; + optional int32 gmscore_version_code = 50; // e.g. 241757026 + optional bool webp_support = 51; + optional CameraType camera_type = 52; + optional string experiments_token = 54; + optional int32 window_width_points = 55; + optional int32 window_height_points = 56; + optional ConfigGroupsClientInfo config_info = 62; + optional UnpluggedLocationInfo unplugged_location_info = 63; + optional int32 android_sdk_version = 64; + optional float screen_density_float = 65; + optional int32 first_time_sign_in_experiment_ids = 66; + optional int32 utc_offset_minutes = 67; + optional bool animated_webp_support = 68; + optional KidsAppInfo kids_app_info = 69; + optional MusicAppInfo music_app_info = 70; + optional TvAppInfo tv_app_info = 71; + optional string internal_geo_ip = 72; + optional UnpluggedAppInfo unplugged_app_info = 73; + optional LocationInfo location_info = 74; + optional string content_size_category = 76; + optional float font_scale = 77; + optional UserInterfaceTheme user_interface_theme = 78; + optional string time_zone = 80; + optional HomeGroupInfo home_group_info = 81; + optional bytes eml_template_context = 84; + optional bytes cold_app_bundle_config_data = 85; + // repeated ExperimentsHeterodyne.ExperimentIds heterodyne_ids = 86; + optional string browser_name = 87; + optional string browser_version = 88; + optional string location_playability_token = 89; + optional string chipset = 92; // e.g. "qcom;taro" + optional string firmware_version = 93; + optional int64 memory_total_kbytes = 95; + optional MainAppWebInfo main_app_web_info = 96; + optional NotificationPermissionInfo notification_permission_info = 97; + optional string device_brand = 98; + // optional ClientStoreInfo client_store_info = 99; + // optional SRSDataPushVersion srs_datapush_build_ids = 100; + // optional PlayerDataPushVersion player_datapush_build_ids = 101; + optional GLDeviceInfo gl_device_info = 102; + + enum ClientFormFactor { + // @TODO: Check these. + UNKNOWN_FORM_FACTOR = 0; + FORM_FACTOR_VAL1 = 1; + FORM_FACTOR_VAL2 = 2; + } + + enum CameraType { + UNKNOWN_CAMERA_TYPE = 0; + } + + enum UserInterfaceTheme { + USER_INTERFACE_THEME_DARK = 0; + USER_INTERFACE_THEME_LIGHT = 1; + } + + message MainAppWebInfo { + optional string graft_url = 1; + optional PwaInstallabilityStatus pwa_installability_status = 2; + optional WebDisplayMode web_display_mode = 3; + optional bool is_web_native_share_available = 4; + optional StoreDigitalGoodsApiSupportStatus store_digital_goods_api_support_status = 5; + + enum StoreDigitalGoodsApiSupportStatus { STORE_DIGITAL_GOODS_API_SUPPORT_STATUS_VAL0 = 0; } + enum PwaInstallabilityStatus { PWA_INSTALLABILITY_STATUS_UNKNOWN = 0; } + enum WebDisplayMode { WEB_DISPLAY_MODE_UNKNOWN = 0; } + } + + message NotificationPermissionInfo { + optional NotificationsSetting notifications_setting = 1; + optional int64 last_device_opt_in_change_time_ago_sec = 2; + enum NotificationsSetting { NOTIFICATIONS_SETTING_UNKNOWN = 0; } + } + + message GLDeviceInfo { + optional string gl_renderer = 1; + optional int32 gl_es_version_major = 2; + optional int32 gl_es_version_minor = 3; + } + + message SpacecastClientInfo { + optional SpacecastAppliance appliances = 1; + optional SpacecastInteractionLevel interaction_level = 2; + + message SpacecastAppliance { + optional bytes content_profile_token = 1; + optional OperationalStatus status = 2; + optional string hostname = 3; + optional bool active = 4; + optional string device_id = 5; + + enum OperationalStatus { UNKNOWN = 0; } + } + + enum SpacecastInteractionLevel { UNKNOWN = 0; } + } + + message MobileDataPlanInfo { + optional string cpid = 49; + optional string serialized_data_plan_status = 50; + optional bool data_saving_quality_picker_enabled = 52; + optional string mccmnc = 53; + } + + message ConfigGroupsClientInfo { + optional string cold_config_data = 1; + optional string cold_hash_data = 3; + optional string hot_hash_data = 5; + optional string app_install_data = 6; + } + + message UnpluggedLocationInfo { + optional int32 latitude_e7 = 1; + optional int32 longitude_e7 = 2; + optional int64 local_timestamp_ms = 3; + optional string ip_address = 4; + optional string timezone = 5; + optional bool prefer_24_hour_time = 6; + optional int32 location_radius_meters = 7; + optional bool is_initial_load = 8; + optional bool browser_permission_granted = 9; + optional int32 client_permission_state = 10; + optional string location_override_token = 11; + } + + message KidsAppInfo { + optional KidsContentSettings content_settings = 1; + optional KidsParentCurationMode parent_curation_mode = 2; + optional KidsCategorySettings category_settings = 3; + optional KidsUserEducationSettings user_education_settings = 4; + + message KidsContentSettings { + optional YTKidsNoSearchMode kids_no_search_mode = 1; + optional YTKidsAgeUpMode age_up_mode = 2; + optional KidsContentDensity content_density = 3; + + enum YTKidsNoSearchMode { + YT_KIDS_NO_SEARCH_MODE_OFF = 0; + YT_KIDS_NO_SEARCH_MODE_ON = 1; + } + + enum YTKidsAgeUpMode { + YT_KIDS_AGE_UP_MODE_OFF = 0; + YT_KIDS_AGE_UP_MODE_ON = 1; + } + + enum KidsContentDensity { + // @TODO: Check these. + YT_KIDS_CONTENT_DENSITY_VAL1 = 0; + YT_KIDS_CONTENT_DENSITY_VAL2 = 1; + YT_KIDS_CONTENT_DENSITY_VAL3 = 2; + } + } + + enum KidsParentCurationMode { KPCM_UNKNOWN = 0; } + + message KidsCategorySettings { + optional string enabled_categories = 1; + } + + message KidsUserEducationSettings { + optional bool has_seen_home_chip_bar_user_education = 1; + optional bool has_seen_home_pivot_bar_user_education = 2; + optional bool has_seen_parent_muir_user_education = 3; + } + } + + message MusicAppInfo { + optional MusicPlayBackMode play_back_mode = 1; + optional MusicLocationMasterSwitch music_location_master_switch = 2; + optional MusicActivityMasterSwitch music_activity_master_switch = 3; + optional bool offline_mixtape_enabled = 4; + optional bool auto_offline_enabled = 5; + optional IosBackgroundRefreshStatus ios_background_refresh_status = 6; + optional int32 smart_downloads_song_limit = 7; + optional bool transitioned_from_mixtape_to_smart_downloads = 8; + optional PwaInstallabilityStatus pwa_installability_status = 9; + optional WebDisplayMode web_display_mode = 10; + optional MusicTier music_tier = 11; + optional StoreDigitalGoodsApiSupportStatus store_digital_goods_api_support_status = 12; + optional int64 smart_downloads_time_since_last_opt_out_sec = 13; + + enum MusicPlayBackMode { MPBM_UNKNOWN = 0; } + enum MusicLocationMasterSwitch { MLMS_UNKNOWN = 0; } + enum MusicActivityMasterSwitch { MAMS_UNKNOWN = 0; } + enum IosBackgroundRefreshStatus { UNKNOWN_STATUS = 0; } + enum PwaInstallabilityStatus { PIS_UNKNOWN = 0; } + enum WebDisplayMode { WDM_UNKNOWN = 0; } + enum MusicTier { UNKNOWN_TIER = 0; } + enum StoreDigitalGoodsApiSupportStatus { SDGAS_UNKNOWN = 0; } + } + + message TvAppInfo { + optional string mdx_impacted_sessions_server_events = 3; + optional bool enable_privacy_filter = 6; + optional bool zylon_left_nav = 7; + optional string certification_scope = 9; + optional string living_room_po_token_id = 10; + optional string js_engine_string = 12; + optional VoiceCapability voice_capability = 13; + optional string system_integrator = 14; + optional string android_build_fingerprint = 18; + optional string cobalt_app_version = 19; + optional string cobalt_starboard_version = 20; + optional bool use_start_playback_preview_command = 22; + optional bool should_show_persistent_signin_on_home = 23; + optional string android_play_services_version = 24; + + message VoiceCapability { + optional bool has_soft_mic_support = 1; + optional bool has_hard_mic_support = 2; + } + } + + message UnpluggedAppInfo { + optional bool enable_filter_mode = 2; + optional bool ios_notification_permission = 3; + optional bool force_enable_epg_3 = 7; + } + + message LocationInfo { + optional int32 location_info_status = 1; + optional UrlStatus ulr_status = 2; + optional string latitude_e7 = 3; + optional string longitude_e7 = 4; + optional string horizontal_accuracy_meters = 5; + optional string location_freshness_ms = 6; + optional int32 location_permission_authorization_status = 7; + optional string location_override_token = 8; + optional bool force_location_playability_token_refresh = 9; + + message UrlStatus { + optional int32 reporting_enabled_setting = 1; + optional int32 history_enabled_setting = 2; + optional bool is_allowed = 3; + optional bool is_active = 4; + } + } + + message HomeGroupInfo { + optional bool is_part_of_group = 1; + optional bool is_group = 3; + } +} diff --git a/protos/youtube/api/pfiinnertube/get_watch_request.proto b/protos/youtube/api/pfiinnertube/get_watch_request.proto new file mode 100644 index 0000000000..7315e1cb40 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/get_watch_request.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "youtube/api/pfiinnertube/innertube_context.proto"; +import "youtube/api/pfiinnertube/player_request.proto"; +import "youtube/api/pfiinnertube/watch_next_request.proto"; +import "youtube/api/pfiinnertube/reel_item_watch_request.proto"; + +message GetWatchRequest { + optional InnerTubeContext context = 1; + optional PlayerRequest player_request = 2; + optional WatchNextRequest watch_next_request = 3; + optional ReelItemWatchRequest reel_item_watch_request = 4; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/innertube_context.proto b/protos/youtube/api/pfiinnertube/innertube_context.proto new file mode 100644 index 0000000000..7a54a06380 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/innertube_context.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "misc/common.proto"; +import "youtube/api/pfiinnertube/client_info.proto"; +import "youtube/api/pfiinnertube/user_info.proto"; +import "youtube/api/pfiinnertube/capability_info.proto"; +import "youtube/api/pfiinnertube/request_info.proto"; +import "youtube/api/pfiinnertube/third_party_info.proto"; + +message InnerTubeContext { + optional ClientInfo client = 1; + optional UserInfo user = 3; + optional CapabilityInfo capabilities = 4; + optional RequestInfo request = 5; + optional InnerTubeContext.ClickTrackingInfo click_tracking = 6; + optional ThirdPartyInfo third_party = 7; + optional ClientInfo remote_client = 8; + optional InnerTubeContext.AdSignalsInfo ad_signals_info = 9; + optional InnerTubeContext.ExperimentalData experimental_data = 10; + optional string client_screen_nonce = 11; + repeated InnerTubeContext.ActivePlayerInfo active_players = 12; + + message ExperimentalData { + repeated .misc.KeyValuePair params = 1; + } + + message ActivePlayerInfo { + optional bytes player_context_params = 1; + } + + message ClickTrackingInfo { + optional bytes click_tracking_params = 2; + } + + message AdSignalsInfo { + repeated .misc.KeyValuePair params = 1; + optional string bid = 2; + optional string mutsu_id = 3; + optional string consent_bump_state = 4; + optional string advertising_id = 7; + optional bool limit_ad_tracking = 9; + optional string attribution_os_supported_version = 10; + } +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/metadata_update_request.proto b/protos/youtube/api/pfiinnertube/metadata_update_request.proto new file mode 100644 index 0000000000..e1b2b0bc10 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/metadata_update_request.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "youtube/api/pfiinnertube/innertube_context.proto"; + +message MetadataUpdateRequest { + optional InnerTubeContext context = 1; + optional string encrypted_video_id = 2; + optional MdeTitleUpdateRequest title = 3; + optional MdeDescriptionUpdateRequest description = 4; + optional MdePrivacyUpdateRequest privacy = 5; + optional MdeTagsUpdateRequest tags = 6; + optional MdeCategoryUpdateRequest category = 7; + optional MdeLicenseUpdateRequest license = 8; + optional MdeAgeRestrictionUpdateRequest age_restriction = 11; + optional MdeVideoStillRequestParams video_still = 20; + optional MdeMadeForKidsUpdateRequestParams made_for_kids = 68; + optional MdeRacyRequestParams racy = 69; + + message MdeTitleUpdateRequest { + optional string new_title = 1; + } + + message MdeDescriptionUpdateRequest { + optional string new_description = 1; + } + + message MdePrivacyUpdateRequest { + optional int32 new_privacy = 1; + optional bool clear_privacy_draft = 2; + } + + message MdeTagsUpdateRequest { + repeated string new_tags = 1; + } + + message MdeCategoryUpdateRequest { + optional int32 new_category_id = 1; + } + + message MdeLicenseUpdateRequest { + optional string new_license_id = 1; + } + + message MdeMadeForKidsUpdateRequestParams { + optional int32 operation = 1; + optional int32 new_mfk = 2; + } + + message MdeRacyRequestParams { + optional int32 operation = 1; + optional int32 new_racy = 2; + } + + message MdeAgeRestrictionUpdateRequest { + optional bool new_is_age_restricted = 1; + } + + message MdeVideoStillRequestParams { + optional int32 operation = 1; + optional int32 new_still_id = 2; + optional CustomThumbnailImage image = 3; + optional CustomThumbnailImage test_image = 4; + repeated ThumbnailExperimentImageData experiment_image = 6; + + message ThumbnailExperimentImageData { + optional CustomThumbnailImage image = 1; + } + + message CustomThumbnailImage { + optional bytes raw_bytes = 1; + optional string data_uri = 2; + optional int64 frame_timestamp_us = 4; + optional bool is_vertical = 5; + } + } +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/playback_context.proto b/protos/youtube/api/pfiinnertube/playback_context.proto new file mode 100644 index 0000000000..b41b15a942 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/playback_context.proto @@ -0,0 +1,60 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message PlaybackContext { + optional ContentPlaybackContext content_playback_context = 1; + + // @TODO: Dump these messages + // optional AdPlaybackContext ad_playback_context = 2; + // optional PrefetchPlaybackContext prefetch_playback_context = 3; + // optional ResumePlaybackContext resume_playback_context = 4; + // optional OfflinePlaybackContext offline_playback_context = 5; + // optional ReloadPlaybackContext reload_playback_context = 7; + // optional DevicePlaybackCapabilities device_playback_capabilities = 8; + + message ContentPlaybackContext { + optional string device_signals = 1; + optional string rev_share_client_id = 3; + optional uint32 time_since_last_ad_seconds = 4; + optional int64 lact_milliseconds = 5; + optional uint32 autoplays_since_last_ad = 6; + optional uint32 vis = 8; + optional bool fling = 9; + optional bool splay = 10; + optional bool autoplay = 11; + optional uint64 time_of_last_instream_preroll_ad = 13; + optional string current_url = 15; + optional string referer = 16; + optional bool load_annotations_by_demand = 23; + optional bool auto_captions_default_on = 24; + // optional ForceAdParameters force_ad_parameters = 25; + optional bool sliced_bread = 27; + optional bool autonav = 29; + optional bool trailer = 30; + // optional MdxPlaybackContext mdx_context = 31; + // optional LivePlaybackContext live_context = 32; + optional int32 player_width_pixels = 34; + optional int32 player_height_pixels = 35; + // optional Html5Preference html5_preference = 36; + optional int32 snd = 37; + optional int32 vnd = 38; + // optional UnpluggedContentPlaybackContext unplugged_context = 40; + optional int32 uao = 41; + optional bool muted_autoplay = 44; + // optional AutonavSettingsState autonav_state = 45; + optional bool enable_privacy_filter = 46; + optional bool is_living_room_deeplink = 47; + optional uint32 signature_timestamp = 48; + // optional TrailerPlaybackContext trailer_context = 49; + optional bool is_inline_playback_no_ad = 50; + optional bool is_inline_unmuted_playback = 51; + // optional CustomTabContext custom_tab_context = 52; + // optional VideoPlaybackPosition player_playback_position = 54; + optional int64 play_package_version = 55; + // optional CoWatchPlaybackContext co_watch_context = 56; + // optional WatchAmbientModePlaybackContext watch_ambient_mode_context = 57; + // optional CompositeVideoPlaybackContext composite_video_context = 58; + optional bool is_sequence_entry = 60; + } +} + diff --git a/protos/youtube/api/pfiinnertube/player_attestation_request_data.proto b/protos/youtube/api/pfiinnertube/player_attestation_request_data.proto new file mode 100644 index 0000000000..0febf81df7 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/player_attestation_request_data.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message PlayerAttestationRequestData { + optional IosguardChallengeRequestData iosguard_request = 1; + optional bool omit_botguard_data = 2; + + message IosguardChallengeRequestData { + optional bytes challenge_request = 1; + } +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/player_request.proto b/protos/youtube/api/pfiinnertube/player_request.proto new file mode 100644 index 0000000000..a36dc78092 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/player_request.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "youtube/api/pfiinnertube/innertube_context.proto"; +import "youtube/api/pfiinnertube/service_integrity_dimensions.proto"; +import "youtube/api/pfiinnertube/player_request_caption_params.proto"; +import "youtube/api/pfiinnertube/player_attestation_request_data.proto"; +import "youtube/api/pfiinnertube/playback_context.proto"; + +message PlayerRequest { + optional InnerTubeContext context = 1; + optional string video_id = 2; + optional bool content_check_ok = 3; + optional PlaybackContext playback_context = 4; + optional bool racy_check_ok = 5; + optional string id = 6; + optional string t = 7; + optional bool for_offline = 8; + optional string playlist_id = 9; + optional int32 playlist_index = 10; + optional uint32 start_time_secs = 11; + optional string params = 12; + optional bytes offline_sharing_wrapped_key = 14; + optional PlayerAttestationRequestData attestation_request = 16; + optional string referring_app = 17; + optional string referrer = 18; + optional string serialized_third_party_embed_config = 19; + optional bool proxied_by_onesie = 20; + optional string host_app_token = 22; + optional string cpn = 23; + optional bool override_muted_at_start = 25; + optional PlayerRequestCaptionParams caption_params = 26; + optional ServiceIntegrityDimensions service_integrity_dimensions = 27; + // optional VideoQualitySetting video_quality_setting_params = 28; + optional bytes deferred_player_token = 29; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/player_request_caption_params.proto b/protos/youtube/api/pfiinnertube/player_request_caption_params.proto new file mode 100644 index 0000000000..3f763ff9be --- /dev/null +++ b/protos/youtube/api/pfiinnertube/player_request_caption_params.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message PlayerRequestCaptionParams { + optional bool device_captions_on = 1; + optional string device_captions_lang_pref = 2; + optional string viewer_selected_caption_langs = 3; + optional string cc_lang_pref = 4; + optional bool cc_load_policy_on = 5; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/reel_item_watch_request.proto b/protos/youtube/api/pfiinnertube/reel_item_watch_request.proto new file mode 100644 index 0000000000..e2f783c174 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/reel_item_watch_request.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "youtube/api/pfiinnertube/innertube_context.proto"; +import "youtube/api/pfiinnertube/player_request.proto"; + +message ReelItemWatchRequest { + optional InnerTubeContext context = 1; + optional PlayerRequest player_request = 2; + optional string params = 3; + optional bool disable_player_response = 4; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/request_info.proto b/protos/youtube/api/pfiinnertube/request_info.proto new file mode 100644 index 0000000000..ca33fc283e --- /dev/null +++ b/protos/youtube/api/pfiinnertube/request_info.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "misc/common.proto"; +import "youtube/api/pfiinnertube/attestation_response_data.proto"; + +message RequestInfo { + optional string third_party_digest = 6; + optional bool use_ssl = 7; + optional bool return_error_detail = 9; + // "If-None-Match" HTTP header? + optional string if_none_match = 12; + optional bool return_log_entry = 13; + optional bool is_prefetch = 14; + repeated misc.KeyValuePair internal_experiment_flags = 15; + optional bool return_debug_data = 16; + optional string innertubez = 18; + optional bool trace_proto = 23; + optional bool return_log_entry_json = 24; + optional string sherlog_username = 25; + // repeated ConsistencyTokenJar consistency_token_jars = 26; + optional ReauthRequestInfo reauth_request_info = 29; + optional SessionInfo session_info = 30; + optional bool return_log_entry_proto = 31; + // External pre-request context as a string + optional string external_prequest_context = 32; + // repeated InnerTubeTokenJar innertube_token_jar = 33; + // Would a botguard/droidguard response here allow playback? + optional AttestationResponseData attestation_response_data = 34; + optional bytes eats = 35; + optional RequestQoS request_qos = 36; + + // Quality of Service? + message RequestQoS { + optional Criticality criticality = 1; + } + + enum Criticality { + CRITICALITY_UNSPECIFIED = 0; + CRITICALITY_CRITICAL = 1; + CRITICALITY_NON_CRITICAL = 2; + } + + message SessionInfo { + optional string token = 1; + } + + message ReauthRequestInfo { + optional string encoded_reauth_proof_token = 1; + } +} diff --git a/protos/youtube/api/pfiinnertube/service_integrity_dimensions.proto b/protos/youtube/api/pfiinnertube/service_integrity_dimensions.proto new file mode 100644 index 0000000000..456228f760 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/service_integrity_dimensions.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message ServiceIntegrityDimensions { + optional bytes po_token = 1; +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/third_party_info.proto b/protos/youtube/api/pfiinnertube/third_party_info.proto new file mode 100644 index 0000000000..92b063af10 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/third_party_info.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message ThirdPartyInfo { + optional string developer_key = 1; + optional string app_name = 2; + optional string app_publisher = 3; + optional string embed_url = 4; + optional string app_version = 6; + optional ThirdPartyInfo.EmbeddedPlayerContext embedded_player_context = 7; + + message EmbeddedPlayerContext { + optional string ancestor_origins = 1; + optional string embedded_player_encrypted_context = 2; + optional bool ancestor_origins_supported = 3; + } +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/user_info.proto b/protos/youtube/api/pfiinnertube/user_info.proto new file mode 100644 index 0000000000..9ae94541cd --- /dev/null +++ b/protos/youtube/api/pfiinnertube/user_info.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +message UserInfo { + optional string on_behalf_of_user = 3; + optional bool enable_safety_mode = 7; + repeated UserInfo.CredentialTransferToken credential_transfer_tokens = 12; + optional UserInfo.DelegatePurchases delegate_purchases = 13; + optional UserInfo.KidsParent kids_parent = 14; + optional bool is_incognito = 15; + optional bool locked_safety_mode = 16; + optional UserInfo.DelegationContext delegation_context = 17; + optional string serialized_delegation_context = 18; + + message KidsParent { } + message DelegatePurchases { } + message DelegationContext { } + message CredentialTransferToken { } +} \ No newline at end of file diff --git a/protos/youtube/api/pfiinnertube/watch_next_request.proto b/protos/youtube/api/pfiinnertube/watch_next_request.proto new file mode 100644 index 0000000000..258f307a49 --- /dev/null +++ b/protos/youtube/api/pfiinnertube/watch_next_request.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; +package youtube.api.pfiinnertube; + +import "youtube/api/pfiinnertube/innertube_context.proto"; + +message WatchNextRequest { + optional InnerTubeContext context = 1; + optional string video_id = 2; + optional string playlist_id = 4; + optional string params = 6; + optional string continuation = 8; + optional bool is_ad_playback = 9; + optional bool mdx_use_dev_server = 10; + optional string referrer = 12; + optional string referring_app = 13; + optional string ad_params = 16; + optional bool request_music_sequence = 18; + optional bool enable_mdx_autoplay = 21; + optional bool is_mdx_playback = 22; + optional bool racy_check_ok = 24; + optional bool content_check_ok = 25; + optional bool is_audio_only = 26; + optional bool autonav_enabled = 27; + optional bool enable_persistent_playlist_panel = 30; + optional string playlist_set_video_id = 31; + optional bool show_ru_invalid_token_message = 35; + optional string serialized_third_party_embed_config = 37; + optional bool show_content_owner_only = 38; + optional bool is_embed_preview = 42; + optional string last_scrubbed_inline_playback_video_id = 43; + optional string last_audio_turned_on_inline_playback_video_id = 44; + optional string last_audio_turned_off_inline_playback_video_id = 45; + optional bool captions_requested = 47; + optional bytes queue_context_params = 50; + optional bool show_shorts_only = 55; +} \ No newline at end of file diff --git a/src/Innertube.ts b/src/Innertube.ts index 0be8bdce3f..48110d9d6d 100644 --- a/src/Innertube.ts +++ b/src/Innertube.ts @@ -33,9 +33,8 @@ import { ShortFormVideoInfo } from './parser/ytshorts/index.js'; import NavigationEndpoint from './parser/classes/NavigationEndpoint.js'; -import * as Proto from './proto/index.js'; import * as Constants from './utils/Constants.js'; -import { InnertubeError, generateRandomString, throwIfMissing } from './utils/Utils.js'; +import { InnertubeError, generateRandomString, throwIfMissing, u8ToBase64 } from './utils/Utils.js'; import type { ApiResponse } from './core/Actions.js'; import type { InnerTubeConfig, InnerTubeClient, SearchFilters, INextRequest } from './types/index.js'; @@ -43,6 +42,14 @@ import type { IBrowseResponse, IParsedResponse } from './parser/types/index.js'; import type { DownloadOptions, FormatOptions } from './types/FormatUtils.js'; import type Format from './parser/classes/misc/Format.js'; +import { + SearchFilter_SortBy, + SearchFilter_Filters_UploadDate, + SearchFilter_Filters_SearchType, + SearchFilter_Filters_Duration +} from '../protos/generated/misc/params.js'; +import { Hashtag, SearchFilter, ReelSequence, GetCommentsSectionParams } from '../protos/generated/misc/params.js'; + /** * Provides access to various services and modules in the YouTube API. */ @@ -121,9 +128,20 @@ export default class Innertube { Reel.ReelItemWatchEndpoint.PATH, Reel.ReelItemWatchEndpoint.build({ video_id, client }) ); + const writer = ReelSequence.encode({ + shortId: video_id, + params: { + number: 5 + }, + feature2: 25, + feature3: 0 + }); + + const params = encodeURIComponent(u8ToBase64(writer.finish())); + const sequence_response = this.actions.execute( Reel.ReelWatchSequenceEndpoint.PATH, Reel.ReelWatchSequenceEndpoint.build({ - sequence_params: Proto.encodeReelSequence(video_id) + sequence_params: params }) ); @@ -137,9 +155,71 @@ export default class Innertube { async search(query: string, filters: SearchFilters = {}): Promise { throwIfMissing({ query }); + const search_filter: SearchFilter = {}; + + search_filter.filters = {}; + + if (filters.sort_by) { + search_filter.sortBy = SearchFilter_SortBy[filters.sort_by.toUpperCase() as keyof typeof SearchFilter_SortBy]; + } + + if (filters.upload_date) { + search_filter.filters.uploadDate = SearchFilter_Filters_UploadDate[filters.upload_date.toUpperCase() as keyof typeof SearchFilter_Filters_UploadDate]; + } + + if (filters.type) { + search_filter.filters.type = SearchFilter_Filters_SearchType[filters.type.toUpperCase() as keyof typeof SearchFilter_Filters_SearchType]; + } + + if (filters.duration) { + search_filter.filters.duration = SearchFilter_Filters_Duration[filters.duration.toUpperCase() as keyof typeof SearchFilter_Filters_Duration]; + } + + if (filters.features) { + for (const feature of filters.features) { + switch (feature) { + case '360': + search_filter.filters.features360 = true; + break; + case '3d': + search_filter.filters.features3d = true; + break; + case '4k': + search_filter.filters.features4k = true; + break; + case 'creative_commons': + search_filter.filters.featuresCreativeCommons = true; + break; + case 'hd': + search_filter.filters.featuresHd = true; + break; + case 'hdr': + search_filter.filters.featuresHdr = true; + break; + case 'live': + search_filter.filters.featuresLive = true; + break; + case 'location': + search_filter.filters.featuresLocation = true; + break; + case 'purchased': + search_filter.filters.featuresPurchased = true; + break; + case 'subtitles': + search_filter.filters.featuresSubtitles = true; + break; + case 'vr180': + search_filter.filters.featuresVr180 = true; + break; + default: + break; + } + } + } + const response = await this.actions.execute( SearchEndpoint.PATH, SearchEndpoint.build({ - query, params: filters ? Proto.encodeSearchFilters(filters) : undefined + query, params: filters ? encodeURIComponent(u8ToBase64(SearchFilter.encode(search_filter).finish())) : undefined }) ); @@ -167,16 +247,33 @@ export default class Innertube { return suggestions; } - async getComments(video_id: string, sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST'): Promise { + async getComments(video_id: string, sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST', comment_id?: string): Promise { throwIfMissing({ video_id }); - const response = await this.actions.execute( - NextEndpoint.PATH, NextEndpoint.build({ - continuation: Proto.encodeCommentsSectionParams(video_id, { - sort_by: sort_by || 'TOP_COMMENTS' - }) - }) - ); + const SORT_OPTIONS = { + TOP_COMMENTS: 0, + NEWEST_FIRST: 1 + }; + + const writer = GetCommentsSectionParams.encode({ + ctx: { + videoId: video_id + }, + unkParam: 6, + params: { + opts: { + videoId: video_id, + sortBy: SORT_OPTIONS[sort_by || 'TOP_COMMENTS'], + type: 2, + commentId: comment_id || '' + }, + target: 'comments-section' + } + }); + + const continuation = encodeURIComponent(u8ToBase64(writer.finish())); + + const response = await this.actions.execute(NextEndpoint.PATH, NextEndpoint.build({ continuation })); return new Comments(this.actions, response.data); } @@ -281,10 +378,19 @@ export default class Innertube { async getHashtag(hashtag: string): Promise { throwIfMissing({ hashtag }); + const writer = Hashtag.encode({ + params: { + hashtag, + type: 1 + } + }); + + const params = encodeURIComponent(u8ToBase64(writer.finish())); + const response = await this.actions.execute( BrowseEndpoint.PATH, BrowseEndpoint.build({ browse_id: 'FEhashtag', - params: Proto.encodeHashtag(hashtag) + params }) ); diff --git a/src/core/Session.ts b/src/core/Session.ts index ca456d4fdc..a317c04729 100644 --- a/src/core/Session.ts +++ b/src/core/Session.ts @@ -1,7 +1,6 @@ import OAuth2 from './OAuth2.js'; -import { Log, EventEmitter, HTTPClient, LZW } from '../utils/index.js'; +import { Log, EventEmitter, HTTPClient, LZW, ProtoUtils } from '../utils/index.js'; import * as Constants from '../utils/Constants.js'; -import * as Proto from '../proto/index.js'; import Actions from './Actions.js'; import Player from './Player.js'; @@ -359,7 +358,7 @@ export default class Session extends EventEmitter { hl: lang || 'en', gl: location || 'US', remote_host: '', - visitor_data: visitor_data || Proto.encodeVisitorData(generateRandomString(11), Math.floor(Date.now() / 1000)), + visitor_data: visitor_data || ProtoUtils.encodeVisitorData(generateRandomString(11), Math.floor(Date.now() / 1000)), client_name: client_name, client_version: Constants.CLIENTS.WEB.VERSION, device_category: device_category.toUpperCase(), @@ -525,7 +524,7 @@ export default class Session extends EventEmitter { } static #getVisitorID(visitor_data: string) { - const decoded_visitor_data = Proto.decodeVisitorData(visitor_data); + const decoded_visitor_data = ProtoUtils.decodeVisitorData(visitor_data); return decoded_visitor_data.id; } diff --git a/src/core/clients/Music.ts b/src/core/clients/Music.ts index bd5d4c1910..1638c2b4e1 100644 --- a/src/core/clients/Music.ts +++ b/src/core/clients/Music.ts @@ -1,5 +1,4 @@ -import * as Proto from '../../proto/index.js'; -import { InnertubeError, generateRandomString, throwIfMissing } from '../../utils/Utils.js'; +import { InnertubeError, generateRandomString, throwIfMissing, u8ToBase64 } from '../../utils/Utils.js'; import { Album, Artist, Explore, @@ -26,6 +25,8 @@ import { import { GetSearchSuggestionsEndpoint } from '../endpoints/music/index.js'; +import { SearchFilter } from '../../../protos/generated/misc/params.js'; + import type { ObservedArray } from '../../parser/helpers.js'; import type { MusicSearchFilters } from '../../types/index.js'; import type { Actions, Session } from '../index.js'; @@ -112,10 +113,23 @@ export default class Music { async search(query: string, filters: MusicSearchFilters = {}): Promise { throwIfMissing({ query }); + let params: string | undefined; + + if (filters.type && filters.type !== 'all') { + const writer = SearchFilter.encode({ + filters: { + musicSearchType: { + [filters.type]: true + } + } + }); + params = encodeURIComponent(u8ToBase64(writer.finish())); + } + const response = await this.#actions.execute( SearchEndpoint.PATH, SearchEndpoint.build({ query, client: 'YTMUSIC', - params: filters.type && filters.type !== 'all' ? Proto.encodeMusicSearchFilters(filters) : undefined + params }) ); diff --git a/src/core/clients/Studio.ts b/src/core/clients/Studio.ts index 2b2d6bd39f..aa768e7262 100644 --- a/src/core/clients/Studio.ts +++ b/src/core/clients/Studio.ts @@ -1,11 +1,12 @@ -import * as Proto from '../../proto/index.js'; import { Constants } from '../../utils/index.js'; -import { InnertubeError, MissingParamError, Platform } from '../../utils/Utils.js'; +import { InnertubeError, Platform } from '../../utils/Utils.js'; import { CreateVideoEndpoint } from '../endpoints/upload/index.js'; import type { UpdateVideoMetadataOptions, UploadedVideoMetadataOptions } from '../../types/Misc.js'; import type { ApiResponse, Session } from '../index.js'; +import { MetadataUpdateRequest } from '../../../protos/generated/youtube/api/pfiinnertube/metadata_update_request.js'; + interface UploadResult { status: string; scottyResourceId: string; @@ -27,40 +28,19 @@ export default class Studio { } /** - * Uploads a custom thumbnail and sets it for a video. - * @example - * ```ts - * const buffer = fs.readFileSync('./my_awesome_thumbnail.jpg'); - * const response = await yt.studio.setThumbnail(video_id, buffer); - * ``` - */ - async setThumbnail(video_id: string, buffer: Uint8Array): Promise { - if (!this.#session.logged_in) - throw new InnertubeError('You must be signed in to perform this operation.'); - - if (!video_id || !buffer) - throw new MissingParamError('One or more parameters are missing.'); - - const payload = Proto.encodeCustomThumbnailPayload(video_id, buffer); - - const response = await this.#session.actions.execute('/video_manager/metadata_update', { - protobuf: true, - serialized_data: payload - }); - - return response; - } - - /** - * Updates a given video's metadata. + * Updates the metadata of a video. * @example * ```ts - * const response = await yt.studio.updateVideoMetadata('videoid', { + * const videoId = 'abcdefg'; + * const thumbnail = fs.readFileSync('./my_awesome_thumbnail.jpg'); + * + * const response = await yt.studio.updateVideoMetadata(videoId, { * tags: [ 'astronomy', 'NASA', 'APOD' ], * title: 'Artemis Mission', * description: 'A nicely written description...', * category: 27, - * license: 'creative_commons' + * license: 'creative_commons', + * thumbnail, * // ... * }); * ``` @@ -69,11 +49,92 @@ export default class Studio { if (!this.#session.logged_in) throw new InnertubeError('You must be signed in to perform this operation.'); - const payload = Proto.encodeVideoMetadataPayload(video_id, metadata); + const payload: MetadataUpdateRequest = { + context: { + client: { + osName: 'Android', + clientName: parseInt(Constants.CLIENTS.ANDROID.NAME_ID), + clientVersion: Constants.CLIENTS.ANDROID.VERSION, + androidSdkVersion: Constants.CLIENTS.ANDROID.SDK_VERSION, + visitorData: this.#session.context.client.visitorData, + osVersion: '13', + acceptLanguage: this.#session.context.client.hl, + acceptRegion: this.#session.context.client.gl, + deviceMake: 'Google', + deviceModel: 'sdk_gphone64_x86_64', + screenHeightPoints: 840, + screenWidthPoints: 432, + configInfo: { + appInstallData: this.#session.context.client.configInfo?.appInstallData + }, + timeZone: this.#session.context.client.timeZone, + chipset: 'qcom;taro' + }, + activePlayers: [] + }, + encryptedVideoId: video_id + }; + + if (metadata.title) + payload.title = { newTitle: metadata.title }; + + if (metadata.description) + payload.description = { newDescription: metadata.description }; + + if (metadata.license) + payload.license = { newLicenseId: metadata.license }; + + if (metadata.tags) + payload.tags = { newTags: metadata.tags }; + + if (metadata.thumbnail) { + payload.videoStill = { + operation: 3, + image: { + rawBytes: metadata.thumbnail + }, + experimentImage: [] + }; + } + + if (Reflect.has(metadata, 'category')) + payload.category = { newCategoryId: metadata.category }; + + if (Reflect.has(metadata, 'privacy')) { + switch (metadata.privacy) { + case 'PUBLIC': + payload.privacy = { newPrivacy: 1 }; + break; + case 'UNLISTED': + payload.privacy = { newPrivacy: 2 }; + break; + case 'PRIVATE': + payload.privacy = { newPrivacy: 3 }; + break; + default: + throw new Error('Invalid privacy setting'); + } + } + + if (Reflect.has(metadata, 'made_for_kids')) { + payload.madeForKids = { + operation: 1, + newMfk: metadata.made_for_kids ? 1 : 2 + }; + } + + if (Reflect.has(metadata, 'age_restricted')) { + payload.racy = { + operation: 1, + newRacy: metadata.age_restricted ? 1 : 2 + }; + } + + const writer = MetadataUpdateRequest.encode(payload); const response = await this.#session.actions.execute('/video_manager/metadata_update', { protobuf: true, - serialized_data: payload + serialized_data: writer.finish() }); return response; diff --git a/src/core/managers/AccountManager.ts b/src/core/managers/AccountManager.ts index a5bf551dc3..ff18632f0c 100644 --- a/src/core/managers/AccountManager.ts +++ b/src/core/managers/AccountManager.ts @@ -5,10 +5,11 @@ import Analytics from '../../parser/youtube/Analytics.js'; import Settings from '../../parser/youtube/Settings.js'; import TimeWatched from '../../parser/youtube/TimeWatched.js'; -import * as Proto from '../../proto/index.js'; -import { InnertubeError } from '../../utils/Utils.js'; +import { InnertubeError, u8ToBase64 } from '../../utils/Utils.js'; import { Account, BrowseEndpoint, Channel } from '../endpoints/index.js'; +import { ChannelAnalytics } from '../../../protos/generated/misc/params.js'; + export default class AccountManager { #actions: Actions; @@ -106,11 +107,19 @@ export default class AccountManager { async getAnalytics(): Promise { const info = await this.getInfo(); + const writer = ChannelAnalytics.encode({ + params: { + channelId: info.footers?.endpoint.payload.browseId + } + }); + + const params = encodeURIComponent(u8ToBase64(writer.finish())); + const response = await this.#actions.execute( BrowseEndpoint.PATH, BrowseEndpoint.build({ browse_id: 'FEanalytics_screen', - params: Proto.encodeChannelAnalyticsParams(info.footers?.endpoint.payload.browseId), - client: 'ANDROID' + client: 'ANDROID', + params }) ); diff --git a/src/core/managers/InteractionManager.ts b/src/core/managers/InteractionManager.ts index adfadfbe79..895a01cd4e 100644 --- a/src/core/managers/InteractionManager.ts +++ b/src/core/managers/InteractionManager.ts @@ -1,11 +1,13 @@ -import * as Proto from '../../proto/index.js'; +import * as ProtoUtils from '../../utils/ProtoUtils.js'; -import { throwIfMissing } from '../../utils/Utils.js'; +import { throwIfMissing, u8ToBase64 } from '../../utils/Utils.js'; import { LikeEndpoint, DislikeEndpoint, RemoveLikeEndpoint } from '../endpoints/like/index.js'; import { SubscribeEndpoint, UnsubscribeEndpoint } from '../endpoints/subscription/index.js'; import { CreateCommentEndpoint, PerformCommentActionEndpoint } from '../endpoints/comment/index.js'; import { ModifyChannelPreferenceEndpoint } from '../endpoints/notification/index.js'; +import { CreateCommentParams, NotificationPreferences } from '../../../protos/generated/misc/params.js'; + import type { Actions, ApiResponse } from '../index.js'; export default class InteractionManager { @@ -128,10 +130,20 @@ export default class InteractionManager { if (!this.#actions.session.logged_in) throw new Error('You must be signed in to perform this operation.'); + const writer = CreateCommentParams.encode({ + videoId: video_id, + params: { + index: 0 + }, + number: 7 + }); + + const params = encodeURIComponent(u8ToBase64(writer.finish())); + const action = await this.#actions.execute( CreateCommentEndpoint.PATH, CreateCommentEndpoint.build({ comment_text: text, - create_comment_params: Proto.encodeCommentParams(video_id), + create_comment_params: params, client: 'ANDROID' }) ); @@ -148,7 +160,7 @@ export default class InteractionManager { async translate(text: string, target_language: string, args: { video_id?: string; comment_id?: string; } = {}) { throwIfMissing({ text, target_language }); - const target_action = Proto.encodeCommentActionParams(22, { text, target_language, ...args }); + const target_action = ProtoUtils.encodeCommentActionParams(22, { text, target_language, ...args }); const response = await this.#actions.execute( PerformCommentActionEndpoint.PATH, PerformCommentActionEndpoint.build({ @@ -188,10 +200,20 @@ export default class InteractionManager { if (!Object.keys(pref_types).includes(type.toUpperCase())) throw new Error(`Invalid notification preference type: ${type}`); + const writer = NotificationPreferences.encode({ + channelId: channel_id, + prefId: { + index: pref_types[type.toUpperCase() as keyof typeof pref_types] + }, + number0: 0, number1: 4 + }); + + const params = encodeURIComponent(u8ToBase64(writer.finish())); + const action = await this.#actions.execute( ModifyChannelPreferenceEndpoint.PATH, ModifyChannelPreferenceEndpoint.build({ client: 'WEB', - params: Proto.encodeNotificationPref(channel_id, pref_types[type.toUpperCase() as keyof typeof pref_types]) + params }) ); diff --git a/src/parser/classes/comments/Comment.ts b/src/parser/classes/comments/Comment.ts index fb3d44bf9d..eb738d0a78 100644 --- a/src/parser/classes/comments/Comment.ts +++ b/src/parser/classes/comments/Comment.ts @@ -11,7 +11,7 @@ import CommentReplyDialog from './CommentReplyDialog.js'; import PdgCommentChip from './PdgCommentChip.js'; import SponsorCommentBadge from './SponsorCommentBadge.js'; -import * as Proto from '../../../proto/index.js'; +import * as ProtoUtils from '../../../utils/ProtoUtils.js'; import { InnertubeError } from '../../../utils/Utils.js'; import { YTNode } from '../../helpers.js'; @@ -166,7 +166,7 @@ export default class Comment extends YTNode { comment_id: this.comment_id }; - const action = Proto.encodeCommentActionParams(22, payload); + const action = ProtoUtils.encodeCommentActionParams(22, payload); const response = await this.#actions.execute('comment/perform_comment_action', { action, client: 'ANDROID' }); // XXX: Should move this to Parser#parseResponse diff --git a/src/parser/classes/comments/CommentView.ts b/src/parser/classes/comments/CommentView.ts index b51da91b91..a2af991bd5 100644 --- a/src/parser/classes/comments/CommentView.ts +++ b/src/parser/classes/comments/CommentView.ts @@ -4,7 +4,7 @@ import Author from '../misc/Author.js'; import Text from '../misc/Text.js'; import CommentReplyDialog from './CommentReplyDialog.js'; import { InnertubeError } from '../../../utils/Utils.js'; -import * as Proto from '../../../proto/index.js'; +import * as ProtoUtils from '../../../utils/ProtoUtils.js'; import type Actions from '../../../core/Actions.js'; import type { ApiResponse } from '../../../core/Actions.js'; @@ -223,7 +223,7 @@ export default class CommentView extends YTNode { target_language }; - const action = Proto.encodeCommentActionParams(22, payload); + const action = ProtoUtils.encodeCommentActionParams(22, payload); const response = await this.#actions.execute('comment/perform_comment_action', { action, client: 'ANDROID' }); // XXX: Should move this to Parser#parseResponse diff --git a/src/parser/classes/misc/Format.ts b/src/parser/classes/misc/Format.ts index 58578e22f5..9bdbe2a8dd 100644 --- a/src/parser/classes/misc/Format.ts +++ b/src/parser/classes/misc/Format.ts @@ -10,6 +10,7 @@ export default class Format { width?: number; height?: number; last_modified: Date; + last_modified_ms: string; content_length?: number; quality?: string; xtags?: string; @@ -107,6 +108,7 @@ export default class Format { }; this.last_modified = new Date(Math.floor(parseInt(data.lastModified) / 1000)); + this.last_modified_ms = data.lastModified; if (Reflect.has(data, 'contentLength')) this.content_length = parseInt(data.contentLength); diff --git a/src/parser/parser.ts b/src/parser/parser.ts index 53a5140260..57909c205c 100644 --- a/src/parser/parser.ts +++ b/src/parser/parser.ts @@ -399,8 +399,9 @@ export function parseResponse(data: expires: new Date(Date.now() + parseInt(data.streamingData.expiresInSeconds) * 1000), formats: parseFormats(data.streamingData.formats, this_response_nsig_cache), adaptive_formats: parseFormats(data.streamingData.adaptiveFormats, this_response_nsig_cache), - dash_manifest_url: data.streamingData.dashManifestUrl || null, - hls_manifest_url: data.streamingData.hlsManifestUrl || null + dash_manifest_url: data.streamingData.dashManifestUrl, + hls_manifest_url: data.streamingData.hlsManifestUrl, + server_abr_streaming_url: data.streamingData.serverAbrStreamingUrl }; parsed_data.streaming_data = streaming_data; @@ -421,6 +422,9 @@ export function parseResponse(data: max_read_ahead_media_time_ms: data.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.maxReadAheadMediaTimeMs || 0, min_read_ahead_media_time_ms: data.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.minReadAheadMediaTimeMs || 0, read_ahead_growth_rate_ms: data.playerConfig.mediaCommonConfig?.dynamicReadaheadConfig?.readAheadGrowthRateMs || 0 + }, + media_ustreamer_request_config: { + video_playback_ustreamer_config: data.playerConfig.mediaCommonConfig?.mediaUstreamerRequestConfig?.videoPlaybackUstreamerConfig } } }; diff --git a/src/parser/types/ParsedResponse.ts b/src/parser/types/ParsedResponse.ts index 7b2536430e..731896e625 100644 --- a/src/parser/types/ParsedResponse.ts +++ b/src/parser/types/ParsedResponse.ts @@ -103,6 +103,9 @@ export interface IPlayerConfig { min_read_ahead_media_time_ms: number; read_ahead_growth_rate_ms: number; }; + media_ustreamer_request_config?: { + video_playback_ustreamer_config?: string; + }; }; } @@ -110,8 +113,9 @@ export interface IStreamingData { expires: Date; formats: Format[]; adaptive_formats: Format[]; - dash_manifest_url: string | null; - hls_manifest_url: string | null; + dash_manifest_url?: string; + hls_manifest_url?: string; + server_abr_streaming_url?: string; } export type IPlayerResponse = Pick; diff --git a/src/parser/types/RawResponse.ts b/src/parser/types/RawResponse.ts index 007d3334f5..c48406dc20 100644 --- a/src/parser/types/RawResponse.ts +++ b/src/parser/types/RawResponse.ts @@ -26,11 +26,14 @@ export interface IRawPlayerConfig { maxBitrate: string; }; mediaCommonConfig: { - dynamicReadaheadConfig: { + dynamicReadaheadConfig?: { maxReadAheadMediaTimeMs: number; minReadAheadMediaTimeMs: number; readAheadGrowthRateMs: number; }; + mediaUstreamerRequestConfig?: { + videoPlaybackUstreamerConfig: string; + } }; } @@ -75,6 +78,7 @@ export interface IRawResponse { adaptiveFormats: RawNode[]; dashManifestUrl?: string; hlsManifestUrl?: string; + serverAbrStreamingUrl?: string; }; playerConfig?: IRawPlayerConfig; playerResponse?: IRawResponse; diff --git a/src/parser/youtube/LiveChat.ts b/src/parser/youtube/LiveChat.ts index 643857dc2a..7df94aafd4 100644 --- a/src/parser/youtube/LiveChat.ts +++ b/src/parser/youtube/LiveChat.ts @@ -1,6 +1,5 @@ -import * as Proto from '../../proto/index.js'; import { EventEmitter } from '../../utils/index.js'; -import { InnertubeError, Platform } from '../../utils/Utils.js'; +import { InnertubeError, Platform, u8ToBase64 } from '../../utils/Utils.js'; import { Parser, LiveChatContinuation } from '../index.js'; import SmoothedQueue from './SmoothedQueue.js'; @@ -13,6 +12,8 @@ import UpdateViewershipAction from '../classes/livechat/UpdateViewershipAction.j import NavigationEndpoint from '../classes/NavigationEndpoint.js'; import ItemMenu from './ItemMenu.js'; +import { LiveMessageParams } from '../../../protos/generated/misc/params.js'; + import type { ObservedArray, YTNode } from '../helpers.js'; import type VideoInfo from './VideoInfo.js'; @@ -42,7 +43,7 @@ export type ChatAction = ReplaceChatItemAction | ReplayChatItemAction | ShowLiveChatActionPanelAction | ShowLiveChatTooltipCommand; export type ChatItemWithMenu = LiveChatAutoModMessage | LiveChatMembershipItem | LiveChatPaidMessage | LiveChatPaidSticker | LiveChatTextMessage | LiveChatViewerEngagementMessage; - + export interface LiveMetadata { title?: UpdateTitleAction; description?: UpdateDescriptionAction; @@ -250,12 +251,25 @@ export default class LiveChat extends EventEmitter { * @param text - Text to send. */ async sendMessage(text: string): Promise> { + const writer = LiveMessageParams.encode({ + params: { + ids: { + videoId: this.#video_id, + channelId: this.#channel_id + } + }, + number0: 1, + number1: 4 + }); + + const params = btoa(encodeURIComponent(u8ToBase64(writer.finish()))); + const response = await this.#actions.execute('/live_chat/send_message', { - params: Proto.encodeMessageParams(this.#channel_id, this.#video_id), richMessage: { textSegments: [ { text } ] }, clientMessageId: Platform.shim.uuidv4(), client: 'ANDROID', - parse: true + parse: true, + params }); if (!response.actions) diff --git a/src/platform/lib.ts b/src/platform/lib.ts index ec2f985f9c..580949c4c8 100644 --- a/src/platform/lib.ts +++ b/src/platform/lib.ts @@ -2,7 +2,6 @@ import Innertube from '../Innertube.js'; export * from '../core/index.js'; export * from '../parser/index.js'; -export * as Proto from '../proto/index.js'; export * as Types from '../types/index.js'; export * from '../utils/index.js'; diff --git a/src/proto/generated/index.ts b/src/proto/generated/index.ts deleted file mode 100644 index 90b95984d2..0000000000 --- a/src/proto/generated/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as messages from "./messages/index.js"; - -export type { - messages, -}; diff --git a/src/proto/generated/messages/index.ts b/src/proto/generated/messages/index.ts deleted file mode 100644 index f19e8589e9..0000000000 --- a/src/proto/generated/messages/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as youtube from "./youtube/index.js"; - -export type { - youtube, -}; diff --git a/src/proto/generated/messages/youtube/(ChannelAnalytics)/Params.ts b/src/proto/generated/messages/youtube/(ChannelAnalytics)/Params.ts deleted file mode 100644 index 30f6d0c674..0000000000 --- a/src/proto/generated/messages/youtube/(ChannelAnalytics)/Params.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.ChannelAnalytics { - export type Params = { - channelId: string; - } -} - -export type Type = $.youtube.ChannelAnalytics.Params; - -export function getDefaultValue(): $.youtube.ChannelAnalytics.Params { - return { - channelId: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.ChannelAnalytics.Params>): $.youtube.ChannelAnalytics.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.ChannelAnalytics.Params): unknown { - const result: any = {}; - if (value.channelId !== undefined) result.channelId = tsValueToJsonValueFns.string(value.channelId); - return result; -} - -export function decodeJson(value: any): $.youtube.ChannelAnalytics.Params { - const result = getDefaultValue(); - if (value.channelId !== undefined) result.channelId = jsonValueToTsValueFns.string(value.channelId); - return result; -} - -export function encodeBinary(value: $.youtube.ChannelAnalytics.Params): Uint8Array { - const result: WireMessage = []; - if (value.channelId !== undefined) { - const tsValue = value.channelId; - result.push( - [1001, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.ChannelAnalytics.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1001); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.channelId = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(ChannelAnalytics)/index.ts b/src/proto/generated/messages/youtube/(ChannelAnalytics)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(ChannelAnalytics)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(CreateCommentParams)/Params.ts b/src/proto/generated/messages/youtube/(CreateCommentParams)/Params.ts deleted file mode 100644 index d3cf3005a9..0000000000 --- a/src/proto/generated/messages/youtube/(CreateCommentParams)/Params.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.CreateCommentParams { - export type Params = { - index: number; - } -} - -export type Type = $.youtube.CreateCommentParams.Params; - -export function getDefaultValue(): $.youtube.CreateCommentParams.Params { - return { - index: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.CreateCommentParams.Params>): $.youtube.CreateCommentParams.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.CreateCommentParams.Params): unknown { - const result: any = {}; - if (value.index !== undefined) result.index = tsValueToJsonValueFns.int32(value.index); - return result; -} - -export function decodeJson(value: any): $.youtube.CreateCommentParams.Params { - const result = getDefaultValue(); - if (value.index !== undefined) result.index = jsonValueToTsValueFns.int32(value.index); - return result; -} - -export function encodeBinary(value: $.youtube.CreateCommentParams.Params): Uint8Array { - const result: WireMessage = []; - if (value.index !== undefined) { - const tsValue = value.index; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.CreateCommentParams.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.index = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(CreateCommentParams)/index.ts b/src/proto/generated/messages/youtube/(CreateCommentParams)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(CreateCommentParams)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/(RepliesOptions)/UnkOpts.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/(RepliesOptions)/UnkOpts.ts deleted file mode 100644 index 3799cd7412..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/(RepliesOptions)/UnkOpts.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.GetCommentsSectionParams.Params.RepliesOptions { - export type UnkOpts = { - unkParam: number; - } -} - -export type Type = $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts; - -export function getDefaultValue(): $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts { - return { - unkParam: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts>): $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts): unknown { - const result: any = {}; - if (value.unkParam !== undefined) result.unkParam = tsValueToJsonValueFns.int32(value.unkParam); - return result; -} - -export function decodeJson(value: any): $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts { - const result = getDefaultValue(); - if (value.unkParam !== undefined) result.unkParam = jsonValueToTsValueFns.int32(value.unkParam); - return result; -} - -export function encodeBinary(value: $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts): Uint8Array { - const result: WireMessage = []; - if (value.unkParam !== undefined) { - const tsValue = value.unkParam; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionParams.Params.RepliesOptions.UnkOpts { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkParam = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/(RepliesOptions)/index.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/(RepliesOptions)/index.ts deleted file mode 100644 index edebe8b75b..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/(RepliesOptions)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as UnkOpts } from "./UnkOpts.js"; diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts deleted file mode 100644 index bc4928d78f..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/Options.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.GetCommentsSectionParams.Params { - export type Options = { - videoId: string; - sortBy: number; - type: number; - commentId?: string; - } -} - -export type Type = $.youtube.GetCommentsSectionParams.Params.Options; - -export function getDefaultValue(): $.youtube.GetCommentsSectionParams.Params.Options { - return { - videoId: "", - sortBy: 0, - type: 0, - commentId: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.GetCommentsSectionParams.Params.Options>): $.youtube.GetCommentsSectionParams.Params.Options { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.GetCommentsSectionParams.Params.Options): unknown { - const result: any = {}; - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - if (value.sortBy !== undefined) result.sortBy = tsValueToJsonValueFns.int32(value.sortBy); - if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); - if (value.commentId !== undefined) result.commentId = tsValueToJsonValueFns.string(value.commentId); - return result; -} - -export function decodeJson(value: any): $.youtube.GetCommentsSectionParams.Params.Options { - const result = getDefaultValue(); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - if (value.sortBy !== undefined) result.sortBy = jsonValueToTsValueFns.int32(value.sortBy); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); - if (value.commentId !== undefined) result.commentId = jsonValueToTsValueFns.string(value.commentId); - return result; -} - -export function encodeBinary(value: $.youtube.GetCommentsSectionParams.Params.Options): Uint8Array { - const result: WireMessage = []; - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [4, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.sortBy !== undefined) { - const tsValue = value.sortBy; - result.push( - [6, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [15, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.commentId !== undefined) { - const tsValue = value.commentId; - result.push( - [16, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionParams.Params.Options { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - field: { - const wireValue = wireFields.get(6); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.sortBy = value; - } - field: { - const wireValue = wireFields.get(15); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.type = value; - } - field: { - const wireValue = wireFields.get(16); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.commentId = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/RepliesOptions.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/RepliesOptions.ts deleted file mode 100644 index 3b3fd0022b..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/RepliesOptions.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { - Type as UnkOpts, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(RepliesOptions)/UnkOpts.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.GetCommentsSectionParams.Params { - export type RepliesOptions = { - commentId: string; - unkopts?: UnkOpts; - channelId?: string; - videoId: string; - unkParam1: number; - unkParam2: number; - } -} - -export type Type = $.youtube.GetCommentsSectionParams.Params.RepliesOptions; - -export function getDefaultValue(): $.youtube.GetCommentsSectionParams.Params.RepliesOptions { - return { - commentId: "", - unkopts: undefined, - channelId: undefined, - videoId: "", - unkParam1: 0, - unkParam2: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.GetCommentsSectionParams.Params.RepliesOptions>): $.youtube.GetCommentsSectionParams.Params.RepliesOptions { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.GetCommentsSectionParams.Params.RepliesOptions): unknown { - const result: any = {}; - if (value.commentId !== undefined) result.commentId = tsValueToJsonValueFns.string(value.commentId); - if (value.unkopts !== undefined) result.unkopts = encodeJson_1(value.unkopts); - if (value.channelId !== undefined) result.channelId = tsValueToJsonValueFns.string(value.channelId); - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - if (value.unkParam1 !== undefined) result.unkParam1 = tsValueToJsonValueFns.int32(value.unkParam1); - if (value.unkParam2 !== undefined) result.unkParam2 = tsValueToJsonValueFns.int32(value.unkParam2); - return result; -} - -export function decodeJson(value: any): $.youtube.GetCommentsSectionParams.Params.RepliesOptions { - const result = getDefaultValue(); - if (value.commentId !== undefined) result.commentId = jsonValueToTsValueFns.string(value.commentId); - if (value.unkopts !== undefined) result.unkopts = decodeJson_1(value.unkopts); - if (value.channelId !== undefined) result.channelId = jsonValueToTsValueFns.string(value.channelId); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - if (value.unkParam1 !== undefined) result.unkParam1 = jsonValueToTsValueFns.int32(value.unkParam1); - if (value.unkParam2 !== undefined) result.unkParam2 = jsonValueToTsValueFns.int32(value.unkParam2); - return result; -} - -export function encodeBinary(value: $.youtube.GetCommentsSectionParams.Params.RepliesOptions): Uint8Array { - const result: WireMessage = []; - if (value.commentId !== undefined) { - const tsValue = value.commentId; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.unkopts !== undefined) { - const tsValue = value.unkopts; - result.push( - [4, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.channelId !== undefined) { - const tsValue = value.channelId; - result.push( - [5, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [6, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.unkParam1 !== undefined) { - const tsValue = value.unkParam1; - result.push( - [8, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.unkParam2 !== undefined) { - const tsValue = value.unkParam2; - result.push( - [9, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionParams.Params.RepliesOptions { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.commentId = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.unkopts = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.channelId = value; - } - field: { - const wireValue = wireFields.get(6); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - field: { - const wireValue = wireFields.get(8); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkParam1 = value; - } - field: { - const wireValue = wireFields.get(9); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkParam2 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/index.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/index.ts deleted file mode 100644 index fd5fac0c64..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/(Params)/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type { Type as Options } from "./Options.js"; -export type { Type as RepliesOptions } from "./RepliesOptions.js"; diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/Context.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/Context.ts deleted file mode 100644 index c378684919..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/Context.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.GetCommentsSectionParams { - export type Context = { - videoId: string; - } -} - -export type Type = $.youtube.GetCommentsSectionParams.Context; - -export function getDefaultValue(): $.youtube.GetCommentsSectionParams.Context { - return { - videoId: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.GetCommentsSectionParams.Context>): $.youtube.GetCommentsSectionParams.Context { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.GetCommentsSectionParams.Context): unknown { - const result: any = {}; - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - return result; -} - -export function decodeJson(value: any): $.youtube.GetCommentsSectionParams.Context { - const result = getDefaultValue(); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - return result; -} - -export function encodeBinary(value: $.youtube.GetCommentsSectionParams.Context): Uint8Array { - const result: WireMessage = []; - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionParams.Context { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/Params.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/Params.ts deleted file mode 100644 index 1fb2f30315..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/Params.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { - Type as RepliesOptions, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Params)/RepliesOptions.js"; -import { - Type as Options, - encodeJson as encodeJson_2, - decodeJson as decodeJson_2, - encodeBinary as encodeBinary_2, - decodeBinary as decodeBinary_2, -} from "./(Params)/Options.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.GetCommentsSectionParams { - export type Params = { - unkToken?: string; - repliesOpts?: RepliesOptions; - opts?: Options; - page?: number; - target: string; - } -} - -export type Type = $.youtube.GetCommentsSectionParams.Params; - -export function getDefaultValue(): $.youtube.GetCommentsSectionParams.Params { - return { - unkToken: undefined, - repliesOpts: undefined, - opts: undefined, - page: undefined, - target: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.GetCommentsSectionParams.Params>): $.youtube.GetCommentsSectionParams.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.GetCommentsSectionParams.Params): unknown { - const result: any = {}; - if (value.unkToken !== undefined) result.unkToken = tsValueToJsonValueFns.string(value.unkToken); - if (value.repliesOpts !== undefined) result.repliesOpts = encodeJson_1(value.repliesOpts); - if (value.opts !== undefined) result.opts = encodeJson_2(value.opts); - if (value.page !== undefined) result.page = tsValueToJsonValueFns.int32(value.page); - if (value.target !== undefined) result.target = tsValueToJsonValueFns.string(value.target); - return result; -} - -export function decodeJson(value: any): $.youtube.GetCommentsSectionParams.Params { - const result = getDefaultValue(); - if (value.unkToken !== undefined) result.unkToken = jsonValueToTsValueFns.string(value.unkToken); - if (value.repliesOpts !== undefined) result.repliesOpts = decodeJson_1(value.repliesOpts); - if (value.opts !== undefined) result.opts = decodeJson_2(value.opts); - if (value.page !== undefined) result.page = jsonValueToTsValueFns.int32(value.page); - if (value.target !== undefined) result.target = jsonValueToTsValueFns.string(value.target); - return result; -} - -export function encodeBinary(value: $.youtube.GetCommentsSectionParams.Params): Uint8Array { - const result: WireMessage = []; - if (value.unkToken !== undefined) { - const tsValue = value.unkToken; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.repliesOpts !== undefined) { - const tsValue = value.repliesOpts; - result.push( - [3, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.opts !== undefined) { - const tsValue = value.opts; - result.push( - [4, { type: WireType.LengthDelimited as const, value: encodeBinary_2(tsValue) }], - ); - } - if (value.page !== undefined) { - const tsValue = value.page; - result.push( - [5, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.target !== undefined) { - const tsValue = value.target; - result.push( - [8, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionParams.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.unkToken = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.repliesOpts = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_2(wireValue.value) : undefined; - if (value === undefined) break field; - result.opts = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.page = value; - } - field: { - const wireValue = wireFields.get(8); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.target = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/index.ts b/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/index.ts deleted file mode 100644 index fef3279f4d..0000000000 --- a/src/proto/generated/messages/youtube/(GetCommentsSectionParams)/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type { Type as Context } from "./Context.js"; -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(Hashtag)/Params.ts b/src/proto/generated/messages/youtube/(Hashtag)/Params.ts deleted file mode 100644 index ec92ba22f0..0000000000 --- a/src/proto/generated/messages/youtube/(Hashtag)/Params.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.Hashtag { - export type Params = { - hashtag: string; - type: number; - } -} - -export type Type = $.youtube.Hashtag.Params; - -export function getDefaultValue(): $.youtube.Hashtag.Params { - return { - hashtag: "", - type: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.Hashtag.Params>): $.youtube.Hashtag.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.Hashtag.Params): unknown { - const result: any = {}; - if (value.hashtag !== undefined) result.hashtag = tsValueToJsonValueFns.string(value.hashtag); - if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); - return result; -} - -export function decodeJson(value: any): $.youtube.Hashtag.Params { - const result = getDefaultValue(); - if (value.hashtag !== undefined) result.hashtag = jsonValueToTsValueFns.string(value.hashtag); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); - return result; -} - -export function encodeBinary(value: $.youtube.Hashtag.Params): Uint8Array { - const result: WireMessage = []; - if (value.hashtag !== undefined) { - const tsValue = value.hashtag; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.Hashtag.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.hashtag = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.type = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(Hashtag)/index.ts b/src/proto/generated/messages/youtube/(Hashtag)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(Hashtag)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts deleted file mode 100644 index b57c358ab9..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/Client.ts +++ /dev/null @@ -1,245 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload.Context { - export type Client = { - deviceMake: string; - deviceModel: string; - nameId: number; - clientVersion: string; - osName: string; - osVersion: string; - acceptLanguage: string; - acceptRegion: string; - androidSdkVersion: number; - windowWidthPoints: number; - windowHeightPoints: number; - } -} - -export type Type = $.youtube.InnertubePayload.Context.Client; - -export function getDefaultValue(): $.youtube.InnertubePayload.Context.Client { - return { - deviceMake: "", - deviceModel: "", - nameId: 0, - clientVersion: "", - osName: "", - osVersion: "", - acceptLanguage: "", - acceptRegion: "", - androidSdkVersion: 0, - windowWidthPoints: 0, - windowHeightPoints: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Context.Client>): $.youtube.InnertubePayload.Context.Client { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Context.Client): unknown { - const result: any = {}; - if (value.deviceMake !== undefined) result.deviceMake = tsValueToJsonValueFns.string(value.deviceMake); - if (value.deviceModel !== undefined) result.deviceModel = tsValueToJsonValueFns.string(value.deviceModel); - if (value.nameId !== undefined) result.nameId = tsValueToJsonValueFns.int32(value.nameId); - if (value.clientVersion !== undefined) result.clientVersion = tsValueToJsonValueFns.string(value.clientVersion); - if (value.osName !== undefined) result.osName = tsValueToJsonValueFns.string(value.osName); - if (value.osVersion !== undefined) result.osVersion = tsValueToJsonValueFns.string(value.osVersion); - if (value.acceptLanguage !== undefined) result.acceptLanguage = tsValueToJsonValueFns.string(value.acceptLanguage); - if (value.acceptRegion !== undefined) result.acceptRegion = tsValueToJsonValueFns.string(value.acceptRegion); - if (value.androidSdkVersion !== undefined) result.androidSdkVersion = tsValueToJsonValueFns.int32(value.androidSdkVersion); - if (value.windowWidthPoints !== undefined) result.windowWidthPoints = tsValueToJsonValueFns.int32(value.windowWidthPoints); - if (value.windowHeightPoints !== undefined) result.windowHeightPoints = tsValueToJsonValueFns.int32(value.windowHeightPoints); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Context.Client { - const result = getDefaultValue(); - if (value.deviceMake !== undefined) result.deviceMake = jsonValueToTsValueFns.string(value.deviceMake); - if (value.deviceModel !== undefined) result.deviceModel = jsonValueToTsValueFns.string(value.deviceModel); - if (value.nameId !== undefined) result.nameId = jsonValueToTsValueFns.int32(value.nameId); - if (value.clientVersion !== undefined) result.clientVersion = jsonValueToTsValueFns.string(value.clientVersion); - if (value.osName !== undefined) result.osName = jsonValueToTsValueFns.string(value.osName); - if (value.osVersion !== undefined) result.osVersion = jsonValueToTsValueFns.string(value.osVersion); - if (value.acceptLanguage !== undefined) result.acceptLanguage = jsonValueToTsValueFns.string(value.acceptLanguage); - if (value.acceptRegion !== undefined) result.acceptRegion = jsonValueToTsValueFns.string(value.acceptRegion); - if (value.androidSdkVersion !== undefined) result.androidSdkVersion = jsonValueToTsValueFns.int32(value.androidSdkVersion); - if (value.windowWidthPoints !== undefined) result.windowWidthPoints = jsonValueToTsValueFns.int32(value.windowWidthPoints); - if (value.windowHeightPoints !== undefined) result.windowHeightPoints = jsonValueToTsValueFns.int32(value.windowHeightPoints); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Context.Client): Uint8Array { - const result: WireMessage = []; - if (value.deviceMake !== undefined) { - const tsValue = value.deviceMake; - result.push( - [12, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.deviceModel !== undefined) { - const tsValue = value.deviceModel; - result.push( - [13, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.nameId !== undefined) { - const tsValue = value.nameId; - result.push( - [16, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.clientVersion !== undefined) { - const tsValue = value.clientVersion; - result.push( - [17, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.osName !== undefined) { - const tsValue = value.osName; - result.push( - [18, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.osVersion !== undefined) { - const tsValue = value.osVersion; - result.push( - [19, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.acceptLanguage !== undefined) { - const tsValue = value.acceptLanguage; - result.push( - [21, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.acceptRegion !== undefined) { - const tsValue = value.acceptRegion; - result.push( - [22, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.androidSdkVersion !== undefined) { - const tsValue = value.androidSdkVersion; - result.push( - [34, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.windowWidthPoints !== undefined) { - const tsValue = value.windowWidthPoints; - result.push( - [37, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.windowHeightPoints !== undefined) { - const tsValue = value.windowHeightPoints; - result.push( - [38, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Context.Client { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(12); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.deviceMake = value; - } - field: { - const wireValue = wireFields.get(13); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.deviceModel = value; - } - field: { - const wireValue = wireFields.get(16); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.nameId = value; - } - field: { - const wireValue = wireFields.get(17); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.clientVersion = value; - } - field: { - const wireValue = wireFields.get(18); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.osName = value; - } - field: { - const wireValue = wireFields.get(19); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.osVersion = value; - } - field: { - const wireValue = wireFields.get(21); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.acceptLanguage = value; - } - field: { - const wireValue = wireFields.get(22); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.acceptRegion = value; - } - field: { - const wireValue = wireFields.get(34); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.androidSdkVersion = value; - } - field: { - const wireValue = wireFields.get(37); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.windowWidthPoints = value; - } - field: { - const wireValue = wireFields.get(38); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.windowHeightPoints = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/index.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/index.ts deleted file mode 100644 index f0c8b3d36c..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/(Context)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Client } from "./Client.js"; diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/(VideoThumbnail)/Thumbnail.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/(VideoThumbnail)/Thumbnail.ts deleted file mode 100644 index e7130a98cf..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/(VideoThumbnail)/Thumbnail.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload.VideoThumbnail { - export type Thumbnail = { - imageData: Uint8Array; - } -} - -export type Type = $.youtube.InnertubePayload.VideoThumbnail.Thumbnail; - -export function getDefaultValue(): $.youtube.InnertubePayload.VideoThumbnail.Thumbnail { - return { - imageData: new Uint8Array(), - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.VideoThumbnail.Thumbnail>): $.youtube.InnertubePayload.VideoThumbnail.Thumbnail { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.VideoThumbnail.Thumbnail): unknown { - const result: any = {}; - if (value.imageData !== undefined) result.imageData = tsValueToJsonValueFns.bytes(value.imageData); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.VideoThumbnail.Thumbnail { - const result = getDefaultValue(); - if (value.imageData !== undefined) result.imageData = jsonValueToTsValueFns.bytes(value.imageData); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.VideoThumbnail.Thumbnail): Uint8Array { - const result: WireMessage = []; - if (value.imageData !== undefined) { - const tsValue = value.imageData; - result.push( - [1, tsValueToWireValueFns.bytes(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.VideoThumbnail.Thumbnail { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.bytes(wireValue); - if (value === undefined) break field; - result.imageData = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/(VideoThumbnail)/index.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/(VideoThumbnail)/index.ts deleted file mode 100644 index cbd7bf390e..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/(VideoThumbnail)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Thumbnail } from "./Thumbnail.js"; diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/AgeRestricted.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/AgeRestricted.ts deleted file mode 100644 index 5dbc44255d..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/AgeRestricted.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type AgeRestricted = { - unkparam: number; - choice: number; - } -} - -export type Type = $.youtube.InnertubePayload.AgeRestricted; - -export function getDefaultValue(): $.youtube.InnertubePayload.AgeRestricted { - return { - unkparam: 0, - choice: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.AgeRestricted>): $.youtube.InnertubePayload.AgeRestricted { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.AgeRestricted): unknown { - const result: any = {}; - if (value.unkparam !== undefined) result.unkparam = tsValueToJsonValueFns.int32(value.unkparam); - if (value.choice !== undefined) result.choice = tsValueToJsonValueFns.int32(value.choice); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.AgeRestricted { - const result = getDefaultValue(); - if (value.unkparam !== undefined) result.unkparam = jsonValueToTsValueFns.int32(value.unkparam); - if (value.choice !== undefined) result.choice = jsonValueToTsValueFns.int32(value.choice); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.AgeRestricted): Uint8Array { - const result: WireMessage = []; - if (value.unkparam !== undefined) { - const tsValue = value.unkparam; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.choice !== undefined) { - const tsValue = value.choice; - result.push( - [2, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.AgeRestricted { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkparam = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.choice = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/Category.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/Category.ts deleted file mode 100644 index aaa0db9509..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/Category.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type Category = { - id: number; - } -} - -export type Type = $.youtube.InnertubePayload.Category; - -export function getDefaultValue(): $.youtube.InnertubePayload.Category { - return { - id: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Category>): $.youtube.InnertubePayload.Category { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Category): unknown { - const result: any = {}; - if (value.id !== undefined) result.id = tsValueToJsonValueFns.int32(value.id); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Category { - const result = getDefaultValue(); - if (value.id !== undefined) result.id = jsonValueToTsValueFns.int32(value.id); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Category): Uint8Array { - const result: WireMessage = []; - if (value.id !== undefined) { - const tsValue = value.id; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Category { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.id = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/Context.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/Context.ts deleted file mode 100644 index 9c914efec9..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/Context.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Client, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Context)/Client.js"; -import { - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type Context = { - client?: Client; - } -} - -export type Type = $.youtube.InnertubePayload.Context; - -export function getDefaultValue(): $.youtube.InnertubePayload.Context { - return { - client: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Context>): $.youtube.InnertubePayload.Context { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Context): unknown { - const result: any = {}; - if (value.client !== undefined) result.client = encodeJson_1(value.client); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Context { - const result = getDefaultValue(); - if (value.client !== undefined) result.client = decodeJson_1(value.client); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Context): Uint8Array { - const result: WireMessage = []; - if (value.client !== undefined) { - const tsValue = value.client; - result.push( - [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Context { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.client = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/Description.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/Description.ts deleted file mode 100644 index feaddb0715..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/Description.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type Description = { - text: string; - } -} - -export type Type = $.youtube.InnertubePayload.Description; - -export function getDefaultValue(): $.youtube.InnertubePayload.Description { - return { - text: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Description>): $.youtube.InnertubePayload.Description { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Description): unknown { - const result: any = {}; - if (value.text !== undefined) result.text = tsValueToJsonValueFns.string(value.text); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Description { - const result = getDefaultValue(); - if (value.text !== undefined) result.text = jsonValueToTsValueFns.string(value.text); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Description): Uint8Array { - const result: WireMessage = []; - if (value.text !== undefined) { - const tsValue = value.text; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Description { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.text = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/License.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/License.ts deleted file mode 100644 index c56b956ccc..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/License.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type License = { - type: string; - } -} - -export type Type = $.youtube.InnertubePayload.License; - -export function getDefaultValue(): $.youtube.InnertubePayload.License { - return { - type: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.License>): $.youtube.InnertubePayload.License { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.License): unknown { - const result: any = {}; - if (value.type !== undefined) result.type = tsValueToJsonValueFns.string(value.type); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.License { - const result = getDefaultValue(); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.string(value.type); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.License): Uint8Array { - const result: WireMessage = []; - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.License { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.type = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/MadeForKids.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/MadeForKids.ts deleted file mode 100644 index b40ca45b11..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/MadeForKids.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type MadeForKids = { - unkparam: number; - choice: number; - } -} - -export type Type = $.youtube.InnertubePayload.MadeForKids; - -export function getDefaultValue(): $.youtube.InnertubePayload.MadeForKids { - return { - unkparam: 0, - choice: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.MadeForKids>): $.youtube.InnertubePayload.MadeForKids { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.MadeForKids): unknown { - const result: any = {}; - if (value.unkparam !== undefined) result.unkparam = tsValueToJsonValueFns.int32(value.unkparam); - if (value.choice !== undefined) result.choice = tsValueToJsonValueFns.int32(value.choice); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.MadeForKids { - const result = getDefaultValue(); - if (value.unkparam !== undefined) result.unkparam = jsonValueToTsValueFns.int32(value.unkparam); - if (value.choice !== undefined) result.choice = jsonValueToTsValueFns.int32(value.choice); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.MadeForKids): Uint8Array { - const result: WireMessage = []; - if (value.unkparam !== undefined) { - const tsValue = value.unkparam; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.choice !== undefined) { - const tsValue = value.choice; - result.push( - [2, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.MadeForKids { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkparam = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.choice = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/Privacy.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/Privacy.ts deleted file mode 100644 index cf1079412e..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/Privacy.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type Privacy = { - type: number; - } -} - -export type Type = $.youtube.InnertubePayload.Privacy; - -export function getDefaultValue(): $.youtube.InnertubePayload.Privacy { - return { - type: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Privacy>): $.youtube.InnertubePayload.Privacy { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Privacy): unknown { - const result: any = {}; - if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Privacy { - const result = getDefaultValue(); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Privacy): Uint8Array { - const result: WireMessage = []; - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Privacy { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.type = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/Tags.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/Tags.ts deleted file mode 100644 index 67a8c4a449..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/Tags.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type Tags = { - list: string[]; - } -} - -export type Type = $.youtube.InnertubePayload.Tags; - -export function getDefaultValue(): $.youtube.InnertubePayload.Tags { - return { - list: [], - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Tags>): $.youtube.InnertubePayload.Tags { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Tags): unknown { - const result: any = {}; - result.list = value.list.map(value => tsValueToJsonValueFns.string(value)); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Tags { - const result = getDefaultValue(); - result.list = value.list?.map((value: any) => jsonValueToTsValueFns.string(value)) ?? []; - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Tags): Uint8Array { - const result: WireMessage = []; - for (const tsValue of value.list) { - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Tags { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - collection: { - const wireValues = wireMessage.filter(([fieldNumber]) => fieldNumber === 1).map(([, wireValue]) => wireValue); - const value = wireValues.map((wireValue) => wireValueToTsValueFns.string(wireValue)).filter(x => x !== undefined); - if (!value.length) break collection; - result.list = value as any; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/Title.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/Title.ts deleted file mode 100644 index 9b97c8d4ff..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/Title.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type Title = { - text: string; - } -} - -export type Type = $.youtube.InnertubePayload.Title; - -export function getDefaultValue(): $.youtube.InnertubePayload.Title { - return { - text: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.Title>): $.youtube.InnertubePayload.Title { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.Title): unknown { - const result: any = {}; - if (value.text !== undefined) result.text = tsValueToJsonValueFns.string(value.text); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.Title { - const result = getDefaultValue(); - if (value.text !== undefined) result.text = jsonValueToTsValueFns.string(value.text); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.Title): Uint8Array { - const result: WireMessage = []; - if (value.text !== undefined) { - const tsValue = value.text; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.Title { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.text = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/VideoThumbnail.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/VideoThumbnail.ts deleted file mode 100644 index a12c43c7a6..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/VideoThumbnail.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { - Type as Thumbnail, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(VideoThumbnail)/Thumbnail.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.InnertubePayload { - export type VideoThumbnail = { - type: number; - thumbnail?: Thumbnail; - } -} - -export type Type = $.youtube.InnertubePayload.VideoThumbnail; - -export function getDefaultValue(): $.youtube.InnertubePayload.VideoThumbnail { - return { - type: 0, - thumbnail: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload.VideoThumbnail>): $.youtube.InnertubePayload.VideoThumbnail { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload.VideoThumbnail): unknown { - const result: any = {}; - if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); - if (value.thumbnail !== undefined) result.thumbnail = encodeJson_1(value.thumbnail); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload.VideoThumbnail { - const result = getDefaultValue(); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); - if (value.thumbnail !== undefined) result.thumbnail = decodeJson_1(value.thumbnail); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload.VideoThumbnail): Uint8Array { - const result: WireMessage = []; - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.thumbnail !== undefined) { - const tsValue = value.thumbnail; - result.push( - [3, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload.VideoThumbnail { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.type = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.thumbnail = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(InnertubePayload)/index.ts b/src/proto/generated/messages/youtube/(InnertubePayload)/index.ts deleted file mode 100644 index 04cc23ca35..0000000000 --- a/src/proto/generated/messages/youtube/(InnertubePayload)/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export type { Type as Context } from "./Context.js"; -export type { Type as Title } from "./Title.js"; -export type { Type as Description } from "./Description.js"; -export type { Type as Tags } from "./Tags.js"; -export type { Type as Privacy } from "./Privacy.js"; -export type { Type as Category } from "./Category.js"; -export type { Type as MadeForKids } from "./MadeForKids.js"; -export type { Type as AgeRestricted } from "./AgeRestricted.js"; -export type { Type as License } from "./License.js"; -export type { Type as VideoThumbnail } from "./VideoThumbnail.js"; diff --git a/src/proto/generated/messages/youtube/(LiveMessageParams)/(Params)/Ids.ts b/src/proto/generated/messages/youtube/(LiveMessageParams)/(Params)/Ids.ts deleted file mode 100644 index 5b83935d47..0000000000 --- a/src/proto/generated/messages/youtube/(LiveMessageParams)/(Params)/Ids.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.LiveMessageParams.Params { - export type Ids = { - channelId: string; - videoId: string; - } -} - -export type Type = $.youtube.LiveMessageParams.Params.Ids; - -export function getDefaultValue(): $.youtube.LiveMessageParams.Params.Ids { - return { - channelId: "", - videoId: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.LiveMessageParams.Params.Ids>): $.youtube.LiveMessageParams.Params.Ids { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.LiveMessageParams.Params.Ids): unknown { - const result: any = {}; - if (value.channelId !== undefined) result.channelId = tsValueToJsonValueFns.string(value.channelId); - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - return result; -} - -export function decodeJson(value: any): $.youtube.LiveMessageParams.Params.Ids { - const result = getDefaultValue(); - if (value.channelId !== undefined) result.channelId = jsonValueToTsValueFns.string(value.channelId); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - return result; -} - -export function encodeBinary(value: $.youtube.LiveMessageParams.Params.Ids): Uint8Array { - const result: WireMessage = []; - if (value.channelId !== undefined) { - const tsValue = value.channelId; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.LiveMessageParams.Params.Ids { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.channelId = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(LiveMessageParams)/(Params)/index.ts b/src/proto/generated/messages/youtube/(LiveMessageParams)/(Params)/index.ts deleted file mode 100644 index 1f60fdfa3b..0000000000 --- a/src/proto/generated/messages/youtube/(LiveMessageParams)/(Params)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Ids } from "./Ids.js"; diff --git a/src/proto/generated/messages/youtube/(LiveMessageParams)/Params.ts b/src/proto/generated/messages/youtube/(LiveMessageParams)/Params.ts deleted file mode 100644 index 68f69504e8..0000000000 --- a/src/proto/generated/messages/youtube/(LiveMessageParams)/Params.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Ids, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Params)/Ids.js"; -import { - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.LiveMessageParams { - export type Params = { - ids?: Ids; - } -} - -export type Type = $.youtube.LiveMessageParams.Params; - -export function getDefaultValue(): $.youtube.LiveMessageParams.Params { - return { - ids: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.LiveMessageParams.Params>): $.youtube.LiveMessageParams.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.LiveMessageParams.Params): unknown { - const result: any = {}; - if (value.ids !== undefined) result.ids = encodeJson_1(value.ids); - return result; -} - -export function decodeJson(value: any): $.youtube.LiveMessageParams.Params { - const result = getDefaultValue(); - if (value.ids !== undefined) result.ids = decodeJson_1(value.ids); - return result; -} - -export function encodeBinary(value: $.youtube.LiveMessageParams.Params): Uint8Array { - const result: WireMessage = []; - if (value.ids !== undefined) { - const tsValue = value.ids; - result.push( - [5, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.LiveMessageParams.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.ids = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(LiveMessageParams)/index.ts b/src/proto/generated/messages/youtube/(LiveMessageParams)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(LiveMessageParams)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(MusicSearchFilter)/(Filters)/Type.ts b/src/proto/generated/messages/youtube/(MusicSearchFilter)/(Filters)/Type.ts deleted file mode 100644 index 90c6c51bfe..0000000000 --- a/src/proto/generated/messages/youtube/(MusicSearchFilter)/(Filters)/Type.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.MusicSearchFilter.Filters { - export type Type = { - song?: number; - video?: number; - album?: number; - artist?: number; - playlist?: number; - } -} - -export type Type = $.youtube.MusicSearchFilter.Filters.Type; - -export function getDefaultValue(): $.youtube.MusicSearchFilter.Filters.Type { - return { - song: undefined, - video: undefined, - album: undefined, - artist: undefined, - playlist: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.MusicSearchFilter.Filters.Type>): $.youtube.MusicSearchFilter.Filters.Type { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.MusicSearchFilter.Filters.Type): unknown { - const result: any = {}; - if (value.song !== undefined) result.song = tsValueToJsonValueFns.int32(value.song); - if (value.video !== undefined) result.video = tsValueToJsonValueFns.int32(value.video); - if (value.album !== undefined) result.album = tsValueToJsonValueFns.int32(value.album); - if (value.artist !== undefined) result.artist = tsValueToJsonValueFns.int32(value.artist); - if (value.playlist !== undefined) result.playlist = tsValueToJsonValueFns.int32(value.playlist); - return result; -} - -export function decodeJson(value: any): $.youtube.MusicSearchFilter.Filters.Type { - const result = getDefaultValue(); - if (value.song !== undefined) result.song = jsonValueToTsValueFns.int32(value.song); - if (value.video !== undefined) result.video = jsonValueToTsValueFns.int32(value.video); - if (value.album !== undefined) result.album = jsonValueToTsValueFns.int32(value.album); - if (value.artist !== undefined) result.artist = jsonValueToTsValueFns.int32(value.artist); - if (value.playlist !== undefined) result.playlist = jsonValueToTsValueFns.int32(value.playlist); - return result; -} - -export function encodeBinary(value: $.youtube.MusicSearchFilter.Filters.Type): Uint8Array { - const result: WireMessage = []; - if (value.song !== undefined) { - const tsValue = value.song; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.video !== undefined) { - const tsValue = value.video; - result.push( - [2, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.album !== undefined) { - const tsValue = value.album; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.artist !== undefined) { - const tsValue = value.artist; - result.push( - [4, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.playlist !== undefined) { - const tsValue = value.playlist; - result.push( - [5, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.MusicSearchFilter.Filters.Type { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.song = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.video = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.album = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.artist = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.playlist = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(MusicSearchFilter)/(Filters)/index.ts b/src/proto/generated/messages/youtube/(MusicSearchFilter)/(Filters)/index.ts deleted file mode 100644 index a77f865abf..0000000000 --- a/src/proto/generated/messages/youtube/(MusicSearchFilter)/(Filters)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Type } from "./Type.js"; diff --git a/src/proto/generated/messages/youtube/(MusicSearchFilter)/Filters.ts b/src/proto/generated/messages/youtube/(MusicSearchFilter)/Filters.ts deleted file mode 100644 index 5b0d030a2b..0000000000 --- a/src/proto/generated/messages/youtube/(MusicSearchFilter)/Filters.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Type_1, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Filters)/Type.js"; -import { - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.MusicSearchFilter { - export type Filters = { - type?: Type_1; - } -} - -export type Type = $.youtube.MusicSearchFilter.Filters; - -export function getDefaultValue(): $.youtube.MusicSearchFilter.Filters { - return { - type: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.MusicSearchFilter.Filters>): $.youtube.MusicSearchFilter.Filters { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.MusicSearchFilter.Filters): unknown { - const result: any = {}; - if (value.type !== undefined) result.type = encodeJson_1(value.type); - return result; -} - -export function decodeJson(value: any): $.youtube.MusicSearchFilter.Filters { - const result = getDefaultValue(); - if (value.type !== undefined) result.type = decodeJson_1(value.type); - return result; -} - -export function encodeBinary(value: $.youtube.MusicSearchFilter.Filters): Uint8Array { - const result: WireMessage = []; - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [17, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.MusicSearchFilter.Filters { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(17); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.type = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(MusicSearchFilter)/index.ts b/src/proto/generated/messages/youtube/(MusicSearchFilter)/index.ts deleted file mode 100644 index a4dbe22a40..0000000000 --- a/src/proto/generated/messages/youtube/(MusicSearchFilter)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Filters } from "./Filters.js"; diff --git a/src/proto/generated/messages/youtube/(NotificationPreferences)/Preference.ts b/src/proto/generated/messages/youtube/(NotificationPreferences)/Preference.ts deleted file mode 100644 index f91b0db0af..0000000000 --- a/src/proto/generated/messages/youtube/(NotificationPreferences)/Preference.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.NotificationPreferences { - export type Preference = { - index: number; - } -} - -export type Type = $.youtube.NotificationPreferences.Preference; - -export function getDefaultValue(): $.youtube.NotificationPreferences.Preference { - return { - index: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.NotificationPreferences.Preference>): $.youtube.NotificationPreferences.Preference { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.NotificationPreferences.Preference): unknown { - const result: any = {}; - if (value.index !== undefined) result.index = tsValueToJsonValueFns.int32(value.index); - return result; -} - -export function decodeJson(value: any): $.youtube.NotificationPreferences.Preference { - const result = getDefaultValue(); - if (value.index !== undefined) result.index = jsonValueToTsValueFns.int32(value.index); - return result; -} - -export function encodeBinary(value: $.youtube.NotificationPreferences.Preference): Uint8Array { - const result: WireMessage = []; - if (value.index !== undefined) { - const tsValue = value.index; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.NotificationPreferences.Preference { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.index = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(NotificationPreferences)/index.ts b/src/proto/generated/messages/youtube/(NotificationPreferences)/index.ts deleted file mode 100644 index 1d87290833..0000000000 --- a/src/proto/generated/messages/youtube/(NotificationPreferences)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Preference } from "./Preference.js"; diff --git a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/(Params)/Comment.ts b/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/(Params)/Comment.ts deleted file mode 100644 index 21b0d22f9b..0000000000 --- a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/(Params)/Comment.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.PeformCommentActionParams.TranslateCommentParams.Params { - export type Comment = { - text: string; - } -} - -export type Type = $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment; - -export function getDefaultValue(): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment { - return { - text: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment>): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment): unknown { - const result: any = {}; - if (value.text !== undefined) result.text = tsValueToJsonValueFns.string(value.text); - return result; -} - -export function decodeJson(value: any): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment { - const result = getDefaultValue(); - if (value.text !== undefined) result.text = jsonValueToTsValueFns.string(value.text); - return result; -} - -export function encodeBinary(value: $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment): Uint8Array { - const result: WireMessage = []; - if (value.text !== undefined) { - const tsValue = value.text; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params.Comment { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.text = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/(Params)/index.ts b/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/(Params)/index.ts deleted file mode 100644 index ebfd0194b1..0000000000 --- a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/(Params)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Comment } from "./Comment.js"; diff --git a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/Params.ts b/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/Params.ts deleted file mode 100644 index 87c62bdf12..0000000000 --- a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/Params.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Comment, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Params)/Comment.js"; -import { - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.PeformCommentActionParams.TranslateCommentParams { - export type Params = { - comment?: Comment; - } -} - -export type Type = $.youtube.PeformCommentActionParams.TranslateCommentParams.Params; - -export function getDefaultValue(): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params { - return { - comment: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.PeformCommentActionParams.TranslateCommentParams.Params>): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.PeformCommentActionParams.TranslateCommentParams.Params): unknown { - const result: any = {}; - if (value.comment !== undefined) result.comment = encodeJson_1(value.comment); - return result; -} - -export function decodeJson(value: any): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params { - const result = getDefaultValue(); - if (value.comment !== undefined) result.comment = decodeJson_1(value.comment); - return result; -} - -export function encodeBinary(value: $.youtube.PeformCommentActionParams.TranslateCommentParams.Params): Uint8Array { - const result: WireMessage = []; - if (value.comment !== undefined) { - const tsValue = value.comment; - result.push( - [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.PeformCommentActionParams.TranslateCommentParams.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.comment = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/index.ts b/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/(TranslateCommentParams)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/TranslateCommentParams.ts b/src/proto/generated/messages/youtube/(PeformCommentActionParams)/TranslateCommentParams.ts deleted file mode 100644 index f06054eb80..0000000000 --- a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/TranslateCommentParams.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(TranslateCommentParams)/Params.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.PeformCommentActionParams { - export type TranslateCommentParams = { - commentId: string; - params?: Params; - targetLanguage: string; - } -} - -export type Type = $.youtube.PeformCommentActionParams.TranslateCommentParams; - -export function getDefaultValue(): $.youtube.PeformCommentActionParams.TranslateCommentParams { - return { - commentId: "", - params: undefined, - targetLanguage: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.PeformCommentActionParams.TranslateCommentParams>): $.youtube.PeformCommentActionParams.TranslateCommentParams { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.PeformCommentActionParams.TranslateCommentParams): unknown { - const result: any = {}; - if (value.commentId !== undefined) result.commentId = tsValueToJsonValueFns.string(value.commentId); - if (value.params !== undefined) result.params = encodeJson_1(value.params); - if (value.targetLanguage !== undefined) result.targetLanguage = tsValueToJsonValueFns.string(value.targetLanguage); - return result; -} - -export function decodeJson(value: any): $.youtube.PeformCommentActionParams.TranslateCommentParams { - const result = getDefaultValue(); - if (value.commentId !== undefined) result.commentId = jsonValueToTsValueFns.string(value.commentId); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - if (value.targetLanguage !== undefined) result.targetLanguage = jsonValueToTsValueFns.string(value.targetLanguage); - return result; -} - -export function encodeBinary(value: $.youtube.PeformCommentActionParams.TranslateCommentParams): Uint8Array { - const result: WireMessage = []; - if (value.commentId !== undefined) { - const tsValue = value.commentId; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [3, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.targetLanguage !== undefined) { - const tsValue = value.targetLanguage; - result.push( - [4, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.PeformCommentActionParams.TranslateCommentParams { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.commentId = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.targetLanguage = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/index.ts b/src/proto/generated/messages/youtube/(PeformCommentActionParams)/index.ts deleted file mode 100644 index 14f838f070..0000000000 --- a/src/proto/generated/messages/youtube/(PeformCommentActionParams)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as TranslateCommentParams } from "./TranslateCommentParams.js"; diff --git a/src/proto/generated/messages/youtube/(ReelSequence)/Params.ts b/src/proto/generated/messages/youtube/(ReelSequence)/Params.ts deleted file mode 100644 index 12630edebe..0000000000 --- a/src/proto/generated/messages/youtube/(ReelSequence)/Params.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.ReelSequence { - export type Params = { - number: number; - } -} - -export type Type = $.youtube.ReelSequence.Params; - -export function getDefaultValue(): $.youtube.ReelSequence.Params { - return { - number: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.ReelSequence.Params>): $.youtube.ReelSequence.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.ReelSequence.Params): unknown { - const result: any = {}; - if (value.number !== undefined) result.number = tsValueToJsonValueFns.int32(value.number); - return result; -} - -export function decodeJson(value: any): $.youtube.ReelSequence.Params { - const result = getDefaultValue(); - if (value.number !== undefined) result.number = jsonValueToTsValueFns.int32(value.number); - return result; -} - -export function encodeBinary(value: $.youtube.ReelSequence.Params): Uint8Array { - const result: WireMessage = []; - if (value.number !== undefined) { - const tsValue = value.number; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.ReelSequence.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.number = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(ReelSequence)/index.ts b/src/proto/generated/messages/youtube/(ReelSequence)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(ReelSequence)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(SearchFilter)/Filters.ts b/src/proto/generated/messages/youtube/(SearchFilter)/Filters.ts deleted file mode 100644 index a537ebc447..0000000000 --- a/src/proto/generated/messages/youtube/(SearchFilter)/Filters.ts +++ /dev/null @@ -1,296 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.SearchFilter { - export type Filters = { - uploadDate?: number; - type?: number; - duration?: number; - featuresHd?: number; - featuresSubtitles?: number; - featuresCreativeCommons?: number; - features3d?: number; - featuresLive?: number; - featuresPurchased?: number; - features4k?: number; - features360?: number; - featuresLocation?: number; - featuresHdr?: number; - featuresVr180?: number; - } -} - -export type Type = $.youtube.SearchFilter.Filters; - -export function getDefaultValue(): $.youtube.SearchFilter.Filters { - return { - uploadDate: undefined, - type: undefined, - duration: undefined, - featuresHd: undefined, - featuresSubtitles: undefined, - featuresCreativeCommons: undefined, - features3d: undefined, - featuresLive: undefined, - featuresPurchased: undefined, - features4k: undefined, - features360: undefined, - featuresLocation: undefined, - featuresHdr: undefined, - featuresVr180: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.SearchFilter.Filters>): $.youtube.SearchFilter.Filters { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.SearchFilter.Filters): unknown { - const result: any = {}; - if (value.uploadDate !== undefined) result.uploadDate = tsValueToJsonValueFns.int32(value.uploadDate); - if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); - if (value.duration !== undefined) result.duration = tsValueToJsonValueFns.int32(value.duration); - if (value.featuresHd !== undefined) result.featuresHd = tsValueToJsonValueFns.int32(value.featuresHd); - if (value.featuresSubtitles !== undefined) result.featuresSubtitles = tsValueToJsonValueFns.int32(value.featuresSubtitles); - if (value.featuresCreativeCommons !== undefined) result.featuresCreativeCommons = tsValueToJsonValueFns.int32(value.featuresCreativeCommons); - if (value.features3d !== undefined) result.features3d = tsValueToJsonValueFns.int32(value.features3d); - if (value.featuresLive !== undefined) result.featuresLive = tsValueToJsonValueFns.int32(value.featuresLive); - if (value.featuresPurchased !== undefined) result.featuresPurchased = tsValueToJsonValueFns.int32(value.featuresPurchased); - if (value.features4k !== undefined) result.features4k = tsValueToJsonValueFns.int32(value.features4k); - if (value.features360 !== undefined) result.features360 = tsValueToJsonValueFns.int32(value.features360); - if (value.featuresLocation !== undefined) result.featuresLocation = tsValueToJsonValueFns.int32(value.featuresLocation); - if (value.featuresHdr !== undefined) result.featuresHdr = tsValueToJsonValueFns.int32(value.featuresHdr); - if (value.featuresVr180 !== undefined) result.featuresVr180 = tsValueToJsonValueFns.int32(value.featuresVr180); - return result; -} - -export function decodeJson(value: any): $.youtube.SearchFilter.Filters { - const result = getDefaultValue(); - if (value.uploadDate !== undefined) result.uploadDate = jsonValueToTsValueFns.int32(value.uploadDate); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); - if (value.duration !== undefined) result.duration = jsonValueToTsValueFns.int32(value.duration); - if (value.featuresHd !== undefined) result.featuresHd = jsonValueToTsValueFns.int32(value.featuresHd); - if (value.featuresSubtitles !== undefined) result.featuresSubtitles = jsonValueToTsValueFns.int32(value.featuresSubtitles); - if (value.featuresCreativeCommons !== undefined) result.featuresCreativeCommons = jsonValueToTsValueFns.int32(value.featuresCreativeCommons); - if (value.features3d !== undefined) result.features3d = jsonValueToTsValueFns.int32(value.features3d); - if (value.featuresLive !== undefined) result.featuresLive = jsonValueToTsValueFns.int32(value.featuresLive); - if (value.featuresPurchased !== undefined) result.featuresPurchased = jsonValueToTsValueFns.int32(value.featuresPurchased); - if (value.features4k !== undefined) result.features4k = jsonValueToTsValueFns.int32(value.features4k); - if (value.features360 !== undefined) result.features360 = jsonValueToTsValueFns.int32(value.features360); - if (value.featuresLocation !== undefined) result.featuresLocation = jsonValueToTsValueFns.int32(value.featuresLocation); - if (value.featuresHdr !== undefined) result.featuresHdr = jsonValueToTsValueFns.int32(value.featuresHdr); - if (value.featuresVr180 !== undefined) result.featuresVr180 = jsonValueToTsValueFns.int32(value.featuresVr180); - return result; -} - -export function encodeBinary(value: $.youtube.SearchFilter.Filters): Uint8Array { - const result: WireMessage = []; - if (value.uploadDate !== undefined) { - const tsValue = value.uploadDate; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [2, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.duration !== undefined) { - const tsValue = value.duration; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresHd !== undefined) { - const tsValue = value.featuresHd; - result.push( - [4, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresSubtitles !== undefined) { - const tsValue = value.featuresSubtitles; - result.push( - [5, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresCreativeCommons !== undefined) { - const tsValue = value.featuresCreativeCommons; - result.push( - [6, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.features3d !== undefined) { - const tsValue = value.features3d; - result.push( - [7, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresLive !== undefined) { - const tsValue = value.featuresLive; - result.push( - [8, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresPurchased !== undefined) { - const tsValue = value.featuresPurchased; - result.push( - [9, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.features4k !== undefined) { - const tsValue = value.features4k; - result.push( - [14, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.features360 !== undefined) { - const tsValue = value.features360; - result.push( - [15, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresLocation !== undefined) { - const tsValue = value.featuresLocation; - result.push( - [23, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresHdr !== undefined) { - const tsValue = value.featuresHdr; - result.push( - [25, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.featuresVr180 !== undefined) { - const tsValue = value.featuresVr180; - result.push( - [26, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.SearchFilter.Filters { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.uploadDate = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.type = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.duration = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresHd = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresSubtitles = value; - } - field: { - const wireValue = wireFields.get(6); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresCreativeCommons = value; - } - field: { - const wireValue = wireFields.get(7); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.features3d = value; - } - field: { - const wireValue = wireFields.get(8); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresLive = value; - } - field: { - const wireValue = wireFields.get(9); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresPurchased = value; - } - field: { - const wireValue = wireFields.get(14); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.features4k = value; - } - field: { - const wireValue = wireFields.get(15); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.features360 = value; - } - field: { - const wireValue = wireFields.get(23); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresLocation = value; - } - field: { - const wireValue = wireFields.get(25); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresHdr = value; - } - field: { - const wireValue = wireFields.get(26); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.featuresVr180 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(SearchFilter)/index.ts b/src/proto/generated/messages/youtube/(SearchFilter)/index.ts deleted file mode 100644 index a4dbe22a40..0000000000 --- a/src/proto/generated/messages/youtube/(SearchFilter)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Filters } from "./Filters.js"; diff --git a/src/proto/generated/messages/youtube/(ShortsParam)/Field1.ts b/src/proto/generated/messages/youtube/(ShortsParam)/Field1.ts deleted file mode 100644 index 9a687f2cb5..0000000000 --- a/src/proto/generated/messages/youtube/(ShortsParam)/Field1.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.ShortsParam { - export type Field1 = { - p1: number; - } -} - -export type Type = $.youtube.ShortsParam.Field1; - -export function getDefaultValue(): $.youtube.ShortsParam.Field1 { - return { - p1: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.ShortsParam.Field1>): $.youtube.ShortsParam.Field1 { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.ShortsParam.Field1): unknown { - const result: any = {}; - if (value.p1 !== undefined) result.p1 = tsValueToJsonValueFns.int32(value.p1); - return result; -} - -export function decodeJson(value: any): $.youtube.ShortsParam.Field1 { - const result = getDefaultValue(); - if (value.p1 !== undefined) result.p1 = jsonValueToTsValueFns.int32(value.p1); - return result; -} - -export function encodeBinary(value: $.youtube.ShortsParam.Field1): Uint8Array { - const result: WireMessage = []; - if (value.p1 !== undefined) { - const tsValue = value.p1; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.ShortsParam.Field1 { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.p1 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(ShortsParam)/index.ts b/src/proto/generated/messages/youtube/(ShortsParam)/index.ts deleted file mode 100644 index 9091623bd8..0000000000 --- a/src/proto/generated/messages/youtube/(ShortsParam)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Field1 } from "./Field1.js"; diff --git a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/(Params)/Ids.ts b/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/(Params)/Ids.ts deleted file mode 100644 index 01dfd573ea..0000000000 --- a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/(Params)/Ids.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../../../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../../../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.SoundInfoParams.Sound.Params { - export type Ids = { - id1: string; - id2: string; - id3: string; - } -} - -export type Type = $.youtube.SoundInfoParams.Sound.Params.Ids; - -export function getDefaultValue(): $.youtube.SoundInfoParams.Sound.Params.Ids { - return { - id1: "", - id2: "", - id3: "", - }; -} - -export function createValue(partialValue: Partial<$.youtube.SoundInfoParams.Sound.Params.Ids>): $.youtube.SoundInfoParams.Sound.Params.Ids { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.SoundInfoParams.Sound.Params.Ids): unknown { - const result: any = {}; - if (value.id1 !== undefined) result.id1 = tsValueToJsonValueFns.string(value.id1); - if (value.id2 !== undefined) result.id2 = tsValueToJsonValueFns.string(value.id2); - if (value.id3 !== undefined) result.id3 = tsValueToJsonValueFns.string(value.id3); - return result; -} - -export function decodeJson(value: any): $.youtube.SoundInfoParams.Sound.Params.Ids { - const result = getDefaultValue(); - if (value.id1 !== undefined) result.id1 = jsonValueToTsValueFns.string(value.id1); - if (value.id2 !== undefined) result.id2 = jsonValueToTsValueFns.string(value.id2); - if (value.id3 !== undefined) result.id3 = jsonValueToTsValueFns.string(value.id3); - return result; -} - -export function encodeBinary(value: $.youtube.SoundInfoParams.Sound.Params.Ids): Uint8Array { - const result: WireMessage = []; - if (value.id1 !== undefined) { - const tsValue = value.id1; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.id2 !== undefined) { - const tsValue = value.id2; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.id3 !== undefined) { - const tsValue = value.id3; - result.push( - [3, tsValueToWireValueFns.string(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.SoundInfoParams.Sound.Params.Ids { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.id1 = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.id2 = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.id3 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/(Params)/index.ts b/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/(Params)/index.ts deleted file mode 100644 index 1f60fdfa3b..0000000000 --- a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/(Params)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Ids } from "./Ids.js"; diff --git a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/Params.ts b/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/Params.ts deleted file mode 100644 index c69425cf34..0000000000 --- a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/Params.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Ids, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Params)/Ids.js"; -import { - jsonValueToTsValueFns, -} from "../../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.SoundInfoParams.Sound { - export type Params = { - ids?: Ids; - } -} - -export type Type = $.youtube.SoundInfoParams.Sound.Params; - -export function getDefaultValue(): $.youtube.SoundInfoParams.Sound.Params { - return { - ids: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.SoundInfoParams.Sound.Params>): $.youtube.SoundInfoParams.Sound.Params { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.SoundInfoParams.Sound.Params): unknown { - const result: any = {}; - if (value.ids !== undefined) result.ids = encodeJson_1(value.ids); - return result; -} - -export function decodeJson(value: any): $.youtube.SoundInfoParams.Sound.Params { - const result = getDefaultValue(); - if (value.ids !== undefined) result.ids = decodeJson_1(value.ids); - return result; -} - -export function encodeBinary(value: $.youtube.SoundInfoParams.Sound.Params): Uint8Array { - const result: WireMessage = []; - if (value.ids !== undefined) { - const tsValue = value.ids; - result.push( - [2, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.SoundInfoParams.Sound.Params { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.ids = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/index.ts b/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/index.ts deleted file mode 100644 index fdd997fd6e..0000000000 --- a/src/proto/generated/messages/youtube/(SoundInfoParams)/(Sound)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Params } from "./Params.js"; diff --git a/src/proto/generated/messages/youtube/(SoundInfoParams)/Sound.ts b/src/proto/generated/messages/youtube/(SoundInfoParams)/Sound.ts deleted file mode 100644 index 62bc9467ad..0000000000 --- a/src/proto/generated/messages/youtube/(SoundInfoParams)/Sound.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Sound)/Params.js"; -import { - jsonValueToTsValueFns, -} from "../../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube.SoundInfoParams { - export type Sound = { - params?: Params; - } -} - -export type Type = $.youtube.SoundInfoParams.Sound; - -export function getDefaultValue(): $.youtube.SoundInfoParams.Sound { - return { - params: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.SoundInfoParams.Sound>): $.youtube.SoundInfoParams.Sound { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.SoundInfoParams.Sound): unknown { - const result: any = {}; - if (value.params !== undefined) result.params = encodeJson_1(value.params); - return result; -} - -export function decodeJson(value: any): $.youtube.SoundInfoParams.Sound { - const result = getDefaultValue(); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - return result; -} - -export function encodeBinary(value: $.youtube.SoundInfoParams.Sound): Uint8Array { - const result: WireMessage = []; - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.SoundInfoParams.Sound { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/(SoundInfoParams)/index.ts b/src/proto/generated/messages/youtube/(SoundInfoParams)/index.ts deleted file mode 100644 index 54bd84a13c..0000000000 --- a/src/proto/generated/messages/youtube/(SoundInfoParams)/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { Type as Sound } from "./Sound.js"; diff --git a/src/proto/generated/messages/youtube/ChannelAnalytics.ts b/src/proto/generated/messages/youtube/ChannelAnalytics.ts deleted file mode 100644 index 8824580311..0000000000 --- a/src/proto/generated/messages/youtube/ChannelAnalytics.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(ChannelAnalytics)/Params.js"; -import { - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type ChannelAnalytics = { - params?: Params; - } -} - -export type Type = $.youtube.ChannelAnalytics; - -export function getDefaultValue(): $.youtube.ChannelAnalytics { - return { - params: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.ChannelAnalytics>): $.youtube.ChannelAnalytics { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.ChannelAnalytics): unknown { - const result: any = {}; - if (value.params !== undefined) result.params = encodeJson_1(value.params); - return result; -} - -export function decodeJson(value: any): $.youtube.ChannelAnalytics { - const result = getDefaultValue(); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - return result; -} - -export function encodeBinary(value: $.youtube.ChannelAnalytics): Uint8Array { - const result: WireMessage = []; - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [32, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.ChannelAnalytics { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(32); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/CreateCommentParams.ts b/src/proto/generated/messages/youtube/CreateCommentParams.ts deleted file mode 100644 index 7678940cfc..0000000000 --- a/src/proto/generated/messages/youtube/CreateCommentParams.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(CreateCommentParams)/Params.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type CreateCommentParams = { - videoId: string; - params?: Params; - number: number; - } -} - -export type Type = $.youtube.CreateCommentParams; - -export function getDefaultValue(): $.youtube.CreateCommentParams { - return { - videoId: "", - params: undefined, - number: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.CreateCommentParams>): $.youtube.CreateCommentParams { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.CreateCommentParams): unknown { - const result: any = {}; - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - if (value.params !== undefined) result.params = encodeJson_1(value.params); - if (value.number !== undefined) result.number = tsValueToJsonValueFns.int32(value.number); - return result; -} - -export function decodeJson(value: any): $.youtube.CreateCommentParams { - const result = getDefaultValue(); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - if (value.number !== undefined) result.number = jsonValueToTsValueFns.int32(value.number); - return result; -} - -export function encodeBinary(value: $.youtube.CreateCommentParams): Uint8Array { - const result: WireMessage = []; - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [5, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.number !== undefined) { - const tsValue = value.number; - result.push( - [10, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.CreateCommentParams { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - field: { - const wireValue = wireFields.get(10); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.number = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/GetCommentsSectionParams.ts b/src/proto/generated/messages/youtube/GetCommentsSectionParams.ts deleted file mode 100644 index b4f8c43191..0000000000 --- a/src/proto/generated/messages/youtube/GetCommentsSectionParams.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { - Type as Context, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(GetCommentsSectionParams)/Context.js"; -import { - Type as Params, - encodeJson as encodeJson_2, - decodeJson as decodeJson_2, - encodeBinary as encodeBinary_2, - decodeBinary as decodeBinary_2, -} from "./(GetCommentsSectionParams)/Params.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type GetCommentsSectionParams = { - ctx?: Context; - unkParam: number; - params?: Params; - } -} - -export type Type = $.youtube.GetCommentsSectionParams; - -export function getDefaultValue(): $.youtube.GetCommentsSectionParams { - return { - ctx: undefined, - unkParam: 0, - params: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.GetCommentsSectionParams>): $.youtube.GetCommentsSectionParams { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.GetCommentsSectionParams): unknown { - const result: any = {}; - if (value.ctx !== undefined) result.ctx = encodeJson_1(value.ctx); - if (value.unkParam !== undefined) result.unkParam = tsValueToJsonValueFns.int32(value.unkParam); - if (value.params !== undefined) result.params = encodeJson_2(value.params); - return result; -} - -export function decodeJson(value: any): $.youtube.GetCommentsSectionParams { - const result = getDefaultValue(); - if (value.ctx !== undefined) result.ctx = decodeJson_1(value.ctx); - if (value.unkParam !== undefined) result.unkParam = jsonValueToTsValueFns.int32(value.unkParam); - if (value.params !== undefined) result.params = decodeJson_2(value.params); - return result; -} - -export function encodeBinary(value: $.youtube.GetCommentsSectionParams): Uint8Array { - const result: WireMessage = []; - if (value.ctx !== undefined) { - const tsValue = value.ctx; - result.push( - [2, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.unkParam !== undefined) { - const tsValue = value.unkParam; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [6, { type: WireType.LengthDelimited as const, value: encodeBinary_2(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.GetCommentsSectionParams { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.ctx = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkParam = value; - } - field: { - const wireValue = wireFields.get(6); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_2(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/Hashtag.ts b/src/proto/generated/messages/youtube/Hashtag.ts deleted file mode 100644 index 81dbafd211..0000000000 --- a/src/proto/generated/messages/youtube/Hashtag.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(Hashtag)/Params.js"; -import { - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type Hashtag = { - params?: Params; - } -} - -export type Type = $.youtube.Hashtag; - -export function getDefaultValue(): $.youtube.Hashtag { - return { - params: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.Hashtag>): $.youtube.Hashtag { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.Hashtag): unknown { - const result: any = {}; - if (value.params !== undefined) result.params = encodeJson_1(value.params); - return result; -} - -export function decodeJson(value: any): $.youtube.Hashtag { - const result = getDefaultValue(); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - return result; -} - -export function encodeBinary(value: $.youtube.Hashtag): Uint8Array { - const result: WireMessage = []; - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [93, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.Hashtag { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(93); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/InnertubePayload.ts b/src/proto/generated/messages/youtube/InnertubePayload.ts deleted file mode 100644 index 3097e243a4..0000000000 --- a/src/proto/generated/messages/youtube/InnertubePayload.ts +++ /dev/null @@ -1,316 +0,0 @@ -import { - Type as Context, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(InnertubePayload)/Context.js"; -import { - Type as Title, - encodeJson as encodeJson_2, - decodeJson as decodeJson_2, - encodeBinary as encodeBinary_2, - decodeBinary as decodeBinary_2, -} from "./(InnertubePayload)/Title.js"; -import { - Type as Description, - encodeJson as encodeJson_3, - decodeJson as decodeJson_3, - encodeBinary as encodeBinary_3, - decodeBinary as decodeBinary_3, -} from "./(InnertubePayload)/Description.js"; -import { - Type as Tags, - encodeJson as encodeJson_4, - decodeJson as decodeJson_4, - encodeBinary as encodeBinary_4, - decodeBinary as decodeBinary_4, -} from "./(InnertubePayload)/Tags.js"; -import { - Type as Category, - encodeJson as encodeJson_5, - decodeJson as decodeJson_5, - encodeBinary as encodeBinary_5, - decodeBinary as decodeBinary_5, -} from "./(InnertubePayload)/Category.js"; -import { - Type as License, - encodeJson as encodeJson_6, - decodeJson as decodeJson_6, - encodeBinary as encodeBinary_6, - decodeBinary as decodeBinary_6, -} from "./(InnertubePayload)/License.js"; -import { - Type as VideoThumbnail, - encodeJson as encodeJson_7, - decodeJson as decodeJson_7, - encodeBinary as encodeBinary_7, - decodeBinary as decodeBinary_7, -} from "./(InnertubePayload)/VideoThumbnail.js"; -import { - Type as Privacy, - encodeJson as encodeJson_8, - decodeJson as decodeJson_8, - encodeBinary as encodeBinary_8, - decodeBinary as decodeBinary_8, -} from "./(InnertubePayload)/Privacy.js"; -import { - Type as MadeForKids, - encodeJson as encodeJson_9, - decodeJson as decodeJson_9, - encodeBinary as encodeBinary_9, - decodeBinary as decodeBinary_9, -} from "./(InnertubePayload)/MadeForKids.js"; -import { - Type as AgeRestricted, - encodeJson as encodeJson_10, - decodeJson as decodeJson_10, - encodeBinary as encodeBinary_10, - decodeBinary as decodeBinary_10, -} from "./(InnertubePayload)/AgeRestricted.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type InnertubePayload = { - context?: Context; - videoId?: string; - title?: Title; - description?: Description; - tags?: Tags; - category?: Category; - license?: License; - videoThumbnail?: VideoThumbnail; - privacy?: Privacy; - madeForKids?: MadeForKids; - ageRestricted?: AgeRestricted; - } -} - -export type Type = $.youtube.InnertubePayload; - -export function getDefaultValue(): $.youtube.InnertubePayload { - return { - context: undefined, - videoId: undefined, - title: undefined, - description: undefined, - tags: undefined, - category: undefined, - license: undefined, - videoThumbnail: undefined, - privacy: undefined, - madeForKids: undefined, - ageRestricted: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.InnertubePayload>): $.youtube.InnertubePayload { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.InnertubePayload): unknown { - const result: any = {}; - if (value.context !== undefined) result.context = encodeJson_1(value.context); - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - if (value.title !== undefined) result.title = encodeJson_2(value.title); - if (value.description !== undefined) result.description = encodeJson_3(value.description); - if (value.tags !== undefined) result.tags = encodeJson_4(value.tags); - if (value.category !== undefined) result.category = encodeJson_5(value.category); - if (value.license !== undefined) result.license = encodeJson_6(value.license); - if (value.videoThumbnail !== undefined) result.videoThumbnail = encodeJson_7(value.videoThumbnail); - if (value.privacy !== undefined) result.privacy = encodeJson_8(value.privacy); - if (value.madeForKids !== undefined) result.madeForKids = encodeJson_9(value.madeForKids); - if (value.ageRestricted !== undefined) result.ageRestricted = encodeJson_10(value.ageRestricted); - return result; -} - -export function decodeJson(value: any): $.youtube.InnertubePayload { - const result = getDefaultValue(); - if (value.context !== undefined) result.context = decodeJson_1(value.context); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - if (value.title !== undefined) result.title = decodeJson_2(value.title); - if (value.description !== undefined) result.description = decodeJson_3(value.description); - if (value.tags !== undefined) result.tags = decodeJson_4(value.tags); - if (value.category !== undefined) result.category = decodeJson_5(value.category); - if (value.license !== undefined) result.license = decodeJson_6(value.license); - if (value.videoThumbnail !== undefined) result.videoThumbnail = decodeJson_7(value.videoThumbnail); - if (value.privacy !== undefined) result.privacy = decodeJson_8(value.privacy); - if (value.madeForKids !== undefined) result.madeForKids = decodeJson_9(value.madeForKids); - if (value.ageRestricted !== undefined) result.ageRestricted = decodeJson_10(value.ageRestricted); - return result; -} - -export function encodeBinary(value: $.youtube.InnertubePayload): Uint8Array { - const result: WireMessage = []; - if (value.context !== undefined) { - const tsValue = value.context; - result.push( - [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [2, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.title !== undefined) { - const tsValue = value.title; - result.push( - [3, { type: WireType.LengthDelimited as const, value: encodeBinary_2(tsValue) }], - ); - } - if (value.description !== undefined) { - const tsValue = value.description; - result.push( - [4, { type: WireType.LengthDelimited as const, value: encodeBinary_3(tsValue) }], - ); - } - if (value.tags !== undefined) { - const tsValue = value.tags; - result.push( - [6, { type: WireType.LengthDelimited as const, value: encodeBinary_4(tsValue) }], - ); - } - if (value.category !== undefined) { - const tsValue = value.category; - result.push( - [7, { type: WireType.LengthDelimited as const, value: encodeBinary_5(tsValue) }], - ); - } - if (value.license !== undefined) { - const tsValue = value.license; - result.push( - [8, { type: WireType.LengthDelimited as const, value: encodeBinary_6(tsValue) }], - ); - } - if (value.videoThumbnail !== undefined) { - const tsValue = value.videoThumbnail; - result.push( - [20, { type: WireType.LengthDelimited as const, value: encodeBinary_7(tsValue) }], - ); - } - if (value.privacy !== undefined) { - const tsValue = value.privacy; - result.push( - [38, { type: WireType.LengthDelimited as const, value: encodeBinary_8(tsValue) }], - ); - } - if (value.madeForKids !== undefined) { - const tsValue = value.madeForKids; - result.push( - [68, { type: WireType.LengthDelimited as const, value: encodeBinary_9(tsValue) }], - ); - } - if (value.ageRestricted !== undefined) { - const tsValue = value.ageRestricted; - result.push( - [69, { type: WireType.LengthDelimited as const, value: encodeBinary_10(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.InnertubePayload { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.context = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_2(wireValue.value) : undefined; - if (value === undefined) break field; - result.title = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_3(wireValue.value) : undefined; - if (value === undefined) break field; - result.description = value; - } - field: { - const wireValue = wireFields.get(6); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_4(wireValue.value) : undefined; - if (value === undefined) break field; - result.tags = value; - } - field: { - const wireValue = wireFields.get(7); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_5(wireValue.value) : undefined; - if (value === undefined) break field; - result.category = value; - } - field: { - const wireValue = wireFields.get(8); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_6(wireValue.value) : undefined; - if (value === undefined) break field; - result.license = value; - } - field: { - const wireValue = wireFields.get(20); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_7(wireValue.value) : undefined; - if (value === undefined) break field; - result.videoThumbnail = value; - } - field: { - const wireValue = wireFields.get(38); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_8(wireValue.value) : undefined; - if (value === undefined) break field; - result.privacy = value; - } - field: { - const wireValue = wireFields.get(68); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_9(wireValue.value) : undefined; - if (value === undefined) break field; - result.madeForKids = value; - } - field: { - const wireValue = wireFields.get(69); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_10(wireValue.value) : undefined; - if (value === undefined) break field; - result.ageRestricted = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/LiveMessageParams.ts b/src/proto/generated/messages/youtube/LiveMessageParams.ts deleted file mode 100644 index 9789fc0889..0000000000 --- a/src/proto/generated/messages/youtube/LiveMessageParams.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(LiveMessageParams)/Params.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type LiveMessageParams = { - params?: Params; - number0?: number; - number1?: number; - } -} - -export type Type = $.youtube.LiveMessageParams; - -export function getDefaultValue(): $.youtube.LiveMessageParams { - return { - params: undefined, - number0: undefined, - number1: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.LiveMessageParams>): $.youtube.LiveMessageParams { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.LiveMessageParams): unknown { - const result: any = {}; - if (value.params !== undefined) result.params = encodeJson_1(value.params); - if (value.number0 !== undefined) result.number0 = tsValueToJsonValueFns.int32(value.number0); - if (value.number1 !== undefined) result.number1 = tsValueToJsonValueFns.int32(value.number1); - return result; -} - -export function decodeJson(value: any): $.youtube.LiveMessageParams { - const result = getDefaultValue(); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - if (value.number0 !== undefined) result.number0 = jsonValueToTsValueFns.int32(value.number0); - if (value.number1 !== undefined) result.number1 = jsonValueToTsValueFns.int32(value.number1); - return result; -} - -export function encodeBinary(value: $.youtube.LiveMessageParams): Uint8Array { - const result: WireMessage = []; - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.number0 !== undefined) { - const tsValue = value.number0; - result.push( - [2, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.number1 !== undefined) { - const tsValue = value.number1; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.LiveMessageParams { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.number0 = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.number1 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/MusicSearchFilter.ts b/src/proto/generated/messages/youtube/MusicSearchFilter.ts deleted file mode 100644 index 710835f1d3..0000000000 --- a/src/proto/generated/messages/youtube/MusicSearchFilter.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Filters, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(MusicSearchFilter)/Filters.js"; -import { - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type MusicSearchFilter = { - filters?: Filters; - } -} - -export type Type = $.youtube.MusicSearchFilter; - -export function getDefaultValue(): $.youtube.MusicSearchFilter { - return { - filters: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.MusicSearchFilter>): $.youtube.MusicSearchFilter { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.MusicSearchFilter): unknown { - const result: any = {}; - if (value.filters !== undefined) result.filters = encodeJson_1(value.filters); - return result; -} - -export function decodeJson(value: any): $.youtube.MusicSearchFilter { - const result = getDefaultValue(); - if (value.filters !== undefined) result.filters = decodeJson_1(value.filters); - return result; -} - -export function encodeBinary(value: $.youtube.MusicSearchFilter): Uint8Array { - const result: WireMessage = []; - if (value.filters !== undefined) { - const tsValue = value.filters; - result.push( - [2, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.MusicSearchFilter { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.filters = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/NotificationPreferences.ts b/src/proto/generated/messages/youtube/NotificationPreferences.ts deleted file mode 100644 index 2d25fc6d99..0000000000 --- a/src/proto/generated/messages/youtube/NotificationPreferences.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { - Type as Preference, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(NotificationPreferences)/Preference.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type NotificationPreferences = { - channelId: string; - prefId?: Preference; - number0?: number; - number1?: number; - } -} - -export type Type = $.youtube.NotificationPreferences; - -export function getDefaultValue(): $.youtube.NotificationPreferences { - return { - channelId: "", - prefId: undefined, - number0: undefined, - number1: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.NotificationPreferences>): $.youtube.NotificationPreferences { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.NotificationPreferences): unknown { - const result: any = {}; - if (value.channelId !== undefined) result.channelId = tsValueToJsonValueFns.string(value.channelId); - if (value.prefId !== undefined) result.prefId = encodeJson_1(value.prefId); - if (value.number0 !== undefined) result.number0 = tsValueToJsonValueFns.int32(value.number0); - if (value.number1 !== undefined) result.number1 = tsValueToJsonValueFns.int32(value.number1); - return result; -} - -export function decodeJson(value: any): $.youtube.NotificationPreferences { - const result = getDefaultValue(); - if (value.channelId !== undefined) result.channelId = jsonValueToTsValueFns.string(value.channelId); - if (value.prefId !== undefined) result.prefId = decodeJson_1(value.prefId); - if (value.number0 !== undefined) result.number0 = jsonValueToTsValueFns.int32(value.number0); - if (value.number1 !== undefined) result.number1 = jsonValueToTsValueFns.int32(value.number1); - return result; -} - -export function encodeBinary(value: $.youtube.NotificationPreferences): Uint8Array { - const result: WireMessage = []; - if (value.channelId !== undefined) { - const tsValue = value.channelId; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.prefId !== undefined) { - const tsValue = value.prefId; - result.push( - [2, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.number0 !== undefined) { - const tsValue = value.number0; - result.push( - [3, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.number1 !== undefined) { - const tsValue = value.number1; - result.push( - [4, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.NotificationPreferences { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.channelId = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.prefId = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.number0 = value; - } - field: { - const wireValue = wireFields.get(4); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.number1 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/PeformCommentActionParams.ts b/src/proto/generated/messages/youtube/PeformCommentActionParams.ts deleted file mode 100644 index 0cfc292393..0000000000 --- a/src/proto/generated/messages/youtube/PeformCommentActionParams.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { - Type as TranslateCommentParams, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(PeformCommentActionParams)/TranslateCommentParams.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type PeformCommentActionParams = { - type: number; - unkNum?: number; - commentId: string; - videoId: string; - channelId?: string; - translateCommentParams?: TranslateCommentParams; - } -} - -export type Type = $.youtube.PeformCommentActionParams; - -export function getDefaultValue(): $.youtube.PeformCommentActionParams { - return { - type: 0, - unkNum: undefined, - commentId: "", - videoId: "", - channelId: undefined, - translateCommentParams: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.PeformCommentActionParams>): $.youtube.PeformCommentActionParams { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.PeformCommentActionParams): unknown { - const result: any = {}; - if (value.type !== undefined) result.type = tsValueToJsonValueFns.int32(value.type); - if (value.unkNum !== undefined) result.unkNum = tsValueToJsonValueFns.int32(value.unkNum); - if (value.commentId !== undefined) result.commentId = tsValueToJsonValueFns.string(value.commentId); - if (value.videoId !== undefined) result.videoId = tsValueToJsonValueFns.string(value.videoId); - if (value.channelId !== undefined) result.channelId = tsValueToJsonValueFns.string(value.channelId); - if (value.translateCommentParams !== undefined) result.translateCommentParams = encodeJson_1(value.translateCommentParams); - return result; -} - -export function decodeJson(value: any): $.youtube.PeformCommentActionParams { - const result = getDefaultValue(); - if (value.type !== undefined) result.type = jsonValueToTsValueFns.int32(value.type); - if (value.unkNum !== undefined) result.unkNum = jsonValueToTsValueFns.int32(value.unkNum); - if (value.commentId !== undefined) result.commentId = jsonValueToTsValueFns.string(value.commentId); - if (value.videoId !== undefined) result.videoId = jsonValueToTsValueFns.string(value.videoId); - if (value.channelId !== undefined) result.channelId = jsonValueToTsValueFns.string(value.channelId); - if (value.translateCommentParams !== undefined) result.translateCommentParams = decodeJson_1(value.translateCommentParams); - return result; -} - -export function encodeBinary(value: $.youtube.PeformCommentActionParams): Uint8Array { - const result: WireMessage = []; - if (value.type !== undefined) { - const tsValue = value.type; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.unkNum !== undefined) { - const tsValue = value.unkNum; - result.push( - [2, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.commentId !== undefined) { - const tsValue = value.commentId; - result.push( - [3, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.videoId !== undefined) { - const tsValue = value.videoId; - result.push( - [5, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.channelId !== undefined) { - const tsValue = value.channelId; - result.push( - [23, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.translateCommentParams !== undefined) { - const tsValue = value.translateCommentParams; - result.push( - [31, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.PeformCommentActionParams { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.type = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.unkNum = value; - } - field: { - const wireValue = wireFields.get(3); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.commentId = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.videoId = value; - } - field: { - const wireValue = wireFields.get(23); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.channelId = value; - } - field: { - const wireValue = wireFields.get(31); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.translateCommentParams = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/ReelSequence.ts b/src/proto/generated/messages/youtube/ReelSequence.ts deleted file mode 100644 index 9a6ea41d69..0000000000 --- a/src/proto/generated/messages/youtube/ReelSequence.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { - Type as Params, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(ReelSequence)/Params.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type ReelSequence = { - shortId: string; - params?: Params; - feature2: number; - feature3: number; - } -} - -export type Type = $.youtube.ReelSequence; - -export function getDefaultValue(): $.youtube.ReelSequence { - return { - shortId: "", - params: undefined, - feature2: 0, - feature3: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.ReelSequence>): $.youtube.ReelSequence { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.ReelSequence): unknown { - const result: any = {}; - if (value.shortId !== undefined) result.shortId = tsValueToJsonValueFns.string(value.shortId); - if (value.params !== undefined) result.params = encodeJson_1(value.params); - if (value.feature2 !== undefined) result.feature2 = tsValueToJsonValueFns.int32(value.feature2); - if (value.feature3 !== undefined) result.feature3 = tsValueToJsonValueFns.int32(value.feature3); - return result; -} - -export function decodeJson(value: any): $.youtube.ReelSequence { - const result = getDefaultValue(); - if (value.shortId !== undefined) result.shortId = jsonValueToTsValueFns.string(value.shortId); - if (value.params !== undefined) result.params = decodeJson_1(value.params); - if (value.feature2 !== undefined) result.feature2 = jsonValueToTsValueFns.int32(value.feature2); - if (value.feature3 !== undefined) result.feature3 = jsonValueToTsValueFns.int32(value.feature3); - return result; -} - -export function encodeBinary(value: $.youtube.ReelSequence): Uint8Array { - const result: WireMessage = []; - if (value.shortId !== undefined) { - const tsValue = value.shortId; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.params !== undefined) { - const tsValue = value.params; - result.push( - [5, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.feature2 !== undefined) { - const tsValue = value.feature2; - result.push( - [10, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.feature3 !== undefined) { - const tsValue = value.feature3; - result.push( - [13, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.ReelSequence { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.shortId = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.params = value; - } - field: { - const wireValue = wireFields.get(10); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.feature2 = value; - } - field: { - const wireValue = wireFields.get(13); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.feature3 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/SearchFilter.ts b/src/proto/generated/messages/youtube/SearchFilter.ts deleted file mode 100644 index b0d48f076d..0000000000 --- a/src/proto/generated/messages/youtube/SearchFilter.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - Type as Filters, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(SearchFilter)/Filters.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type SearchFilter = { - sortBy?: number; - filters?: Filters; - noFilter?: number; - } -} - -export type Type = $.youtube.SearchFilter; - -export function getDefaultValue(): $.youtube.SearchFilter { - return { - sortBy: undefined, - filters: undefined, - noFilter: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.SearchFilter>): $.youtube.SearchFilter { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.SearchFilter): unknown { - const result: any = {}; - if (value.sortBy !== undefined) result.sortBy = tsValueToJsonValueFns.int32(value.sortBy); - if (value.filters !== undefined) result.filters = encodeJson_1(value.filters); - if (value.noFilter !== undefined) result.noFilter = tsValueToJsonValueFns.int32(value.noFilter); - return result; -} - -export function decodeJson(value: any): $.youtube.SearchFilter { - const result = getDefaultValue(); - if (value.sortBy !== undefined) result.sortBy = jsonValueToTsValueFns.int32(value.sortBy); - if (value.filters !== undefined) result.filters = decodeJson_1(value.filters); - if (value.noFilter !== undefined) result.noFilter = jsonValueToTsValueFns.int32(value.noFilter); - return result; -} - -export function encodeBinary(value: $.youtube.SearchFilter): Uint8Array { - const result: WireMessage = []; - if (value.sortBy !== undefined) { - const tsValue = value.sortBy; - result.push( - [1, tsValueToWireValueFns.int32(tsValue)], - ); - } - if (value.filters !== undefined) { - const tsValue = value.filters; - result.push( - [2, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.noFilter !== undefined) { - const tsValue = value.noFilter; - result.push( - [19, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.SearchFilter { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.sortBy = value; - } - field: { - const wireValue = wireFields.get(2); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.filters = value; - } - field: { - const wireValue = wireFields.get(19); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.noFilter = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/ShortsParam.ts b/src/proto/generated/messages/youtube/ShortsParam.ts deleted file mode 100644 index 01cf4c89fa..0000000000 --- a/src/proto/generated/messages/youtube/ShortsParam.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { - Type as Field1, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(ShortsParam)/Field1.js"; -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type ShortsParam = { - f1?: Field1; - p59: number; - } -} - -export type Type = $.youtube.ShortsParam; - -export function getDefaultValue(): $.youtube.ShortsParam { - return { - f1: undefined, - p59: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.ShortsParam>): $.youtube.ShortsParam { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.ShortsParam): unknown { - const result: any = {}; - if (value.f1 !== undefined) result.f1 = encodeJson_1(value.f1); - if (value.p59 !== undefined) result.p59 = tsValueToJsonValueFns.int32(value.p59); - return result; -} - -export function decodeJson(value: any): $.youtube.ShortsParam { - const result = getDefaultValue(); - if (value.f1 !== undefined) result.f1 = decodeJson_1(value.f1); - if (value.p59 !== undefined) result.p59 = jsonValueToTsValueFns.int32(value.p59); - return result; -} - -export function encodeBinary(value: $.youtube.ShortsParam): Uint8Array { - const result: WireMessage = []; - if (value.f1 !== undefined) { - const tsValue = value.f1; - result.push( - [1, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - if (value.p59 !== undefined) { - const tsValue = value.p59; - result.push( - [59, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.ShortsParam { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.f1 = value; - } - field: { - const wireValue = wireFields.get(59); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.p59 = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/SoundInfoParams.ts b/src/proto/generated/messages/youtube/SoundInfoParams.ts deleted file mode 100644 index 464d5c1b8b..0000000000 --- a/src/proto/generated/messages/youtube/SoundInfoParams.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { - Type as Sound, - encodeJson as encodeJson_1, - decodeJson as decodeJson_1, - encodeBinary as encodeBinary_1, - decodeBinary as decodeBinary_1, -} from "./(SoundInfoParams)/Sound.js"; -import { - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, - WireType, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type SoundInfoParams = { - sound?: Sound; - } -} - -export type Type = $.youtube.SoundInfoParams; - -export function getDefaultValue(): $.youtube.SoundInfoParams { - return { - sound: undefined, - }; -} - -export function createValue(partialValue: Partial<$.youtube.SoundInfoParams>): $.youtube.SoundInfoParams { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.SoundInfoParams): unknown { - const result: any = {}; - if (value.sound !== undefined) result.sound = encodeJson_1(value.sound); - return result; -} - -export function decodeJson(value: any): $.youtube.SoundInfoParams { - const result = getDefaultValue(); - if (value.sound !== undefined) result.sound = decodeJson_1(value.sound); - return result; -} - -export function encodeBinary(value: $.youtube.SoundInfoParams): Uint8Array { - const result: WireMessage = []; - if (value.sound !== undefined) { - const tsValue = value.sound; - result.push( - [94, { type: WireType.LengthDelimited as const, value: encodeBinary_1(tsValue) }], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.SoundInfoParams { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(94); - if (wireValue === undefined) break field; - const value = wireValue.type === WireType.LengthDelimited ? decodeBinary_1(wireValue.value) : undefined; - if (value === undefined) break field; - result.sound = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/VisitorData.ts b/src/proto/generated/messages/youtube/VisitorData.ts deleted file mode 100644 index 03a831f3c1..0000000000 --- a/src/proto/generated/messages/youtube/VisitorData.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - tsValueToJsonValueFns, - jsonValueToTsValueFns, -} from "../../runtime/json/scalar.js"; -import { - WireMessage, -} from "../../runtime/wire/index.js"; -import { - default as serialize, -} from "../../runtime/wire/serialize.js"; -import { - tsValueToWireValueFns, - wireValueToTsValueFns, -} from "../../runtime/wire/scalar.js"; -import { - default as deserialize, -} from "../../runtime/wire/deserialize.js"; - -export declare namespace $.youtube { - export type VisitorData = { - id: string; - timestamp: number; - } -} - -export type Type = $.youtube.VisitorData; - -export function getDefaultValue(): $.youtube.VisitorData { - return { - id: "", - timestamp: 0, - }; -} - -export function createValue(partialValue: Partial<$.youtube.VisitorData>): $.youtube.VisitorData { - return { - ...getDefaultValue(), - ...partialValue, - }; -} - -export function encodeJson(value: $.youtube.VisitorData): unknown { - const result: any = {}; - if (value.id !== undefined) result.id = tsValueToJsonValueFns.string(value.id); - if (value.timestamp !== undefined) result.timestamp = tsValueToJsonValueFns.int32(value.timestamp); - return result; -} - -export function decodeJson(value: any): $.youtube.VisitorData { - const result = getDefaultValue(); - if (value.id !== undefined) result.id = jsonValueToTsValueFns.string(value.id); - if (value.timestamp !== undefined) result.timestamp = jsonValueToTsValueFns.int32(value.timestamp); - return result; -} - -export function encodeBinary(value: $.youtube.VisitorData): Uint8Array { - const result: WireMessage = []; - if (value.id !== undefined) { - const tsValue = value.id; - result.push( - [1, tsValueToWireValueFns.string(tsValue)], - ); - } - if (value.timestamp !== undefined) { - const tsValue = value.timestamp; - result.push( - [5, tsValueToWireValueFns.int32(tsValue)], - ); - } - return serialize(result); -} - -export function decodeBinary(binary: Uint8Array): $.youtube.VisitorData { - const result = getDefaultValue(); - const wireMessage = deserialize(binary); - const wireFields = new Map(wireMessage); - field: { - const wireValue = wireFields.get(1); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.string(wireValue); - if (value === undefined) break field; - result.id = value; - } - field: { - const wireValue = wireFields.get(5); - if (wireValue === undefined) break field; - const value = wireValueToTsValueFns.int32(wireValue); - if (value === undefined) break field; - result.timestamp = value; - } - return result; -} diff --git a/src/proto/generated/messages/youtube/index.ts b/src/proto/generated/messages/youtube/index.ts deleted file mode 100644 index 6c4524d13e..0000000000 --- a/src/proto/generated/messages/youtube/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type { Type as VisitorData } from "./VisitorData.js"; -export type { Type as InnertubePayload } from "./InnertubePayload.js"; -export type { Type as ChannelAnalytics } from "./ChannelAnalytics.js"; -export type { Type as SoundInfoParams } from "./SoundInfoParams.js"; -export type { Type as NotificationPreferences } from "./NotificationPreferences.js"; -export type { Type as LiveMessageParams } from "./LiveMessageParams.js"; -export type { Type as GetCommentsSectionParams } from "./GetCommentsSectionParams.js"; -export type { Type as CreateCommentParams } from "./CreateCommentParams.js"; -export type { Type as PeformCommentActionParams } from "./PeformCommentActionParams.js"; -export type { Type as MusicSearchFilter } from "./MusicSearchFilter.js"; -export type { Type as SearchFilter } from "./SearchFilter.js"; -export type { Type as Hashtag } from "./Hashtag.js"; -export type { Type as ReelSequence } from "./ReelSequence.js"; -export type { Type as ShortsParam } from "./ShortsParam.js"; diff --git a/src/proto/generated/runtime/Long.ts b/src/proto/generated/runtime/Long.ts deleted file mode 100644 index f6cd3f5473..0000000000 --- a/src/proto/generated/runtime/Long.ts +++ /dev/null @@ -1,113 +0,0 @@ -export const UINT16_MAX = 0xFFFF; -export const UINT32_MAX = 0xFFFFFFFF; - -export default class Long extends Uint32Array { - constructor(lo: number = 0, hi: number = 0) { - super([lo, hi]); - } - toString(signed = true): string { - const [lo, hi] = this; - if (lo === 0 && hi === 0) return "0"; - if (signed && (hi > 0x7FFFFFFF)) { - return "-" + add(negate(this), one).toString(false); - } - const result = []; - let tmp = new Long(lo, hi); - while (compare(tmp, zero)) { - const [next, remainder] = divByTen(tmp); - result.push(remainder); - tmp = next; - } - return result.reverse().join(""); - } - static parse(text: string): Long { - const parsedValue = parseInt(text, 10); - const sign = parsedValue < 0; - if (Number.isNaN(parsedValue)) return new Long(0); - if (text.length < 10) { - if (parsedValue < 0) return add(negate(new Long(-parsedValue)), one); - return new Long(parsedValue); - } - let result = new Long(); - let powerTen = one; - for (const digit of text.split("").reverse()) { - if (parseInt(digit)) { - result = add(result, mul(new Long(parseInt(digit)), powerTen)); - } - powerTen = mul(powerTen, new Long(10)); - } - if (!sign) return result; - return add(negate(result), one); - } -} - -const zero = new Long(0); -const one = new Long(1); - -function makeChunk(value: Long): [number, number, number, number] { - const [lo, hi] = value; - return [lo & UINT16_MAX, lo >>> 16, hi & UINT16_MAX, hi >>> 16]; -} - -export function add(a: Long, b: Long): Long { - const [a00, a16, a32, a48] = makeChunk(a); - const [b00, b16, b32, b48] = makeChunk(b); - let c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= UINT16_MAX; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= UINT16_MAX; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= UINT16_MAX; - c48 += a48 + b48; - c48 &= UINT16_MAX; - return new Long(c16 << 16 | c00, c48 << 16 | c32); -} - -export function sub(a: Long, b: Long): Long { - return add(a, add(negate(b), one)); -} - -export function mul(a: Long, b: Long): Long { - const [a00, a16, a32, a48] = makeChunk(a); - const [b00, b16, b32, b48] = makeChunk(b); - let c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= UINT16_MAX; - c16 += a00 * b16 + a16 * b00; - c32 += c16 >>> 16; - c16 &= UINT16_MAX; - c32 += a00 * b32 + a32 * b00 + a16 * b16; - c48 += c32 >>> 16; - c32 &= UINT16_MAX; - c48 += a00 * b48 + a16 * b32 + a32 * b16 + a48 * b00; - c48 &= UINT16_MAX; - return new Long(c16 << 16 | c00, c48 << 16 | c32); -} - -export function divByTen(value: Long): [Long, number] { - const [lo, hi] = value; - return [ - new Long( - (((hi % 10) * (UINT32_MAX + 1) + lo) / 10) | 0, - (hi / 10) | 0, - ), - ((hi % 10) * (UINT32_MAX + 1) + lo) % 10, - ]; -} - -export function compare(a: Long, b: Long): number { - const [l1, h1] = a; - const [l2, h2] = b; - if (h1 !== h2) return h1 - h2; - return l1 - l2; -} - -function negate(value: Long): Long { - const [lo, hi] = value; - return new Long(~lo, ~hi); -} diff --git a/src/proto/generated/runtime/array.ts b/src/proto/generated/runtime/array.ts deleted file mode 100644 index fabdc657c4..0000000000 --- a/src/proto/generated/runtime/array.ts +++ /dev/null @@ -1,25 +0,0 @@ -// @ts-ignore -export type PojoSet = { [key in T]: T }; -export function toPojoSet( - arr: readonly T[], -): PojoSet { - const result: any = {}; - for (const item of arr) result[item] = item; - return result; -} - -export function removeItem(arr: T[], item: T): T[] { - const index = arr.indexOf(item); - arr.splice(index, 1); - return arr; -} - -export function groupBy(arr: T[], by: U): Map { - const result = new Map(); - for (const item of arr) { - const key = item[by]; - if (result.has(key)) result.get(key)!.push(item); - else result.set(key, [item]); - } - return result; -} diff --git a/src/proto/generated/runtime/async/async-generator.ts b/src/proto/generated/runtime/async/async-generator.ts deleted file mode 100644 index e2b40d17d8..0000000000 --- a/src/proto/generated/runtime/async/async-generator.ts +++ /dev/null @@ -1,11 +0,0 @@ -export async function* fromSingle(value: T): AsyncGenerator { - yield value; -} - -export async function first( - generator: AsyncGenerator, -): Promise { - const { done, value } = await generator.next(); - if (done) throw Error("The generator should yield at least one value."); - return value; -} diff --git a/src/proto/generated/runtime/async/event-buffer.ts b/src/proto/generated/runtime/async/event-buffer.ts deleted file mode 100644 index a7c0f6c8fd..0000000000 --- a/src/proto/generated/runtime/async/event-buffer.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { defer, Deferred } from "./observer.js"; - -export interface EventBuffer { - push(value: T): void; - error(error: Error): void; - finish(): void; - drain(): AsyncGenerator; -} -export interface CreateEventBufferConfig { - onDrainStart?: () => void; - onDrainEnd?: () => void; -} -export function createEventBuffer( - config?: CreateEventBufferConfig, -): EventBuffer { - const queue: T[] = []; - let _error: Error | undefined; - let deferred: Deferred> | undefined; - let finished = false; - return { - push(value) { - if (finished) throw new Error("can't push after finish"); - if (deferred) { - deferred.resolve({ value, done: false }); - deferred = undefined; - } else { - queue.push(value); - } - }, - error(error) { - if (deferred) deferred.reject(error); - else _error = error; - finished = true; - }, - finish() { - deferred?.resolve({ value: undefined, done: true }); - finished = true; - }, - drain() { - config?.onDrainStart?.(); - const result: AsyncGenerator = { - [Symbol.asyncIterator]: () => result, - next() { - if (queue.length > 0) { - return Promise.resolve({ - value: queue.shift()!, - done: false, - }); - } else { - if (_error) return Promise.reject(_error); - if (finished) { - return Promise.resolve({ value: undefined, done: true }); - } else { - return deferred = defer(); - } - } - }, - return(value) { - config?.onDrainEnd?.(); - return Promise.resolve({ value, done: true }); - }, - throw(error) { - config?.onDrainEnd?.(); - return Promise.reject(error); - }, - }; - return result; - }, - }; -} diff --git a/src/proto/generated/runtime/async/event-emitter.ts b/src/proto/generated/runtime/async/event-emitter.ts deleted file mode 100644 index 7dd63c1684..0000000000 --- a/src/proto/generated/runtime/async/event-emitter.ts +++ /dev/null @@ -1,34 +0,0 @@ -export interface EventEmitter> { - emit(type: Type, event: Events[Type]): void; - on( - type: Type | "*", - listener: Listener, - ): Off; - off(type: keyof Events): void; -} -export type Listener = (event: Event, type: string) => void; -export type Off = () => void; - -export function createEventEmitter< - Events extends Record, ->(): EventEmitter { - const listeners = {} as Record>>; - const eventEmitter: EventEmitter = { - emit(type, event) { - listeners[type]?.forEach( - (listener) => listener(event, type as string), - ); - (type !== "*") && listeners["*"]?.forEach( - (listener) => listener(event, type as string), - ); - }, - on(type, listener) { - (listeners[type] ||= new Set()).add(listener); - return () => listeners[type]?.delete(listener); - }, - off(type) { - delete listeners[type]; - }, - }; - return eventEmitter; -} diff --git a/src/proto/generated/runtime/async/observer.ts b/src/proto/generated/runtime/async/observer.ts deleted file mode 100644 index 24402d3839..0000000000 --- a/src/proto/generated/runtime/async/observer.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { removeItem } from "../array.js"; - -export interface Observer { - next(value: T): void; - error(exception?: any): void; - complete(): void; -} -export type SubscribeFn = (observer: Observer) => UnsubscribeFn; -export type UnsubscribeFn = () => void; - -export interface Deferred extends Promise { - resolve(value: T): void; - reject(reason?: any): void; -} -export function defer(): Deferred { - const transit: any = {}; - const result = new Promise( - (resolve, reject) => Object.assign(transit, { resolve, reject }), - ); - return Object.assign(result, transit); -} - -export interface Next { - (): Promise<[T, boolean]>; -} -export function createSubscribeFn( - next: Next, - wait = Promise.resolve(), -): SubscribeFn { - const observers: Observer[] = []; - (async () => { - try { - await wait; - while (observers.length) { - const [value, done] = await next(); - for (const observer of observers) observer.next(value); - if (done) break; - } - } catch (err) { - for (const observer of observers) observer.error(err); - } finally { - for (const observer of observers) observer.complete(); - } - })(); - return (observer) => { - observers.push(observer); - return () => { - observer.complete(); - removeItem(observers, observer); - }; - }; -} -export async function* subscribeFnToAsyncGenerator( - subscribe: SubscribeFn, -): AsyncGenerator { - let finished = false; - let deferred = defer(); - const observer: Observer = { - next(value) { - const result = deferred; - deferred = defer(); - result.resolve(value); - }, - error(exception) { - const result = deferred; - deferred = defer(); - result.reject(exception); - }, - complete() { - finished = true; - deferred.resolve(null as any); - }, - }; - const unsubscribe = subscribe(observer); - try { - while (true) { - const value = await deferred; - if (finished) break; - yield value; - } - } finally { - unsubscribe(); - } -} diff --git a/src/proto/generated/runtime/async/wait.ts b/src/proto/generated/runtime/async/wait.ts deleted file mode 100644 index 9f7cb86526..0000000000 --- a/src/proto/generated/runtime/async/wait.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default function wait(ms: number): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/src/proto/generated/runtime/base64.ts b/src/proto/generated/runtime/base64.ts deleted file mode 100644 index d0060bc75d..0000000000 --- a/src/proto/generated/runtime/base64.ts +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. - -const base64abc = [ - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "0", - "1", - "2", - "3", - "4", - "5", - "6", - "7", - "8", - "9", - "+", - "/", -]; - -/** - * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 - * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation - * @param data - */ -export function encode(data: ArrayBuffer | string): string { - const uint8 = typeof data === "string" - ? new TextEncoder().encode(data) - : data instanceof Uint8Array - ? data - : new Uint8Array(data); - let result = "", - i; - const l = uint8.length; - for (i = 2; i < l; i += 3) { - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; - result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)]; - result += base64abc[uint8[i] & 0x3f]; - } - if (i === l + 1) { - // 1 octet yet to write - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[(uint8[i - 2] & 0x03) << 4]; - result += "=="; - } - if (i === l) { - // 2 octets yet to write - result += base64abc[uint8[i - 2] >> 2]; - result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; - result += base64abc[(uint8[i - 1] & 0x0f) << 2]; - result += "="; - } - return result; -} - -/** - * Decodes a given RFC4648 base64 encoded string - * @param b64 - */ -export function decode(b64: string): Uint8Array { - const binString = atob(b64); - const size = binString.length; - const bytes = new Uint8Array(size); - for (let i = 0; i < size; i++) { - bytes[i] = binString.charCodeAt(i); - } - return bytes; -} diff --git a/src/proto/generated/runtime/client-devtools.ts b/src/proto/generated/runtime/client-devtools.ts deleted file mode 100644 index 58d6369016..0000000000 --- a/src/proto/generated/runtime/client-devtools.ts +++ /dev/null @@ -1,198 +0,0 @@ -import type { RpcClientImpl } from "./rpc.js"; -import { - createEventEmitter, - EventEmitter, - Off, -} from "./async/event-emitter.js"; - -export const devtoolsKey = "@pbkit/devtools"; - -export function registerRemoteDevtools(host: string): Off { - return getDevtoolsConfig().on("*", (event, type) => { - fetch(`${host}/send`, { - method: "POST", - mode: "no-cors", - body: JSON.stringify({ event, type }), - }); - }); -} - -export function getDevtoolsConfig(): DevtoolsConfig { - const global = globalThis as any; - if (!global[devtoolsKey]) { - const devtoolsConfig = createDevtoolsConfig(); - return global[devtoolsKey] = devtoolsConfig; - } else if (Array.isArray(global[devtoolsKey])) { - const devtoolsConfig = createDevtoolsConfig(); - for (const fn of global[devtoolsKey]) { - if (typeof fn !== "function") continue; - fn(devtoolsConfig); - } - return global[devtoolsKey] = devtoolsConfig; - } else { - return global[devtoolsKey]; - } -} - -export interface DevtoolsConfig extends EventEmitter { - configId: string; - requestIdCounter: number; -} -function createDevtoolsConfig(): DevtoolsConfig { - const devtoolsConfig: DevtoolsConfig = { - configId: String(Date.now()), - requestIdCounter: 0, - ...createEventEmitter(), - }; - return devtoolsConfig; -} - -export interface WrapRpcClientImplConfig { - rpcClientImpl: RpcClientImpl; - devtoolsConfig: DevtoolsConfig; - tags: string[]; -} -export function wrapRpcClientImpl( - config: WrapRpcClientImplConfig, -): RpcClientImpl { - return function devtoolsRpcClientImpl(methodDescriptor) { - const { rpcClientImpl, devtoolsConfig, tags } = config; - const rpcMethodImpl = rpcClientImpl(methodDescriptor); - return function devtoolsRpcMethodImpl(req, metadata) { - const configId = devtoolsConfig.configId; - const requestId = devtoolsConfig.requestIdCounter++; - devtoolsConfig.emit("request", { - configId, - requestId, - servicePath: methodDescriptor.service.serviceName, - rpcName: methodDescriptor.methodName, - metadataJson: toJson(metadata), - tags, - }); - const rpcMethodResult = rpcMethodImpl( - mapAsyncGenerator(req, (payload) => { - devtoolsConfig.emit("request-payload", { - configId, - requestId, - payloadJson: methodDescriptor.requestType.serializeJson(payload), - payloadProto: methodDescriptor.requestType.serializeBinary(payload), - }); - return payload; - }, (error) => { - devtoolsConfig.emit("request-error", { - configId, - requestId, - errorMessage: getErrorMessage(error), - }); - }), - metadata, - ); - const resAsyncGenerator = mapAsyncGenerator( - rpcMethodResult[0], - (payload) => { - devtoolsConfig.emit("response-payload", { - configId, - requestId, - payloadJson: methodDescriptor.responseType.serializeJson(payload), - payloadProto: methodDescriptor.responseType.serializeBinary( - payload, - ), - }); - return payload; - }, - (error) => { - devtoolsConfig.emit("response-error", { - configId, - requestId, - errorMessage: getErrorMessage(error), - }); - }, - ); - const headerPromise = rpcMethodResult[1].then((header) => { - devtoolsConfig.emit("response", { - configId, - requestId, - headerJson: toJson(header), - }); - return header; - }); - const trailerPromise = rpcMethodResult[2].then((trailer) => { - devtoolsConfig.emit("response-trailer", { - configId, - requestId, - trailerJson: toJson(trailer), - }); - return trailer; - }); - return [resAsyncGenerator, headerPromise, trailerPromise]; - }; - }; -} - -function toJson(value: any): string { - if ((!value) || (typeof value !== "object")) return "{}"; - return JSON.stringify(value); -} - -async function* mapAsyncGenerator( - asyncGenerator: AsyncGenerator, - fn: (value: T) => T | Promise, - catchFn: (error: any) => void, -): AsyncGenerator { - try { - for await (const value of asyncGenerator) { - yield await fn(value); - } - } catch (error) { - catchFn(error); - throw error; - } -} - -function getErrorMessage(error: any): string { - if (error instanceof Error) return error.stack || error.message; - return String(error); -} - -export interface Events { - "request": { - configId: string; - requestId: number; - servicePath: string; - rpcName: string; - metadataJson: string; - tags: string[]; - }; - "request-payload": { - configId: string; - requestId: number; - payloadJson: string; - payloadProto: Uint8Array; - }; - "request-error": { - configId: string; - requestId: number; - errorMessage: string; - }; - "response": { - configId: string; - requestId: number; - headerJson: string; - }; - "response-payload": { - configId: string; - requestId: number; - payloadJson: string; - payloadProto: Uint8Array; - }; - "response-error": { - configId: string; - requestId: number; - errorMessage: string; - }; - "response-trailer": { - configId: string; - requestId: number; - trailerJson: string; - }; -} diff --git a/src/proto/generated/runtime/json/scalar.ts b/src/proto/generated/runtime/json/scalar.ts deleted file mode 100644 index a8c9ad8978..0000000000 --- a/src/proto/generated/runtime/json/scalar.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { encode as base64Encode, decode as base64Decode } from "../base64.js"; - -type TsValueToJsonValue = (tsValue: T) => unknown; -type JsonValueToTsValue = (jsonValue: any) => T; - -interface TsValueToJsonValueFns { - int32: TsValueToJsonValue; - int64: TsValueToJsonValue; - uint32: TsValueToJsonValue; - uint64: TsValueToJsonValue; - sint32: TsValueToJsonValue; - sint64: TsValueToJsonValue; - bool: TsValueToJsonValue; - double: TsValueToJsonValue; - float: TsValueToJsonValue; - fixed32: TsValueToJsonValue; - fixed64: TsValueToJsonValue; - sfixed32: TsValueToJsonValue; - sfixed64: TsValueToJsonValue; - string: TsValueToJsonValue; - bytes: TsValueToJsonValue; - enum: TsValueToJsonValue; -} - -interface JsonValueToTsValueFns { - int32: JsonValueToTsValue; - int64: JsonValueToTsValue; - uint32: JsonValueToTsValue; - uint64: JsonValueToTsValue; - sint32: JsonValueToTsValue; - sint64: JsonValueToTsValue; - bool: JsonValueToTsValue; - double: JsonValueToTsValue; - float: JsonValueToTsValue; - fixed32: JsonValueToTsValue; - fixed64: JsonValueToTsValue; - sfixed32: JsonValueToTsValue; - sfixed64: JsonValueToTsValue; - string: JsonValueToTsValue; - bytes: JsonValueToTsValue; - enum: JsonValueToTsValue; -} - - -export const tsValueToJsonValueFns: TsValueToJsonValueFns = { - int32: (tsValue) => tsValue, - int64: (tsValue) => tsValue, - uint32: (tsValue) => tsValue, - uint64: (tsValue) => tsValue, - sint32: (tsValue) => tsValue, - sint64: (tsValue) => tsValue, - bool: (tsValue) => tsValue, - double: (tsValue) => tsValue, - float: (tsValue) => tsValue, - fixed32: (tsValue) => tsValue, - fixed64: (tsValue) => tsValue, - sfixed32: (tsValue) => tsValue, - sfixed64: (tsValue) => tsValue, - string: (tsValue) => tsValue, - bytes: (tsValue) => base64Encode(tsValue), - enum: (tsValue) => tsValue, -}; - - -export const jsonValueToTsValueFns: JsonValueToTsValueFns = { - int32: (tsValue) => tsValue, - int64: (tsValue) => tsValue, - uint32: (tsValue) => tsValue, - uint64: (tsValue) => tsValue, - sint32: (tsValue) => tsValue, - sint64: (tsValue) => tsValue, - bool: (tsValue) => tsValue, - double: (tsValue) => tsValue, - float: (tsValue) => tsValue, - fixed32: (tsValue) => tsValue, - fixed64: (tsValue) => tsValue, - sfixed32: (tsValue) => tsValue, - sfixed64: (tsValue) => tsValue, - string: (tsValue) => tsValue, - bytes: (tsValue) => base64Decode(tsValue), - enum: (tsValue) => tsValue, -}; diff --git a/src/proto/generated/runtime/rpc.ts b/src/proto/generated/runtime/rpc.ts deleted file mode 100644 index 6f966794a1..0000000000 --- a/src/proto/generated/runtime/rpc.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { createEventBuffer } from "./async/event-buffer.js"; -import { defer } from "./async/observer.js"; - -export type Method< - TMetadata = any, - THeader = any, - TTrailer = any, - TServiceName extends string = string, - TMethodName extends string = string, - TRequestStream extends boolean = boolean, - TResponseStream extends boolean = boolean, - TReq = any, - TRes = any, -> = [ - MethodDescriptor< - TReq, - TRes, - TMethodName, - TServiceName, - TRequestStream, - TResponseStream - >, - MethodImpl, -]; - -export type RpcClientImpl = < - TReq, - TRes, ->( - methodDescriptor: MethodDescriptor, -) => MethodImpl; - -export interface MethodDescriptor< - TReq, - TRes, - TMethodName extends string = string, - TServiceName extends string = string, - TRequestStream extends boolean = boolean, - TResponseStream extends boolean = boolean, -> { - methodName: TMethodName; - service: { serviceName: TServiceName }; - requestStream: TRequestStream; - responseStream: TResponseStream; - requestType: { - serializeBinary: (value: TReq) => Uint8Array; - deserializeBinary: (value: Uint8Array) => TReq; - serializeJson: (value: TReq) => string; - }; - responseType: { - serializeBinary: (value: TRes) => Uint8Array; - deserializeBinary: (value: Uint8Array) => TRes; - serializeJson: (value: TRes) => string; - }; -} - -type ThenArg = T extends Promise ? U : T; -export type RpcReturnType = ( - Promise : [ThenArg, ...TResArgs]> -); - -export interface MethodImpl< - TReq, - TRes, - TMetadata = any, - THeader = any, - TTrailer = any, -> { - ( - req: AsyncGenerator, - metadata?: TMetadata, - ): [AsyncGenerator, Promise, Promise]; -} - -export interface MethodImplHandlerReq { - metadata?: TMetadata; - messages: AsyncGenerator; - drainEnd: Promise; -} -export interface MethodImplHandlerRes { - header(value: THeader): void; - send(value: TRes): void; - end(value: TTrailer): void; -} -export interface MethodImplHandler { - ( - req: MethodImplHandlerReq, - res: MethodImplHandlerRes, - ): void; -} -export function getMethodImpl< - TReq, - TRes, - TMetadata, - THeader, - TTrailer, ->( - handler: MethodImplHandler, -): MethodImpl { - return (messages: AsyncGenerator, metadata?: TMetadata) => { - const headerPromise = defer(); - const trailerPromise = defer(); - const drainEnd = defer(); - const eventBuffer = createEventBuffer({ - onDrainEnd: drainEnd.resolve, - }); - const header = headerPromise.resolve; - const send = eventBuffer.push; - const end = (value: TTrailer) => { - eventBuffer.finish(); - trailerPromise.resolve(value); - }; - handler({ metadata, messages, drainEnd }, { header, send, end }); - return [eventBuffer.drain(), headerPromise, trailerPromise]; - }; -} - -export function createServerImplBuilder() { - const buffer = createEventBuffer>(); - return { - register( - methodDescriptor: MethodDescriptor, - handler: MethodImplHandler, - ) { - buffer.push([methodDescriptor, getMethodImpl(handler)]); - }, - finish: buffer.finish, - drain: buffer.drain, - }; -} diff --git a/src/proto/generated/runtime/scalar.ts b/src/proto/generated/runtime/scalar.ts deleted file mode 100644 index 570fbd3844..0000000000 --- a/src/proto/generated/runtime/scalar.ts +++ /dev/null @@ -1,26 +0,0 @@ -export type ScalarValueTypePath = `.${ScalarValueType}`; -export type ScalarValueTypes = Writable; -export type ScalarValueType = ScalarValueTypes[number]; -export const _scalarValueTypes = [ - "double", - "float", - "int32", - "int64", - "uint32", - "uint64", - "sint32", - "sint64", - "fixed32", - "fixed64", - "sfixed32", - "sfixed64", - "bool", - "string", - "bytes", -] as const; -export const scalarValueTypes: ScalarValueTypes = - _scalarValueTypes as ScalarValueTypes; - -type Writable = { - -readonly [K in keyof T]: T[K]; -}; diff --git a/src/proto/generated/runtime/wire/deserialize.ts b/src/proto/generated/runtime/wire/deserialize.ts deleted file mode 100644 index 361dcdbdb2..0000000000 --- a/src/proto/generated/runtime/wire/deserialize.ts +++ /dev/null @@ -1,60 +0,0 @@ -import Long from "../Long.js"; -import { WireMessage, WireType } from "./index.js"; -import { decode } from "./varint.js"; - -export default function deserialize(uint8array: Uint8Array): WireMessage { - let idx = 0; - const offset = uint8array.byteOffset; - const result: WireMessage = []; - const dataview = new DataView(uint8array.buffer, offset); - while (idx < uint8array.length) { - const decodeResult = decode(new DataView(uint8array.buffer, offset + idx)); - const key = decodeResult[1][0]; - idx += decodeResult[0]; - const type = (key & 0b111) as WireType; - const fieldNumber = key >>> 3; - switch (type) { - default: - throw new Error(`Unknown wire type ${type}`); - case WireType.Varint: { - const [len, value] = decode( - new DataView(uint8array.buffer, offset + idx), - ); - result.push([fieldNumber, { type, value }]); - idx += len; - break; - } - case WireType.Fixed64: - const lo = dataview.getUint32(idx, true); - const hi = dataview.getUint32(idx += 4, true); - idx += 4; - result.push([fieldNumber, { - type, - value: new Long(lo, hi), - }]); - break; - case WireType.LengthDelimited: { - const [len, value] = decode( - new DataView(uint8array.buffer, offset + idx), - ); - result.push([fieldNumber, { - type, - value: uint8array.subarray(idx += len, idx += value[0]), - }]); - break; - } - case WireType.StartGroup: - case WireType.EndGroup: - result.push([fieldNumber, { type }]); - break; - case WireType.Fixed32: - result.push([fieldNumber, { - type, - value: dataview.getUint32(idx, true), - }]); - idx += 4; - break; - } - } - return result; -} diff --git a/src/proto/generated/runtime/wire/index.ts b/src/proto/generated/runtime/wire/index.ts deleted file mode 100644 index 6b9ed2e8a2..0000000000 --- a/src/proto/generated/runtime/wire/index.ts +++ /dev/null @@ -1,38 +0,0 @@ -import Long from "../Long.js"; - -export type WireMessage = [FieldNumber, Field][]; -export type FieldNumber = number; -export type Field = - | Varint - | Fixed64 - | LengthDelimited - | StartGroup - | EndGroup - | Fixed32; - -export enum WireType { - Varint = 0, - Fixed64 = 1, - LengthDelimited = 2, - StartGroup = 3, - EndGroup = 4, - Fixed32 = 5, -} - -interface FieldBase { - type: T; -} -export interface Varint extends FieldBase { - value: Long; -} -export interface Fixed64 extends FieldBase { - value: Long; -} -export interface LengthDelimited extends FieldBase { - value: Uint8Array; -} -export interface StartGroup extends FieldBase {} -export interface EndGroup extends FieldBase {} -export interface Fixed32 extends FieldBase { - value: number; -} diff --git a/src/proto/generated/runtime/wire/scalar.ts b/src/proto/generated/runtime/wire/scalar.ts deleted file mode 100644 index 90e5eef3f8..0000000000 --- a/src/proto/generated/runtime/wire/scalar.ts +++ /dev/null @@ -1,372 +0,0 @@ -import Long from "../Long.js"; -import { decode as decodeVarint, encode as encodeVarint } from "./varint.js"; -import { decode as decodeZigzag, encode as encodeZigzag } from "./zigzag.js"; -import { concat } from "./serialize.js"; -import { Field, LengthDelimited, WireType } from "./index.js"; - -type WireValueToTsValue = (wireValue: Field) => T | undefined; -type TsValueToWireValue = (tsValue: T) => Field; -type Unpack = (wireValues: Iterable) => Generator; -type Pack = (values: T[]) => LengthDelimited; - -interface WireValueToTsValueFns extends NumericWireValueToTsValueFns { - string: WireValueToTsValue; - bytes: WireValueToTsValue; -} - -interface TsValueToWireValueFns extends TsValueToNumericWireValueFns { - string: TsValueToWireValue; - bytes: TsValueToWireValue; -} - -interface NumericWireValueToTsValueFns extends VarintFieldToTsValueFns { - double: WireValueToTsValue; - float: WireValueToTsValue; - fixed32: WireValueToTsValue; - fixed64: WireValueToTsValue; - sfixed32: WireValueToTsValue; - sfixed64: WireValueToTsValue; -} - -interface TsValueToNumericWireValueFns extends TsValueToVarintFieldFns { - double: TsValueToWireValue; - float: TsValueToWireValue; - fixed32: TsValueToWireValue; - fixed64: TsValueToWireValue; - sfixed32: TsValueToWireValue; - sfixed64: TsValueToWireValue; -} - -type DecodeVarintFns = typeof decodeVarintFns; -const decodeVarintFns = { - int32: (long: Long) => long[0] | 0, - int64: (long: Long) => long.toString(true), - uint32: (long: Long) => long[0] >>> 0, - uint64: (long: Long) => long.toString(false), - sint32: (long: Long) => decodeZigzag(long[0]), - sint64: (long: Long) => decodeZigzag(long).toString(true), - bool: (long: Long) => long[0] !== 0, -}; - -type EncodeVarintFns = { - [key in keyof DecodeVarintFns]: ( - tsValue: ReturnType, - ) => Long; -}; -const encodeVarintFns: EncodeVarintFns = { - int32: (tsValue) => new Long(tsValue), - int64: (tsValue) => Long.parse(tsValue), - uint32: (tsValue) => new Long(tsValue), - uint64: (tsValue) => Long.parse(tsValue), - sint32: (tsValue) => encodeZigzag(new Long(tsValue)), - sint64: (tsValue) => encodeZigzag(Long.parse(tsValue)), - bool: (tsValue) => new Long(+tsValue), -}; - -type VarintFieldToTsValueFns = typeof varintFieldToTsValueFns; -const varintFieldToTsValueFns = Object.fromEntries( - Object.entries(decodeVarintFns).map(([type, fn]) => [ - type, - (wireValue: Field) => { - if (wireValue.type !== WireType.Varint) return; - return fn(wireValue.value); - }, - ]), -) as { - [type in keyof DecodeVarintFns]: WireValueToTsValue< - ReturnType - >; -}; - -type TsValueToVarintFieldFns = typeof tsValueToVarintFieldFns; -const tsValueToVarintFieldFns = Object.fromEntries( - Object.entries(encodeVarintFns).map(([type, fn]) => ([ - type, - (tsValue: T) => ({ - type: WireType.Varint, - value: fn(tsValue), - }), - ])), -) as { - [type in keyof DecodeVarintFns]: TsValueToWireValue< - ReturnType - >; -}; - -export const wireValueToTsValueFns: WireValueToTsValueFns = { - ...varintFieldToTsValueFns, - double: (wireValue) => { - if (wireValue.type !== WireType.Fixed64) return; - const dataview = new DataView(wireValue.value.buffer); - return dataview.getFloat64(0, true); - }, - float: (wireValue) => { - if (wireValue.type !== WireType.Fixed32) return; - const dataview = new DataView(new Uint32Array([wireValue.value]).buffer); - return dataview.getFloat32(0, true); - }, - fixed32: (wireValue) => { - if (wireValue.type !== WireType.Fixed32) return; - return wireValue.value >>> 0; - }, - fixed64: (wireValue) => { - if (wireValue.type !== WireType.Fixed64) return; - return wireValue.value.toString(false); - }, - sfixed32: (wireValue) => { - if (wireValue.type !== WireType.Fixed32) return; - return wireValue.value | 0; - }, - sfixed64: (wireValue) => { - if (wireValue.type !== WireType.Fixed64) return; - return wireValue.value.toString(true); - }, - string: (wireValue) => { - if (wireValue.type !== WireType.LengthDelimited) return; - const textDecoder = new TextDecoder(); - return textDecoder.decode(wireValue.value); - }, - bytes: (wireValue) => { - if (wireValue.type !== WireType.LengthDelimited) return; - return wireValue.value; - }, -}; - -export const tsValueToWireValueFns: TsValueToWireValueFns = { - ...tsValueToVarintFieldFns, - double: (tsValue) => { - const long = new Long(); - const dataview = new DataView(long.buffer); - dataview.setFloat64(0, tsValue, true); - return { type: WireType.Fixed64, value: long }; - }, - float: (tsValue) => { - const u32 = new Uint32Array(1); - const dataview = new DataView(u32.buffer); - dataview.setFloat32(0, tsValue, true); - return { type: WireType.Fixed32, value: dataview.getUint32(0, true) }; - }, - fixed32: (tsValue) => ({ type: WireType.Fixed32, value: tsValue >>> 0 }), - fixed64: (tsValue) => ({ - type: WireType.Fixed64, - value: Long.parse(tsValue), - }), - sfixed32: (tsValue) => ({ type: WireType.Fixed32, value: tsValue | 0 }), - sfixed64: (tsValue) => ({ - type: WireType.Fixed64, - value: Long.parse(tsValue), - }), - string: (tsValue) => { - const textEncoder = new TextEncoder(); - return { - type: WireType.LengthDelimited, - value: textEncoder.encode(tsValue), - }; - }, - bytes: (tsValue) => ({ type: WireType.LengthDelimited, value: tsValue }), -}; - -type UnpackFns = { - [type in keyof NumericWireValueToTsValueFns]: Unpack< - NonNullable> - >; -}; -const unpackVarintFns = Object.fromEntries( - Object.keys(decodeVarintFns).map((type) => [ - type, - function* (wireValues: Iterable) { - type Key = keyof typeof decodeVarintFns; - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns[type as Key](wireValue); - if (value != null) yield value; - else { - for (const long of unpackVarint(wireValue)) { - yield decodeVarintFns[type as Key](long); - } - } - } - }, - ]), -) as { - [type in keyof DecodeVarintFns]: Unpack< - ReturnType - >; -}; -export const unpackFns: UnpackFns = { - ...unpackVarintFns, - *double(wireValues) { - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns.double(wireValue); - if (value != null) yield value; - else yield* unpackDouble(wireValue); - } - }, - *float(wireValues) { - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns.float(wireValue); - if (value != null) yield value; - else yield* unpackFloat(wireValue); - } - }, - *fixed32(wireValues) { - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns.fixed32(wireValue); - if (value != null) yield value; - else for (const value of unpackFixed32(wireValue)) yield value >>> 0; - } - }, - *fixed64(wireValues) { - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns.fixed64(wireValue); - if (value != null) yield value; - else { - for (const value of unpackFixed64(wireValue)) { - yield value.toString(false); - } - } - } - }, - *sfixed32(wireValues) { - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns.sfixed32(wireValue); - if (value != null) yield value; - else for (const value of unpackFixed32(wireValue)) yield value | 0; - } - }, - *sfixed64(wireValues) { - for (const wireValue of wireValues) { - const value = wireValueToTsValueFns.sfixed64(wireValue); - if (value != null) yield value; - else { - for (const value of unpackFixed64(wireValue)) { - yield value.toString(true); - } - } - } - }, -}; - -type PackFns = { - [type in keyof NumericWireValueToTsValueFns]: Pack< - NonNullable> - >; -}; -const packVarintFns = Object.fromEntries( - Object.keys(encodeVarintFns).map((type) => [ - type, - function (tsValues: T[]) { - type Key = keyof typeof encodeVarintFns; - return { - type: WireType.LengthDelimited, - value: concat(tsValues.map((tsValue) => { - const value = encodeVarintFns[type as Key](tsValue); - return encodeVarint(value); - })), - }; - }, - ]), -) as { - [type in keyof EncodeVarintFns]: Pack< - ReturnType - >; -}; -function getFixedPackFn( - size: number, - setFn: (dataview: DataView, byteOffset: number, value: T) => void, -): Pack { - return function pack(values) { - const value = new Uint8Array(values.length * size); - const dataview = new DataView(value.buffer); - for (let i = 0; i < values.length; ++i) { - setFn(dataview, i * size, values[i]); - } - return { type: WireType.LengthDelimited, value }; - }; -} -export const packFns: PackFns = { - ...packVarintFns, - double: getFixedPackFn(8, (dataView, byteOffset, value) => { - dataView.setFloat64(byteOffset, value, true); - }), - float: getFixedPackFn(4, (dataView, byteOffset, value) => { - dataView.setFloat32(byteOffset, value, true); - }), - fixed32: getFixedPackFn(4, (dataView, byteOffset, value) => { - dataView.setUint32(byteOffset, value, true); - }), - fixed64: getFixedPackFn(8, (dataView, byteOffset, value) => { - const long = Long.parse(value); - dataView.setUint32(byteOffset, long[0], true); - dataView.setUint32(byteOffset + 4, long[1], true); - }), - sfixed32: getFixedPackFn(4, (dataView, byteOffset, value) => { - dataView.setInt32(byteOffset, value, true); - }), - sfixed64: getFixedPackFn(8, (dataView, byteOffset, value) => { - const long = Long.parse(value); - dataView.setUint32(byteOffset, long[0], true); - dataView.setUint32(byteOffset + 4, long[1], true); - }), -}; - -function* unpackDouble(wireValue: Field): Generator { - if (wireValue.type !== WireType.LengthDelimited) return; - const { value } = wireValue; - let idx = 0; - const dataview = new DataView(value.buffer, value.byteOffset); - while (idx < value.length) { - const double = dataview.getFloat64(idx, true); - idx += 4; - yield double; - } -} - -function* unpackFloat(wireValue: Field): Generator { - if (wireValue.type !== WireType.LengthDelimited) return; - const { value } = wireValue; - let idx = 0; - const dataview = new DataView(value.buffer, value.byteOffset); - while (idx < value.length) { - const float = dataview.getFloat32(idx, true); - idx += 4; - yield float; - } -} - -function* unpackVarint(wireValue: Field): Generator { - if (wireValue.type !== WireType.LengthDelimited) return; - const { value } = wireValue; - let idx = 0; - const offset = value.byteOffset; - while (idx < value.length) { - const decodeResult = decodeVarint(new DataView(value.buffer, offset + idx)); - idx += decodeResult[0]; - yield decodeResult[1]; - } -} - -function* unpackFixed32(wireValue: Field): Generator { - if (wireValue.type !== WireType.LengthDelimited) return; - const { value } = wireValue; - let idx = 0; - const dataview = new DataView(value.buffer, value.byteOffset); - while (idx < value.length) { - const fixed32 = dataview.getUint32(idx, true); - idx += 4; - yield fixed32; - } -} - -function* unpackFixed64(wireValue: Field): Generator { - if (wireValue.type !== WireType.LengthDelimited) return; - const { value } = wireValue; - let idx = 0; - const dataview = new DataView(value.buffer, value.byteOffset); - while (idx < value.length) { - const lo = dataview.getUint32(idx, true); - idx += 4; - const hi = dataview.getUint32(idx, true); - idx += 4; - yield new Long(lo, hi); - } -} diff --git a/src/proto/generated/runtime/wire/serialize.ts b/src/proto/generated/runtime/wire/serialize.ts deleted file mode 100644 index 0dc624091a..0000000000 --- a/src/proto/generated/runtime/wire/serialize.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { WireMessage, WireType } from "./index.js"; -import { encode } from "./varint.js"; - -export default function serialize(wireMessage: WireMessage): Uint8Array { - const result: Uint8Array[] = []; - wireMessage.forEach(([fieldNumber, field]) => { - result.push(encode((fieldNumber << 3) | field.type)); - switch (field.type) { - case WireType.Varint: - result.push(encode(field.value)); - break; - case WireType.Fixed64: { - const arr = new Uint8Array(8); - const dataview = new DataView(arr.buffer); - dataview.setUint32(0, field.value[0], true); - dataview.setUint32(4, field.value[1], true); - result.push(arr); - break; - } - case WireType.LengthDelimited: - result.push(encode(field.value.byteLength)); - result.push(field.value); - break; - case WireType.Fixed32: { - const arr = new Uint8Array(4); - const dataview = new DataView(arr.buffer); - dataview.setUint32(0, field.value, true); - result.push(arr); - break; - } - } - }); - return concat(result); -} - -export function concat(arrays: Uint8Array[]): Uint8Array { - const totalLength = arrays.reduce((acc, value) => { - return acc + value.byteLength; - }, 0); - const result = new Uint8Array(totalLength); - arrays.reduce((acc, array) => { - result.set(array, acc); - return acc + array.byteLength; - }, 0); - return result; -} diff --git a/src/proto/generated/runtime/wire/varint.ts b/src/proto/generated/runtime/wire/varint.ts deleted file mode 100644 index 6864e4b571..0000000000 --- a/src/proto/generated/runtime/wire/varint.ts +++ /dev/null @@ -1,51 +0,0 @@ -import Long from "../Long.js"; - -export function encode(value: number | Long): Uint8Array { - const result: number[] = []; - const mask = 0b1111111; - const head = 1 << 7; - let long = typeof value === "number" ? new Long(value) : value; - while (long[0] || long[1]) { - const [lo, hi] = long; - const chunk = lo & mask; - const nextHi = hi >>> 7; - const nextLo = (lo >>> 7) | ((hi & mask) << (32 - 7)); - long = new Long(nextLo, nextHi); - const resultChunk = !(long[0] || long[1]) ? chunk : chunk | head; - result.push(resultChunk); - } - if (result.length < 1) return new Uint8Array(1); - return Uint8Array.from(result); -} - -export type DecodeResult = [ - number, // byte count - Long, // value -]; -export function decode(dataview: DataView): DecodeResult { - let result = new Long(0); - let i = 0; - while (true) { - const curr = dataview.getUint8(i); - result = or( - result, - leftshift(new Long(curr & 0b1111111), i * 7), - ); - ++i; - if (curr >>> 7) continue; - return [i, result]; - } -} - -function or(a: Long, b: Long): Long { - return new Long(a[0] | b[0], a[1] | b[1]); -} - -function leftshift(a: Long, count: number): Long { - if (count === 0) return a; - if (count >= 32) return new Long(0, a[0] << (count - 32)); - return new Long( - a[0] << count, - (a[1] << count) | (a[0] >>> (32 - count)), - ); -} diff --git a/src/proto/generated/runtime/wire/zigzag.ts b/src/proto/generated/runtime/wire/zigzag.ts deleted file mode 100644 index 83bd543280..0000000000 --- a/src/proto/generated/runtime/wire/zigzag.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Long from "../Long.js"; - -export function encode(value: T): T { - if (value instanceof Long) { - const l = new Long( - value[0] << 1, - (value[1] << 1) | (value[0] >>> 31), - ); - const r = value[1] >>> 31 ? new Long(0xFFFFFFFF, 0xFFFFFFFF) : new Long(); - return new Long(l[0] ^ r[0], l[1] ^ r[1]) as T; - } - return (((value as number) * 2) ^ ((value as number) >> 31)) >>> 0 as T; -} - -export function decode(value: T): T { - if (value instanceof Long) { - const l = new Long((value[0] >>> 1) | (value[1] << 31), (value[1]) >>> 1); - const r = value[0] & 1 ? new Long(0xFFFFFFFF, 0xFFFFFFFF) : new Long(); - return new Long(l[0] ^ r[0], l[1] ^ r[1]) as T; - } - return (((value as number) >>> 1) ^ -((value as number) & 1)) as T; -} diff --git a/src/proto/index.ts b/src/proto/index.ts deleted file mode 100644 index 33c103e583..0000000000 --- a/src/proto/index.ts +++ /dev/null @@ -1,376 +0,0 @@ -import { CLIENTS } from '../utils/Constants.js'; -import { base64ToU8, u8ToBase64 } from '../utils/Utils.js'; -import type { UpdateVideoMetadataOptions } from '../types/index.js'; - -import * as VisitorData from './generated/messages/youtube/VisitorData.js'; -import * as ChannelAnalytics from './generated/messages/youtube/ChannelAnalytics.js'; -import * as SearchFilter from './generated/messages/youtube/SearchFilter.js'; -import type * as SearchFilter_Filters from './generated/messages/youtube/(SearchFilter)/Filters.js'; -import * as MusicSearchFilter from './generated/messages/youtube/MusicSearchFilter.js'; -import * as LiveMessageParams from './generated/messages/youtube/LiveMessageParams.js'; -import * as GetCommentsSectionParams from './generated/messages/youtube/GetCommentsSectionParams.js'; -import * as CreateCommentParams from './generated/messages/youtube/CreateCommentParams.js'; -import * as PeformCommentActionParams from './generated/messages/youtube/PeformCommentActionParams.js'; -import * as NotificationPreferences from './generated/messages/youtube/NotificationPreferences.js'; -import * as InnertubePayload from './generated/messages/youtube/InnertubePayload.js'; -import * as Hashtag from './generated/messages/youtube/Hashtag.js'; -import * as ReelSequence from './generated/messages/youtube/ReelSequence.js'; -import * as ShortsParam from './generated/messages/youtube/ShortsParam.js'; - -export function encodeVisitorData(id: string, timestamp: number): string { - const buf = VisitorData.encodeBinary({ id, timestamp }); - return encodeURIComponent(u8ToBase64(buf).replace(/\+/g, '-').replace(/\//g, '_')); -} - -export function decodeVisitorData(visitor_data: string): VisitorData.Type { - const data = VisitorData.decodeBinary(base64ToU8(decodeURIComponent(visitor_data).replace(/-/g, '+').replace(/_/g, '/'))); - return data; -} - -export function encodeChannelAnalyticsParams(channel_id: string): string { - const buf = ChannelAnalytics.encodeBinary({ - params: { - channelId: channel_id - } - }); - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeSearchFilters(filters: { - upload_date?: 'all' | 'hour' | 'today' | 'week' | 'month' | 'year', - type?: 'all' | 'video' | 'channel' | 'playlist' | 'movie', - duration?: 'all' | 'short' | 'medium' | 'long', - sort_by?: 'relevance' | 'rating' | 'upload_date' | 'view_count', - features?: ('hd' | 'subtitles' | 'creative_commons' | '3d' | 'live' | 'purchased' | '4k' | '360' | 'location' | 'hdr' | 'vr180')[] -}): string { - const upload_date = { - all: undefined, - hour: 1, - today: 2, - week: 3, - month: 4, - year: 5 - }; - - const type = { - all: undefined, - video: 1, - channel: 2, - playlist: 3, - movie: 4 - }; - - const duration = { - all: undefined, - short: 1, - long: 2, - medium: 3 - }; - - const order = { - relevance: undefined, - rating: 1, - upload_date: 2, - view_count: 3 - }; - - const features = { - hd: 'featuresHd', - subtitles: 'featuresSubtitles', - creative_commons: 'featuresCreativeCommons', - '3d': 'features3D', - live: 'featuresLive', - purchased: 'featuresPurchased', - '4k': 'features4K', - '360': 'features360', - location: 'featuresLocation', - hdr: 'featuresHdr', - vr180: 'featuresVr180' - }; - - const data: SearchFilter.Type = {}; - - if (filters) - data.filters = {}; - else - data.noFilter = 0; - - if (data.filters) { - if (filters.upload_date) { - data.filters.uploadDate = upload_date[filters.upload_date]; - } - - if (filters.type) { - data.filters.type = type[filters.type]; - } - - if (filters.duration) { - data.filters.duration = duration[filters.duration]; - } - - if (filters.sort_by && filters.sort_by !== 'relevance') { - data.sortBy = order[filters.sort_by]; - } - - if (filters.features) { - for (const feature of filters.features) { - data.filters[features[feature] as keyof SearchFilter_Filters.Type] = 1; - } - } - } - - const buf = SearchFilter.encodeBinary(data); - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeMusicSearchFilters(filters: { - type?: 'all' | 'song' | 'video' | 'album' | 'playlist' | 'artist' -}): string { - const data: MusicSearchFilter.Type = { - filters: { - type: {} - } - }; - - // TODO: See protobuf definition (protoc doesn't allow zero index: optional int32 all = 0;) - if (filters.type && filters.type !== 'all' && data.filters?.type) - data.filters.type[filters.type] = 1; - - const buf = MusicSearchFilter.encodeBinary(data); - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeMessageParams(channel_id: string, video_id: string): string { - const buf = LiveMessageParams.encodeBinary({ - params: { - ids: { - channelId: channel_id, videoId: video_id - } - }, - number0: 1, number1: 4 - }); - - return btoa(encodeURIComponent(u8ToBase64(buf))); -} - -export function encodeCommentsSectionParams(video_id: string, options: { - type?: number, - sort_by?: 'TOP_COMMENTS' | 'NEWEST_FIRST', - comment_id?: string -} = {}): string { - const sort_options = { - TOP_COMMENTS: 0, - NEWEST_FIRST: 1 - }; - - const buf = GetCommentsSectionParams.encodeBinary({ - ctx: { - videoId: video_id - }, - unkParam: 6, - params: { - opts: { - videoId: video_id, - sortBy: sort_options[options.sort_by || 'TOP_COMMENTS'], - type: options.type || 2, - commentId: options.comment_id || '' - }, - target: 'comments-section' - } - }); - - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeCommentParams(video_id: string): string { - const buf = CreateCommentParams.encodeBinary({ - videoId: video_id, - params: { - index: 0 - }, - number: 7 - }); - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeCommentActionParams(type: number, args: { - comment_id?: string, - video_id?: string, - text?: string, - target_language?: string -} = {}): string { - const data: PeformCommentActionParams.Type = { - type, - commentId: args.comment_id || ' ', - videoId: args.video_id || ' ', - channelId: ' ', - unkNum: 2 - }; - - if (args.hasOwnProperty('text')) { - if (typeof args.target_language !== 'string') - throw new Error('target_language must be a string'); - - if (args.comment_id) - delete data.unkNum; - - data.translateCommentParams = { - params: { - comment: { - text: args.text as string - } - }, - commentId: args.comment_id || ' ', - targetLanguage: args.target_language - }; - } - - const buf = PeformCommentActionParams.encodeBinary(data); - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeNotificationPref(channel_id: string, index: number): string { - const buf = NotificationPreferences.encodeBinary({ - channelId: channel_id, - prefId: { - index - }, - number0: 0, number1: 4 - }); - - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeVideoMetadataPayload(video_id: string, metadata: UpdateVideoMetadataOptions): Uint8Array { - const data: InnertubePayload.Type = { - context: { - client: { - nameId: 3, - osName: 'Android', - androidSdkVersion: CLIENTS.ANDROID.SDK_VERSION, - osVersion: '13', - acceptLanguage: 'en-US', - acceptRegion: 'US', - deviceMake: 'Google', - deviceModel: 'sdk_gphone64_x86_64', - windowHeightPoints: 840, - windowWidthPoints: 432, - clientVersion: CLIENTS.ANDROID.VERSION - } - }, - videoId: video_id - }; - - if (Reflect.has(metadata, 'title')) - data.title = { text: metadata.title || '' }; - - if (Reflect.has(metadata, 'description')) - data.description = { text: metadata.description || '' }; - - if (Reflect.has(metadata, 'license')) - data.license = { type: metadata.license || '' }; - - if (Reflect.has(metadata, 'tags')) - data.tags = { list: metadata.tags || [] }; - - if (Reflect.has(metadata, 'category')) - data.category = { id: metadata.category || 0 }; - - if (Reflect.has(metadata, 'privacy')) { - switch (metadata.privacy) { - case 'PUBLIC': - data.privacy = { type: 1 }; - break; - case 'UNLISTED': - data.privacy = { type: 2 }; - break; - case 'PRIVATE': - data.privacy = { type: 3 }; - break; - default: - throw new Error('Invalid visibility option'); - } - } - - if (Reflect.has(metadata, 'made_for_kids')) { - data.madeForKids = { - unkparam: 1, - choice: metadata.made_for_kids ? 1 : 2 - }; - } - - if (Reflect.has(metadata, 'age_restricted')) { - data.ageRestricted = { - unkparam: 1, - choice: metadata.age_restricted ? 1 : 2 - }; - } - - const buf = InnertubePayload.encodeBinary(data); - - return buf; -} - -export function encodeCustomThumbnailPayload(video_id: string, bytes: Uint8Array): Uint8Array { - const data: InnertubePayload.Type = { - context: { - client: { - nameId: 3, - osName: 'Android', - androidSdkVersion: CLIENTS.ANDROID.SDK_VERSION, - osVersion: '13', - acceptLanguage: 'en-US', - acceptRegion: 'US', - deviceMake: 'Google', - deviceModel: 'sdk_gphone64_x86_64', - windowHeightPoints: 840, - windowWidthPoints: 432, - clientVersion: CLIENTS.ANDROID.VERSION - } - }, - videoId: video_id, - videoThumbnail: { - type: 3, - thumbnail: { - imageData: bytes - } - } - }; - - const buf = InnertubePayload.encodeBinary(data); - - return buf; -} - -export function encodeHashtag(hashtag: string): string { - const buf = Hashtag.encodeBinary({ - params: { - hashtag, - type: 1 - } - }); - - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeReelSequence(short_id: string): string { - const buf = ReelSequence.encodeBinary({ - shortId: short_id, - params: { - number: 5 - }, - feature2: 25, - feature3: 0 - }); - return encodeURIComponent(u8ToBase64(buf)); -} - -export function encodeShortsParam() { - const buf = ShortsParam.encodeBinary({ - f1: { - p1: 1 - }, - p59: 1 - }); - return encodeURIComponent(u8ToBase64(buf)); -} \ No newline at end of file diff --git a/src/proto/youtube.proto b/src/proto/youtube.proto deleted file mode 100644 index ffb795a784..0000000000 --- a/src/proto/youtube.proto +++ /dev/null @@ -1,294 +0,0 @@ -// TODO: clean this up - -syntax = "proto2"; -package youtube; - -message VisitorData { - required string id = 1; - required int32 timestamp = 5; -} - -message InnertubePayload { - message Context { - message Client { - string deviceMake = 12; - string deviceModel = 13; - int32 nameId = 16; - string clientVersion = 17; - string osName = 18; - string osVersion = 19; - string acceptLanguage = 21; - string acceptRegion = 22; - int32 windowWidthPoints = 37; - int32 windowHeightPoints = 38; - int32 androidSdkVersion = 34; - } - required Client client = 1; - } - - required Context context = 1; - - optional string videoId = 2; - - /**** YT Sudio stuff ****/ - - message Title { - required string text = 1; - } - - optional Title title = 3; - - message Description { - required string text = 1; - } - - optional Description description = 4; - - message Tags { - repeated string list = 1; - } - - optional Tags tags = 6; - - message Privacy { - required int32 type = 1; - } - - optional Privacy privacy = 38; - - message Category { - required int32 id = 1; - } - - optional Category category = 7; - - message MadeForKids { - required int32 unkparam = 1; - required int32 choice = 2; - } - - optional MadeForKids made_for_kids = 68; - - message AgeRestricted { - required int32 unkparam = 1; - required int32 choice = 2; - } - - optional AgeRestricted age_restricted = 69; - - message License { - required string type = 1; - } - - optional License license = 8; - - message VideoThumbnail { - required int32 type = 1; // is this something else? - - message Thumbnail { - required bytes image_data = 1; - } - - required Thumbnail thumbnail = 3; - } - - optional VideoThumbnail video_thumbnail = 20; -} - -message ChannelAnalytics { - message Params { - required string channel_id = 1001; - } - - required Params params = 32; -} - -message SoundInfoParams { - message Sound { - message Params { - message Ids { - required string id_1 = 1; - required string id_2 = 2; - required string id_3 = 3; - } - required Ids ids = 2; - } - required Params params = 1; - } - - required Sound sound = 94; -} - -message NotificationPreferences { - required string channel_id = 1; - - message Preference { - required int32 index = 1; - } - - required Preference pref_id = 2; - - optional int32 number_0 = 3; - optional int32 number_1 = 4; -} - -message LiveMessageParams { - message Params { - message Ids { - required string channel_id = 1; - required string video_id = 2; - } - required Ids ids = 5; - } - - required Params params = 1; - - optional int32 number_0 = 2; - optional int32 number_1 = 3; -} - -message GetCommentsSectionParams { - message Context { - required string video_id = 2; - } - required Context ctx = 2; - - required int32 unk_param = 3; - - message Params { - optional string unk_token = 1; - - message Options { - required string video_id = 4; - required int32 sort_by = 6; - required int32 type = 15; - optional string comment_id = 16; - } - - message RepliesOptions { - required string comment_id = 2; - - message UnkOpts { - required int32 unk_param = 1; - } - required UnkOpts unkopts = 4; - - optional string channel_id = 5; - required string video_id = 6; - - required int32 unk_param_1 = 8; - required int32 unk_param_2 = 9; - } - - optional Options opts = 4; - optional RepliesOptions replies_opts = 3; - - optional int32 page = 5; - required string target = 8; - } - - required Params params = 6; -} - -message CreateCommentParams { - required string video_id = 2; - message Params { - required int32 index = 1; - } - required Params params = 5; - required int32 number = 10; -} - -message PeformCommentActionParams { - required int32 type = 1; - required string comment_id = 3; - required string video_id = 5; - - optional int32 unk_num = 2; - optional string channel_id = 23; - - message TranslateCommentParams { - message Params { - message Comment { - required string text = 1; - } - required Comment comment = 1; - } - required Params params = 3; - - required string comment_id = 2; - required string target_language = 4; - } - - optional TranslateCommentParams translate_comment_params = 31; -} - -message MusicSearchFilter { - message Filters { - message Type { - // TODO: protoc doesn't allow zero index: optional int32 all = 0; - optional int32 song = 1; - optional int32 video = 2; - optional int32 album = 3; - optional int32 artist = 4; - optional int32 playlist = 5; - } - - optional Type type = 17; - } - - optional Filters filters = 2; -} - -message SearchFilter { - optional int32 sort_by = 1; - optional int32 no_filter = 19; - - message Filters { - optional int32 upload_date = 1; - optional int32 type = 2; - optional int32 duration = 3; - - optional int32 features_hd = 4; - optional int32 features_subtitles = 5; - optional int32 features_creative_commons = 6; - optional int32 features_3d = 7; - optional int32 features_live = 8; - optional int32 features_purchased = 9; - optional int32 features_4k = 14; - optional int32 features_360 = 15; - optional int32 features_location = 23; - optional int32 features_hdr = 25; - optional int32 features_vr180 = 26; - } - - optional Filters filters = 2; -} - -message Hashtag { - message Params { - required string hashtag = 1; - required int32 type = 3; - } - - required Params params = 93; -} - -message ReelSequence { - required string short_id = 1; - message Params { - required int32 number = 3; - } - - required Params params = 5; - required int32 feature_2 = 10; - required int32 feature_3 = 13; -} - -message ShortsParam { - message Field1 { - int32 p1 = 1; - } - Field1 f1 = 1; - int32 p59 = 59; -} \ No newline at end of file diff --git a/src/types/Misc.ts b/src/types/Misc.ts index 3bf926e78f..4a82d520ac 100644 --- a/src/types/Misc.ts +++ b/src/types/Misc.ts @@ -25,6 +25,7 @@ export type UpdateVideoMetadataOptions = Partial<{ license: string; age_restricted: boolean; made_for_kids: boolean; + thumbnail: Uint8Array; privacy: 'PUBLIC' | 'PRIVATE' | 'UNLISTED'; }>; diff --git a/src/utils/ProtoUtils.ts b/src/utils/ProtoUtils.ts new file mode 100644 index 0000000000..2bae974baf --- /dev/null +++ b/src/utils/ProtoUtils.ts @@ -0,0 +1,48 @@ +import { base64ToU8, u8ToBase64 } from './Utils.js'; +import { VisitorData, PeformCommentActionParams } from '../../protos/generated/misc/params.js'; + +export function encodeVisitorData(id: string, timestamp: number): string { + const writer = VisitorData.encode({ id, timestamp }); + return encodeURIComponent(u8ToBase64(writer.finish()).replace(/\+/g, '-').replace(/\//g, '_')); +} + +export function decodeVisitorData(visitor_data: string): VisitorData { + const data = VisitorData.decode(base64ToU8(decodeURIComponent(visitor_data).replace(/-/g, '+').replace(/_/g, '/'))); + return data; +} + +export function encodeCommentActionParams(type: number, args: { + comment_id?: string, + video_id?: string, + text?: string, + target_language?: string +} = {}): string { + const data: PeformCommentActionParams = { + type, + commentId: args.comment_id || ' ', + videoId: args.video_id || ' ', + channelId: ' ', + unkNum: 2 + }; + + if (args.hasOwnProperty('text')) { + if (typeof args.target_language !== 'string') + throw new Error('target_language must be a string'); + + if (args.comment_id) + delete data.unkNum; + + data.translateCommentParams = { + params: { + comment: { + text: args.text as string + } + }, + commentId: args.comment_id || ' ', + targetLanguage: args.target_language + }; + } + + const writer = PeformCommentActionParams.encode(data); + return encodeURIComponent(u8ToBase64(writer.finish())); +} \ No newline at end of file diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 435ecd8699..9aceda39e2 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -234,7 +234,9 @@ export function u8ToBase64(u8: Uint8Array): string { } export function base64ToU8(base64: string): Uint8Array { - return new Uint8Array(atob(base64).split('').map((char) => char.charCodeAt(0))); + const standard_base64 = base64.replace(/-/g, '+').replace(/_/g, '/'); + const padded_base64 = standard_base64.padEnd(standard_base64.length + (4 - standard_base64.length % 4) % 4, '='); + return new Uint8Array(atob(padded_base64).split('').map((char) => char.charCodeAt(0))); } export function isTextRun(run: TextRun | EmojiRun): run is TextRun { diff --git a/src/utils/index.ts b/src/utils/index.ts index b324a14dd8..7394f22f8c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -15,5 +15,7 @@ export * as Utils from './Utils.js'; export { default as Log } from './Log.js'; export * as LZW from './LZW.js'; +export * as ProtoUtils from './ProtoUtils.js'; + export { default as UMP } from './UMP.js'; export * from './UMP.js'; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 8fe3c3cee8..d3faf64d8e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "lib": ["ESNext", "DOM", "DOM.Iterable"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ "jsx": "react", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -47,7 +47,7 @@ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ // "declarationMap": true, /* Create sourcemaps for d.ts files. */ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ "outDir": "./dist", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ @@ -104,6 +104,7 @@ ] }, "include": [ - "src/**/*" + "src/**/*", + "protos/generated" ], }