import { TypedRouter } from './typedrequest.classes.typedrouter.js'; import * as plugins from './typedrequest.plugins.js'; export declare type IPostMethod = (typedRequestPostObject: plugins.typedRequestInterfaces.ITypedRequest) => Promise; /** * this is an alternative to a post url supplied in `new Typedrequest(new TypedTarget(...), 'someMethodName')` * enables the use of custom post functions * used for things like broadcast channels * e.g. @designestate/dees-comms * the main difference here is, that the response comes back async and is routed by interest through typedrouter */ export declare type IPostMethodWithTypedRouter = (typedRequestPostObject: plugins.typedRequestInterfaces.ITypedRequest) => Promise | Promise; export interface ITypedTargetConstructorOptions { url?: string; postMethod?: IPostMethod; /** * a post method that does not return the answer */ postMethodWithTypedRouter?: IPostMethodWithTypedRouter; /** * this typedrouter allows us to have easy async request response cycles */ typedRouterRef?: TypedRouter; } /** * a typed target defines a target for requests */ export declare class TypedTarget { url: string; type: 'rest' | 'socket'; options: ITypedTargetConstructorOptions; constructor(optionsArg: ITypedTargetConstructorOptions); /** * wether calls to this target are bound to the request/response cycle * if false, always delivers response as result of a call * if true, delivers response in a separate call * can only be async when type is 'socket' */ isAsync: boolean; post(payloadArg: T): Promise; }