From cfbb9ec071c129455c2d6b0e24bcb48eddf99295 Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Wed, 1 Jul 2026 21:59:51 -0400 Subject: [PATCH] feat: add most file API endpoints --- src/lib.rs | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index fe6c388..2571af8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1732,4 +1732,80 @@ impl CKAN { ) -> Result { post!(&self, "api_token_revoke", (json token), jti) } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_create + #[builder] + pub async fn file_create( + &self, + name: Option, + storage: Option, + upload: Option, + ) -> Result { + post!(&self, "file_create", name, storage; (upload upload)) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_register + #[builder] + pub async fn file_register( + &self, + location: Option, + storage: Option, + ) -> Result { + post!(&self, "file_register", location, storage) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_delete + #[builder] + pub async fn file_delete(&self, id: Option) -> Result { + post!(&self, "file_delete", id) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_show + #[builder] + pub async fn file_show(&self, id: Option) -> Result { + post!(&self, "file_show", id) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_rename + #[builder] + pub async fn file_rename( + &self, + id: Option, + name: Option, + ) -> Result { + post!(&self, "file_rename", id, name) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_pin + #[builder] + pub async fn file_pin(&self, id: Option) -> Result { + post!(&self, "file_pin", id) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_unpin + #[builder] + pub async fn file_unpin(&self, id: Option) -> Result { + post!(&self, "file_unpin", id) + } + + /// https://docs.ckan.org/en/latest/api/index.html#ckan.logic.action.file.file_ownership_transfer + #[builder] + pub async fn file_ownership_transfer( + &self, + id: Option, + owner_id: Option, + owner_type: Option, + force: Option, + pin: Option, + ) -> Result { + post!( + &self, + "file_ownership_transfer", + id, + owner_id, + owner_type, + force, + pin + ) + } }