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
impl R3Client
Sourcepub 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>>
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.
Sourcepub fn get_files_async<'f1>(&'f1 self) -> R3ClientGetFilesAsyncBuilder<'f1>
pub fn get_files_async<'f1>(&'f1 self) -> R3ClientGetFilesAsyncBuilder<'f1>
Get a list of files that were uploaded to remote.it.
Sourcepub fn delete_file_async<'f1>(&'f1 self) -> R3ClientDeleteFileAsyncBuilder<'f1>
pub fn delete_file_async<'f1>(&'f1 self) -> R3ClientDeleteFileAsyncBuilder<'f1>
Delete a file from remote.it. Deletes all versions of the file.
Sourcepub fn delete_file_version_async<'f1>(
&'f1 self,
) -> R3ClientDeleteFileVersionAsyncBuilder<'f1>
pub fn delete_file_version_async<'f1>( &'f1 self, ) -> R3ClientDeleteFileVersionAsyncBuilder<'f1>
Delete a version of a file from remote.it. (Not the whole file)
Sourcepub fn start_job_async<'f1>(&'f1 self) -> R3ClientStartJobAsyncBuilder<'f1>
pub fn start_job_async<'f1>(&'f1 self) -> R3ClientStartJobAsyncBuilder<'f1>
Start scripting jobs on one or more devices.
Sourcepub fn cancel_job_async<'f1>(&'f1 self) -> R3ClientCancelJobAsyncBuilder<'f1>
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.
Sourcepub fn get_jobs_async<'f1>(&'f1 self) -> R3ClientGetJobsAsyncBuilder<'f1>
pub fn get_jobs_async<'f1>(&'f1 self) -> R3ClientGetJobsAsyncBuilder<'f1>
Get a list of jobs that were started on remote.it.
Sourcepub fn get_owned_organization_async<'f1>(
&'f1 self,
) -> R3ClientGetOwnedOrganizationAsyncBuilder<'f1>
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.
Sourcepub fn get_application_types_async<'f1>(
&'f1 self,
) -> R3ClientGetApplicationTypesAsyncBuilder<'f1>
pub fn get_application_types_async<'f1>( &'f1 self, ) -> R3ClientGetApplicationTypesAsyncBuilder<'f1>
Get a list of application types that are available on remote.it.
Sourcepub fn get_devices_async<'f1>(&'f1 self) -> R3ClientGetDevicesAsyncBuilder<'f1>
pub fn get_devices_async<'f1>(&'f1 self) -> R3ClientGetDevicesAsyncBuilder<'f1>
Get a list of devices.
Source§impl R3Client
Impl block for blocking API calls.
impl R3Client
Impl block for blocking API calls.
Sourcepub fn send_remoteit_graphql_request<V: Serialize, R: for<'a> Deserialize<'a>>(
&self,
query_body: &QueryBody<V>,
) -> Result<Response<R>, Box<dyn Error>>
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.
Sourcepub fn get_files<'f1>(&'f1 self) -> R3ClientGetFilesBuilder<'f1>
pub fn get_files<'f1>(&'f1 self) -> R3ClientGetFilesBuilder<'f1>
Get a list of files that were uploaded to remote.it.
Sourcepub fn delete_file<'f1>(&'f1 self) -> R3ClientDeleteFileBuilder<'f1>
pub fn delete_file<'f1>(&'f1 self) -> R3ClientDeleteFileBuilder<'f1>
Delete a file from remote.it. Deletes all versions of the file.
Sourcepub fn delete_file_version<'f1>(
&'f1 self,
) -> R3ClientDeleteFileVersionBuilder<'f1>
pub fn delete_file_version<'f1>( &'f1 self, ) -> R3ClientDeleteFileVersionBuilder<'f1>
Delete a version of a file from remote.it. (Not the whole file)
Sourcepub fn start_job<'f1>(&'f1 self) -> R3ClientStartJobBuilder<'f1>
pub fn start_job<'f1>(&'f1 self) -> R3ClientStartJobBuilder<'f1>
Start scripting jobs on one or more devices.
Sourcepub fn cancel_job<'f1>(&'f1 self) -> R3ClientCancelJobBuilder<'f1>
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.
Sourcepub fn get_jobs<'f1>(&'f1 self) -> R3ClientGetJobsBuilder<'f1>
pub fn get_jobs<'f1>(&'f1 self) -> R3ClientGetJobsBuilder<'f1>
Get a list of jobs that were started on remote.it.
Sourcepub fn get_owned_organization<'f1>(
&'f1 self,
) -> R3ClientGetOwnedOrganizationBuilder<'f1>
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.
Sourcepub fn get_organization_self_membership<'f1>(
&'f1 self,
) -> R3ClientGetOrganizationSelfMembershipBuilder<'f1>
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.
Sourcepub fn get_application_types<'f1>(
&'f1 self,
) -> R3ClientGetApplicationTypesBuilder<'f1>
pub fn get_application_types<'f1>( &'f1 self, ) -> R3ClientGetApplicationTypesBuilder<'f1>
Get a list of application types that are available on remote.it.
Sourcepub fn get_devices<'f1>(&'f1 self) -> R3ClientGetDevicesBuilder<'f1>
pub fn get_devices<'f1>(&'f1 self) -> R3ClientGetDevicesBuilder<'f1>
Get a list of devices.
Source§impl R3Client
impl R3Client
Sourcepub fn upload_file<'f1>(&'f1 self) -> R3ClientUploadFileBuilder<'f1>
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
UploadFileError::IO
if there is an error reading the file.UploadFileError::Reqwest
if there is an error sending the request.UploadFileError::ApiError
if the remote.it API returns an error response.UploadFileError::ParseJson
if there is an error parsing the response.
Source§impl R3Client
impl R3Client
Sourcepub fn upload_file_async<'f1>(&'f1 self) -> R3ClientUploadFileAsyncBuilder<'f1>
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
UploadFileError::IO
if there is an error reading the file.UploadFileError::Reqwest
if there is an error sending the request.UploadFileError::ApiError
if the remote.it API returns an error response.UploadFileError::ParseJson
if there is an error parsing the response.
Source§impl R3Client
impl R3Client
Sourcepub fn builder() -> R3ClientBuilder
pub fn builder() -> R3ClientBuilder
Create an instance of R3Client
using the builder syntax
Source§impl R3Client
impl R3Client
Sourcepub fn credentials(&self) -> &Credentials
pub fn credentials(&self) -> &Credentials
§Returns
A reference to the credentials used by the client.