Files
blitzkit/packages/core/src/protos/tank.ts
T
2025-03-05 09:52:09 -06:00

146 lines
4.1 KiB
TypeScript

// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.2.2
// protoc v5.28.2
// source: packages/core/src/protos/tank.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { I18n } from "./i18n";
export const protobufPackage = "blitzkit";
export interface Tank {
id: string;
slug: string;
name: I18n;
}
function createBaseTank(): Tank {
return { id: "", slug: "", name: createBaseI18n() };
}
export const Tank: MessageFns<Tank> = {
encode(message: Tank, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.id !== "") {
writer.uint32(10).string(message.id);
}
if (message.slug !== "") {
writer.uint32(18).string(message.slug);
}
if (message.name !== undefined) {
I18n.encode(message.name, writer.uint32(26).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Tank {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTank();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.id = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.slug = reader.string();
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.name = I18n.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Tank {
return {
id: globalThis.String(assertSet("Tank.id", object.id)),
slug: globalThis.String(assertSet("Tank.slug", object.slug)),
name: I18n.fromJSON(assertSet("Tank.name", object.name)),
};
},
toJSON(message: Tank): unknown {
const obj: any = {};
if (message.id !== "") {
obj.id = message.id;
}
if (message.slug !== "") {
obj.slug = message.slug;
}
if (message.name !== undefined) {
obj.name = I18n.toJSON(message.name);
}
return obj;
},
create<I extends Exact<DeepPartial<Tank>, I>>(base?: I): Tank {
return Tank.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Tank>, I>>(object: I): Tank {
const message = createBaseTank();
message.id = object.id ?? "";
message.slug = object.slug ?? "";
message.name = (object.name !== undefined && object.name !== null)
? I18n.fromPartial(object.name)
: createBaseI18n();
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;
}
function assertSet<T>(field: string, value: T | undefined): T {
if (!isSet(value)) {
throw new TypeError(`Required field ${field} is not set`);
}
return value as T;
}
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;
}