mirror of
https://github.com/dathere/ckanaction.git
synced 2025-11-09 22:19:49 +00:00
feat(docs): initial interactive ckanaction docs web app
This commit is contained in:
parent
945fc6dca1
commit
39c573a5a4
27 changed files with 1507 additions and 0 deletions
38
docs/content/docs/index.mdx
Normal file
38
docs/content/docs/index.mdx
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: ckanaction docs
|
||||
---
|
||||
|
||||
ckanaction is a Rust library crate that acts as an API wrapper for the CKAN Actions API (v3).
|
||||
|
||||
This means that instead of using generic request library crates such as `reqwest`, a developer can use `ckanaction` instead to make API calls to their CKAN instance.
|
||||
|
||||
For example the following code can be ran to send an HTTP GET request to the `/package_list` endpoint of a local CKAN instance's API by using the `ckanaction` crate:
|
||||
|
||||
```rust
|
||||
use dotenvy::dotenv;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Load environment variables from .env file
|
||||
dotenv()?;
|
||||
|
||||
// Initialize and build CKAN struct
|
||||
let ckan = ckanaction::CKAN::builder()
|
||||
.url("http://localhost:5000")
|
||||
.token(dotenvy::var("CKAN_API_TOKEN")?)
|
||||
.build();
|
||||
|
||||
// Send request to /package_list and print output
|
||||
let result = ckan.package_list()
|
||||
.limit(5) // <-- This is an optional parameter you can remove
|
||||
.call()
|
||||
.await?;
|
||||
println!("{result:#?}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
The source code of ckanaction can be found at [github.com/dathere/ckanaction](https://github.com/ckanaction).
|
||||
|
||||
You may also explore this web app to view more code examples for each endpoint and also use an interactive GUI for sending HTTP requests to any local or remote CKAN instance.
|
||||
18
docs/content/docs/package_list.mdx
Normal file
18
docs/content/docs/package_list.mdx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
title: /package_list
|
||||
full: true
|
||||
_openapi:
|
||||
method: GET
|
||||
route: /package_list
|
||||
toc: []
|
||||
structuredData:
|
||||
headings: []
|
||||
contents:
|
||||
- content: This endpoint lists CKAN resources (limit 10).
|
||||
---
|
||||
|
||||
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
|
||||
|
||||
This endpoint lists CKAN resources (limit 10).
|
||||
|
||||
<APIPage document={"./lib/openapi.yml"} operations={[{"path":"/package_list","method":"get"}]} webhooks={[]} hasHead={false} />
|
||||
18
docs/content/docs/status_show.mdx
Normal file
18
docs/content/docs/status_show.mdx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
title: /status_show
|
||||
full: true
|
||||
_openapi:
|
||||
method: GET
|
||||
route: /status_show
|
||||
toc: []
|
||||
structuredData:
|
||||
headings: []
|
||||
contents:
|
||||
- content: This endpoint shows information about the CKAN instance.
|
||||
---
|
||||
|
||||
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
|
||||
|
||||
This endpoint shows information about the CKAN instance.
|
||||
|
||||
<APIPage document={"./lib/openapi.yml"} operations={[{"path":"/status_show","method":"get"}]} webhooks={[]} hasHead={false} />
|
||||
Loading…
Add table
Add a link
Reference in a new issue