2 releases

Uses new Rust 2021

0.0.2 Jan 18, 2022
0.0.1 Jan 18, 2022
Download history 2/week @ 2022-02-19 4/week @ 2022-03-12 8/week @ 2022-03-19 2/week @ 2022-04-09 9/week @ 2022-04-23 14/week @ 2022-04-30 20/week @ 2022-05-07 34/week @ 2022-05-14 8/week @ 2022-05-21 16/week @ 2022-05-28 13/week @ 2022-06-04

71 downloads per month

MIT license

14KB
225 lines

Yupdates Rust SDK

The Yupdates Rust SDK lets you easily use the Yupdates API from your own software and scripts.

Also see the Yupdates Python SDK.

Getting started

First, obtain an API token from the application. Navigate to "Settings" and then "API".

The examples will start with read-only operations, so you can use the general, read-only token to get started.

Create a new Rust project:

$ cargo new yupdates-example
$ cd yupdates-example

Add the dependency to Cargo.toml:

[dependencies]
yupdates = "0"

Add this to the src/main.rs file:

use std::process;
use yupdates::api::{PingResponse, YupdatesV0};
use yupdates::clients::sync::new_sync_client;
use yupdates::errors::Result;

fn main() {
    match ping_one() {
        Ok(ping_response) => {
            println!("Worked: {}", ping_response.message);
        }
        Err(e) => {
            eprintln!("Failed. {}", e);
            process::exit(1);
        }
    }
}

fn ping_one() -> Result<PingResponse> {
    let yup = new_sync_client()?;
    yup.ping()
}

Set the API token environment variable:

set +o history
export YUPDATES_API_TOKEN="1a7814fc25:c38bb526..."
set -o history

During the preview, you also need to set the URL. This won't be necessary once there is a default endpoint.

export YUPDATES_API_URL="https://..."

Test the connection and authentication:

cargo run

Getting help

You can create a GitHub issue on this repository for bugs and feature requests.

The fastest way to get help is to create a support ticket from the Yupdates application. Or email support@yupdates.com. Especially if you need help that is not specific to this SDK.

License

The SDK is distributed under the MIT license, please see LICENSE for more information.

This covers the source code and examples, but it does not cover related items like the Yupdates logo or API documentation which is not hosted here.

Dependencies

~3–12MB
~243K SLoC