use crate::{
Created, CreatedUrl, Creditor, CreditorKyc, CreditorShare, CreditorShares, CreditorSubs,
CreditorToken, Creditors, DefaultActionConfig, EmptyResponse, Request, RequestBuilder, Stream,
Uuid,
};
pub fn get_a_creditor(id: Uuid) -> Request<Creditor> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/creditor/")
.path_param(id)
.build()
}
pub fn update_a_creditor(body: &Creditor) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/creditors/creditor")
.body(body)
.build()
}
pub fn create_a_creditor(body: &Creditor) -> Request<Created> {
RequestBuilder::new(http::Method::POST, "/v1/creditors/creditor")
.body(body)
.build()
}
pub fn delete_a_creditor(id: Uuid) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/creditors/creditor/")
.path_param(id)
.build()
}
pub fn get_all_creditors(
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<Creditors> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/creditors")
.query_param_opt("offset", offset)
.query_param_opt("limit", limit)
.query_param_opt("sortingfield", sortingfield)
.query_param_opt("asc", asc)
.build()
}
pub fn get_creditors_subset_of_information() -> Request<CreditorSubs> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/creditorsubs").build()
}
pub fn delete_a_text_template(
creditorpublicid: Uuid,
invoicetexttemplatepublicid: Uuid,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/creditors/creditortexttemplate")
.query_param("creditorpublicid", creditorpublicid)
.query_param("invoicetexttemplatepublicid", invoicetexttemplatepublicid)
.build()
}
pub fn create_creditor_single_sign_in_token(
id: Uuid,
username: Option<&str>,
) -> Request<CreditorToken> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/creditortoken/")
.path_param(id)
.query_param_opt("username", username)
.build()
}
pub fn get_default_configuration(id: Uuid) -> Request<DefaultActionConfig> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/defaultactionconfig/")
.path_param(id)
.build()
}
pub fn update_default_configuration(body: &DefaultActionConfig) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/creditors/defaultactionconfig")
.body(body)
.build()
}
pub fn get_creditors_kyc_information(id: Uuid) -> Request<CreditorKyc> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/kyc/")
.path_param(id)
.build()
}
pub fn create_or_update_kyc_information(body: &CreditorKyc) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/creditors/kyc")
.body(body)
.build()
}
pub fn update_creditor_logo(id: Uuid, body: &Stream) -> Request<CreatedUrl> {
RequestBuilder::new(http::Method::PUT, "/v1/creditors/logotype/")
.path_param(id)
.body(body)
.build()
}
pub fn get_all_shared_creditors_to_current_api_user() -> Request<CreditorShares> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/shares").build()
}
pub fn get_all_shares_on_creditor(id: Uuid) -> Request<CreditorShares> {
RequestBuilder::new(http::Method::GET, "/v1/creditors/shares/")
.path_param(id)
.build()
}
pub fn update_creditor_share(body: &CreditorShare) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/creditors/shares")
.body(body)
.build()
}
pub fn share_a_creditor(body: &CreditorShare) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::POST, "/v1/creditors/shares")
.body(body)
.build()
}
pub fn unshare_a_creditor(id: Uuid) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/creditors/shares/")
.path_param(id)
.build()
}