feat(docs): add GIF, GitHub URL, and more endpoints

This commit is contained in:
rzmk 2025-10-12 21:13:17 -04:00
parent f538cfeb83
commit 4fc9937520
6 changed files with 131 additions and 3 deletions

View file

@ -36,3 +36,5 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
The source code of ckanaction can be found at [github.com/dathere/ckanaction](https://github.com/ckanaction). 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. 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.
![ckanaction web app demo](/ckanaction-web-app-interactive-demo.gif)

View file

@ -0,0 +1,18 @@
---
title: /package_search
full: true
_openapi:
method: GET
route: /package_search
toc: []
structuredData:
headings: []
contents:
- content: Searches for packages satisfying a given search criteria.
---
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Searches for packages satisfying a given search criteria.
<APIPage document={"./lib/openapi.yml"} operations={[{"path":"/package_search","method":"get"}]} webhooks={[]} hasHead={false} />

View file

@ -0,0 +1,18 @@
---
title: /package_show
full: true
_openapi:
method: GET
route: /package_show
toc: []
structuredData:
headings: []
contents:
- content: Return the metadata of a dataset and its resources.
---
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Return the metadata of a dataset and its resources.
<APIPage document={"./lib/openapi.yml"} operations={[{"path":"/package_show","method":"get"}]} webhooks={[]} hasHead={false} />

View file

@ -20,5 +20,6 @@ export function baseOptions(): BaseLayoutProps {
}, },
// see https://fumadocs.dev/docs/ui/navigation/links // see https://fumadocs.dev/docs/ui/navigation/links
links: [], links: [],
githubUrl: "https://github.com/dathere/ckanaction"
}; };
} }

View file

@ -33,7 +33,7 @@ paths:
description: This endpoint shows information about the CKAN instance. description: This endpoint shows information about the CKAN instance.
x-codeSamples: x-codeSamples:
- lang: rust - lang: rust
label: Rust SDK (ckanaction) label: Rust SDK (ckanaction) example
source: | source: |
use dotenvy::dotenv; use dotenvy::dotenv;
@ -61,7 +61,7 @@ paths:
description: This endpoint lists CKAN resources (limit 10). description: This endpoint lists CKAN resources (limit 10).
x-codeSamples: x-codeSamples:
- lang: rust - lang: rust
label: Rust SDK (ckanaction) label: Rust SDK (ckanaction) example
source: | source: |
use dotenvy::dotenv; use dotenvy::dotenv;
@ -84,4 +84,93 @@ paths:
println!("{result:#?}"); println!("{result:#?}");
Ok(()) Ok(())
} }
'/package_show':
get:
operationId: /package_show
summary: /package_show
description: Return the metadata of a dataset and its resources.
x-codeSamples:
- lang: rust
label: Rust SDK (ckanaction) example
source: |
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_show and print output
let result = ckan.package_show()
.id("6b044c6b-e896-4800-a94d-9e5147b25a25".to_string())
.call()
.await?;
println!("{result:#?}");
Ok(())
}
parameters:
- in: query
name: id
description: The ID or name of the dataset
required: true
schema:
type: string
default: ""
'/package_search':
get:
operationId: /package_search
summary: /package_search
description: Searches for packages satisfying a given search criteria.
x-codeSamples:
- lang: rust
label: Rust SDK (ckanaction) example
source: |
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_search and print output
let result = ckan.package_search()
.q("*:*".to_string())
.call()
.await?;
println!("{result:#?}");
Ok(())
}
parameters:
- in: query
name: q
description: the solr query
schema:
type: string
default: "*:*"
- in: query
name: fq
description: any filter queries to apply
schema:
type: string
default: "*:*"
- in: query
name: include_private
description: if `True`, private datasets will be included in the results. Only private datasets from the user's organizations will be returned and sysadmins will be returned all private datasets.
schema:
type: boolean
default: false

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB