Struct VoltClient

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

The VoltClient struct is the main entry point for interacting with the Volt API. It provides methods for making unary, server streaming, and client streaming RPC calls. The client maintains a connection to the Volt server and handles the WebSocket communication, it manages the RPC lifecycle, including sending requests and receiving responses. The client also provides a set of convenience methods for making calls to the Volt API.

Implementations§

Source§

impl VoltClient

Source

pub async fn create(config_json: &str) -> Result<VoltClient, String>

Creates a new API client instance and connects to the WebSocket server. The client is configured with the provided JSON configuration.

§Arguments
  • config_json - A JSON string containing the configuration settings.
§Returns

A Result containing the API client instance or an error message.

Source

pub async fn unary_rpc( &mut self, method: &str, request: &Value, service: &str, ) -> Result<Value, String>

Generic method for unary RPC calls. Sends a request and awaits the response.

§Arguments
  • method - The method to call.
  • request - The request payload.
  • service - The service to call.
§Returns

A Result containing the response or an error message.

Source

pub async fn server_streaming_call( &mut self, method: &str, request: &Value, service: &str, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

Generic method for server streaming RPC calls. Sends a request and returns an RPC instance.

§Arguments
  • method - The method to call.
  • request - The request payload.
  • service - The service to call.
§Returns

A Result containing the RPC event emitter or an error message.

Source

pub async fn streaming_call( &mut self, method: &str, request: &Value, service: &str, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

Generic method for client streaming RPC calls. Sends a request and returns an RPC instance.

§Arguments
  • method - The method to call.
  • request - The request payload.
  • service - The service to call.
§Returns

A Result containing the RPC event emitter or an error message.

Source

pub async fn can_access_resource( &mut self, request: &Value, ) -> Result<Value, String>

RESOURCE API

See https://docs.tdxvolt.com/en/api/volt_api#CanAccessResource

Source

pub async fn connect( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/volt_api#Connect

Source

pub async fn delete_resource( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#DeleteResource

Source

pub async fn discover_services( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#DiscoverServices

Source

pub async fn get_resource(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetResource

Source

pub async fn get_resources(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetResources

Source

pub async fn get_resource_ancestors( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetResourceAncestors

Source

pub async fn get_resource_descendants( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetResourceDescendants

Source

pub async fn request_access(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#RequestAccess

Source

pub async fn save_resource(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SaveResource

Source

pub async fn save_resource_attribute( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SaveResourceAttribute

Source

pub async fn set_service_status( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SetServiceStatus

Source

pub async fn download_file( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

FILE API

See https://docs.tdxvolt.com/en/api/file_api#DownloadFile

Source

pub async fn get_file(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/file_api#GetFile

Source

pub async fn get_file_content( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/file_api#GetFileContent

Source

pub async fn get_file_descendants( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/file_api#GetFileDescendants

Source

pub async fn set_file_content( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/file_api#SetFileContent

Source

pub async fn upload_file( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/file_api#UploadFile

Source

pub async fn authenticate(&mut self, request: &Value) -> Result<Value, String>

VOLT MANAGEMENT API

See https://docs.tdxvolt.com/en/api/volt_api#Authenticate

Source

pub async fn delete_access(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#DeleteAccess

Source

pub async fn delete_volt(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#DeleteVolt

Source

pub async fn get_access(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetAccess

Source

pub async fn get_identities(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetIdentities

Source

pub async fn get_identity(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetIdentity

Source

pub async fn get_one_time_token( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetOneTimeToken

Source

pub async fn get_policy(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetPolicy

Source

pub async fn get_settings(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#GetSettings

Source

pub async fn invoke(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#Invoke

Source

pub async fn save_access(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SaveAccess

Source

pub async fn save_identity(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SaveIdentity

Source

pub async fn save_settings(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SaveSettings

Source

pub async fn set_access_request_decision( &mut self, request: &Value, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SetAccessRequestDecision

Source

pub async fn sign_verify(&mut self, request: &Value) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/volt_api#SignVerify

Source

pub async fn publish_wire( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

WIRE API

See https://docs.tdxvolt.com/en/api/wire_api#PublishWire

Source

pub async fn subscribe_wire( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/wire_api#SubscribeWire

Source

pub async fn bulk_update( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

DATABASE API

See https://docs.tdxvolt.com/en/api/sqlite_database_api#BulkUpdate

Source

pub async fn create_database( &mut self, request: &Value, ) -> Result<Value, String>

https://docs.tdxvolt.com/en/api/sqlite_server_api#CreateDatabase

Source

pub async fn sql_execute( &mut self, request: &Value, service: &str, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/sqlite_database_api#Execute

Source

pub async fn sql_execute_json( &mut self, request: &Value, service: &str, ) -> Result<Value, String>

See https://docs.tdxvolt.com/en/api/sqlite_database_api#Execute

Source

pub async fn import_csv( &mut self, request: &Value, ) -> Result<Arc<Mutex<WebsocketRpc>>, String>

See https://docs.tdxvolt.com/en/api/sqlite_database_api#ImportCSV

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, 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V