forked from projectmoon/tenebrous-dicebot
Remove some proto js definitions from api
This commit is contained in:
parent
96330e13e4
commit
81b4447c84
|
@ -1,214 +0,0 @@
|
||||||
// package: dicebot
|
|
||||||
// file: dicebot.proto
|
|
||||||
|
|
||||||
import * as jspb from "google-protobuf";
|
|
||||||
|
|
||||||
export class GetVariableRequest extends jspb.Message {
|
|
||||||
getUserId(): string;
|
|
||||||
setUserId(value: string): void;
|
|
||||||
|
|
||||||
getRoomId(): string;
|
|
||||||
setRoomId(value: string): void;
|
|
||||||
|
|
||||||
getVariableName(): string;
|
|
||||||
setVariableName(value: string): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): GetVariableRequest.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: GetVariableRequest): GetVariableRequest.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: GetVariableRequest, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): GetVariableRequest;
|
|
||||||
static deserializeBinaryFromReader(message: GetVariableRequest, reader: jspb.BinaryReader): GetVariableRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace GetVariableRequest {
|
|
||||||
export type AsObject = {
|
|
||||||
userId: string,
|
|
||||||
roomId: string,
|
|
||||||
variableName: string,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GetVariableReply extends jspb.Message {
|
|
||||||
getValue(): number;
|
|
||||||
setValue(value: number): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): GetVariableReply.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: GetVariableReply): GetVariableReply.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: GetVariableReply, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): GetVariableReply;
|
|
||||||
static deserializeBinaryFromReader(message: GetVariableReply, reader: jspb.BinaryReader): GetVariableReply;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace GetVariableReply {
|
|
||||||
export type AsObject = {
|
|
||||||
value: number,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GetAllVariablesRequest extends jspb.Message {
|
|
||||||
getUserId(): string;
|
|
||||||
setUserId(value: string): void;
|
|
||||||
|
|
||||||
getRoomId(): string;
|
|
||||||
setRoomId(value: string): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): GetAllVariablesRequest.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: GetAllVariablesRequest): GetAllVariablesRequest.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: GetAllVariablesRequest, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): GetAllVariablesRequest;
|
|
||||||
static deserializeBinaryFromReader(message: GetAllVariablesRequest, reader: jspb.BinaryReader): GetAllVariablesRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace GetAllVariablesRequest {
|
|
||||||
export type AsObject = {
|
|
||||||
userId: string,
|
|
||||||
roomId: string,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GetAllVariablesReply extends jspb.Message {
|
|
||||||
getVariablesMap(): jspb.Map<string, number>;
|
|
||||||
clearVariablesMap(): void;
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): GetAllVariablesReply.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: GetAllVariablesReply): GetAllVariablesReply.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: GetAllVariablesReply, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): GetAllVariablesReply;
|
|
||||||
static deserializeBinaryFromReader(message: GetAllVariablesReply, reader: jspb.BinaryReader): GetAllVariablesReply;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace GetAllVariablesReply {
|
|
||||||
export type AsObject = {
|
|
||||||
variablesMap: Array<[string, number]>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SetVariableRequest extends jspb.Message {
|
|
||||||
getUserId(): string;
|
|
||||||
setUserId(value: string): void;
|
|
||||||
|
|
||||||
getRoomId(): string;
|
|
||||||
setRoomId(value: string): void;
|
|
||||||
|
|
||||||
getVariableName(): string;
|
|
||||||
setVariableName(value: string): void;
|
|
||||||
|
|
||||||
getValue(): number;
|
|
||||||
setValue(value: number): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): SetVariableRequest.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: SetVariableRequest): SetVariableRequest.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: SetVariableRequest, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): SetVariableRequest;
|
|
||||||
static deserializeBinaryFromReader(message: SetVariableRequest, reader: jspb.BinaryReader): SetVariableRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace SetVariableRequest {
|
|
||||||
export type AsObject = {
|
|
||||||
userId: string,
|
|
||||||
roomId: string,
|
|
||||||
variableName: string,
|
|
||||||
value: number,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SetVariableReply extends jspb.Message {
|
|
||||||
getSuccess(): boolean;
|
|
||||||
setSuccess(value: boolean): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): SetVariableReply.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: SetVariableReply): SetVariableReply.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: SetVariableReply, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): SetVariableReply;
|
|
||||||
static deserializeBinaryFromReader(message: SetVariableReply, reader: jspb.BinaryReader): SetVariableReply;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace SetVariableReply {
|
|
||||||
export type AsObject = {
|
|
||||||
success: boolean,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class UserIdRequest extends jspb.Message {
|
|
||||||
getUserId(): string;
|
|
||||||
setUserId(value: string): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): UserIdRequest.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: UserIdRequest): UserIdRequest.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: UserIdRequest, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): UserIdRequest;
|
|
||||||
static deserializeBinaryFromReader(message: UserIdRequest, reader: jspb.BinaryReader): UserIdRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace UserIdRequest {
|
|
||||||
export type AsObject = {
|
|
||||||
userId: string,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoomsListReply extends jspb.Message {
|
|
||||||
clearRoomsList(): void;
|
|
||||||
getRoomsList(): Array<RoomsListReply.Room>;
|
|
||||||
setRoomsList(value: Array<RoomsListReply.Room>): void;
|
|
||||||
addRooms(value?: RoomsListReply.Room, index?: number): RoomsListReply.Room;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): RoomsListReply.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: RoomsListReply): RoomsListReply.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: RoomsListReply, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): RoomsListReply;
|
|
||||||
static deserializeBinaryFromReader(message: RoomsListReply, reader: jspb.BinaryReader): RoomsListReply;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace RoomsListReply {
|
|
||||||
export type AsObject = {
|
|
||||||
roomsList: Array<RoomsListReply.Room.AsObject>,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Room extends jspb.Message {
|
|
||||||
getRoomId(): string;
|
|
||||||
setRoomId(value: string): void;
|
|
||||||
|
|
||||||
getDisplayName(): string;
|
|
||||||
setDisplayName(value: string): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): Room.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: Room): Room.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: Room, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Room;
|
|
||||||
static deserializeBinaryFromReader(message: Room, reader: jspb.BinaryReader): Room;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Room {
|
|
||||||
export type AsObject = {
|
|
||||||
roomId: string,
|
|
||||||
displayName: string,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,120 +0,0 @@
|
||||||
// package: dicebot
|
|
||||||
// file: dicebot.proto
|
|
||||||
|
|
||||||
import * as dicebot_pb from "./dicebot_pb";
|
|
||||||
import {grpc} from "@improbable-eng/grpc-web";
|
|
||||||
|
|
||||||
type DicebotGetVariable = {
|
|
||||||
readonly methodName: string;
|
|
||||||
readonly service: typeof Dicebot;
|
|
||||||
readonly requestStream: false;
|
|
||||||
readonly responseStream: false;
|
|
||||||
readonly requestType: typeof dicebot_pb.GetVariableRequest;
|
|
||||||
readonly responseType: typeof dicebot_pb.GetVariableReply;
|
|
||||||
};
|
|
||||||
|
|
||||||
type DicebotGetAllVariables = {
|
|
||||||
readonly methodName: string;
|
|
||||||
readonly service: typeof Dicebot;
|
|
||||||
readonly requestStream: false;
|
|
||||||
readonly responseStream: false;
|
|
||||||
readonly requestType: typeof dicebot_pb.GetAllVariablesRequest;
|
|
||||||
readonly responseType: typeof dicebot_pb.GetAllVariablesReply;
|
|
||||||
};
|
|
||||||
|
|
||||||
type DicebotSetVariable = {
|
|
||||||
readonly methodName: string;
|
|
||||||
readonly service: typeof Dicebot;
|
|
||||||
readonly requestStream: false;
|
|
||||||
readonly responseStream: false;
|
|
||||||
readonly requestType: typeof dicebot_pb.SetVariableRequest;
|
|
||||||
readonly responseType: typeof dicebot_pb.SetVariableReply;
|
|
||||||
};
|
|
||||||
|
|
||||||
type DicebotRoomsForUser = {
|
|
||||||
readonly methodName: string;
|
|
||||||
readonly service: typeof Dicebot;
|
|
||||||
readonly requestStream: false;
|
|
||||||
readonly responseStream: false;
|
|
||||||
readonly requestType: typeof dicebot_pb.UserIdRequest;
|
|
||||||
readonly responseType: typeof dicebot_pb.RoomsListReply;
|
|
||||||
};
|
|
||||||
|
|
||||||
export class Dicebot {
|
|
||||||
static readonly serviceName: string;
|
|
||||||
static readonly GetVariable: DicebotGetVariable;
|
|
||||||
static readonly GetAllVariables: DicebotGetAllVariables;
|
|
||||||
static readonly SetVariable: DicebotSetVariable;
|
|
||||||
static readonly RoomsForUser: DicebotRoomsForUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
|
|
||||||
export type Status = { details: string, code: number; metadata: grpc.Metadata }
|
|
||||||
|
|
||||||
interface UnaryResponse {
|
|
||||||
cancel(): void;
|
|
||||||
}
|
|
||||||
interface ResponseStream<T> {
|
|
||||||
cancel(): void;
|
|
||||||
on(type: 'data', handler: (message: T) => void): ResponseStream<T>;
|
|
||||||
on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>;
|
|
||||||
on(type: 'status', handler: (status: Status) => void): ResponseStream<T>;
|
|
||||||
}
|
|
||||||
interface RequestStream<T> {
|
|
||||||
write(message: T): RequestStream<T>;
|
|
||||||
end(): void;
|
|
||||||
cancel(): void;
|
|
||||||
on(type: 'end', handler: (status?: Status) => void): RequestStream<T>;
|
|
||||||
on(type: 'status', handler: (status: Status) => void): RequestStream<T>;
|
|
||||||
}
|
|
||||||
interface BidirectionalStream<ReqT, ResT> {
|
|
||||||
write(message: ReqT): BidirectionalStream<ReqT, ResT>;
|
|
||||||
end(): void;
|
|
||||||
cancel(): void;
|
|
||||||
on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>;
|
|
||||||
on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>;
|
|
||||||
on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class DicebotClient {
|
|
||||||
readonly serviceHost: string;
|
|
||||||
|
|
||||||
constructor(serviceHost: string, options?: grpc.RpcOptions);
|
|
||||||
getVariable(
|
|
||||||
requestMessage: dicebot_pb.GetVariableRequest,
|
|
||||||
metadata: grpc.Metadata,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.GetVariableReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
getVariable(
|
|
||||||
requestMessage: dicebot_pb.GetVariableRequest,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.GetVariableReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
getAllVariables(
|
|
||||||
requestMessage: dicebot_pb.GetAllVariablesRequest,
|
|
||||||
metadata: grpc.Metadata,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.GetAllVariablesReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
getAllVariables(
|
|
||||||
requestMessage: dicebot_pb.GetAllVariablesRequest,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.GetAllVariablesReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
setVariable(
|
|
||||||
requestMessage: dicebot_pb.SetVariableRequest,
|
|
||||||
metadata: grpc.Metadata,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.SetVariableReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
setVariable(
|
|
||||||
requestMessage: dicebot_pb.SetVariableRequest,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.SetVariableReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
roomsForUser(
|
|
||||||
requestMessage: dicebot_pb.UserIdRequest,
|
|
||||||
metadata: grpc.Metadata,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.RoomsListReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
roomsForUser(
|
|
||||||
requestMessage: dicebot_pb.UserIdRequest,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: dicebot_pb.RoomsListReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,181 +0,0 @@
|
||||||
// package: dicebot
|
|
||||||
// file: dicebot.proto
|
|
||||||
|
|
||||||
var dicebot_pb = require("./dicebot_pb");
|
|
||||||
var grpc = require("@improbable-eng/grpc-web").grpc;
|
|
||||||
|
|
||||||
var Dicebot = (function () {
|
|
||||||
function Dicebot() {}
|
|
||||||
Dicebot.serviceName = "dicebot.Dicebot";
|
|
||||||
return Dicebot;
|
|
||||||
}());
|
|
||||||
|
|
||||||
Dicebot.GetVariable = {
|
|
||||||
methodName: "GetVariable",
|
|
||||||
service: Dicebot,
|
|
||||||
requestStream: false,
|
|
||||||
responseStream: false,
|
|
||||||
requestType: dicebot_pb.GetVariableRequest,
|
|
||||||
responseType: dicebot_pb.GetVariableReply
|
|
||||||
};
|
|
||||||
|
|
||||||
Dicebot.GetAllVariables = {
|
|
||||||
methodName: "GetAllVariables",
|
|
||||||
service: Dicebot,
|
|
||||||
requestStream: false,
|
|
||||||
responseStream: false,
|
|
||||||
requestType: dicebot_pb.GetAllVariablesRequest,
|
|
||||||
responseType: dicebot_pb.GetAllVariablesReply
|
|
||||||
};
|
|
||||||
|
|
||||||
Dicebot.SetVariable = {
|
|
||||||
methodName: "SetVariable",
|
|
||||||
service: Dicebot,
|
|
||||||
requestStream: false,
|
|
||||||
responseStream: false,
|
|
||||||
requestType: dicebot_pb.SetVariableRequest,
|
|
||||||
responseType: dicebot_pb.SetVariableReply
|
|
||||||
};
|
|
||||||
|
|
||||||
Dicebot.RoomsForUser = {
|
|
||||||
methodName: "RoomsForUser",
|
|
||||||
service: Dicebot,
|
|
||||||
requestStream: false,
|
|
||||||
responseStream: false,
|
|
||||||
requestType: dicebot_pb.UserIdRequest,
|
|
||||||
responseType: dicebot_pb.RoomsListReply
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.Dicebot = Dicebot;
|
|
||||||
|
|
||||||
function DicebotClient(serviceHost, options) {
|
|
||||||
this.serviceHost = serviceHost;
|
|
||||||
this.options = options || {};
|
|
||||||
}
|
|
||||||
|
|
||||||
DicebotClient.prototype.getVariable = function getVariable(requestMessage, metadata, callback) {
|
|
||||||
if (arguments.length === 2) {
|
|
||||||
callback = arguments[1];
|
|
||||||
}
|
|
||||||
var client = grpc.unary(Dicebot.GetVariable, {
|
|
||||||
request: requestMessage,
|
|
||||||
host: this.serviceHost,
|
|
||||||
metadata: metadata,
|
|
||||||
transport: this.options.transport,
|
|
||||||
debug: this.options.debug,
|
|
||||||
onEnd: function (response) {
|
|
||||||
if (callback) {
|
|
||||||
if (response.status !== grpc.Code.OK) {
|
|
||||||
var err = new Error(response.statusMessage);
|
|
||||||
err.code = response.status;
|
|
||||||
err.metadata = response.trailers;
|
|
||||||
callback(err, null);
|
|
||||||
} else {
|
|
||||||
callback(null, response.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
cancel: function () {
|
|
||||||
callback = null;
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
DicebotClient.prototype.getAllVariables = function getAllVariables(requestMessage, metadata, callback) {
|
|
||||||
if (arguments.length === 2) {
|
|
||||||
callback = arguments[1];
|
|
||||||
}
|
|
||||||
var client = grpc.unary(Dicebot.GetAllVariables, {
|
|
||||||
request: requestMessage,
|
|
||||||
host: this.serviceHost,
|
|
||||||
metadata: metadata,
|
|
||||||
transport: this.options.transport,
|
|
||||||
debug: this.options.debug,
|
|
||||||
onEnd: function (response) {
|
|
||||||
if (callback) {
|
|
||||||
if (response.status !== grpc.Code.OK) {
|
|
||||||
var err = new Error(response.statusMessage);
|
|
||||||
err.code = response.status;
|
|
||||||
err.metadata = response.trailers;
|
|
||||||
callback(err, null);
|
|
||||||
} else {
|
|
||||||
callback(null, response.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
cancel: function () {
|
|
||||||
callback = null;
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
DicebotClient.prototype.setVariable = function setVariable(requestMessage, metadata, callback) {
|
|
||||||
if (arguments.length === 2) {
|
|
||||||
callback = arguments[1];
|
|
||||||
}
|
|
||||||
var client = grpc.unary(Dicebot.SetVariable, {
|
|
||||||
request: requestMessage,
|
|
||||||
host: this.serviceHost,
|
|
||||||
metadata: metadata,
|
|
||||||
transport: this.options.transport,
|
|
||||||
debug: this.options.debug,
|
|
||||||
onEnd: function (response) {
|
|
||||||
if (callback) {
|
|
||||||
if (response.status !== grpc.Code.OK) {
|
|
||||||
var err = new Error(response.statusMessage);
|
|
||||||
err.code = response.status;
|
|
||||||
err.metadata = response.trailers;
|
|
||||||
callback(err, null);
|
|
||||||
} else {
|
|
||||||
callback(null, response.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
cancel: function () {
|
|
||||||
callback = null;
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
DicebotClient.prototype.roomsForUser = function roomsForUser(requestMessage, metadata, callback) {
|
|
||||||
if (arguments.length === 2) {
|
|
||||||
callback = arguments[1];
|
|
||||||
}
|
|
||||||
var client = grpc.unary(Dicebot.RoomsForUser, {
|
|
||||||
request: requestMessage,
|
|
||||||
host: this.serviceHost,
|
|
||||||
metadata: metadata,
|
|
||||||
transport: this.options.transport,
|
|
||||||
debug: this.options.debug,
|
|
||||||
onEnd: function (response) {
|
|
||||||
if (callback) {
|
|
||||||
if (response.status !== grpc.Code.OK) {
|
|
||||||
var err = new Error(response.statusMessage);
|
|
||||||
err.code = response.status;
|
|
||||||
err.metadata = response.trailers;
|
|
||||||
callback(err, null);
|
|
||||||
} else {
|
|
||||||
callback(null, response.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
cancel: function () {
|
|
||||||
callback = null;
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.DicebotClient = DicebotClient;
|
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
// package: web_api
|
|
||||||
// file: web-api.proto
|
|
||||||
|
|
||||||
import * as jspb from "google-protobuf";
|
|
||||||
|
|
||||||
export class UserIdRequest extends jspb.Message {
|
|
||||||
getUserId(): string;
|
|
||||||
setUserId(value: string): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): UserIdRequest.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: UserIdRequest): UserIdRequest.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: UserIdRequest, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): UserIdRequest;
|
|
||||||
static deserializeBinaryFromReader(message: UserIdRequest, reader: jspb.BinaryReader): UserIdRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace UserIdRequest {
|
|
||||||
export type AsObject = {
|
|
||||||
userId: string,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RoomsListReply extends jspb.Message {
|
|
||||||
clearRoomsList(): void;
|
|
||||||
getRoomsList(): Array<RoomsListReply.Room>;
|
|
||||||
setRoomsList(value: Array<RoomsListReply.Room>): void;
|
|
||||||
addRooms(value?: RoomsListReply.Room, index?: number): RoomsListReply.Room;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): RoomsListReply.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: RoomsListReply): RoomsListReply.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: RoomsListReply, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): RoomsListReply;
|
|
||||||
static deserializeBinaryFromReader(message: RoomsListReply, reader: jspb.BinaryReader): RoomsListReply;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace RoomsListReply {
|
|
||||||
export type AsObject = {
|
|
||||||
roomsList: Array<RoomsListReply.Room.AsObject>,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Room extends jspb.Message {
|
|
||||||
getRoomId(): string;
|
|
||||||
setRoomId(value: string): void;
|
|
||||||
|
|
||||||
getDisplayName(): string;
|
|
||||||
setDisplayName(value: string): void;
|
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
|
||||||
toObject(includeInstance?: boolean): Room.AsObject;
|
|
||||||
static toObject(includeInstance: boolean, msg: Room): Room.AsObject;
|
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
||||||
static serializeBinaryToWriter(message: Room, writer: jspb.BinaryWriter): void;
|
|
||||||
static deserializeBinary(bytes: Uint8Array): Room;
|
|
||||||
static deserializeBinaryFromReader(message: Room, reader: jspb.BinaryReader): Room;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace Room {
|
|
||||||
export type AsObject = {
|
|
||||||
roomId: string,
|
|
||||||
displayName: string,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,534 +0,0 @@
|
||||||
// source: web-api.proto
|
|
||||||
/**
|
|
||||||
* @fileoverview
|
|
||||||
* @enhanceable
|
|
||||||
* @suppress {missingRequire} reports error on implicit type usages.
|
|
||||||
* @suppress {messageConventions} JS Compiler reports an error if a variable or
|
|
||||||
* field starts with 'MSG_' and isn't a translatable message.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
// GENERATED CODE -- DO NOT EDIT!
|
|
||||||
/* eslint-disable */
|
|
||||||
// @ts-nocheck
|
|
||||||
|
|
||||||
var jspb = require('google-protobuf');
|
|
||||||
var goog = jspb;
|
|
||||||
var global = Function('return this')();
|
|
||||||
|
|
||||||
goog.exportSymbol('proto.web_api.RoomsListReply', null, global);
|
|
||||||
goog.exportSymbol('proto.web_api.RoomsListReply.Room', null, global);
|
|
||||||
goog.exportSymbol('proto.web_api.UserIdRequest', null, global);
|
|
||||||
/**
|
|
||||||
* Generated by JsPbCodeGenerator.
|
|
||||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
||||||
* server response, or constructed directly in Javascript. The array is used
|
|
||||||
* in place and becomes part of the constructed object. It is not cloned.
|
|
||||||
* If no data is provided, the constructed object will be empty, but still
|
|
||||||
* valid.
|
|
||||||
* @extends {jspb.Message}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest = function(opt_data) {
|
|
||||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
||||||
};
|
|
||||||
goog.inherits(proto.web_api.UserIdRequest, jspb.Message);
|
|
||||||
if (goog.DEBUG && !COMPILED) {
|
|
||||||
/**
|
|
||||||
* @public
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.displayName = 'proto.web_api.UserIdRequest';
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Generated by JsPbCodeGenerator.
|
|
||||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
||||||
* server response, or constructed directly in Javascript. The array is used
|
|
||||||
* in place and becomes part of the constructed object. It is not cloned.
|
|
||||||
* If no data is provided, the constructed object will be empty, but still
|
|
||||||
* valid.
|
|
||||||
* @extends {jspb.Message}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply = function(opt_data) {
|
|
||||||
jspb.Message.initialize(this, opt_data, 0, -1, proto.web_api.RoomsListReply.repeatedFields_, null);
|
|
||||||
};
|
|
||||||
goog.inherits(proto.web_api.RoomsListReply, jspb.Message);
|
|
||||||
if (goog.DEBUG && !COMPILED) {
|
|
||||||
/**
|
|
||||||
* @public
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.displayName = 'proto.web_api.RoomsListReply';
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Generated by JsPbCodeGenerator.
|
|
||||||
* @param {Array=} opt_data Optional initial data array, typically from a
|
|
||||||
* server response, or constructed directly in Javascript. The array is used
|
|
||||||
* in place and becomes part of the constructed object. It is not cloned.
|
|
||||||
* If no data is provided, the constructed object will be empty, but still
|
|
||||||
* valid.
|
|
||||||
* @extends {jspb.Message}
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room = function(opt_data) {
|
|
||||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
|
|
||||||
};
|
|
||||||
goog.inherits(proto.web_api.RoomsListReply.Room, jspb.Message);
|
|
||||||
if (goog.DEBUG && !COMPILED) {
|
|
||||||
/**
|
|
||||||
* @public
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.displayName = 'proto.web_api.RoomsListReply.Room';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
||||||
/**
|
|
||||||
* Creates an object representation of this proto.
|
|
||||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
||||||
* Optional fields that are not set will be set to undefined.
|
|
||||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
||||||
* For the list of reserved names please see:
|
|
||||||
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
||||||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
||||||
* JSPB instance for transitional soy proto support:
|
|
||||||
* http://goto/soy-param-migration
|
|
||||||
* @return {!Object}
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.prototype.toObject = function(opt_includeInstance) {
|
|
||||||
return proto.web_api.UserIdRequest.toObject(opt_includeInstance, this);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static version of the {@see toObject} method.
|
|
||||||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
||||||
* the JSPB instance for transitional soy proto support:
|
|
||||||
* http://goto/soy-param-migration
|
|
||||||
* @param {!proto.web_api.UserIdRequest} msg The msg instance to transform.
|
|
||||||
* @return {!Object}
|
|
||||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.toObject = function(includeInstance, msg) {
|
|
||||||
var f, obj = {
|
|
||||||
userId: jspb.Message.getFieldWithDefault(msg, 1, "")
|
|
||||||
};
|
|
||||||
|
|
||||||
if (includeInstance) {
|
|
||||||
obj.$jspbMessageInstance = msg;
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes binary data (in protobuf wire format).
|
|
||||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
||||||
* @return {!proto.web_api.UserIdRequest}
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.deserializeBinary = function(bytes) {
|
|
||||||
var reader = new jspb.BinaryReader(bytes);
|
|
||||||
var msg = new proto.web_api.UserIdRequest;
|
|
||||||
return proto.web_api.UserIdRequest.deserializeBinaryFromReader(msg, reader);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes binary data (in protobuf wire format) from the
|
|
||||||
* given reader into the given message object.
|
|
||||||
* @param {!proto.web_api.UserIdRequest} msg The message object to deserialize into.
|
|
||||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
||||||
* @return {!proto.web_api.UserIdRequest}
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.deserializeBinaryFromReader = function(msg, reader) {
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
var field = reader.getFieldNumber();
|
|
||||||
switch (field) {
|
|
||||||
case 1:
|
|
||||||
var value = /** @type {string} */ (reader.readString());
|
|
||||||
msg.setUserId(value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipField();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the message to binary data (in protobuf wire format).
|
|
||||||
* @return {!Uint8Array}
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.prototype.serializeBinary = function() {
|
|
||||||
var writer = new jspb.BinaryWriter();
|
|
||||||
proto.web_api.UserIdRequest.serializeBinaryToWriter(this, writer);
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the given message to binary data (in protobuf wire
|
|
||||||
* format), writing to the given BinaryWriter.
|
|
||||||
* @param {!proto.web_api.UserIdRequest} message
|
|
||||||
* @param {!jspb.BinaryWriter} writer
|
|
||||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.serializeBinaryToWriter = function(message, writer) {
|
|
||||||
var f = undefined;
|
|
||||||
f = message.getUserId();
|
|
||||||
if (f.length > 0) {
|
|
||||||
writer.writeString(
|
|
||||||
1,
|
|
||||||
f
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* optional string user_id = 1;
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.prototype.getUserId = function() {
|
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} value
|
|
||||||
* @return {!proto.web_api.UserIdRequest} returns this
|
|
||||||
*/
|
|
||||||
proto.web_api.UserIdRequest.prototype.setUserId = function(value) {
|
|
||||||
return jspb.Message.setProto3StringField(this, 1, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of repeated fields within this message type.
|
|
||||||
* @private {!Array<number>}
|
|
||||||
* @const
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.repeatedFields_ = [1];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
||||||
/**
|
|
||||||
* Creates an object representation of this proto.
|
|
||||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
||||||
* Optional fields that are not set will be set to undefined.
|
|
||||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
||||||
* For the list of reserved names please see:
|
|
||||||
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
||||||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
||||||
* JSPB instance for transitional soy proto support:
|
|
||||||
* http://goto/soy-param-migration
|
|
||||||
* @return {!Object}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.prototype.toObject = function(opt_includeInstance) {
|
|
||||||
return proto.web_api.RoomsListReply.toObject(opt_includeInstance, this);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static version of the {@see toObject} method.
|
|
||||||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
||||||
* the JSPB instance for transitional soy proto support:
|
|
||||||
* http://goto/soy-param-migration
|
|
||||||
* @param {!proto.web_api.RoomsListReply} msg The msg instance to transform.
|
|
||||||
* @return {!Object}
|
|
||||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.toObject = function(includeInstance, msg) {
|
|
||||||
var f, obj = {
|
|
||||||
roomsList: jspb.Message.toObjectList(msg.getRoomsList(),
|
|
||||||
proto.web_api.RoomsListReply.Room.toObject, includeInstance)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (includeInstance) {
|
|
||||||
obj.$jspbMessageInstance = msg;
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes binary data (in protobuf wire format).
|
|
||||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
||||||
* @return {!proto.web_api.RoomsListReply}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.deserializeBinary = function(bytes) {
|
|
||||||
var reader = new jspb.BinaryReader(bytes);
|
|
||||||
var msg = new proto.web_api.RoomsListReply;
|
|
||||||
return proto.web_api.RoomsListReply.deserializeBinaryFromReader(msg, reader);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes binary data (in protobuf wire format) from the
|
|
||||||
* given reader into the given message object.
|
|
||||||
* @param {!proto.web_api.RoomsListReply} msg The message object to deserialize into.
|
|
||||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
||||||
* @return {!proto.web_api.RoomsListReply}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.deserializeBinaryFromReader = function(msg, reader) {
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
var field = reader.getFieldNumber();
|
|
||||||
switch (field) {
|
|
||||||
case 1:
|
|
||||||
var value = new proto.web_api.RoomsListReply.Room;
|
|
||||||
reader.readMessage(value,proto.web_api.RoomsListReply.Room.deserializeBinaryFromReader);
|
|
||||||
msg.addRooms(value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipField();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the message to binary data (in protobuf wire format).
|
|
||||||
* @return {!Uint8Array}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.prototype.serializeBinary = function() {
|
|
||||||
var writer = new jspb.BinaryWriter();
|
|
||||||
proto.web_api.RoomsListReply.serializeBinaryToWriter(this, writer);
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the given message to binary data (in protobuf wire
|
|
||||||
* format), writing to the given BinaryWriter.
|
|
||||||
* @param {!proto.web_api.RoomsListReply} message
|
|
||||||
* @param {!jspb.BinaryWriter} writer
|
|
||||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.serializeBinaryToWriter = function(message, writer) {
|
|
||||||
var f = undefined;
|
|
||||||
f = message.getRoomsList();
|
|
||||||
if (f.length > 0) {
|
|
||||||
writer.writeRepeatedMessage(
|
|
||||||
1,
|
|
||||||
f,
|
|
||||||
proto.web_api.RoomsListReply.Room.serializeBinaryToWriter
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (jspb.Message.GENERATE_TO_OBJECT) {
|
|
||||||
/**
|
|
||||||
* Creates an object representation of this proto.
|
|
||||||
* Field names that are reserved in JavaScript and will be renamed to pb_name.
|
|
||||||
* Optional fields that are not set will be set to undefined.
|
|
||||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
|
|
||||||
* For the list of reserved names please see:
|
|
||||||
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
|
|
||||||
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
|
|
||||||
* JSPB instance for transitional soy proto support:
|
|
||||||
* http://goto/soy-param-migration
|
|
||||||
* @return {!Object}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.prototype.toObject = function(opt_includeInstance) {
|
|
||||||
return proto.web_api.RoomsListReply.Room.toObject(opt_includeInstance, this);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static version of the {@see toObject} method.
|
|
||||||
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
|
|
||||||
* the JSPB instance for transitional soy proto support:
|
|
||||||
* http://goto/soy-param-migration
|
|
||||||
* @param {!proto.web_api.RoomsListReply.Room} msg The msg instance to transform.
|
|
||||||
* @return {!Object}
|
|
||||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.toObject = function(includeInstance, msg) {
|
|
||||||
var f, obj = {
|
|
||||||
roomId: jspb.Message.getFieldWithDefault(msg, 1, ""),
|
|
||||||
displayName: jspb.Message.getFieldWithDefault(msg, 2, "")
|
|
||||||
};
|
|
||||||
|
|
||||||
if (includeInstance) {
|
|
||||||
obj.$jspbMessageInstance = msg;
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes binary data (in protobuf wire format).
|
|
||||||
* @param {jspb.ByteSource} bytes The bytes to deserialize.
|
|
||||||
* @return {!proto.web_api.RoomsListReply.Room}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.deserializeBinary = function(bytes) {
|
|
||||||
var reader = new jspb.BinaryReader(bytes);
|
|
||||||
var msg = new proto.web_api.RoomsListReply.Room;
|
|
||||||
return proto.web_api.RoomsListReply.Room.deserializeBinaryFromReader(msg, reader);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes binary data (in protobuf wire format) from the
|
|
||||||
* given reader into the given message object.
|
|
||||||
* @param {!proto.web_api.RoomsListReply.Room} msg The message object to deserialize into.
|
|
||||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
|
|
||||||
* @return {!proto.web_api.RoomsListReply.Room}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.deserializeBinaryFromReader = function(msg, reader) {
|
|
||||||
while (reader.nextField()) {
|
|
||||||
if (reader.isEndGroup()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
var field = reader.getFieldNumber();
|
|
||||||
switch (field) {
|
|
||||||
case 1:
|
|
||||||
var value = /** @type {string} */ (reader.readString());
|
|
||||||
msg.setRoomId(value);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
var value = /** @type {string} */ (reader.readString());
|
|
||||||
msg.setDisplayName(value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reader.skipField();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the message to binary data (in protobuf wire format).
|
|
||||||
* @return {!Uint8Array}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.prototype.serializeBinary = function() {
|
|
||||||
var writer = new jspb.BinaryWriter();
|
|
||||||
proto.web_api.RoomsListReply.Room.serializeBinaryToWriter(this, writer);
|
|
||||||
return writer.getResultBuffer();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the given message to binary data (in protobuf wire
|
|
||||||
* format), writing to the given BinaryWriter.
|
|
||||||
* @param {!proto.web_api.RoomsListReply.Room} message
|
|
||||||
* @param {!jspb.BinaryWriter} writer
|
|
||||||
* @suppress {unusedLocalVariables} f is only used for nested messages
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.serializeBinaryToWriter = function(message, writer) {
|
|
||||||
var f = undefined;
|
|
||||||
f = message.getRoomId();
|
|
||||||
if (f.length > 0) {
|
|
||||||
writer.writeString(
|
|
||||||
1,
|
|
||||||
f
|
|
||||||
);
|
|
||||||
}
|
|
||||||
f = message.getDisplayName();
|
|
||||||
if (f.length > 0) {
|
|
||||||
writer.writeString(
|
|
||||||
2,
|
|
||||||
f
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* optional string room_id = 1;
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.prototype.getRoomId = function() {
|
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} value
|
|
||||||
* @return {!proto.web_api.RoomsListReply.Room} returns this
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.prototype.setRoomId = function(value) {
|
|
||||||
return jspb.Message.setProto3StringField(this, 1, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* optional string display_name = 2;
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.prototype.getDisplayName = function() {
|
|
||||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} value
|
|
||||||
* @return {!proto.web_api.RoomsListReply.Room} returns this
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.Room.prototype.setDisplayName = function(value) {
|
|
||||||
return jspb.Message.setProto3StringField(this, 2, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* repeated Room rooms = 1;
|
|
||||||
* @return {!Array<!proto.web_api.RoomsListReply.Room>}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.prototype.getRoomsList = function() {
|
|
||||||
return /** @type{!Array<!proto.web_api.RoomsListReply.Room>} */ (
|
|
||||||
jspb.Message.getRepeatedWrapperField(this, proto.web_api.RoomsListReply.Room, 1));
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {!Array<!proto.web_api.RoomsListReply.Room>} value
|
|
||||||
* @return {!proto.web_api.RoomsListReply} returns this
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.prototype.setRoomsList = function(value) {
|
|
||||||
return jspb.Message.setRepeatedWrapperField(this, 1, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {!proto.web_api.RoomsListReply.Room=} opt_value
|
|
||||||
* @param {number=} opt_index
|
|
||||||
* @return {!proto.web_api.RoomsListReply.Room}
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.prototype.addRooms = function(opt_value, opt_index) {
|
|
||||||
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.web_api.RoomsListReply.Room, opt_index);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the list making it empty but non-null.
|
|
||||||
* @return {!proto.web_api.RoomsListReply} returns this
|
|
||||||
*/
|
|
||||||
proto.web_api.RoomsListReply.prototype.clearRoomsList = function() {
|
|
||||||
return this.setRoomsList([]);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
goog.object.extend(exports, proto.web_api);
|
|
|
@ -1,63 +0,0 @@
|
||||||
// package: web_api
|
|
||||||
// file: web-api.proto
|
|
||||||
|
|
||||||
import * as web_api_pb from "./web-api_pb";
|
|
||||||
import {grpc} from "@improbable-eng/grpc-web";
|
|
||||||
|
|
||||||
type WebApiListRoom = {
|
|
||||||
readonly methodName: string;
|
|
||||||
readonly service: typeof WebApi;
|
|
||||||
readonly requestStream: false;
|
|
||||||
readonly responseStream: false;
|
|
||||||
readonly requestType: typeof web_api_pb.UserIdRequest;
|
|
||||||
readonly responseType: typeof web_api_pb.RoomsListReply;
|
|
||||||
};
|
|
||||||
|
|
||||||
export class WebApi {
|
|
||||||
static readonly serviceName: string;
|
|
||||||
static readonly ListRoom: WebApiListRoom;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
|
|
||||||
export type Status = { details: string, code: number; metadata: grpc.Metadata }
|
|
||||||
|
|
||||||
interface UnaryResponse {
|
|
||||||
cancel(): void;
|
|
||||||
}
|
|
||||||
interface ResponseStream<T> {
|
|
||||||
cancel(): void;
|
|
||||||
on(type: 'data', handler: (message: T) => void): ResponseStream<T>;
|
|
||||||
on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>;
|
|
||||||
on(type: 'status', handler: (status: Status) => void): ResponseStream<T>;
|
|
||||||
}
|
|
||||||
interface RequestStream<T> {
|
|
||||||
write(message: T): RequestStream<T>;
|
|
||||||
end(): void;
|
|
||||||
cancel(): void;
|
|
||||||
on(type: 'end', handler: (status?: Status) => void): RequestStream<T>;
|
|
||||||
on(type: 'status', handler: (status: Status) => void): RequestStream<T>;
|
|
||||||
}
|
|
||||||
interface BidirectionalStream<ReqT, ResT> {
|
|
||||||
write(message: ReqT): BidirectionalStream<ReqT, ResT>;
|
|
||||||
end(): void;
|
|
||||||
cancel(): void;
|
|
||||||
on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>;
|
|
||||||
on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>;
|
|
||||||
on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class WebApiClient {
|
|
||||||
readonly serviceHost: string;
|
|
||||||
|
|
||||||
constructor(serviceHost: string, options?: grpc.RpcOptions);
|
|
||||||
listRoom(
|
|
||||||
requestMessage: web_api_pb.UserIdRequest,
|
|
||||||
metadata: grpc.Metadata,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: web_api_pb.RoomsListReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
listRoom(
|
|
||||||
requestMessage: web_api_pb.UserIdRequest,
|
|
||||||
callback: (error: ServiceError|null, responseMessage: web_api_pb.RoomsListReply|null) => void
|
|
||||||
): UnaryResponse;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
// package: web_api
|
|
||||||
// file: web-api.proto
|
|
||||||
|
|
||||||
var web_api_pb = require("./web-api_pb");
|
|
||||||
var grpc = require("@improbable-eng/grpc-web").grpc;
|
|
||||||
|
|
||||||
var WebApi = (function () {
|
|
||||||
function WebApi() {}
|
|
||||||
WebApi.serviceName = "web_api.WebApi";
|
|
||||||
return WebApi;
|
|
||||||
}());
|
|
||||||
|
|
||||||
WebApi.ListRoom = {
|
|
||||||
methodName: "ListRoom",
|
|
||||||
service: WebApi,
|
|
||||||
requestStream: false,
|
|
||||||
responseStream: false,
|
|
||||||
requestType: web_api_pb.UserIdRequest,
|
|
||||||
responseType: web_api_pb.RoomsListReply
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.WebApi = WebApi;
|
|
||||||
|
|
||||||
function WebApiClient(serviceHost, options) {
|
|
||||||
this.serviceHost = serviceHost;
|
|
||||||
this.options = options || {};
|
|
||||||
}
|
|
||||||
|
|
||||||
WebApiClient.prototype.listRoom = function listRoom(requestMessage, metadata, callback) {
|
|
||||||
if (arguments.length === 2) {
|
|
||||||
callback = arguments[1];
|
|
||||||
}
|
|
||||||
var client = grpc.unary(WebApi.ListRoom, {
|
|
||||||
request: requestMessage,
|
|
||||||
host: this.serviceHost,
|
|
||||||
metadata: metadata,
|
|
||||||
transport: this.options.transport,
|
|
||||||
debug: this.options.debug,
|
|
||||||
onEnd: function (response) {
|
|
||||||
if (callback) {
|
|
||||||
if (response.status !== grpc.Code.OK) {
|
|
||||||
var err = new Error(response.statusMessage);
|
|
||||||
err.code = response.status;
|
|
||||||
err.metadata = response.trailers;
|
|
||||||
callback(err, null);
|
|
||||||
} else {
|
|
||||||
callback(null, response.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
cancel: function () {
|
|
||||||
callback = null;
|
|
||||||
client.close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.WebApiClient = WebApiClient;
|
|
||||||
|
|
Loading…
Reference in New Issue