UNPKG

@itwin/itwins-client

Version:

iTwins client for the iTwin platform

141 lines 4.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseITwinsApiClient = void 0; const BaseBentleyAPIClient_1 = require("./BaseBentleyAPIClient"); /** Abstract class for accessing working with ITwins Service * @beta */ class BaseITwinsApiClient extends BaseBentleyAPIClient_1.BaseBentleyAPIClient { /** * Creates a new BaseClient instance for iTwins API operations * @param url - Optional custom base URL, defaults to production iTwins API URL * * @example * ```typescript * // Use default production URL * const client = new BaseClient(); * * // Use custom URL for development/testing * const client = new ITwinsAccessClient("https://dev-api.bentley.com/itwins"); * ``` */ constructor(url, maxRedirects) { super(maxRedirects); /** * The base URL for iTwins API endpoints. * The URL can be customized via the constructor parameter or automatically * modified based on the IMJS_URL_PREFIX environment variable for different * deployment environments. * * @readonly */ this._baseUrl = "https://api.bentley.com/itwins"; if (url !== undefined) { this._baseUrl = url; } else { const urlPrefix = globalThis.IMJS_URL_PREFIX; if (urlPrefix) { const baseUrl = new URL(this._baseUrl); baseUrl.hostname = `${urlPrefix}${baseUrl.hostname}`; this._baseUrl = baseUrl.href; } } } } exports.BaseITwinsApiClient = BaseITwinsApiClient; /** * Maps the properties of {@link ITwinsQueryArg} to their corresponding query parameter names. * * @remarks * This mapping is used to translate internal property names to the expected parameter names * when constructing iTwins queries. Properties mapped to empty strings are excluded from * the query string as they should be sent as headers instead. * * The mapping includes both OData query parameters (prefixed with $) and iTwins-specific * parameters for filtering and pagination. * * @readonly */ BaseITwinsApiClient.iTwinsQueryParamMapping = { subClass: "subClass", type: "type", status: "status", search: "$search", displayName: "displayName", // eslint-disable-next-line id-denylist number: "number", top: "$top", skip: "$skip", parentId: "parentId", iTwinAccountId: "iTwinAccountId", includeInactive: "includeInactive", resultMode: "", queryScope: "", }; /** * Maps the properties some of the {@link ODataQueryParams} to their corresponding query parameter names. * * @remarks * This mapping is used to translate internal property names to the expected parameter names * when constructing iTwins queries. Properties mapped to empty strings are excluded from * the query string as they should be sent as headers instead. * * The mapping includes both OData query parameters (prefixed with $) and iTwins-specific * parameters for filtering and pagination. * * @readonly */ // eslint-disable-next-line @typescript-eslint/naming-convention BaseITwinsApiClient.ODataParamMapping = { top: "$top", skip: "$skip", search: "$search", }; /** * Maps the properties some of the {@link ODataQueryParams} and all of the {@link ITwinsQueryArg} to their corresponding query parameter names. * * @remarks * This mapping is used to translate internal property names to the expected parameter names * when constructing iTwins queries. Properties mapped to empty strings are excluded from * the query string as they should be sent as headers instead. * * The mapping includes both OData query parameters (prefixed with $) and iTwins-specific * parameters for filtering and pagination. * * @readonly */ // eslint-disable-next-line @typescript-eslint/naming-convention BaseITwinsApiClient.ITwinsGetQueryParamMapping = { subClass: "subClass", type: "type", status: "status", search: "$search", displayName: "displayName", // eslint-disable-next-line id-denylist number: "number", top: "$top", skip: "$skip", parentId: "parentId", iTwinAccountId: "iTwinAccountId", includeInactive: "includeInactive", resultMode: "", queryScope: "", filter: "$filter", orderby: "$orderby", select: "$select", }; /** * Maps the properties of class and subclass to their corresponding query parameter names. * * @remarks * This mapping is used to translate internal property names to the expected parameter names * when constructing repository queries. * * @readonly */ BaseITwinsApiClient.repositoryParamMapping = { class: "class", subClass: "subClass", }; //# sourceMappingURL=BaseITwinsApiClient.js.map