cesium-native 0.46.0
Loading...
Searching...
No Matches
CesiumITwinClient::Connection Class Reference

Represents a connection to the Bentley iTwin API. More...

#include <CesiumITwinClient/Connection.h>

Public Member Functions

CesiumAsync::Future< CesiumUtility::Result< UserProfile > > me ()
 Obtains profile information of the currently logged in user.
 
CesiumAsync::Future< CesiumUtility::Result< PagedList< ITwin > > > itwins (const QueryParameters &params)
 Returns a list of iTwins the current user is a member of.
 
CesiumAsync::Future< CesiumUtility::Result< PagedList< IModel > > > imodels (const std::string &iTwinId, const QueryParameters &params)
 Returns a list of iModels belonging to the specified iTwin.
 
CesiumAsync::Future< CesiumUtility::Result< PagedList< IModelMeshExport > > > meshExports (const std::string &iModelId, const QueryParameters &params)
 Returns a list of mesh export tasks for the specified iModel.
 
CesiumAsync::Future< CesiumUtility::Result< PagedList< ITwinRealityData > > > realityData (const std::string &iTwinId, const QueryParameters &params)
 Returns a list of reality data instances belonging to the specified iTwin.
 
CesiumAsync::Future< CesiumUtility::Result< std::vector< CesiumCuratedContentAsset > > > cesiumCuratedContent ()
 Returns all available iTwin Cesium Curated Content items.
 
 Connection (const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const AuthenticationToken &accessToken, const std::optional< std::string > &refreshToken, const CesiumClientCommon::OAuth2ClientOptions &clientOptions)
 Creates a new Connection with the provided tokens.
 
const AuthenticationTokengetAccessToken () const
 Returns the AuthenticationToken object representing the parsed JWT access token.
 
void setAccessToken (const AuthenticationToken &authToken)
 Sets the access token that will be used for API calls.
 
const std::optional< std::string > & getRefreshToken () const
 Returns the refresh token used to obtain new access tokens, if any.
 
void setRefreshToken (const std::optional< std::string > &refreshToken)
 Sets the refresh token used to obtain new access tokens, if any.
 

Static Public Member Functions

static CesiumAsync::Future< CesiumUtility::Result< Connection > > authorize (const CesiumAsync::AsyncSystem &asyncSystem, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const std::string &friendlyApplicationName, const std::string &clientID, const std::string &redirectPath, const std::optional< int > &redirectPort, const std::vector< std::string > &scopes, std::function< void(const std::string &)> &&openUrlCallback)
 Authorizes access to iTwin on behalf of a user, and returns a Connection that can be used to interact with the iTwin API.
 

Detailed Description

Represents a connection to the Bentley iTwin API.

Definition at line 75 of file Connection.h.

Constructor & Destructor Documentation

◆ Connection()

CesiumITwinClient::Connection::Connection ( const CesiumAsync::AsyncSystem & asyncSystem,
const std::shared_ptr< CesiumAsync::IAssetAccessor > & pAssetAccessor,
const AuthenticationToken & accessToken,
const std::optional< std::string > & refreshToken,
const CesiumClientCommon::OAuth2ClientOptions & clientOptions )
inline

Creates a new Connection with the provided tokens.

It's recommended to use the Connection::authorize method to create a token instead of calling this constructor directly as the authorize method will handle the OAuth2 authentication flow with iTwin.

Parameters
asyncSystemThe CesiumAsync::AsyncSystem to use.
pAssetAccessorThe CesiumAsync::IAssetAccessor to use for making requests to the iTwin API.
accessTokenAn AuthenticationToken object created from parsing the obtained iTwin access token.
refreshTokenA refresh token to use to fetch new access tokens as needed, if any.
clientOptionsThe set of options to use when interacting with the iTwin OAuth2 API.

Definition at line 196 of file Connection.h.

Member Function Documentation

◆ authorize()

static CesiumAsync::Future< CesiumUtility::Result< Connection > > CesiumITwinClient::Connection::authorize ( const CesiumAsync::AsyncSystem & asyncSystem,
const std::shared_ptr< CesiumAsync::IAssetAccessor > & pAssetAccessor,
const std::string & friendlyApplicationName,
const std::string & clientID,
const std::string & redirectPath,
const std::optional< int > & redirectPort,
const std::vector< std::string > & scopes,
std::function< void(const std::string &)> && openUrlCallback )
static

Authorizes access to iTwin on behalf of a user, and returns a Connection that can be used to interact with the iTwin API.

