mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
183 lines
5.3 KiB
TypeScript
183 lines
5.3 KiB
TypeScript
// 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<PopularTanks> = {
|
|
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 extends Exact<DeepPartial<PopularTanks>, I>>(base?: I): PopularTanks {
|
|
return PopularTanks.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<PopularTanks>, 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<PopularTank> = {
|
|
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 extends Exact<DeepPartial<PopularTank>, I>>(base?: I): PopularTank {
|
|
return PopularTank.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<PopularTank>, 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> = T extends Builtin ? T
|
|
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
|
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
: Partial<T>;
|
|
|
|
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
|
|
function isSet(value: any): boolean {
|
|
return value !== null && value !== undefined;
|
|
}
|
|
|
|
export interface MessageFns<T> {
|
|
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
fromJSON(object: any): T;
|
|
toJSON(message: T): unknown;
|
|
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
}
|