protoc-gen-go-micro/examples/flow/output/test/test_grpc_js.js

312 lines
9.5 KiB
JavaScript
Raw Normal View History

2017-01-05 20:06:24 +03:00
// @flow
2016-12-20 13:31:46 +03:00
// GENERATED CODE -- DO NOT EDIT!
2017-01-11 16:52:00 +03:00
import base64 from 'base64-js'
import test_pb from './test_pb'
2017-01-06 13:41:42 +03:00
2017-01-11 17:39:51 +03:00
export type TestEnum = {|
2017-01-11 18:33:03 +03:00
ELEMENT_A?: 0;
ELEMENT_B?: 1;
2017-01-11 17:39:51 +03:00
|};
2017-01-11 17:39:51 +03:00
export type TestMessage$TestNestedEnum = {|
2017-01-11 18:33:03 +03:00
ELEMENT_C?: 0;
ELEMENT_D?: 1;
2017-01-11 17:39:51 +03:00
|};
2017-01-11 17:20:01 +03:00
export type TestMessage$TestNestedMessage = {
2017-01-11 18:33:03 +03:00
getS?: () => string;
setS?: (s: string) => void;
getT?: () => number;
setT?: (t: number) => void;
2017-01-11 17:20:01 +03:00
};
2017-01-10 14:24:06 +03:00
2017-01-11 17:20:01 +03:00
export type TestMessage = {
2017-01-11 18:33:03 +03:00
getA?: () => string;
setA?: (a: string) => void;
getB?: () => number;
setB?: (b: number) => void;
getC?: () => number;
setC?: (c: number) => void;
getD?: () => number;
setD?: (d: number) => void;
getE?: () => number;
setE?: (e: number) => void;
getNList?: () => Array<string>;
setNList?: (n: Array<string>) => void;
addN?: (n: string) => void;
clearNList?: () => void;
getOList?: () => Array<number>;
setOList?: (o: Array<number>) => void;
addO?: (o: number) => void;
clearOList?: () => void;
getPList?: () => Array<number>;
setPList?: (p: Array<number>) => void;
addP?: (p: number) => void;
clearPList?: () => void;
getQList?: () => Array<number>;
setQList?: (q: Array<number>) => void;
addQ?: (q: number) => void;
clearQList?: () => void;
getRList?: () => Array<number>;
setRList?: (r: Array<number>) => void;
addR?: (r: number) => void;
clearRList?: () => void;
getU?: () => test$TestEnum;
setU?: (u: test$TestEnum) => void;
getV?: () => test$TestMessage$TestNestedEnum;
setV?: (v: test$TestMessage$TestNestedEnum) => void;
getWList?: () => Array<test$TestMessage$TestNestedMessage>;
setWList?: (w: Array<test$TestMessage$TestNestedMessage>) => void;
addW?: (w: test$TestMessage$TestNestedMessage) => void;
2017-01-11 18:33:03 +03:00
clearWList?: () => void;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestNoStreamRequest = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestNoStreamReply = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
getErrMsg?: () => string;
setErrMsg?: (err_msg: string) => void;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestStreamRequestRequest = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestStreamRequestReply = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
getErrMsg?: () => string;
setErrMsg?: (err_msg: string) => void;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestStreamReplyRequest = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestStreamReplyReply = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
getErrMsg?: () => string;
setErrMsg?: (err_msg: string) => void;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestStreamBothRequest = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
2017-01-11 17:20:01 +03:00
};
2017-01-05 20:06:24 +03:00
2017-01-11 17:20:01 +03:00
export type TestStreamBothReply = {
getMessage?: () => test$TestMessage;
setMessage?: (message: test$TestMessage) => void;
2017-01-11 18:33:03 +03:00
clearMessage?: () => void;
hasMessage?: () => boolean;
getErrMsg?: () => string;
setErrMsg?: (err_msg: string) => void;
2017-01-11 17:20:01 +03:00
};
const serializeToBase64 = (byteArray: Uint8Array): string => base64.fromByteArray(byteArray)
const deserializeFromBase64 = (base64Encoded: string): Uint8Array => new Uint8Array(base64.toByteArray(base64Encoded))
2017-01-11 16:52:00 +03:00
function serialize_test_TestNoStreamRequest(arg : TestNoStreamRequest): string {
if (!(arg instanceof test_pb.TestNoStreamRequest)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestNoStreamRequest')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestNoStreamRequest(base64Encoded: string): TestNoStreamRequest {
return test_pb.TestNoStreamRequest.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestNoStreamReply(arg : TestNoStreamReply): string {
if (!(arg instanceof test_pb.TestNoStreamReply)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestNoStreamReply')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestNoStreamReply(base64Encoded: string): TestNoStreamReply {
return test_pb.TestNoStreamReply.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestStreamRequestRequest(arg : TestStreamRequestRequest): string {
if (!(arg instanceof test_pb.TestStreamRequestRequest)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestStreamRequestRequest')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestStreamRequestRequest(base64Encoded: string): TestStreamRequestRequest {
return test_pb.TestStreamRequestRequest.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestStreamRequestReply(arg : TestStreamRequestReply): string {
if (!(arg instanceof test_pb.TestStreamRequestReply)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestStreamRequestReply')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestStreamRequestReply(base64Encoded: string): TestStreamRequestReply {
return test_pb.TestStreamRequestReply.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestStreamReplyRequest(arg : TestStreamReplyRequest): string {
if (!(arg instanceof test_pb.TestStreamReplyRequest)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestStreamReplyRequest')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestStreamReplyRequest(base64Encoded: string): TestStreamReplyRequest {
return test_pb.TestStreamReplyRequest.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestStreamReplyReply(arg : TestStreamReplyReply): string {
if (!(arg instanceof test_pb.TestStreamReplyReply)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestStreamReplyReply')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestStreamReplyReply(base64Encoded: string): TestStreamReplyReply {
return test_pb.TestStreamReplyReply.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestStreamBothRequest(arg : TestStreamBothRequest): string {
if (!(arg instanceof test_pb.TestStreamBothRequest)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestStreamBothRequest')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function deserialize_test_TestStreamBothRequest(base64Encoded: string): TestStreamBothRequest {
return test_pb.TestStreamBothRequest.deserializeBinary(deserializeFromBase64(base64Encoded))
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
function serialize_test_TestStreamBothReply(arg : TestStreamBothReply): string {
if (!(arg instanceof test_pb.TestStreamBothReply)) {
2017-01-05 20:06:24 +03:00
throw new Error('Expected argument of type TestStreamBothReply')
2016-12-20 13:31:46 +03:00
}
2017-01-11 16:52:00 +03:00
return serializeToBase64(arg.serializeBinary())
}
function deserialize_test_TestStreamBothReply(base64Encoded: string): TestStreamBothReply {
return test_pb.TestStreamBothReply.deserializeBinary(deserializeFromBase64(base64Encoded))
}
export default {
TestService: {
testNoStream: {
path: '/test.TestService/TestNoStream',
requestStream: false,
responseStream: false,
requestType: test_pb.TestNoStreamRequest,
responseType: test_pb.TestNoStreamReply,
requestSerialize: serialize_test_TestNoStreamRequest,
requestDeserialize: deserialize_test_TestNoStreamRequest,
responseSerialize: serialize_test_TestNoStreamReply,
responseDeserialize: deserialize_test_TestNoStreamReply,
},
testStreamRequest: {
path: '/test.TestService/TestStreamRequest',
requestStream: true,
responseStream: false,
requestType: test_pb.TestStreamRequestRequest,
responseType: test_pb.TestStreamRequestReply,
requestSerialize: serialize_test_TestStreamRequestRequest,
requestDeserialize: deserialize_test_TestStreamRequestRequest,
responseSerialize: serialize_test_TestStreamRequestReply,
responseDeserialize: deserialize_test_TestStreamRequestReply,
},
testStreamReply: {
path: '/test.TestService/TestStreamReply',
requestStream: false,
responseStream: true,
requestType: test_pb.TestStreamReplyRequest,
responseType: test_pb.TestStreamReplyReply,
requestSerialize: serialize_test_TestStreamReplyRequest,
requestDeserialize: deserialize_test_TestStreamReplyRequest,
responseSerialize: serialize_test_TestStreamReplyReply,
responseDeserialize: deserialize_test_TestStreamReplyReply,
},
testStreamBoth: {
path: '/test.TestService/TestStreamBoth',
requestStream: true,
responseStream: true,
requestType: test_pb.TestStreamBothRequest,
responseType: test_pb.TestStreamBothReply,
requestSerialize: serialize_test_TestStreamBothRequest,
requestDeserialize: deserialize_test_TestStreamBothRequest,
responseSerialize: serialize_test_TestStreamBothReply,
responseDeserialize: deserialize_test_TestStreamBothReply,
},
}
2016-12-20 13:31:46 +03:00
}