game_list/frontend/items.ts
2025-11-29 12:03:05 +01:00

444 lines
12 KiB
TypeScript

// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.8.3
// protoc v6.33.1
// source: items.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "items";
export enum Source {
STEAM = 0,
ROBLOX = 1,
UNRECOGNIZED = -1,
}
export function sourceFromJSON(object: any): Source {
switch (object) {
case 0:
case "STEAM":
return Source.STEAM;
case 1:
case "ROBLOX":
return Source.ROBLOX;
case -1:
case "UNRECOGNIZED":
default:
return Source.UNRECOGNIZED;
}
}
export function sourceToJSON(object: Source): string {
switch (object) {
case Source.STEAM:
return "STEAM";
case Source.ROBLOX:
return "ROBLOX";
case Source.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
export interface Person {
name: string;
opinion: Opinion[];
}
export interface Opinion {
game: Game | undefined;
wouldPlay: boolean;
}
export interface Game {
title: string;
source: Source;
multiplayer: boolean;
minPlayers: number;
maxPlayers: number;
price: number;
}
export interface PersonList {
person: Person[];
}
function createBasePerson(): Person {
return { name: "", opinion: [] };
}
export const Person: MessageFns<Person> = {
encode(message: Person, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
for (const v of message.opinion) {
Opinion.encode(v!, writer.uint32(18).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Person {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePerson();
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.opinion.push(Opinion.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Person {
return {
name: isSet(object.name) ? globalThis.String(object.name) : "",
opinion: globalThis.Array.isArray(object?.opinion) ? object.opinion.map((e: any) => Opinion.fromJSON(e)) : [],
};
},
toJSON(message: Person): unknown {
const obj: any = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.opinion?.length) {
obj.opinion = message.opinion.map((e) => Opinion.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<Person>, I>>(base?: I): Person {
return Person.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Person>, I>>(object: I): Person {
const message = createBasePerson();
message.name = object.name ?? "";
message.opinion = object.opinion?.map((e) => Opinion.fromPartial(e)) || [];
return message;
},
};
function createBaseOpinion(): Opinion {
return { game: undefined, wouldPlay: false };
}
export const Opinion: MessageFns<Opinion> = {
encode(message: Opinion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.game !== undefined) {
Game.encode(message.game, writer.uint32(10).fork()).join();
}
if (message.wouldPlay !== false) {
writer.uint32(16).bool(message.wouldPlay);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Opinion {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOpinion();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.game = Game.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.wouldPlay = reader.bool();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Opinion {
return {
game: isSet(object.game) ? Game.fromJSON(object.game) : undefined,
wouldPlay: isSet(object.wouldPlay) ? globalThis.Boolean(object.wouldPlay) : false,
};
},
toJSON(message: Opinion): unknown {
const obj: any = {};
if (message.game !== undefined) {
obj.game = Game.toJSON(message.game);
}
if (message.wouldPlay !== false) {
obj.wouldPlay = message.wouldPlay;
}
return obj;
},
create<I extends Exact<DeepPartial<Opinion>, I>>(base?: I): Opinion {
return Opinion.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Opinion>, I>>(object: I): Opinion {
const message = createBaseOpinion();
message.game = (object.game !== undefined && object.game !== null) ? Game.fromPartial(object.game) : undefined;
message.wouldPlay = object.wouldPlay ?? false;
return message;
},
};
function createBaseGame(): Game {
return { title: "", source: 0, multiplayer: false, minPlayers: 0, maxPlayers: 0, price: 0 };
}
export const Game: MessageFns<Game> = {
encode(message: Game, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.title !== "") {
writer.uint32(10).string(message.title);
}
if (message.source !== 0) {
writer.uint32(16).int32(message.source);
}
if (message.multiplayer !== false) {
writer.uint32(24).bool(message.multiplayer);
}
if (message.minPlayers !== 0) {
writer.uint32(32).uint32(message.minPlayers);
}
if (message.maxPlayers !== 0) {
writer.uint32(40).uint32(message.maxPlayers);
}
if (message.price !== 0) {
writer.uint32(48).uint32(message.price);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): Game {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGame();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.title = reader.string();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.source = reader.int32() as any;
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.multiplayer = reader.bool();
continue;
}
case 4: {
if (tag !== 32) {
break;
}
message.minPlayers = reader.uint32();
continue;
}
case 5: {
if (tag !== 40) {
break;
}
message.maxPlayers = reader.uint32();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.price = reader.uint32();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): Game {
return {
title: isSet(object.title) ? globalThis.String(object.title) : "",
source: isSet(object.source) ? sourceFromJSON(object.source) : 0,
multiplayer: isSet(object.multiplayer) ? globalThis.Boolean(object.multiplayer) : false,
minPlayers: isSet(object.minPlayers) ? globalThis.Number(object.minPlayers) : 0,
maxPlayers: isSet(object.maxPlayers) ? globalThis.Number(object.maxPlayers) : 0,
price: isSet(object.price) ? globalThis.Number(object.price) : 0,
};
},
toJSON(message: Game): unknown {
const obj: any = {};
if (message.title !== "") {
obj.title = message.title;
}
if (message.source !== 0) {
obj.source = sourceToJSON(message.source);
}
if (message.multiplayer !== false) {
obj.multiplayer = message.multiplayer;
}
if (message.minPlayers !== 0) {
obj.minPlayers = Math.round(message.minPlayers);
}
if (message.maxPlayers !== 0) {
obj.maxPlayers = Math.round(message.maxPlayers);
}
if (message.price !== 0) {
obj.price = Math.round(message.price);
}
return obj;
},
create<I extends Exact<DeepPartial<Game>, I>>(base?: I): Game {
return Game.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<Game>, I>>(object: I): Game {
const message = createBaseGame();
message.title = object.title ?? "";
message.source = object.source ?? 0;
message.multiplayer = object.multiplayer ?? false;
message.minPlayers = object.minPlayers ?? 0;
message.maxPlayers = object.maxPlayers ?? 0;
message.price = object.price ?? 0;
return message;
},
};
function createBasePersonList(): PersonList {
return { person: [] };
}
export const PersonList: MessageFns<PersonList> = {
encode(message: PersonList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
for (const v of message.person) {
Person.encode(v!, writer.uint32(10).fork()).join();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): PersonList {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePersonList();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.person.push(Person.decode(reader, reader.uint32()));
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): PersonList {
return {
person: globalThis.Array.isArray(object?.person) ? object.person.map((e: any) => Person.fromJSON(e)) : [],
};
},
toJSON(message: PersonList): unknown {
const obj: any = {};
if (message.person?.length) {
obj.person = message.person.map((e) => Person.toJSON(e));
}
return obj;
},
create<I extends Exact<DeepPartial<PersonList>, I>>(base?: I): PersonList {
return PersonList.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<PersonList>, I>>(object: I): PersonList {
const message = createBasePersonList();
message.person = object.person?.map((e) => Person.fromPartial(e)) || [];
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 {} ? { [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;
}