// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.7.7 // protoc v3.19.6 // source: popular_tanks.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; export const protobufPackage = "blitzkit"; export interface PopularTanks { tanks: PopularTank[]; } export interface PopularTank { id: number; /** views in the last 7 days */ views: number; } function createBasePopularTanks(): PopularTanks { return { tanks: [] }; } export const PopularTanks: MessageFns = { encode(message: PopularTanks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { for (const v of message.tanks) { PopularTank.encode(v!, writer.uint32(10).fork()).join(); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): PopularTanks { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBasePopularTanks(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.tanks.push(PopularTank.decode(reader, reader.uint32())); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): PopularTanks { return { tanks: globalThis.Array.isArray(object?.tanks) ? object.tanks.map((e: any) => PopularTank.fromJSON(e)) : [], }; }, toJSON(message: PopularTanks): unknown { const obj: any = {}; if (message.tanks?.length) { obj.tanks = message.tanks.map((e) => PopularTank.toJSON(e)); } return obj; }, create, I>>(base?: I): PopularTanks { return PopularTanks.fromPartial(base ?? ({} as any)); }, fromPartial, I>>(object: I): PopularTanks { const message = createBasePopularTanks(); message.tanks = object.tanks?.map((e) => PopularTank.fromPartial(e)) || []; return message; }, }; function createBasePopularTank(): PopularTank { return { id: 0, views: 0 }; } export const PopularTank: MessageFns = { encode(message: PopularTank, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { if (message.id !== 0) { writer.uint32(8).uint32(message.id); } if (message.views !== 0) { writer.uint32(16).uint32(message.views); } return writer; }, decode(input: BinaryReader | Uint8Array, length?: number): PopularTank { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBasePopularTank(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.id = reader.uint32(); continue; } case 2: { if (tag !== 16) { break; } message.views = reader.uint32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object: any): PopularTank { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, views: isSet(object.views) ? globalThis.Number(object.views) : 0, }; }, toJSON(message: PopularTank): unknown { const obj: any = {}; if (message.id !== 0) { obj.id = Math.round(message.id); } if (message.views !== 0) { obj.views = Math.round(message.views); } return obj; }, create, I>>(base?: I): PopularTank { return PopularTank.fromPartial(base ?? ({} as any)); }, fromPartial, I>>(object: I): PopularTank { const message = createBasePopularTank(); message.id = object.id ?? 0; message.views = object.views ?? 0; return message; }, }; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial } : 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; }