Struct R3Client

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

A client for the remote.it API.

§Example

You can create a new R3Client using the builder pattern:

let credentials: Credentials = Credentials::load_from_disk()
    .custom_credentials_path(".env.remoteit")
    .call()
    .expect("Couldn't load credentials!")
    .take_profile("default")
    .expect("Couldn't parse secret access key!")
    .expect("Profile with given name does not exist!");
let client = R3Client::builder().credentials(credentials).build();
// Start making API calls
let devices = client.get_devices().call().unwrap();

Implementations§

Source§

impl R3Client

Source

pub async fn send_remoteit_graphql_request_async<V: Serialize, R: for<'a> Deserialize<'a>>( &self, query_body: &QueryBody<V>, ) -> Result<Response<R>, Box<dyn Error>>

Sends a signed GraphQL request to the remote.it API in a blocking way.

You probably don’t want to use this function directly, but rather use the other functions in this module like R3Client::get_files().

§Errors
  • Any error that occurs during the request.
  • Any error that occurs during deserialization of the response.
Source

pub fn get_files_async<'f1>(&'f1 self) -> R3ClientGetFilesAsyncBuilder<'f1>

Get a list of files that were uploaded to remote.it.

Source

pub fn delete_file_async<'f1>(&'f1 self) -> R3ClientDeleteFileAsyncBuilder<'f1>

Delete a file from remote.it. Deletes all versions of the file.

Source

pub fn delete_file_version_async<'f1>( &'f1 self, ) -> R3ClientDeleteFileVersionAsyncBuilder<'f1>

Delete a version of a file from remote.it. (Not the whole file)

Source

pub fn start_job_async<'f1>(&'f1 self) -> R3ClientStartJobAsyncBuilder<'f1>

Start scripting jobs on one or more devices.

Source

pub fn cancel_job_async<'f1>(&'f1 self) -> R3ClientCancelJobAsyncBuilder<'f1>

Cancel a job. See remote.it docs on more information on when jobs can be cancelled.

Source

pub fn get_jobs_async<'f1>(&'f1 self) -> R3ClientGetJobsAsyncBuilder<'f1>

Get a list of jobs that were started on remote.it.

Source

pub fn get_owned_organization_async<'f1>( &'f1 self, ) -> R3ClientGetOwnedOrganizationAsyncBuilder<'f1>

Get data on your own organization, which belongs to the current user. This Organization may or may not exist. You can create and configure your organization through the remote.it Web UI.

§Returns

Data on your organization, if you have one.

Source

pub fn get_application_types_async<'f1>( &'f1 self, ) -> R3ClientGetApplicationTypesAsyncBuilder<'f1>

Get a list of application types that are available on remote.it.

Source

pub fn get_devices_async<'f1>(&'f1 self) -> R3ClientGetDevicesAsyncBuilder<'f1>

Get a list of devices.

Source§

impl R3Client

Impl block for blocking API calls.

Source

pub fn send_remoteit_graphql_request<V: Serialize, R: for<'a> Deserialize<'a>>( &self, query_body: &QueryBody<V>, ) -> Result<Response<R>, Box<dyn Error>>

Sends a signed GraphQL request to the remote.it API in a blocking way.

You probably don’t want to use this function directly, but rather use the other functions in this module like R3Client::get_files().

§Errors
  • Any error that occurs during the request.
  • Any error that occurs during deserialization of the response.
Source

pub fn get_files<'f1>(&'f1 self) -> R3ClientGetFilesBuilder<'f1>

Get a list of files that were uploaded to remote.it.

Source

pub fn delete_file<'f1>(&'f1 self) -> R3ClientDeleteFileBuilder<'f1>

Delete a file from remote.it. Deletes all versions of the file.

Source

pub fn delete_file_version<'f1>( &'f1 self, ) -> R3ClientDeleteFileVersionBuilder<'f1>

Delete a version of a file from remote.it. (Not the whole file)

Source

pub fn start_job<'f1>(&'f1 self) -> R3ClientStartJobBuilder<'f1>

Start scripting jobs on one or more devices.

Source

pub fn cancel_job<'f1>(&'f1 self) -> R3ClientCancelJobBuilder<'f1>

Cancel a job. See remote.it docs on more information on when jobs can be cancelled.

Source

pub fn get_jobs<'f1>(&'f1 self) -> R3ClientGetJobsBuilder<'f1>

Get a list of jobs that were started on remote.it.

Source

pub fn get_owned_organization<'f1>( &'f1 self, ) -> R3ClientGetOwnedOrganizationBuilder<'f1>

Get data on your own organization, which belongs to the current user. This Organization may or may not exist. You can create and configure your organization through the remote.it Web UI.

§Returns

Data on your organization, if you have one.

Source

pub fn get_organization_self_membership<'f1>( &'f1 self, ) -> R3ClientGetOrganizationSelfMembershipBuilder<'f1>

Get a list of organization memberships for the current user.

§Returns

A list of organizations that you are a member of.

Source

pub fn get_application_types<'f1>( &'f1 self, ) -> R3ClientGetApplicationTypesBuilder<'f1>

Get a list of application types that are available on remote.it.

Source

pub fn get_devices<'f1>(&'f1 self) -> R3ClientGetDevicesBuilder<'f1>

Get a list of devices.

Source§

impl R3Client

Source

pub fn upload_file<'f1>(&'f1 self) -> R3ClientUploadFileBuilder<'f1>

Upload a file to remote.it. The file could be an executable script, or any other file to be used as a resource in scripts.

Note: This is not GraphQL, it is a multipart form upload

§Returns

The response from the remote.it API. Contains the ID of the file and the version among other things. See UploadFileResponse for more details.

§Errors
Source§

impl R3Client

Source

pub fn upload_file_async<'f1>(&'f1 self) -> R3ClientUploadFileAsyncBuilder<'f1>

Upload a file to remote.it. The file could be an executable script, or any other file to be used as a resource in scripts.

Note: This is not GraphQL, it is a multipart form upload

§Returns

The response from the remote.it API. Contains the ID of the file and the version among other things. See UploadFileResponse for more details.

§Errors
Source§

impl R3Client

Source

pub fn builder() -> R3ClientBuilder

Create an instance of R3Client using the builder syntax

Source§

impl R3Client

Source

pub fn credentials(&self) -> &Credentials

§Returns

A reference to the credentials used by the client.

Trait Implementations§

Source§

impl Clone for R3Client

Source§

fn clone(&self) -> R3Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for R3Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T