1291 lines
36 KiB
TypeScript
1291 lines
36 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 {
|
|
title: string;
|
|
wouldPlay: boolean;
|
|
}
|
|
|
|
export interface Game {
|
|
title: string;
|
|
source: Source;
|
|
multiplayer: boolean;
|
|
minPlayers: number;
|
|
maxPlayers: number;
|
|
price: number;
|
|
remoteId: number;
|
|
}
|
|
|
|
export interface PersonList {
|
|
person: Person[];
|
|
}
|
|
|
|
export interface GameList {
|
|
games: Game[];
|
|
}
|
|
|
|
/** Authentication messages */
|
|
export interface LoginRequest {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export interface LoginResponse {
|
|
token: string;
|
|
success: boolean;
|
|
message: string;
|
|
}
|
|
|
|
export interface LogoutRequest {
|
|
token: string;
|
|
}
|
|
|
|
export interface LogoutResponse {
|
|
success: boolean;
|
|
message: string;
|
|
}
|
|
|
|
export interface AuthStatusRequest {
|
|
token: string;
|
|
}
|
|
|
|
export interface AuthStatusResponse {
|
|
authenticated: boolean;
|
|
username: string;
|
|
message: string;
|
|
}
|
|
|
|
export interface GameRequest {
|
|
title: string;
|
|
}
|
|
|
|
export interface GetGamesRequest {
|
|
}
|
|
|
|
export interface AddOpinionRequest {
|
|
gameTitle: string;
|
|
wouldPlay: boolean;
|
|
}
|
|
|
|
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 { title: "", wouldPlay: false };
|
|
}
|
|
|
|
export const Opinion: MessageFns<Opinion> = {
|
|
encode(message: Opinion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.title !== "") {
|
|
writer.uint32(10).string(message.title);
|
|
}
|
|
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.title = reader.string();
|
|
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 {
|
|
title: isSet(object.title) ? globalThis.String(object.title) : "",
|
|
wouldPlay: isSet(object.wouldPlay) ? globalThis.Boolean(object.wouldPlay) : false,
|
|
};
|
|
},
|
|
|
|
toJSON(message: Opinion): unknown {
|
|
const obj: any = {};
|
|
if (message.title !== "") {
|
|
obj.title = message.title;
|
|
}
|
|
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.title = object.title ?? "";
|
|
message.wouldPlay = object.wouldPlay ?? false;
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseGame(): Game {
|
|
return { title: "", source: 0, multiplayer: false, minPlayers: 0, maxPlayers: 0, price: 0, remoteId: 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);
|
|
}
|
|
if (message.remoteId !== 0) {
|
|
writer.uint32(56).uint64(message.remoteId);
|
|
}
|
|
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;
|
|
}
|
|
case 7: {
|
|
if (tag !== 56) {
|
|
break;
|
|
}
|
|
|
|
message.remoteId = longToNumber(reader.uint64());
|
|
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,
|
|
remoteId: isSet(object.remoteId) ? globalThis.Number(object.remoteId) : 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);
|
|
}
|
|
if (message.remoteId !== 0) {
|
|
obj.remoteId = Math.round(message.remoteId);
|
|
}
|
|
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;
|
|
message.remoteId = object.remoteId ?? 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;
|
|
},
|
|
};
|
|
|
|
function createBaseGameList(): GameList {
|
|
return { games: [] };
|
|
}
|
|
|
|
export const GameList: MessageFns<GameList> = {
|
|
encode(message: GameList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
for (const v of message.games) {
|
|
Game.encode(v!, writer.uint32(10).fork()).join();
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): GameList {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseGameList();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 10) {
|
|
break;
|
|
}
|
|
|
|
message.games.push(Game.decode(reader, reader.uint32()));
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): GameList {
|
|
return { games: globalThis.Array.isArray(object?.games) ? object.games.map((e: any) => Game.fromJSON(e)) : [] };
|
|
},
|
|
|
|
toJSON(message: GameList): unknown {
|
|
const obj: any = {};
|
|
if (message.games?.length) {
|
|
obj.games = message.games.map((e) => Game.toJSON(e));
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<GameList>, I>>(base?: I): GameList {
|
|
return GameList.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<GameList>, I>>(object: I): GameList {
|
|
const message = createBaseGameList();
|
|
message.games = object.games?.map((e) => Game.fromPartial(e)) || [];
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseLoginRequest(): LoginRequest {
|
|
return { username: "", password: "" };
|
|
}
|
|
|
|
export const LoginRequest: MessageFns<LoginRequest> = {
|
|
encode(message: LoginRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.username !== "") {
|
|
writer.uint32(10).string(message.username);
|
|
}
|
|
if (message.password !== "") {
|
|
writer.uint32(18).string(message.password);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): LoginRequest {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseLoginRequest();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 10) {
|
|
break;
|
|
}
|
|
|
|
message.username = reader.string();
|
|
continue;
|
|
}
|
|
case 2: {
|
|
if (tag !== 18) {
|
|
break;
|
|
}
|
|
|
|
message.password = reader.string();
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): LoginRequest {
|
|
return {
|
|
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
|
password: isSet(object.password) ? globalThis.String(object.password) : "",
|
|
};
|
|
},
|
|
|
|
toJSON(message: LoginRequest): unknown {
|
|
const obj: any = {};
|
|
if (message.username !== "") {
|
|
obj.username = message.username;
|
|
}
|
|
if (message.password !== "") {
|
|
obj.password = message.password;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<LoginRequest>, I>>(base?: I): LoginRequest {
|
|
return LoginRequest.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<LoginRequest>, I>>(object: I): LoginRequest {
|
|
const message = createBaseLoginRequest();
|
|
message.username = object.username ?? "";
|
|
message.password = object.password ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseLoginResponse(): LoginResponse {
|
|
return { token: "", success: false, message: "" };
|
|
}
|
|
|
|
export const LoginResponse: MessageFns<LoginResponse> = {
|
|
encode(message: LoginResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.token !== "") {
|
|
writer.uint32(10).string(message.token);
|
|
}
|
|
if (message.success !== false) {
|
|
writer.uint32(16).bool(message.success);
|
|
}
|
|
if (message.message !== "") {
|
|
writer.uint32(26).string(message.message);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): LoginResponse {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseLoginResponse();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 10) {
|
|
break;
|
|
}
|
|
|
|
message.token = reader.string();
|
|
continue;
|
|
}
|
|
case 2: {
|
|
if (tag !== 16) {
|
|
break;
|
|
}
|
|
|
|
message.success = reader.bool();
|
|
continue;
|
|
}
|
|
case 3: {
|
|
if (tag !== 26) {
|
|
break;
|
|
}
|
|
|
|
message.message = reader.string();
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): LoginResponse {
|
|
return {
|
|
token: isSet(object.token) ? globalThis.String(object.token) : "",
|
|
success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
|
|
message: isSet(object.message) ? globalThis.String(object.message) : "",
|
|
};
|
|
},
|
|
|
|
toJSON(message: LoginResponse): unknown {
|
|
const obj: any = {};
|
|
if (message.token !== "") {
|
|
obj.token = message.token;
|
|
}
|
|
if (message.success !== false) {
|
|
obj.success = message.success;
|
|
}
|
|
if (message.message !== "") {
|
|
obj.message = message.message;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<LoginResponse>, I>>(base?: I): LoginResponse {
|
|
return LoginResponse.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<LoginResponse>, I>>(object: I): LoginResponse {
|
|
const message = createBaseLoginResponse();
|
|
message.token = object.token ?? "";
|
|
message.success = object.success ?? false;
|
|
message.message = object.message ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseLogoutRequest(): LogoutRequest {
|
|
return { token: "" };
|
|
}
|
|
|
|
export const LogoutRequest: MessageFns<LogoutRequest> = {
|
|
encode(message: LogoutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.token !== "") {
|
|
writer.uint32(10).string(message.token);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): LogoutRequest {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseLogoutRequest();
|
|
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): LogoutRequest {
|
|
return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
|
|
},
|
|
|
|
toJSON(message: LogoutRequest): unknown {
|
|
const obj: any = {};
|
|
if (message.token !== "") {
|
|
obj.token = message.token;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<LogoutRequest>, I>>(base?: I): LogoutRequest {
|
|
return LogoutRequest.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<LogoutRequest>, I>>(object: I): LogoutRequest {
|
|
const message = createBaseLogoutRequest();
|
|
message.token = object.token ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseLogoutResponse(): LogoutResponse {
|
|
return { success: false, message: "" };
|
|
}
|
|
|
|
export const LogoutResponse: MessageFns<LogoutResponse> = {
|
|
encode(message: LogoutResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.success !== false) {
|
|
writer.uint32(8).bool(message.success);
|
|
}
|
|
if (message.message !== "") {
|
|
writer.uint32(18).string(message.message);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): LogoutResponse {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseLogoutResponse();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 8) {
|
|
break;
|
|
}
|
|
|
|
message.success = reader.bool();
|
|
continue;
|
|
}
|
|
case 2: {
|
|
if (tag !== 18) {
|
|
break;
|
|
}
|
|
|
|
message.message = reader.string();
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): LogoutResponse {
|
|
return {
|
|
success: isSet(object.success) ? globalThis.Boolean(object.success) : false,
|
|
message: isSet(object.message) ? globalThis.String(object.message) : "",
|
|
};
|
|
},
|
|
|
|
toJSON(message: LogoutResponse): unknown {
|
|
const obj: any = {};
|
|
if (message.success !== false) {
|
|
obj.success = message.success;
|
|
}
|
|
if (message.message !== "") {
|
|
obj.message = message.message;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<LogoutResponse>, I>>(base?: I): LogoutResponse {
|
|
return LogoutResponse.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<LogoutResponse>, I>>(object: I): LogoutResponse {
|
|
const message = createBaseLogoutResponse();
|
|
message.success = object.success ?? false;
|
|
message.message = object.message ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseAuthStatusRequest(): AuthStatusRequest {
|
|
return { token: "" };
|
|
}
|
|
|
|
export const AuthStatusRequest: MessageFns<AuthStatusRequest> = {
|
|
encode(message: AuthStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.token !== "") {
|
|
writer.uint32(10).string(message.token);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): AuthStatusRequest {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseAuthStatusRequest();
|
|
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): AuthStatusRequest {
|
|
return { token: isSet(object.token) ? globalThis.String(object.token) : "" };
|
|
},
|
|
|
|
toJSON(message: AuthStatusRequest): unknown {
|
|
const obj: any = {};
|
|
if (message.token !== "") {
|
|
obj.token = message.token;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<AuthStatusRequest>, I>>(base?: I): AuthStatusRequest {
|
|
return AuthStatusRequest.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<AuthStatusRequest>, I>>(object: I): AuthStatusRequest {
|
|
const message = createBaseAuthStatusRequest();
|
|
message.token = object.token ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseAuthStatusResponse(): AuthStatusResponse {
|
|
return { authenticated: false, username: "", message: "" };
|
|
}
|
|
|
|
export const AuthStatusResponse: MessageFns<AuthStatusResponse> = {
|
|
encode(message: AuthStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.authenticated !== false) {
|
|
writer.uint32(8).bool(message.authenticated);
|
|
}
|
|
if (message.username !== "") {
|
|
writer.uint32(18).string(message.username);
|
|
}
|
|
if (message.message !== "") {
|
|
writer.uint32(26).string(message.message);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): AuthStatusResponse {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseAuthStatusResponse();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 8) {
|
|
break;
|
|
}
|
|
|
|
message.authenticated = reader.bool();
|
|
continue;
|
|
}
|
|
case 2: {
|
|
if (tag !== 18) {
|
|
break;
|
|
}
|
|
|
|
message.username = reader.string();
|
|
continue;
|
|
}
|
|
case 3: {
|
|
if (tag !== 26) {
|
|
break;
|
|
}
|
|
|
|
message.message = reader.string();
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): AuthStatusResponse {
|
|
return {
|
|
authenticated: isSet(object.authenticated) ? globalThis.Boolean(object.authenticated) : false,
|
|
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
|
message: isSet(object.message) ? globalThis.String(object.message) : "",
|
|
};
|
|
},
|
|
|
|
toJSON(message: AuthStatusResponse): unknown {
|
|
const obj: any = {};
|
|
if (message.authenticated !== false) {
|
|
obj.authenticated = message.authenticated;
|
|
}
|
|
if (message.username !== "") {
|
|
obj.username = message.username;
|
|
}
|
|
if (message.message !== "") {
|
|
obj.message = message.message;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<AuthStatusResponse>, I>>(base?: I): AuthStatusResponse {
|
|
return AuthStatusResponse.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<AuthStatusResponse>, I>>(object: I): AuthStatusResponse {
|
|
const message = createBaseAuthStatusResponse();
|
|
message.authenticated = object.authenticated ?? false;
|
|
message.username = object.username ?? "";
|
|
message.message = object.message ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseGameRequest(): GameRequest {
|
|
return { title: "" };
|
|
}
|
|
|
|
export const GameRequest: MessageFns<GameRequest> = {
|
|
encode(message: GameRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.title !== "") {
|
|
writer.uint32(10).string(message.title);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): GameRequest {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseGameRequest();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 10) {
|
|
break;
|
|
}
|
|
|
|
message.title = reader.string();
|
|
continue;
|
|
}
|
|
}
|
|
if ((tag & 7) === 4 || tag === 0) {
|
|
break;
|
|
}
|
|
reader.skip(tag & 7);
|
|
}
|
|
return message;
|
|
},
|
|
|
|
fromJSON(object: any): GameRequest {
|
|
return { title: isSet(object.title) ? globalThis.String(object.title) : "" };
|
|
},
|
|
|
|
toJSON(message: GameRequest): unknown {
|
|
const obj: any = {};
|
|
if (message.title !== "") {
|
|
obj.title = message.title;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<GameRequest>, I>>(base?: I): GameRequest {
|
|
return GameRequest.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<GameRequest>, I>>(object: I): GameRequest {
|
|
const message = createBaseGameRequest();
|
|
message.title = object.title ?? "";
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseGetGamesRequest(): GetGamesRequest {
|
|
return {};
|
|
}
|
|
|
|
export const GetGamesRequest: MessageFns<GetGamesRequest> = {
|
|
encode(_: GetGamesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): GetGamesRequest {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseGetGamesRequest();
|
|
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): GetGamesRequest {
|
|
return {};
|
|
},
|
|
|
|
toJSON(_: GetGamesRequest): unknown {
|
|
const obj: any = {};
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<GetGamesRequest>, I>>(base?: I): GetGamesRequest {
|
|
return GetGamesRequest.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<GetGamesRequest>, I>>(_: I): GetGamesRequest {
|
|
const message = createBaseGetGamesRequest();
|
|
return message;
|
|
},
|
|
};
|
|
|
|
function createBaseAddOpinionRequest(): AddOpinionRequest {
|
|
return { gameTitle: "", wouldPlay: false };
|
|
}
|
|
|
|
export const AddOpinionRequest: MessageFns<AddOpinionRequest> = {
|
|
encode(message: AddOpinionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
if (message.gameTitle !== "") {
|
|
writer.uint32(10).string(message.gameTitle);
|
|
}
|
|
if (message.wouldPlay !== false) {
|
|
writer.uint32(16).bool(message.wouldPlay);
|
|
}
|
|
return writer;
|
|
},
|
|
|
|
decode(input: BinaryReader | Uint8Array, length?: number): AddOpinionRequest {
|
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
const message = createBaseAddOpinionRequest();
|
|
while (reader.pos < end) {
|
|
const tag = reader.uint32();
|
|
switch (tag >>> 3) {
|
|
case 1: {
|
|
if (tag !== 10) {
|
|
break;
|
|
}
|
|
|
|
message.gameTitle = reader.string();
|
|
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): AddOpinionRequest {
|
|
return {
|
|
gameTitle: isSet(object.gameTitle) ? globalThis.String(object.gameTitle) : "",
|
|
wouldPlay: isSet(object.wouldPlay) ? globalThis.Boolean(object.wouldPlay) : false,
|
|
};
|
|
},
|
|
|
|
toJSON(message: AddOpinionRequest): unknown {
|
|
const obj: any = {};
|
|
if (message.gameTitle !== "") {
|
|
obj.gameTitle = message.gameTitle;
|
|
}
|
|
if (message.wouldPlay !== false) {
|
|
obj.wouldPlay = message.wouldPlay;
|
|
}
|
|
return obj;
|
|
},
|
|
|
|
create<I extends Exact<DeepPartial<AddOpinionRequest>, I>>(base?: I): AddOpinionRequest {
|
|
return AddOpinionRequest.fromPartial(base ?? ({} as any));
|
|
},
|
|
fromPartial<I extends Exact<DeepPartial<AddOpinionRequest>, I>>(object: I): AddOpinionRequest {
|
|
const message = createBaseAddOpinionRequest();
|
|
message.gameTitle = object.gameTitle ?? "";
|
|
message.wouldPlay = object.wouldPlay ?? false;
|
|
return message;
|
|
},
|
|
};
|
|
|
|
/** Authentication service */
|
|
export interface AuthService {
|
|
Login(request: LoginRequest): Promise<LoginResponse>;
|
|
Logout(request: LogoutRequest): Promise<LogoutResponse>;
|
|
GetAuthStatus(request: AuthStatusRequest): Promise<AuthStatusResponse>;
|
|
}
|
|
|
|
export const AuthServiceServiceName = "items.AuthService";
|
|
export class AuthServiceClientImpl implements AuthService {
|
|
private readonly rpc: Rpc;
|
|
private readonly service: string;
|
|
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
this.service = opts?.service || AuthServiceServiceName;
|
|
this.rpc = rpc;
|
|
this.Login = this.Login.bind(this);
|
|
this.Logout = this.Logout.bind(this);
|
|
this.GetAuthStatus = this.GetAuthStatus.bind(this);
|
|
}
|
|
Login(request: LoginRequest): Promise<LoginResponse> {
|
|
const data = LoginRequest.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "Login", data);
|
|
return promise.then((data) => LoginResponse.decode(new BinaryReader(data)));
|
|
}
|
|
|
|
Logout(request: LogoutRequest): Promise<LogoutResponse> {
|
|
const data = LogoutRequest.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "Logout", data);
|
|
return promise.then((data) => LogoutResponse.decode(new BinaryReader(data)));
|
|
}
|
|
|
|
GetAuthStatus(request: AuthStatusRequest): Promise<AuthStatusResponse> {
|
|
const data = AuthStatusRequest.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "GetAuthStatus", data);
|
|
return promise.then((data) => AuthStatusResponse.decode(new BinaryReader(data)));
|
|
}
|
|
}
|
|
|
|
export interface MainService {
|
|
GetGame(request: GameRequest): Promise<Game>;
|
|
GetGames(request: GetGamesRequest): Promise<GameList>;
|
|
AddGame(request: Game): Promise<Game>;
|
|
AddOpinion(request: AddOpinionRequest): Promise<Person>;
|
|
}
|
|
|
|
export const MainServiceServiceName = "items.MainService";
|
|
export class MainServiceClientImpl implements MainService {
|
|
private readonly rpc: Rpc;
|
|
private readonly service: string;
|
|
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
this.service = opts?.service || MainServiceServiceName;
|
|
this.rpc = rpc;
|
|
this.GetGame = this.GetGame.bind(this);
|
|
this.GetGames = this.GetGames.bind(this);
|
|
this.AddGame = this.AddGame.bind(this);
|
|
this.AddOpinion = this.AddOpinion.bind(this);
|
|
}
|
|
GetGame(request: GameRequest): Promise<Game> {
|
|
const data = GameRequest.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "GetGame", data);
|
|
return promise.then((data) => Game.decode(new BinaryReader(data)));
|
|
}
|
|
|
|
GetGames(request: GetGamesRequest): Promise<GameList> {
|
|
const data = GetGamesRequest.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "GetGames", data);
|
|
return promise.then((data) => GameList.decode(new BinaryReader(data)));
|
|
}
|
|
|
|
AddGame(request: Game): Promise<Game> {
|
|
const data = Game.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "AddGame", data);
|
|
return promise.then((data) => Game.decode(new BinaryReader(data)));
|
|
}
|
|
|
|
AddOpinion(request: AddOpinionRequest): Promise<Person> {
|
|
const data = AddOpinionRequest.encode(request).finish();
|
|
const promise = this.rpc.request(this.service, "AddOpinion", data);
|
|
return promise.then((data) => Person.decode(new BinaryReader(data)));
|
|
}
|
|
}
|
|
|
|
interface Rpc {
|
|
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
}
|
|
|
|
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 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<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;
|
|
}
|