Giter VIP home page Giter VIP logo

catenisapiclientrust's Introduction

Catenis API Client for Rust

This library is used to make it easier to access the Catenis API services from code written in the Rust programming language.

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

Documentation

The complete library documentation can be found here.

Usage

To start using the library, 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),
    ],
)?;

Catenis API Documentation

For further information on the Catenis API, please reference the Catenis API Documentation.

License

This library is distributed under the terms of both the MIT License and the Apache License (Version 2.0).

Copyright © 2021-2022, Blockchain of Things Inc.

catenisapiclientrust's People

Contributors

claudiosdc avatar

Watchers

James Cloos avatar  avatar Andre De Castro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.