mirror of
https://github.com/hanzoai/zap-es.git
synced 2026-10-30 18:17:07 +00:00
103 lines
3.4 KiB
TypeScript
103 lines
3.4 KiB
TypeScript
// This file has been automatically generated by zap-es.
|
|
import * as $ from "zap-es";
|
|
export const _zapFileId = 0xaa89f7261e168017n;
|
|
export class SimpleInterface_Subtract$Params extends $.Struct {
|
|
static readonly _zap = {
|
|
displayName: "subtract$Params",
|
|
id: "888da0aceabad12a",
|
|
size: new $.ObjectSize(8, 0),
|
|
};
|
|
get a(): number {
|
|
return $.utils.getInt32(0, this);
|
|
}
|
|
set a(value: number) {
|
|
$.utils.setInt32(0, value, this);
|
|
}
|
|
get b(): number {
|
|
return $.utils.getInt32(4, this);
|
|
}
|
|
set b(value: number) {
|
|
$.utils.setInt32(4, value, this);
|
|
}
|
|
toString(): string { return "SimpleInterface_Subtract$Params_" + super.toString(); }
|
|
}
|
|
export class SimpleInterface_Subtract$Results extends $.Struct {
|
|
static readonly _zap = {
|
|
displayName: "subtract$Results",
|
|
id: "b0164441a304b38f",
|
|
size: new $.ObjectSize(8, 0),
|
|
};
|
|
get result(): number {
|
|
return $.utils.getInt32(0, this);
|
|
}
|
|
set result(value: number) {
|
|
$.utils.setInt32(0, value, this);
|
|
}
|
|
toString(): string { return "SimpleInterface_Subtract$Results_" + super.toString(); }
|
|
}
|
|
export class SimpleInterface_Subtract$Results$Promise {
|
|
pipeline: $.Pipeline<any, any, SimpleInterface_Subtract$Results>;
|
|
constructor(pipeline: $.Pipeline<any, any, SimpleInterface_Subtract$Results>) {
|
|
this.pipeline = pipeline;
|
|
}
|
|
async promise(): Promise<SimpleInterface_Subtract$Results> {
|
|
return await this.pipeline.struct();
|
|
}
|
|
}
|
|
export class SimpleInterface$Client {
|
|
client: $.Client;
|
|
static readonly interfaceId: bigint = 0xdaf73e960b8928d6n;
|
|
constructor(client: $.Client) {
|
|
this.client = client;
|
|
}
|
|
static readonly methods: [
|
|
$.Method<SimpleInterface_Subtract$Params, SimpleInterface_Subtract$Results>
|
|
] = [
|
|
{
|
|
ParamsClass: SimpleInterface_Subtract$Params,
|
|
ResultsClass: SimpleInterface_Subtract$Results,
|
|
interfaceId: SimpleInterface$Client.interfaceId,
|
|
methodId: 0,
|
|
interfaceName: "test/fixtures/simple-interface.zap:SimpleInterface",
|
|
methodName: "subtract"
|
|
}
|
|
];
|
|
subtract(paramsFunc?: (params: SimpleInterface_Subtract$Params) => void): SimpleInterface_Subtract$Results$Promise {
|
|
const answer = this.client.call({
|
|
method: SimpleInterface$Client.methods[0],
|
|
paramsFunc: paramsFunc
|
|
});
|
|
const pipeline = new $.Pipeline(SimpleInterface_Subtract$Results, answer);
|
|
return new SimpleInterface_Subtract$Results$Promise(pipeline);
|
|
}
|
|
}
|
|
$.Registry.register(SimpleInterface$Client.interfaceId, SimpleInterface$Client);
|
|
export interface SimpleInterface$Server$Target {
|
|
subtract(params: SimpleInterface_Subtract$Params, results: SimpleInterface_Subtract$Results): Promise<void>;
|
|
}
|
|
export class SimpleInterface$Server extends $.Server {
|
|
readonly target: SimpleInterface$Server$Target;
|
|
constructor(target: SimpleInterface$Server$Target) {
|
|
super(target, [
|
|
{
|
|
...SimpleInterface$Client.methods[0],
|
|
impl: target.subtract
|
|
}
|
|
]);
|
|
this.target = target;
|
|
}
|
|
client(): SimpleInterface$Client {
|
|
return new SimpleInterface$Client(this);
|
|
}
|
|
}
|
|
export class SimpleInterface extends $.Interface {
|
|
static readonly Client = SimpleInterface$Client;
|
|
static readonly Server = SimpleInterface$Server;
|
|
static readonly _zap = {
|
|
displayName: "SimpleInterface",
|
|
id: "daf73e960b8928d6",
|
|
size: new $.ObjectSize(0, 0),
|
|
};
|
|
toString(): string { return "SimpleInterface_" + super.toString(); }
|
|
}
|