cesium-native 0.46.0
|
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 ¶ms) |
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 ¶ms) |
Returns a list of iModels belonging to the specified iTwin. | |
CesiumAsync::Future< CesiumUtility::Result< PagedList< IModelMeshExport > > > | meshExports (const std::string &iModelId, const QueryParameters ¶ms) |
Returns a list of mesh export tasks for the specified iModel. | |
CesiumAsync::Future< CesiumUtility::Result< PagedList< ITwinRealityData > > > | realityData (const std::string &iTwinId, const QueryParameters ¶ms) |
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 AuthenticationToken & | getAccessToken () 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. | |
Represents a connection to the Bentley iTwin API.
Definition at line 75 of file Connection.h.
|
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.
asyncSystem | The CesiumAsync::AsyncSystem to use. |
pAssetAccessor | The CesiumAsync::IAssetAccessor to use for making requests to the iTwin API. |
accessToken | An AuthenticationToken object created from parsing the obtained iTwin access token. |
refreshToken | A refresh token to use to fetch new access tokens as needed, if any. |
clientOptions | The set of options to use when interacting with the iTwin OAuth2 API. |
Definition at line 196 of file Connection.h.
|
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.
asyncSystem | The async system used to do work in threads. |
pAssetAccessor | The interface used to interact with the iTwin REST API. |
friendlyApplicationName | A 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. |
clientID | The client ID that was assigned to your application when you registered it. |
redirectPath | The 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. |
redirectPort | If 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. |
scopes | The list of scopes that the eventually-granted token should allow access to. |
openUrlCallback | A function that is invoked to launch the user's web browser with a given URL so that they can authorize access. |
Connection
once the user authorizes the application and the token handshake completes. CesiumAsync::Future< CesiumUtility::Result< std::vector< CesiumCuratedContentAsset > > > CesiumITwinClient::Connection::cesiumCuratedContent | ( | ) |
Returns all available iTwin Cesium Curated Content items.
|
inline |
Returns the AuthenticationToken object representing the parsed JWT access token.
Definition at line 212 of file Connection.h.
|
inline |
Returns the refresh token used to obtain new access tokens, if any.
Definition at line 225 of file Connection.h.
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.
iTwinId | The ID of the iTwin to obtain the iModels of. |
params | Optional parameters to filter the list results. |
CesiumAsync::Future< CesiumUtility::Result< PagedList< ITwin > > > CesiumITwinClient::Connection::itwins | ( | const QueryParameters & | params | ) |
Returns a list of iTwins the current user is a member of.
params | Optional parameters to filter the list results. |
CesiumAsync::Future< CesiumUtility::Result< UserProfile > > CesiumITwinClient::Connection::me | ( | ) |
Obtains profile information of the currently logged in user.
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.
iModelId | The ID of the iModel to obtain a list of export tasks for. |
params | Optional parameters to filter the list results. |
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.
iTwinId | The ID of the iTwin to obtain a list of reality data instances for. |
params | Optional parameters to filter the list results. |
|
inline |
Sets the access token that will be used for API calls.
authToken | The new auth token. |
Definition at line 218 of file Connection.h.
|
inline |
Sets the refresh token used to obtain new access tokens, if any.
Definition at line 231 of file Connection.h.