Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
evolveProtocol
export namespace api {
export interface Request<
> {
method: string;
params: any;
result: any;
}
export interface Notification<
> extends Request {
result: void;
}
export type Params<
T extends Request
> = T['params'];
export type Result<
T extends Request
> = T['result'];
export type Function<
T extends Request
> = (params: Params<T>) => Result<T>;
export type Interface<T extends any> = {
[M in keyof T]: api.Function<T[M]>
}
}
export namespace evolve {
export type Solution = any;
export type Metrics = any;
/**
* The [[evolve.combine]] request...
*/
export class combine implements api.Request {
method = 'evolve.combine';
params: {
/** Solutions to be combined */
solutions: Solution[];
};
result: {
solution: Solution;
};
}
export class hello implements api.Notification {
method = 'evolve.hello';
params: {
};
result: void
}
}
class Implements {
combine: evolve.combine;
hello: evolve.hello;
};
class Combiner implements api.Interface<Implements> {
combine(params: api.Params<evolve.combine>): api.Result<evolve.combine> {
return { solution: null };
}
hello(params: api.Params<evolve.hello>): api.Result<evolve.hello> {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.