@rxap/open-api
Version:
This package provides tools for working with OpenAPI specifications in Angular applications. It includes services for configuring and loading OpenAPI definitions, validating requests and responses against schemas, and handling errors. It also offers utili
49 lines (48 loc) • 2.98 kB
TypeScript
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Injector } from '@angular/core';
import { OpenApiConfigService, OpenApiMetaData, OperationObjectWithMetadata, SchemaValidationMixin } from '@rxap/open-api';
import { BaseHttpRemoteMethod } from '@rxap/remote-method/http';
import * as i0 from "@angular/core";
export interface OperationForMetadata {
operation: OperationObjectWithMetadata;
/**
* used to specify the target server for the reset api operation
*/
serverId?: string;
/**
* the fallback id used if the operation does not have a operationId
*/
fallbackId?: string;
}
export interface OperationFromMetadataInline {
operationId: string;
operation: string;
/**
* used to specify the target server for the reset api operation
*/
serverId?: string;
}
export declare function IsOperationFromMetadataInline(metadata: OperationForMetadata | OperationFromMetadataInline): metadata is OperationFromMetadataInline;
export declare function RxapOpenApiRemoteMethod(operationOrId: string | OperationForMetadata | OperationFromMetadataInline, serverIndex?: number): (target: any) => void;
export type OpenApiRemoteMethodMetadata = OpenApiMetaData;
export interface OpenApiRemoteMethodParameter<Parameters extends Record<string, any> | void = any, RequestBody = any> {
parameters?: Parameters;
requestBody?: RequestBody;
}
export interface OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any> extends SchemaValidationMixin<Response, Parameters, RequestBody> {
}
export declare class OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any> extends BaseHttpRemoteMethod<Response, any, OpenApiRemoteMethodParameter<Parameters, RequestBody>> {
protected readonly disableSchemaValidation: boolean;
protected readonly disableValidation: boolean;
private readonly strict;
constructor(http: HttpClient, injector: Injector, openApiConfigService: OpenApiConfigService, metadata?: OpenApiRemoteMethodMetadata | null, strict?: boolean | null, disableSchemaValidation?: boolean | null, disableValidation?: boolean | null);
get operation(): OperationObjectWithMetadata;
/**
* Instead of returning the response body the full response object is returned
*/
callWithResponse(args?: OpenApiRemoteMethodParameter<Parameters, RequestBody>): Promise<HttpResponse<Response>>;
_callWithResponse(args?: OpenApiRemoteMethodParameter<Parameters, RequestBody>): Promise<HttpResponse<Response>>;
protected _call(args?: OpenApiRemoteMethodParameter<Parameters, RequestBody>): Promise<Response>;
static ɵfac: i0.ɵɵFactoryDeclaration<OpenApiRemoteMethod<any, any, any>, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<OpenApiRemoteMethod<any, any, any>>;
}