Skip to content

Commit

Permalink
#55 update example
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm committed Dec 22, 2020
1 parent 279bec6 commit f44b70d
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 69 deletions.
3 changes: 2 additions & 1 deletion packages/example-browser-grpcweb-client/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {ExampleServiceClient, FailRequest, IExampleServiceClient} from "./service-example";
import {FailRequest} from "./service-example";
import {GrpcWebFetchTransport} from "@protobuf-ts/grpcweb-transport";
import {ExampleServiceClient, IExampleServiceClient} from "./service-example.client";


const transport = new GrpcWebFetchTransport({
Expand Down
73 changes: 73 additions & 0 deletions packages/example-browser-grpcweb-client/service-example.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// @generated by protobuf-ts 2.0.0-alpha.9 with parameters generate_dependencies,optimize_code_size
// @generated from protobuf file "service-example.proto" (package "spec", syntax proto3)
// tslint:disable
import { RpcTransport } from "@protobuf-ts/runtime-rpc";
import { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { ExampleService } from "./service-example";
import { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
import { ClientStreamingCall } from "@protobuf-ts/runtime-rpc";
import { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import { ExampleResponse } from "./service-example";
import { ExampleRequest } from "./service-example";
import { UnaryCall } from "@protobuf-ts/runtime-rpc";
import { RpcOptions } from "@protobuf-ts/runtime-rpc";
/**
* @generated from protobuf service spec.ExampleService
*/
export interface IExampleServiceClient {
/**
* @generated from protobuf rpc: Unary(spec.ExampleRequest) returns (spec.ExampleResponse);
*/
unary(input: ExampleRequest, options?: RpcOptions): UnaryCall<ExampleRequest, ExampleResponse>;
/**
* @generated from protobuf rpc: ServerStream(spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
serverStream(input: ExampleRequest, options?: RpcOptions): ServerStreamingCall<ExampleRequest, ExampleResponse>;
/**
* @generated from protobuf rpc: ClientStream(stream spec.ExampleRequest) returns (spec.ExampleResponse);
*/
clientStream(options?: RpcOptions): ClientStreamingCall<ExampleRequest, ExampleResponse>;
/**
* @generated from protobuf rpc: Bidi(stream spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
bidi(options?: RpcOptions): DuplexStreamingCall<ExampleRequest, ExampleResponse>;
}
/**
* @generated from protobuf service spec.ExampleService
*/
export class ExampleServiceClient implements IExampleServiceClient, ServiceInfo {
typeName = ExampleService.typeName;
methods = ExampleService.methods;
options = ExampleService.options;
constructor(private readonly _transport: RpcTransport) {
}
/**
* @generated from protobuf rpc: Unary(spec.ExampleRequest) returns (spec.ExampleResponse);
*/
unary(input: ExampleRequest, options?: RpcOptions): UnaryCall<ExampleRequest, ExampleResponse> {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: ServerStream(spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
serverStream(input: ExampleRequest, options?: RpcOptions): ServerStreamingCall<ExampleRequest, ExampleResponse> {
const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("serverStreaming", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: ClientStream(stream spec.ExampleRequest) returns (spec.ExampleResponse);
*/
clientStream(options?: RpcOptions): ClientStreamingCall<ExampleRequest, ExampleResponse> {
const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("clientStreaming", this._transport, method, opt);
}
/**
* @generated from protobuf rpc: Bidi(stream spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
bidi(options?: RpcOptions): DuplexStreamingCall<ExampleRequest, ExampleResponse> {
const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("duplex", this._transport, method, opt);
}
}
69 changes: 1 addition & 68 deletions packages/example-browser-grpcweb-client/service-example.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
// @generated by protobuf-ts 2.0.0-alpha.7 with parameters generate_dependencies,optimize_code_size
// @generated by protobuf-ts 2.0.0-alpha.9 with parameters generate_dependencies,optimize_code_size
// @generated from protobuf file "service-example.proto" (package "spec", syntax proto3)
// tslint:disable
import { RpcTransport } from "@protobuf-ts/runtime-rpc";
import { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { DuplexStreamingCall } from "@protobuf-ts/runtime-rpc";
import { ClientStreamingCall } from "@protobuf-ts/runtime-rpc";
import { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
import { UnaryCall } from "@protobuf-ts/runtime-rpc";
import { RpcOptions } from "@protobuf-ts/runtime-rpc";
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import { MessageType } from "@protobuf-ts/runtime";
/**
Expand Down Expand Up @@ -133,62 +125,3 @@ export const ExampleService = new ServiceType("spec.ExampleService", [
{ name: "ClientStream", clientStreaming: true, options: {}, I: ExampleRequest, O: ExampleResponse },
{ name: "Bidi", serverStreaming: true, clientStreaming: true, options: {}, I: ExampleRequest, O: ExampleResponse }
]);
/**
* @generated from protobuf service spec.ExampleService
*/
export interface IExampleServiceClient {
/**
* @generated from protobuf rpc: Unary(spec.ExampleRequest) returns (spec.ExampleResponse);
*/
unary(input: ExampleRequest, options?: RpcOptions): UnaryCall<ExampleRequest, ExampleResponse>;
/**
* @generated from protobuf rpc: ServerStream(spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
serverStream(input: ExampleRequest, options?: RpcOptions): ServerStreamingCall<ExampleRequest, ExampleResponse>;
/**
* @generated from protobuf rpc: ClientStream(stream spec.ExampleRequest) returns (spec.ExampleResponse);
*/
clientStream(options?: RpcOptions): ClientStreamingCall<ExampleRequest, ExampleResponse>;
/**
* @generated from protobuf rpc: Bidi(stream spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
bidi(options?: RpcOptions): DuplexStreamingCall<ExampleRequest, ExampleResponse>;
}
/**
* @generated from protobuf service spec.ExampleService
*/
export class ExampleServiceClient implements IExampleServiceClient, ServiceInfo {
typeName = ExampleService.typeName;
methods = ExampleService.methods;
options = ExampleService.options;
constructor(private readonly _transport: RpcTransport) {
}
/**
* @generated from protobuf rpc: Unary(spec.ExampleRequest) returns (spec.ExampleResponse);
*/
unary(input: ExampleRequest, options?: RpcOptions): UnaryCall<ExampleRequest, ExampleResponse> {
const method = this.methods[0], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: ServerStream(spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
serverStream(input: ExampleRequest, options?: RpcOptions): ServerStreamingCall<ExampleRequest, ExampleResponse> {
const method = this.methods[1], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("serverStreaming", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: ClientStream(stream spec.ExampleRequest) returns (spec.ExampleResponse);
*/
clientStream(options?: RpcOptions): ClientStreamingCall<ExampleRequest, ExampleResponse> {
const method = this.methods[2], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("clientStreaming", this._transport, method, opt);
}
/**
* @generated from protobuf rpc: Bidi(stream spec.ExampleRequest) returns (stream spec.ExampleResponse);
*/
bidi(options?: RpcOptions): DuplexStreamingCall<ExampleRequest, ExampleResponse> {
const method = this.methods[3], opt = this._transport.mergeOptions(options);
return stackIntercept<ExampleRequest, ExampleResponse>("duplex", this._transport, method, opt);
}
}

0 comments on commit f44b70d

Please sign in to comment.