import { HTTPRequest } from "./HTTPRequest.js"; import { IHttpResponse } from "./IHttpResponse.js"; import { IServiceNowInstance } from "../../sn/IServiceNowInstance.js"; export interface IRequestHandler { post(request: HTTPRequest): Promise>; put(request: HTTPRequest): Promise>; get(request: HTTPRequest): Promise>; delete(request: HTTPRequest): Promise>; /** * Records the session to use for outgoing requests, together with the instance * it was minted for. * * `instance` is optional so existing callers keep compiling, but omitting it * disables the cross-instance guard for this handler — pass it wherever the * owning instance is known. */ setSession(session: any, instance?: IServiceNowInstance): any; /** * Declares which instance this handler serves. Set once, at construction. * A session recorded for any other instance will be refused at dispatch. * * Optional so that adding it is not a breaking change for anyone implementing * this interface outside the repo. A handler that does not implement it simply * has no bound identity, and the dispatch guard stays permissive — the same * behaviour as a handler built without an instance. */ bindInstance?(instance: IServiceNowInstance): any; }