mirror of
https://github.com/foomo/gotsrpc.git
synced 2026-08-13 05:10:23 +00:00
feat: replace examples
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import {ServiceClient} from "./service-client.js";
|
||||
import transport from "./transport.js";
|
||||
|
||||
|
||||
export const init = () => {
|
||||
const client = new ServiceClient(transport("/service"));
|
||||
|
||||
client.string("hello world").then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,187 @@
|
||||
/* eslint:disable */
|
||||
// hello commonjs - we need some imports - sorted in alphabetical order, by go package
|
||||
import * as github_com_foomo_gotsrpc_v2_example_basic_service from './service-vo'; // ./client/src/service-client.ts to ./client/src/service-vo.ts
|
||||
|
||||
export class ServiceClient {
|
||||
public static defaultEndpoint = "/service";
|
||||
constructor(
|
||||
public transport:<T>(method: string, data?: any[]) => Promise<T>
|
||||
) {}
|
||||
async bool(v:boolean):Promise<boolean> {
|
||||
return (await this.transport<{0:boolean}>("Bool", [v]))[0]
|
||||
}
|
||||
async boolSlice(v:Array<boolean>|null):Promise<Array<boolean>|null> {
|
||||
return (await this.transport<{0:Array<boolean>|null}>("BoolSlice", [v]))[0]
|
||||
}
|
||||
async float32(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("Float32", [v]))[0]
|
||||
}
|
||||
async float32Map(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("Float32Map", [v]))[0]
|
||||
}
|
||||
async float32Slice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("Float32Slice", [v]))[0]
|
||||
}
|
||||
async float32Type(v:github_com_foomo_gotsrpc_v2_example_basic_service.Float32Type):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Float32Type> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Float32Type}>("Float32Type", [v]))[0]
|
||||
}
|
||||
async float32TypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapValue>|null}>("Float32TypeMap", [v]))[0]
|
||||
}
|
||||
async float32TypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapTyped|null}>("Float32TypeMapTyped", [v]))[0]
|
||||
}
|
||||
async float64(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("Float64", [v]))[0]
|
||||
}
|
||||
async float64Map(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("Float64Map", [v]))[0]
|
||||
}
|
||||
async float64Slice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("Float64Slice", [v]))[0]
|
||||
}
|
||||
async float64Type(v:github_com_foomo_gotsrpc_v2_example_basic_service.Float64Type):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Float64Type> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Float64Type}>("Float64Type", [v]))[0]
|
||||
}
|
||||
async float64TypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapValue>|null}>("Float64TypeMap", [v]))[0]
|
||||
}
|
||||
async float64TypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapTyped|null}>("Float64TypeMapTyped", [v]))[0]
|
||||
}
|
||||
async int(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("Int", [v]))[0]
|
||||
}
|
||||
async int32(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("Int32", [v]))[0]
|
||||
}
|
||||
async int32Map(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("Int32Map", [v]))[0]
|
||||
}
|
||||
async int32Slice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("Int32Slice", [v]))[0]
|
||||
}
|
||||
async int32Type(v:github_com_foomo_gotsrpc_v2_example_basic_service.Int32Type):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Int32Type> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Int32Type}>("Int32Type", [v]))[0]
|
||||
}
|
||||
async int32TypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapValue>|null}>("Int32TypeMap", [v]))[0]
|
||||
}
|
||||
async int32TypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapTyped|null}>("Int32TypeMapTyped", [v]))[0]
|
||||
}
|
||||
async int64(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("Int64", [v]))[0]
|
||||
}
|
||||
async int64Map(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("Int64Map", [v]))[0]
|
||||
}
|
||||
async int64Slice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("Int64Slice", [v]))[0]
|
||||
}
|
||||
async int64Type(v:github_com_foomo_gotsrpc_v2_example_basic_service.Int64Type):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Int64Type> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Int64Type}>("Int64Type", [v]))[0]
|
||||
}
|
||||
async int64TypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapValue>|null}>("Int64TypeMap", [v]))[0]
|
||||
}
|
||||
async int64TypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapTyped|null}>("Int64TypeMapTyped", [v]))[0]
|
||||
}
|
||||
async intMap(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("IntMap", [v]))[0]
|
||||
}
|
||||
async intSlice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("IntSlice", [v]))[0]
|
||||
}
|
||||
async intType(v:github_com_foomo_gotsrpc_v2_example_basic_service.IntType):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.IntType> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.IntType}>("IntType", [v]))[0]
|
||||
}
|
||||
async intTypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapValue>|null}>("IntTypeMap", [v]))[0]
|
||||
}
|
||||
async intTypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapTyped|null}>("IntTypeMapTyped", [v]))[0]
|
||||
}
|
||||
async interface(v:any):Promise<any> {
|
||||
return (await this.transport<{0:any}>("Interface", [v]))[0]
|
||||
}
|
||||
async interfaceSlice(v:Array<any>|null):Promise<Array<any>|null> {
|
||||
return (await this.transport<{0:Array<any>|null}>("InterfaceSlice", [v]))[0]
|
||||
}
|
||||
async string(v:string):Promise<string> {
|
||||
return (await this.transport<{0:string}>("String", [v]))[0]
|
||||
}
|
||||
async stringMap(v:Record<string,any>|null):Promise<Record<string,any>|null> {
|
||||
return (await this.transport<{0:Record<string,any>|null}>("StringMap", [v]))[0]
|
||||
}
|
||||
async stringSlice(v:Array<string>|null):Promise<Array<string>|null> {
|
||||
return (await this.transport<{0:Array<string>|null}>("StringSlice", [v]))[0]
|
||||
}
|
||||
async stringType(v:github_com_foomo_gotsrpc_v2_example_basic_service.StringType):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.StringType> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.StringType}>("StringType", [v]))[0]
|
||||
}
|
||||
async stringTypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapValue>|null}>("StringTypeMap", [v]))[0]
|
||||
}
|
||||
async stringTypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapTyped|null}>("StringTypeMapTyped", [v]))[0]
|
||||
}
|
||||
async struct(v:github_com_foomo_gotsrpc_v2_example_basic_service.Struct):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.Struct> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.Struct}>("Struct", [v]))[0]
|
||||
}
|
||||
async uInt(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("UInt", [v]))[0]
|
||||
}
|
||||
async uInt32(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("UInt32", [v]))[0]
|
||||
}
|
||||
async uInt32Map(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("UInt32Map", [v]))[0]
|
||||
}
|
||||
async uInt32Slice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("UInt32Slice", [v]))[0]
|
||||
}
|
||||
async uInt32Type(v:github_com_foomo_gotsrpc_v2_example_basic_service.UInt32Type):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32Type> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.UInt32Type}>("UInt32Type", [v]))[0]
|
||||
}
|
||||
async uInt32TypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapValue>|null}>("UInt32TypeMap", [v]))[0]
|
||||
}
|
||||
async uInt32TypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapTyped|null}>("UInt32TypeMapTyped", [v]))[0]
|
||||
}
|
||||
async uInt64(v:number):Promise<number> {
|
||||
return (await this.transport<{0:number}>("UInt64", [v]))[0]
|
||||
}
|
||||
async uInt64Map(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("UInt64Map", [v]))[0]
|
||||
}
|
||||
async uInt64Slice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("UInt64Slice", [v]))[0]
|
||||
}
|
||||
async uInt64Type(v:github_com_foomo_gotsrpc_v2_example_basic_service.UInt64Type):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64Type> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.UInt64Type}>("UInt64Type", [v]))[0]
|
||||
}
|
||||
async uInt64TypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapValue>|null}>("UInt64TypeMap", [v]))[0]
|
||||
}
|
||||
async uInt64TypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapTyped|null}>("UInt64TypeMapTyped", [v]))[0]
|
||||
}
|
||||
async uIntMap(v:Record<number,any>|null):Promise<Record<number,any>|null> {
|
||||
return (await this.transport<{0:Record<number,any>|null}>("UIntMap", [v]))[0]
|
||||
}
|
||||
async uIntSlice(v:Array<number>|null):Promise<Array<number>|null> {
|
||||
return (await this.transport<{0:Array<number>|null}>("UIntSlice", [v]))[0]
|
||||
}
|
||||
async uIntType(v:github_com_foomo_gotsrpc_v2_example_basic_service.UIntType):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.UIntType> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.UIntType}>("UIntType", [v]))[0]
|
||||
}
|
||||
async uIntTypeMap(v:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapValue>|null):Promise<Record<github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapValue>|null> {
|
||||
return (await this.transport<{0:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapValue>|null}>("UIntTypeMap", [v]))[0]
|
||||
}
|
||||
async uIntTypeMapTyped(v:github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapTyped|null):Promise<github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapTyped|null> {
|
||||
return (await this.transport<{0:github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapTyped|null}>("UIntTypeMapTyped", [v]))[0]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/* eslint:disable */
|
||||
// hello commonjs - we need some imports - sorted in alphabetical order, by go package
|
||||
import * as github_com_foomo_gotsrpc_v2_example_basic_service from './service-vo'; // ./client/src/service-vo.ts to ./client/src/service-vo.ts
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float32Type
|
||||
export enum Float32Type {
|
||||
Float32AType = 1,
|
||||
Float32BType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float32TypeMapKey
|
||||
export enum Float32TypeMapKey {
|
||||
Float32ATypeMapKey = 1,
|
||||
Float32BTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float32TypeMapTyped
|
||||
export type Float32TypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float32TypeMapValue
|
||||
export enum Float32TypeMapValue {
|
||||
Float32ATypeMapValue = 1,
|
||||
Float32BTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float64Type
|
||||
export enum Float64Type {
|
||||
Float64AType = 1,
|
||||
Float64BType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float64TypeMapKey
|
||||
export enum Float64TypeMapKey {
|
||||
Float64ATypeMapKey = 1,
|
||||
Float64BTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float64TypeMapTyped
|
||||
export type Float64TypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Float64TypeMapValue
|
||||
export enum Float64TypeMapValue {
|
||||
Float64ATypeMapValue = 1,
|
||||
Float64BTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int32Type
|
||||
export enum Int32Type {
|
||||
Int32AType = 1,
|
||||
Int32BType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int32TypeMapKey
|
||||
export enum Int32TypeMapKey {
|
||||
Int32ATypeMapKey = 1,
|
||||
Int32BTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int32TypeMapTyped
|
||||
export type Int32TypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int32TypeMapValue
|
||||
export enum Int32TypeMapValue {
|
||||
Int32ATypeMapValue = 1,
|
||||
Int32BTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int64Type
|
||||
export enum Int64Type {
|
||||
Int64AType = 1,
|
||||
Int64BType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int64TypeMapKey
|
||||
export enum Int64TypeMapKey {
|
||||
Int64ATypeMapKey = 1,
|
||||
Int64BTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int64TypeMapTyped
|
||||
export type Int64TypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Int64TypeMapValue
|
||||
export enum Int64TypeMapValue {
|
||||
Int64ATypeMapValue = 1,
|
||||
Int64BTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.IntType
|
||||
export enum IntType {
|
||||
IntAType = 1,
|
||||
IntBType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.IntTypeMapKey
|
||||
export enum IntTypeMapKey {
|
||||
IntATypeMapKey = 1,
|
||||
IntBTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.IntTypeMapTyped
|
||||
export type IntTypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.IntTypeMapValue
|
||||
export enum IntTypeMapValue {
|
||||
IntATypeMapValue = 1,
|
||||
IntBTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.StringType
|
||||
export enum StringType {
|
||||
StringAType = "A",
|
||||
StringBType = "B",
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.StringTypeMapKey
|
||||
export enum StringTypeMapKey {
|
||||
StringATypeMapKey = "A",
|
||||
StringBTypeMapKey = "B",
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.StringTypeMapTyped
|
||||
export type StringTypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.StringTypeMapValue
|
||||
export enum StringTypeMapValue {
|
||||
StringATypeMapValue = "A",
|
||||
StringBTypeMapValue = "B",
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.Struct
|
||||
export interface Struct {
|
||||
Int:number;
|
||||
Int32:number;
|
||||
Int64:number;
|
||||
UInt:number;
|
||||
UInt32:number;
|
||||
UInt64:number;
|
||||
Float32:number;
|
||||
Float64:number;
|
||||
String:string;
|
||||
Interface:any;
|
||||
IntTypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.IntTypeMapValue>|null;
|
||||
Int32TypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int32TypeMapValue>|null;
|
||||
Int64TypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Int64TypeMapValue>|null;
|
||||
UIntTypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapValue>|null;
|
||||
UInt32TypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapValue>|null;
|
||||
UInt64TypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapValue>|null;
|
||||
Float32TypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float32TypeMapValue>|null;
|
||||
Float64TypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.Float64TypeMapValue>|null;
|
||||
StringTypeMapTyped:Record<github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.StringTypeMapValue>|null;
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt32Type
|
||||
export enum UInt32Type {
|
||||
UInt32AType = 1,
|
||||
UInt32BType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt32TypeMapKey
|
||||
export enum UInt32TypeMapKey {
|
||||
UInt32ATypeMapKey = 1,
|
||||
UInt32BTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt32TypeMapTyped
|
||||
export type UInt32TypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt32TypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt32TypeMapValue
|
||||
export enum UInt32TypeMapValue {
|
||||
UInt32ATypeMapValue = 1,
|
||||
UInt32BTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt64Type
|
||||
export enum UInt64Type {
|
||||
UInt64AType = 1,
|
||||
UInt64BType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt64TypeMapKey
|
||||
export enum UInt64TypeMapKey {
|
||||
UInt64ATypeMapKey = 1,
|
||||
UInt64BTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt64TypeMapTyped
|
||||
export type UInt64TypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UInt64TypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UInt64TypeMapValue
|
||||
export enum UInt64TypeMapValue {
|
||||
UInt64ATypeMapValue = 1,
|
||||
UInt64BTypeMapValue = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UIntType
|
||||
export enum UIntType {
|
||||
UIntAType = 1,
|
||||
UIntBType = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UIntTypeMapKey
|
||||
export enum UIntTypeMapKey {
|
||||
UIntATypeMapKey = 1,
|
||||
UIntBTypeMapKey = 2,
|
||||
}
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UIntTypeMapTyped
|
||||
export type UIntTypeMapTyped = Record<github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapKey,github_com_foomo_gotsrpc_v2_example_basic_service.UIntTypeMapValue>
|
||||
// github.com/foomo/gotsrpc/v2/example/basic/service.UIntTypeMapValue
|
||||
export enum UIntTypeMapValue {
|
||||
UIntATypeMapValue = 1,
|
||||
UIntBTypeMapValue = 2,
|
||||
}
|
||||
// end of common js
|
||||
@@ -0,0 +1,18 @@
|
||||
const transport = endpoint => async <T>(method: string, args: any = []) => {
|
||||
return new Promise<T>(async (resolve, reject) => {
|
||||
fetch(
|
||||
`${endpoint}/${encodeURIComponent(method)}`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify(args),
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
return response.json() as Promise<T>;
|
||||
})
|
||||
.then((val) => resolve(val))
|
||||
.catch((err) => reject(err))
|
||||
})
|
||||
};
|
||||
|
||||
export default transport
|
||||
Reference in New Issue
Block a user