Skip to main content

ServiceClient

Struct ServiceClient 

Source
pub struct ServiceClient { /* private fields */ }
Expand description

HTTP client for Dataverse Web API operations.

Implementations§

Source§

impl ServiceClient

Source

pub async fn new( connection_string: &str, log_level: LogLevel, ) -> Result<Self, String>

Create a new client from a Dataverse connection string.

Source

pub async fn new_with_auth( auth: AuthConfig, log_level: LogLevel, ) -> Result<Self, String>

Create a new client from explicit authentication configuration.

Source

pub async fn token_expires_at(&self) -> Option<DateTime<Utc>>

Return the current token expiry as a UTC datetime.

Source

pub async fn retrieve_multiple_fetchxml( &self, entity: &str, fetchxml: &str, ) -> Result<Vec<Entity>, String>

Retrieve a single FetchXML response page without automatic paging.

Source

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.

Source

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>
where F: FnMut(usize, usize),

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).

Source

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.

Source

pub async fn list_entity_definitions( &self, ) -> Result<Vec<EntityDefinition>, String>

List all entity definitions.

Source

pub async fn list_entity_attributes( &self, logical_name: &str, ) -> Result<Vec<EntityAttribute>, String>

List entity attributes for a given logical name.

Source

pub async fn list_entity_relationships( &self, logical_name: &str, ) -> Result<Vec<EntityRelationship>, String>

List entity relationships for a given logical name.

Source

pub async fn update_entity( &self, entity_set: &str, id: &str, attributes: &HashMap<String, Value>, ) -> Result<(), String>

Update a single entity record by ID.

Source

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.

Source

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.

Source

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.

Source

pub async fn delete_entity( &self, entity_set: &str, id: &str, ) -> Result<(), String>

Delete a single entity record by ID.

Source

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.

Source

pub async fn execute_multiple( &self, request: &ExecuteMultipleRequest, ) -> Result<ExecuteMultipleResponse, String>

Execute multiple create, update, and delete requests using a single Dataverse batch call.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more