mirror of
https://github.com/dathere/ckanaction.git
synced 2026-07-05 17:12:19 +00:00
feat: add most file API endpoints
This commit is contained in:
parent
f3aa0c4e21
commit
cfbb9ec071
1 changed files with 76 additions and 0 deletions
76
src/lib.rs
76
src/lib.rs
|
|
@ -1732,4 +1732,80 @@ impl CKAN {
|
|||
) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>,
|
||||
storage: Option<String>,
|
||||
upload: Option<PathBuf>,
|
||||
) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>,
|
||||
storage: Option<String>,
|
||||
) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>,
|
||||
name: Option<String>,
|
||||
) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>) -> Result<serde_json::Value, CKANError> {
|
||||
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<String>,
|
||||
owner_id: Option<String>,
|
||||
owner_type: Option<String>,
|
||||
force: Option<bool>,
|
||||
pin: Option<bool>,
|
||||
) -> Result<serde_json::Value, CKANError> {
|
||||
post!(
|
||||
&self,
|
||||
"file_ownership_transfer",
|
||||
id,
|
||||
owner_id,
|
||||
owner_type,
|
||||
force,
|
||||
pin
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue