import { CyHttpMessages } from 'cypress/types/net-stubbing'; import { Observable } from 'rxjs'; import { Headers, Method, RouteConfig } from './routing'; import { SpyHttpClient } from './spy-http-client'; /** * An endpoint definition with methods to get route config and alias * IN: endpoint input parameters * OUT: endpoint response */ export declare abstract class AbstractEndpoint { private readonly parentName; protected headers: Headers; abstract defaultConfig(...params: IN): RouteConfig; endpointName: string; protected constructor(parentName: string, headers?: Headers); get routeName(): string; get alias(): string; /** * Prepare the fixture or fixture builder to build the route config. * * In the case of a fixture object, it clones it. * In the case of a function (i.e. fixture builder), it doesn't do anything. * @param fixtureOrFixtureBuilder * @private */ protected prepareFixtureOrFixtureBuilder(fixtureOrFixtureBuilder: OUT | ((req: CyHttpMessages.IncomingHttpRequest) => OUT)): OUT | ((req: CyHttpMessages.IncomingHttpRequest) => OUT); } /** * Endpoint based on a generated client endpoint */ export declare class Endpoint extends AbstractEndpoint { private readonly spyHttpClient; private readonly actualClient; private readonly actualEndpoint; statusCode: number; fixtureOrFixtureBuilder: OUT | ((req: CyHttpMessages.IncomingHttpRequest) => OUT); private static readonly STRIP_COMMENTS; private static readonly ARGUMENT_NAMES; private urlModifier; /** * Inject an optional url modifier * @param urlModifier */ withUrlModifier(urlModifier: (url: string) => string | RegExp): this; /** * Get the list of parameter names from a function. Used when introspecting generated client's endpoint method * @param func * @private */ private getParamNames; constructor(spyHttpClient: SpyHttpClient, actualClient: C, actualEndpoint: (...params: IN) => Observable, parentName: string, statusCode: number, fixtureOrFixtureBuilder: OUT | ((req: CyHttpMessages.IncomingHttpRequest) => OUT), headers?: Headers); /** * Get the fixture object (if endpoint was stubbed with a fixture), * or throw an error (if endpoint was stubbed with a fixture builder function) */ get fixture(): OUT; /** * Get the fixture builder function (if endpoint was stubbed with a fixture builder), * or throw an error (if endpoint was stubbed with a fixture object) */ get fixtureBuilder(): (req: CyHttpMessages.IncomingHttpRequest) => OUT; defaultConfig(...userParams: Partial | []): RouteConfig; } /** * Endpoint configured manually, not based on a generated client */ export declare class ManualEndpoint extends AbstractEndpoint { method: Method; url: string | RegExp; originalUrlForSmokeJS: string; statusCode: number; fixtureOrFixtureBuilder: OUT | ((req: CyHttpMessages.IncomingHttpRequest) => OUT); constructor(parentName: string, method: Method, url: string | RegExp, originalUrlForSmokeJS: string, statusCode: number, fixtureOrFixtureBuilder: OUT | ((req: CyHttpMessages.IncomingHttpRequest) => OUT), headers?: Headers); /** * Get the fixture (if endpoint was stubbed with a fixture object), * or throw an error (if endpoint was stubbed with a fixture builder function) */ get fixture(): OUT; /** * Get the fixture builder (if endpoint was stubbed with a fixture builder function), * or throw an error (if endpoint was stubbed with a fixture object) */ get fixtureBuilder(): (req: CyHttpMessages.IncomingHttpRequest) => OUT; defaultConfig(): RouteConfig; }