chore: examples update and docs, add package-list example

This commit is contained in:
rzmk 2026-05-05 17:26:59 -04:00
parent 4ff1155d9b
commit a88a8fffc3
8 changed files with 2299 additions and 275 deletions

View file

@ -90,3 +90,12 @@ To run some of the tests in the `tests` directory, first replace the values for
```bash
cargo test
```
## Examples
You can run an example from the `examples` directory by first changing into the directory then running `cargo run`. For example:
```bash
cd examples/status-show
cargo run
```

2
examples/package-list/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.env
target/

1862
examples/package-list/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
[package]
name = "package-list"
version = "0.1.0"
edition = "2024"
[dependencies]
ckanaction = "0.2.0"
tokio = { version = "1.52.2", features = ["full"] }

View file

@ -0,0 +1,8 @@
# Example of using ckanaction to run the /package_list API endpoint
## Usage
the following command to run the `/package_list` CKAN Action API endpoint on `http://localhost:5000` and print the formatted debug output.
```bash
cargo run
```

View file

@ -0,0 +1,15 @@
use ckanaction::CKANError;
#[tokio::main]
async fn main() -> Result<(), CKANError> {
// Initialize and build CKAN struct
let ckan = ckanaction::CKAN::builder()
.url("http://localhost:5000")
.build();
// Send request to /package_list and print formatted debug output
let package_list = ckan.package_list().call().await?;
println!("{package_list:#?}");
Ok(())
}

File diff suppressed because it is too large Load diff

View file

@ -5,4 +5,4 @@ edition = "2024"
[dependencies]
ckanaction = "0.2.0"
tokio = { version = "1.49.0", features = ["full"] }
tokio = { version = "1.52.2", features = ["full"] }