#http #dataspace #client #edc

edc-connector-client

A Rust client for EDC

2 releases

new 0.1.1 May 27, 2024
0.1.0 May 8, 2024

#1987 in Network programming

Download history 80/week @ 2024-05-05 7/week @ 2024-05-12 9/week @ 2024-05-19

96 downloads per month

Apache-2.0

79KB
2.5K SLoC

EDC-rs

Rust client and tools for EDC.

edc-connector-client

A Rust client for EDC.

Installation

Install from crates.io

[dependencies]
edc-connector-client = "0.1"

Examples

Basic usage

Fetching an asset with id 1 and reading the description property as string.

use edc_connector_client::{Auth, EdcConnectorClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = EdcConnectorClient::builder()
        .management_url("http://myedc")
        .with_auth(Auth::api_token("password"))
        .build()?;

    let asset = client.assets().get("1").await?;

    println!("Got {:?}", asset);

    println!(
        "Property description: {:?}",
        asset.property::<String>("description").unwrap()
    );

    Ok(())
}

Development

Compiling

git clone https://github.com/wolf4ood/edc-rs.git
cd edc-rs
cargo build

Running Tests

Some tests run against a running instance of EDC.

You can use docker compose to start an instance for testing.

docker compose -f testing/docker-compose.yml up -d
cargo test 

Dependencies

~5–19MB
~249K SLoC