CosmosClient Class Reference¶
Defined in siddiqsoft/cosmoscl.hpp inside namespace siddiqsoft.
Constructors & Rule of 5¶
CosmosClient() = default;
CosmosClient(CosmosClient&& src) noexcept;
CosmosClient& operator=(CosmosClient&& src) noexcept;
CosmosClient(const CosmosClient&) = delete;
CosmosClient& operator=(const CosmosClient&) = delete;
CosmosClient is move-only, managing internal thread pools and connection state.
Member Functions¶
Configuration & State¶
configure¶
Configures the client with connection strings and partition key names.
configuration¶
Returns the active configuration JSON.
Document Operations¶
createDocument¶
Creates a new document in the specified database and collection.
findDocument¶
Retrieves a single document by id and partitionKey.
updateDocument¶
Updates an existing document.
upsertDocument¶
Inserts a new document or updates an existing document.
removeDocument¶
Removes a document by id and partitionKey. Returns the HTTP status code (e.g. 204).
Query Operations¶
queryDocuments¶
Executes a SQL query against the collection, returning paged document arrays and continuation tokens.
listDocuments¶
Lists documents with pagination support.
Database & Collection Operations¶
createDatabase / findDatabase / listDatabases / deleteDatabase¶
CosmosResponseType createDatabase(CosmosArgumentType const& ctx);
CosmosResponseType findDatabase(CosmosArgumentType const& ctx);
CosmosResponseType listDatabases();
CosmosResponseType deleteDatabase(CosmosArgumentType const& ctx);
createCollection / listCollections¶
CosmosResponseType createCollection(CosmosArgumentType const& ctx);
CosmosResponseType listCollections(CosmosArgumentType const& ctx);
discoverRegions¶
Discovers regional read and write endpoints for failover routing.
Asynchronous Execution¶
async¶
Dispatches the operation payload to an internal asynchronous thread pool. Upon completion (or exception), the op.onResponse callback is safely invoked. Exceptions inside background workers are caught and logged without process termination.