/** @packageDocumentation * @module iModelHubClient */ import { ClientRequestContext } from "@bentley/bentleyjs-core"; import { AuthorizedClientRequestContext, ChunkedQueryContext, FileHandler, HttpRequestOptions, RequestOptions, RequestQueryOptions, WsgClient, WsgInstance, WsgRequestOptions } from "@bentley/itwin-client"; import { CustomRequestOptions } from "./CustomRequestOptions"; /** * This type allows modifying HttpRequestOptions that are sent for every request. * @beta */ export declare type HttpRequestOptionsTransformer = (options: HttpRequestOptions) => void; /** * This function when used on IModelClient adds specified header to every request. * @beta */ export declare function addHeader(name: string, valueFactory: () => string): HttpRequestOptionsTransformer; /** * This function when used on IModelClient adds specified application version header to every request. * @beta */ export declare function addApplicationVersion(version: string): HttpRequestOptionsTransformer; /** * This function when used on IModelClient adds CSRF header to every request. * @beta */ export declare function addCsrfHeader(headerName?: string, cookieName?: string): HttpRequestOptionsTransformer; /** * This class acts as the WsgClient for other iModelHub Handlers. * @public */ export declare class IModelBaseHandler extends WsgClient { protected _url?: string; private _defaultIModelHubOptionsProvider; static readonly configRelyingPartyUri = "imjs_imodelhub_relying_party_uri"; protected _agent: any; protected _fileHandler: FileHandler | undefined; private _customRequestOptions; private _httpRequestOptionsTransformers; /** @internal */ protected getUrlSearchKey(): string; /** * Create an instance of IModelBaseHandler. * @internal */ constructor(keepAliveDuration?: number, fileHandler?: FileHandler); /** * @internal */ formatContextIdForUrl(contextId: string): string; /** * @internal */ getFileHandler(): FileHandler | undefined; /** * Augment request options with defaults returned by the DefaultIModelHubRequestOptionsProvider. Note that the options passed in by clients override any defaults where necessary. * @param options Options the caller wants to augment with the defaults. * @returns Promise resolves after the defaults are setup. * @internal */ protected setupOptionDefaults(options: RequestOptions): Promise; /** * Populates HTTP request options with additional data. * @param options Options that need to be populated. * @returns Options populated with additional data. * @internal */ protected setupHttpOptions(options?: HttpRequestOptions): HttpRequestOptions; /** * Adds a method that will be called for every request to modify HttpRequestOptions. * @param func Method that will be used to modify HttpRequestOptions. * @beta */ use(func: HttpRequestOptionsTransformer): void; /** * Gets theRelyingPartyUrl for the service. * @returns RelyingPartyUrl for the service. * @internal */ protected getRelyingPartyUrl(): string; /** * Get the agent used for imodelhub connection pooling. * @returns The agent used for imodelhub connection pooling. * @internal */ getAgent(): any; /** * Get the URL of the service. This method attempts to discover and cache the URL from the URL Discovery Service. If not found uses the default URL provided by client implementations. Note that for consistency sake, the URL is stripped of any trailing "/" * @returns URL for the service * @internal */ getUrl(requestContext: ClientRequestContext): Promise; /** * Send a delete request. Sends a request without body. * @param requestContext The client request context * @param relativeUrlPath Relative path to the REST resource. * @param httpRequestOptions Additional options for the HTTP request. * @returns Promise resolves after successfully deleting REST resource at the specified path. */ delete(requestContext: AuthorizedClientRequestContext, relativeUrlPath: string, httpRequestOptions?: HttpRequestOptions): Promise; /** * Delete a strongly typed instance. Sends a request body with a WSG instance. * @param requestContext The client request context * @param relativeUrlPath Relative path to the REST resource. * @param instance Instance to be deleted. * @param requestOptions WSG options for the request. * @returns Promise resolves after successfully deleting instance. */ deleteInstance(requestContext: AuthorizedClientRequestContext, relativeUrlPath: string, instance?: T, requestOptions?: WsgRequestOptions): Promise; /** * Post a strongly typed instance. Sends a request body with a WSG instance. * @param requestContext The client request context * @param typedConstructor Used to construct the resulting instances from the response. * @param relativeUrlPath Relative path to the REST resource. * @param instance Strongly typed instance to be posted. * @param requestOptions WSG options for the request. * @param httpRequestOptions Additional options for the HTTP request. * @returns The posted instance that's returned back from the server. */ postInstance(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, instance: T, requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise; /** * Post multiple strongly typed instances. Sends a request body with WSG instances. * @param requestContext The client request context * @param typedConstructor Used to construct the resulting instances from the response. * @param relativeUrlPath Relative path to the REST resource. * @param instances Strongly typed instances to be posted. * @param requestOptions WSG options for the request. * @param httpRequestOptions Additional options for the HTTP request. * @returns The posted instances that's returned back from the server. */ postInstances(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, instances: T[], requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise; /** * Get multiple strongly typed instances. * @param requestContext The client request context * @param typedConstructor Used to construct the resulting instances from the response. * @param relativeUrlPath Relative path to the REST resource. * @param queryOptions Query options. * @param httpRequestOptions Additional options for the HTTP request. * @returns Array of strongly typed instances. */ getInstances(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, queryOptions?: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise; /** * Get a chunk of strongly typed instances. * @param requestContext Client request context * @param url Full path to the REST resource. * @param chunkedQueryContext Chunked query context * @param typedConstructor Constructor function for the type * @param queryOptions Query options. * @param httpRequestOptions Additional options for the HTTP request. * @returns Array of strongly typed instances. */ getInstancesChunk(requestContext: AuthorizedClientRequestContext, url: string, chunkedQueryContext: ChunkedQueryContext | undefined, typedConstructor: new () => T, queryOptions?: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise; /** * Get multiple strongly typed instances. Sends query in the request's body. This can be used for queries that are too long to fit in URL. * @param requestContext The client request context * @param typedConstructor Used to construct the resulting instances from the response. * @param relativeUrlPath Relative path to the REST resource. * @param queryOptions Query options. * @param httpRequestOptions Additional options for the HTTP request. * @returns Array of strongly typed instances. */ postQuery(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, queryOptions: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise; /** * Get an instance of CustomRequestOptions, which can be used to set custom request parameters for all future requests made by this handler. * @internal */ getCustomRequestOptions(): CustomRequestOptions; } //# sourceMappingURL=BaseHandler.d.ts.map