3#include "AuthenticationToken.h"
4#include "CesiumCuratedContent.h"
6#include "IModelMeshExport.h"
8#include "ITwinRealityData.h"
12#include <CesiumAsync/AsyncSystem.h>
13#include <CesiumAsync/Future.h>
14#include <CesiumAsync/IAssetAccessor.h>
15#include <CesiumClientCommon/OAuth2PKCE.h>
16#include <CesiumITwinClient/PagedList.h>
17#include <CesiumUtility/Result.h>
18#include <CesiumUtility/Uri.h>
54 std::optional<uint32_t>
top;
60 std::optional<uint32_t>
skip;
111 const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
112 const std::string& friendlyApplicationName,
113 const std::string& clientID,
114 const std::string& redirectPath,
115 const std::optional<int>& redirectPort,
116 const std::vector<std::string>& scopes,
117 std::function<
void(
const std::string&)>&& openUrlCallback);
198 const std::shared_ptr<CesiumAsync::IAssetAccessor>& pAssetAccessor,
200 const std::optional<std::string>& refreshToken,
202 : _asyncSystem(asyncSystem),
203 _pAssetAccessor(pAssetAccessor),
204 _accessToken(accessToken),
205 _refreshToken(refreshToken),
206 _clientOptions(clientOptions) {}
219 _accessToken = authToken;
226 return _refreshToken;
232 _refreshToken = refreshToken;
237 listITwins(
const std::string& url);
239 listIModels(
const std::string& url);
241 listIModelMeshExports(
const std::string& url);
243 listITwinRealityData(
const std::string& url);
249 std::shared_ptr<CesiumAsync::IAssetAccessor> _pAssetAccessor;
251 std::optional<std::string> _refreshToken;
A system for managing asynchronous requests and tasks.
A value that will be available in the future, as produced by AsyncSystem.
An authentication token obtained from the iTwin OAuth2 flow.
Represents a connection to the Bentley iTwin API.
CesiumAsync::Future< CesiumUtility::Result< std::vector< CesiumCuratedContentAsset > > > cesiumCuratedContent()
Returns all available iTwin Cesium Curated Content items.
const AuthenticationToken & getAccessToken() const
Returns the AuthenticationToken object representing the parsed JWT access token.
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< UserProfile > > me()
Obtains profile information of the currently logged in user.
const std::optional< std::string > & getRefreshToken() const
Returns the refresh token used to obtain new access tokens, if any.
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< PagedList< ITwin > > > itwins(const QueryParameters ¶ms)
Returns a list of iTwins the current user is a member of.
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.
void setAccessToken(const AuthenticationToken &authToken)
Sets the access token that will be used for API calls.
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...
void setRefreshToken(const std::optional< std::string > &refreshToken)
Sets the refresh token used to obtain new access tokens, if any.
A class for parsing and manipulating the query string of a URI.
A class for parsing and manipulating Uniform Resource Identifiers (URIs).
Classes for interacting with the iTwin API.
Options used to configure the OAuth2 authentication process.
A common set of query parameters used across list operations in the Bentley API.
std::optional< std::string > search
A search string to use to limit results. Not used by all endpoints.
std::optional< std::string > orderBy
Used to order the results.
std::optional< uint32_t > skip
Requests that this number of items in the results will be skipped and not returned.
std::optional< uint32_t > top
Limits the number of items that can be returned.
void addToQuery(CesiumUtility::UriQuery &uriQuery) const
Adds the parameters in this object to the provided URI query string.
void addToUri(CesiumUtility::Uri &uri) const
Adds the parameters in this object to the query of the provided URI.
Holds the result of an operation. If the operation succeeds, it will provide a value....