How to use the @here/olp-sdk-dataservice-api.LookupApi.resourceAPI function in @here/olp-sdk-dataservice-api

To help you get started, we’ve selected a few @here/olp-sdk-dataservice-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / here-olp-sdk-typescript / @here / olp-sdk-dataservice-read / lib / utils / RequestBuilderFactory.ts View on Github external
hrn?: HRN
    ): Promise {
        const apiCache = new ApiCacheRepository(settings.cache, hrn);
        const baseUrl = apiCache.get(serviceName, serviceVersion);
        if (baseUrl) {
            return Promise.resolve(baseUrl);
        }

        const lookUpUrl = getEnvLookUpUrl(settings.environment);
        const lookUpApiRequest = new DataStoreRequestBuilder(
            settings.downloadManager,
            lookUpUrl,
            settings.token
        );

        const apiService = hrn ? LookupApi.resourceAPI : LookupApi.platformAPI;
        const params: {
            api: string;
            version: string;
            hrn: string;
            region?: string | undefined;
        } = {
            api: serviceName,
            version: serviceVersion,
            hrn: ""
        };

        if (hrn) {
            params.hrn = hrn.toString();
        }

        return apiService(lookUpApiRequest, params)