pub struct ServiceClient { /* private fields */ }Expand description
HTTP client for Dataverse Web API operations.
Implementations§
Source§impl ServiceClient
impl ServiceClient
Sourcepub async fn new(
connection_string: &str,
log_level: LogLevel,
) -> Result<Self, String>
pub async fn new( connection_string: &str, log_level: LogLevel, ) -> Result<Self, String>
Create a new client from a Dataverse connection string.
Sourcepub async fn new_with_auth(
auth: AuthConfig,
log_level: LogLevel,
) -> Result<Self, String>
pub async fn new_with_auth( auth: AuthConfig, log_level: LogLevel, ) -> Result<Self, String>
Create a new client from explicit authentication configuration.
Sourcepub async fn token_expires_at(&self) -> Option<DateTime<Utc>>
pub async fn token_expires_at(&self) -> Option<DateTime<Utc>>
Return the current token expiry as a UTC datetime.
Sourcepub async fn retrieve_multiple_fetchxml(
&self,
entity: &str,
fetchxml: &str,
) -> Result<Vec<Entity>, String>
pub async fn retrieve_multiple_fetchxml( &self, entity: &str, fetchxml: &str, ) -> Result<Vec<Entity>, String>
Retrieve a single FetchXML response page without automatic paging.
Sourcepub async fn retrieve_multiple_fetchxml_paging(
&self,
entity: &str,
fetchxml: &str,
) -> Result<Vec<Entity>, String>
pub async fn retrieve_multiple_fetchxml_paging( &self, entity: &str, fetchxml: &str, ) -> Result<Vec<Entity>, String>
Retrieve multiple records by FetchXML, automatically paging until all results are returned.
Sourcepub async fn retrieve_multiple_fetchxml_paging_with_progress<F>(
&self,
entity: &str,
fetchxml: &str,
on_progress: F,
page_size: Option<i32>,
) -> Result<Vec<Entity>, String>
pub async fn retrieve_multiple_fetchxml_paging_with_progress<F>( &self, entity: &str, fetchxml: &str, on_progress: F, page_size: Option<i32>, ) -> Result<Vec<Entity>, String>
Retrieve multiple records by FetchXML, automatically paging until all results are returned.
Uses the provided page size when specified, otherwise defaults to 5000 records per page.
Reports page-level progress as (page_number, total_records_retrieved_so_far).
Sourcepub async fn retrieve_multiple_fetchxml_count(
&self,
entity: &str,
fetchxml: &str,
) -> Result<usize, String>
pub async fn retrieve_multiple_fetchxml_count( &self, entity: &str, fetchxml: &str, ) -> Result<usize, String>
Count records for a FetchXML query without retrieving all data.
Sourcepub async fn list_entity_definitions(
&self,
) -> Result<Vec<EntityDefinition>, String>
pub async fn list_entity_definitions( &self, ) -> Result<Vec<EntityDefinition>, String>
List all entity definitions.
Sourcepub async fn list_entity_attributes(
&self,
logical_name: &str,
) -> Result<Vec<EntityAttribute>, String>
pub async fn list_entity_attributes( &self, logical_name: &str, ) -> Result<Vec<EntityAttribute>, String>
List entity attributes for a given logical name.
Sourcepub async fn list_entity_relationships(
&self,
logical_name: &str,
) -> Result<Vec<EntityRelationship>, String>
pub async fn list_entity_relationships( &self, logical_name: &str, ) -> Result<Vec<EntityRelationship>, String>
List entity relationships for a given logical name.
Sourcepub async fn update_entity(
&self,
entity_set: &str,
id: &str,
attributes: &HashMap<String, Value>,
) -> Result<(), String>
pub async fn update_entity( &self, entity_set: &str, id: &str, attributes: &HashMap<String, Value>, ) -> Result<(), String>
Update a single entity record by ID.
Sourcepub async fn create_entity(
&self,
entity_set: &str,
attributes: &HashMap<String, Value>,
) -> Result<Option<Uuid>, String>
pub async fn create_entity( &self, entity_set: &str, attributes: &HashMap<String, Value>, ) -> Result<Option<Uuid>, String>
Create a single entity record and return its ID when available.
Sourcepub async fn create_entity_with_options(
&self,
entity_set: &str,
attributes: &HashMap<String, Value>,
options: &RequestParameters,
) -> Result<Option<Uuid>, String>
pub async fn create_entity_with_options( &self, entity_set: &str, attributes: &HashMap<String, Value>, options: &RequestParameters, ) -> Result<Option<Uuid>, String>
Create a single entity record with Dataverse request parameters.
Sourcepub async fn update_entity_with_options(
&self,
entity_set: &str,
id: &str,
attributes: &HashMap<String, Value>,
options: &RequestParameters,
) -> Result<(), String>
pub async fn update_entity_with_options( &self, entity_set: &str, id: &str, attributes: &HashMap<String, Value>, options: &RequestParameters, ) -> Result<(), String>
Update a single entity record by ID with Dataverse request parameters.
Sourcepub async fn delete_entity(
&self,
entity_set: &str,
id: &str,
) -> Result<(), String>
pub async fn delete_entity( &self, entity_set: &str, id: &str, ) -> Result<(), String>
Delete a single entity record by ID.
Sourcepub async fn delete_entity_with_options(
&self,
entity_set: &str,
id: &str,
options: &RequestParameters,
) -> Result<(), String>
pub async fn delete_entity_with_options( &self, entity_set: &str, id: &str, options: &RequestParameters, ) -> Result<(), String>
Delete a single entity record by ID with Dataverse request parameters.
Sourcepub async fn execute_multiple(
&self,
request: &ExecuteMultipleRequest,
) -> Result<ExecuteMultipleResponse, String>
pub async fn execute_multiple( &self, request: &ExecuteMultipleRequest, ) -> Result<ExecuteMultipleResponse, String>
Execute multiple create, update, and delete requests using a single Dataverse batch call.