Expand description

Catenis API Client

This library is used to make it easier to access the Catenis API services.

Note: this release of the library targets version 0.12 of the Catenis API.

Usage

To use it, one needs to instantiate a new CatenisClient object. Then, to make a call to an API method, just call the corresponding method on the client object.

Example

use catenis_api_client::{
    CatenisClient, ClientOptions, Environment, Result,
};

// Instantiate Catenis API client object
let mut ctn_client = CatenisClient::new_with_options(
    Some((
        "drc3XdxNtzoucpw9xiRp",
        concat!(
            "4c1749c8e86f65e0a73e5fb19f2aa9e74a716bc22d7956bf3072b4bc3fbfe2a0",
            "d138ad0d4bcfee251e4e5f54d6e92b8fd4eb36958a7aeaeeb51e8d2fcc4552c3"
        ),
    ).into()),
    &[
        ClientOptions::Environment(Environment::Sandbox),
    ],
)?;

// Call Read Message API method
let result = ctn_client.read_message("o3muoTnnD6cXYyarYY38", None)?;

println!("Read message result: {:?}", result);

Notification

The library also makes it easy for receiving notifications from the Catenis system through its WsNotifyChannel data structure, which embeds a WebSocket client.

Asynchronous processing

The library allows for asynchronous processing using the Tokio runtime.

To activate asynchronous processing, the async feature must be enabled.

catenis_api_client = { version = "3.0", features = ["async"] }

The asynchronous version of the client can then be accessed from the async_impl module.

Example

use catenis_api_client::{
    async_impl,
    ClientOptions, Environment, Result,
};

// Instantiate asynchronous Catenis API client object
let mut ctn_client = async_impl::CatenisClient::new_with_options(
    Some((
        "drc3XdxNtzoucpw9xiRp",
        concat!(
            "4c1749c8e86f65e0a73e5fb19f2aa9e74a716bc22d7956bf3072b4bc3fbfe2a0",
            "d138ad0d4bcfee251e4e5f54d6e92b8fd4eb36958a7aeaeeb51e8d2fcc4552c3"
        ),
    ).into()),
    &[
        ClientOptions::Environment(Environment::Sandbox),
    ],
)?;

Re-exports

pub use api::JsonObject;
pub use error::Error;
pub use error::Result;
pub use notification::WsNotifyChannel;

Modules

Macros

Helper for defining custom non-fungible token metadata properties.

Structs

Specifies a version of the Catenis API.
Represents a Catenis API client.
Credentials for a Catenis virtual device to access the Catenis API services.
Represents a JSON key/value type.
Represents a date and time in reference to the UTC timezone.

Enums

Option settings that can be used when instantiating the Catenis API client.
Available Catenis API server environments.
Represents any valid JSON value.