Uses the "Authorization Code with PKCE" OAuth2 flow.

See Authorize Native Application for a description of the authorization process.

Parameters
asyncSystemThe async system used to do work in threads.
pAssetAccessorThe interface used to interact with the iTwin REST API.
friendlyApplicationNameA friendly name for the application requesting access. It will be displayed to the user when authorization is complete, informing them that they can return to the original application.
clientIDThe client ID that was assigned to your application when you registered it.
redirectPathThe path on http://127.0.0.1 that a user will be redirected to once they authorize your application. This must match the URI provided when you registered your application, without the protocol, hostname, or port.
redirectPortIf provided, this will be the port that the internal web server will attempt to bind to. If no port is specified, the server will bind to a random available port.
scopesThe list of scopes that the eventually-granted token should allow access to.
openUrlCallbackA function that is invoked to launch the user's web browser with a given URL so that they can authorize access.
Returns
A future that resolves to an iTwin Connection once the user authorizes the application and the token handshake completes.

◆ cesiumCuratedContent()

CesiumAsync::Future< CesiumUtility::Result< std::vector< CesiumCuratedContentAsset > > > CesiumITwinClient::Connection::cesiumCuratedContent ( )

Returns all available iTwin Cesium Curated Content items.

See also
https://developer.bentley.com/apis/cesium-curated-content/operations/list-content/

◆ getAccessToken()

const AuthenticationToken & CesiumITwinClient::Connection::getAccessToken ( ) const
inline

Returns the AuthenticationToken object representing the parsed JWT access token.

Definition at line 212 of file Connection.h.

◆ getRefreshToken()

const std::optional< std::string > & CesiumITwinClient::Connection::getRefreshToken ( ) const
inline

Returns the refresh token used to obtain new access tokens, if any.

Definition at line 225 of file Connection.h.

◆ imodels()

CesiumAsync::Future< CesiumUtility::Result< PagedList< IModel > > > CesiumITwinClient::Connection::imodels ( const std::string & iTwinId,
const QueryParameters & params )

Returns a list of iModels belonging to the specified iTwin.

Parameters
iTwinIdThe ID of the iTwin to obtain the iModels of.
paramsOptional parameters to filter the list results.
See also
https://developer.bentley.com/apis/imodels-v2/operations/get-itwin-imodels/

◆ itwins()

CesiumAsync::Future< CesiumUtility::Result< PagedList< ITwin > > > CesiumITwinClient::Connection::itwins ( const QueryParameters & params)

Returns a list of iTwins the current user is a member of.

Parameters
paramsOptional parameters to filter the list results.
See also
https://developer.bentley.com/apis/itwins/operations/get-my-itwins/

◆ me()

CesiumAsync::Future< CesiumUtility::Result< UserProfile > > CesiumITwinClient::Connection::me ( )

Obtains profile information of the currently logged in user.

See also
https://developer.bentley.com/apis/users/operations/me/

◆ meshExports()

CesiumAsync::Future< CesiumUtility::Result< PagedList< IModelMeshExport > > > CesiumITwinClient::Connection::meshExports ( const std::string & iModelId,
const QueryParameters & params )

Returns a list of mesh export tasks for the specified iModel.

Parameters
iModelIdThe ID of the iModel to obtain a list of export tasks for.
paramsOptional parameters to filter the list results.
See also
https://developer.bentley.com/apis/mesh-export/operations/get-exports/

◆ realityData()

CesiumAsync::Future< CesiumUtility::Result< PagedList< ITwinRealityData > > > CesiumITwinClient::Connection::realityData ( const std::string & iTwinId,
const QueryParameters & params )

Returns a list of reality data instances belonging to the specified iTwin.

Parameters
iTwinIdThe ID of the iTwin to obtain a list of reality data instances for.
paramsOptional parameters to filter the list results.
See also
https://developer.bentley.com/apis/reality-management/operations/get-all-reality-data/

◆ setAccessToken()

void CesiumITwinClient::Connection::setAccessToken ( const AuthenticationToken & authToken)
inline

Sets the access token that will be used for API calls.

Parameters
authTokenThe new auth token.

Definition at line 218 of file Connection.h.

◆ setRefreshToken()

void CesiumITwinClient::Connection::setRefreshToken ( const std::optional< std::string > & refreshToken)
inline

Sets the refresh token used to obtain new access tokens, if any.

Definition at line 231 of file Connection.h.


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