mirror of
https://github.com/dathere/ckanaction.git
synced 2026-02-04 02:05:32 +00:00
feat: add example of using status_show method
This commit is contained in:
parent
6df4f863f1
commit
723130792c
5 changed files with 1775 additions and 0 deletions
2
examples/status-show/.gitignore
vendored
Normal file
2
examples/status-show/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
.env
|
||||||
|
target/
|
||||||
1742
examples/status-show/Cargo.lock
generated
Normal file
1742
examples/status-show/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
8
examples/status-show/Cargo.toml
Normal file
8
examples/status-show/Cargo.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "status-show"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
ckanaction = "0.1.2"
|
||||||
|
tokio = { version = "1.49.0", features = ["full"] }
|
||||||
9
examples/status-show/README.md
Normal file
9
examples/status-show/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Example of using ckanaction to run the /status_show API endpoint
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Run the following command to run the `/status_show` CKAN Action API endpoint on `http://localhost:5000` and print the formatted debug output.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run
|
||||||
|
```
|
||||||
14
examples/status-show/src/main.rs
Normal file
14
examples/status-show/src/main.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
|
// Initialize and build CKAN struct
|
||||||
|
let ckan = ckanaction::CKAN::builder()
|
||||||
|
.url("http://localhost:5000")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Send request to /status_show and print formatted debug output
|
||||||
|
let status_show = ckan.status_show().await?;
|
||||||
|
println!("{status_show:#?}");
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue