olp-cpp-sdk  1.21.0
Public Types | Public Member Functions | List of all members
olp::client::ApiLookupClient Class Referencefinal

A client for API lookup requests. More...

#include <ApiLookupClient.h>

Public Types

using LookupApiResponse = ApiResponse< OlpClient, ApiError >
 Alias for the lookup API response.
 
using LookupApiCallback = std::function< void(LookupApiResponse)>
 Alias for the lookup API callback.
 

Public Member Functions

 ApiLookupClient (const HRN &catalog, const OlpClientSettings &settings)
 Creates the ApiLookupClient instance. More...
 
LookupApiResponse LookupApi (const std::string &service, const std::string &service_version, FetchOptions options, CancellationContext context)
 Gets a API for a single service sync, internally uses ApiLookupSettings from OlpClientSettings. More...
 
CancellationToken LookupApi (const std::string &service, const std::string &service_version, FetchOptions options, LookupApiCallback callback)
 Gets an API for a single service asynchronously. More...
 

Detailed Description

A client for API lookup requests.

Constructor & Destructor Documentation

◆ ApiLookupClient()

olp::client::ApiLookupClient::ApiLookupClient ( const HRN catalog,
const OlpClientSettings settings 
)
explicit

Creates the ApiLookupClient instance.

Parameters
catalogThe catalog HRN.
settingsThe OlpClientSettings instance.

Member Function Documentation

◆ LookupApi() [1/2]

LookupApiResponse olp::client::ApiLookupClient::LookupApi ( const std::string &  service,
const std::string &  service_version,
FetchOptions  options,
CancellationContext  context 
)

Gets a API for a single service sync, internally uses ApiLookupSettings from OlpClientSettings.

Parameters
serviceThe name of the required service.
service_versionThe version of the required service.
optionsThe fetch option that should be used to set the source from which data should be fetched.
contextThe CancellationContext instance that is used to cancel the request.
Returns
LookupApiResponse that contains the OlpClient instance or an error.

◆ LookupApi() [2/2]

CancellationToken olp::client::ApiLookupClient::LookupApi ( const std::string &  service,
const std::string &  service_version,
FetchOptions  options,
LookupApiCallback  callback 
)

Gets an API for a single service asynchronously.

Internally, it uses ApiLookupSettings from OlpClientSettings.

Parameters
serviceThe name of the required service.
service_versionThe version of the required service.
optionsThe fetch option that should be used to set the source from which data should be fetched.
callbackThe function callback used to receive the LookupApiResponse instance.
Note
If the catalog endpoint provider is set and provides a static URL for this catalog, the method does not trigger any asynchronous download and provides the synchronous result instead. This means that the user needs to take special care in case the callback is called within the same context and avoid locking any mutex twice.
Returns
The method used to call or to cancel the request.

The documentation for this class was generated from the following file: