diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index 5d28eab..c8c0980 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -36,3 +36,5 @@ async fn main() -> Result<(), Box> { 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. + +![ckanaction web app demo](/ckanaction-web-app-interactive-demo.gif) diff --git a/docs/content/docs/package_search.mdx b/docs/content/docs/package_search.mdx new file mode 100644 index 0000000..88179e9 --- /dev/null +++ b/docs/content/docs/package_search.mdx @@ -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. + + \ No newline at end of file diff --git a/docs/content/docs/package_show.mdx b/docs/content/docs/package_show.mdx new file mode 100644 index 0000000..36f8744 --- /dev/null +++ b/docs/content/docs/package_show.mdx @@ -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. + + \ No newline at end of file diff --git a/docs/lib/layout.shared.tsx b/docs/lib/layout.shared.tsx index 2f68e62..ec51433 100644 --- a/docs/lib/layout.shared.tsx +++ b/docs/lib/layout.shared.tsx @@ -20,5 +20,6 @@ export function baseOptions(): BaseLayoutProps { }, // see https://fumadocs.dev/docs/ui/navigation/links links: [], + githubUrl: "https://github.com/dathere/ckanaction" }; } diff --git a/docs/lib/openapi.yml b/docs/lib/openapi.yml index 09b5219..70d9f18 100644 --- a/docs/lib/openapi.yml +++ b/docs/lib/openapi.yml @@ -33,7 +33,7 @@ paths: description: This endpoint shows information about the CKAN instance. x-codeSamples: - lang: rust - label: Rust SDK (ckanaction) + label: Rust SDK (ckanaction) example source: | use dotenvy::dotenv; @@ -61,7 +61,7 @@ paths: description: This endpoint lists CKAN resources (limit 10). x-codeSamples: - lang: rust - label: Rust SDK (ckanaction) + label: Rust SDK (ckanaction) example source: | use dotenvy::dotenv; @@ -84,4 +84,93 @@ paths: println!("{result:#?}"); Ok(()) - } \ No newline at end of file + } + '/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> { + // 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> { + // 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 \ No newline at end of file diff --git a/docs/public/ckanaction-web-app-interactive-demo.gif b/docs/public/ckanaction-web-app-interactive-demo.gif new file mode 100644 index 0000000..b9612bb Binary files /dev/null and b/docs/public/ckanaction-web-app-interactive-demo.gif differ