use crate::{
CommentAction, CommonActionEvents, Created, Date, DeliveryMethodType, EmptyResponse, Request,
RequestBuilder, SelfInvoiceAction, SelfInvoiceActionEntry, SelfInvoiceActionSub,
SelfInvoicePayment, Uuid,
};
pub fn get_a_self_invoice(id: &str) -> Request<SelfInvoiceAction> {
RequestBuilder::new(http::Method::GET, "/v1/selfinvoice/action/")
.path_param(id)
.build()
}
pub fn update_a_self_invoice(id: &str, body: &SelfInvoiceActionEntry) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/action/")
.path_param(id)
.body(body)
.build()
}
pub fn create_a_self_invoice(body: &SelfInvoiceActionEntry) -> Request<Created> {
RequestBuilder::new(http::Method::POST, "/v1/selfinvoice/action")
.body(body)
.build()
}
pub fn delete_a_self_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/selfinvoice/action/")
.path_param(id)
.build()
}
pub fn get_self_invoice_s_by_external_id(
id: Uuid,
externalid: &str,
) -> Request<Vec<SelfInvoiceAction>> {
RequestBuilder::new(http::Method::GET, "/v1/selfinvoice/actionsbyexternalid/")
.path_param(id)
.query_param("externalid", externalid)
.build()
}
pub fn attest_a_self_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/attest/")
.path_param(id)
.build()
}
pub fn cancel_a_self_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/cancel/")
.path_param(id)
.build()
}
pub fn get_all_closed_self_invoices(
id: Uuid,
from: Date,
to: Date,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<Vec<SelfInvoiceActionSub>> {
RequestBuilder::new(http::Method::GET, "/v1/selfinvoice/closed/")
.path_param(id)
.query_param("from", from)
.query_param("to", to)
.query_param_opt("offset", offset)
.query_param_opt("limit", limit)
.query_param_opt("sortingfield", sortingfield)
.query_param_opt("asc", asc)
.build()
}
pub fn comment_a_self_invoice(body: &CommentAction) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::POST, "/v1/selfinvoice/comment")
.body(body)
.build()
}
pub fn get_all_events_for_all_self_invoices(
id: Uuid,
from: Date,
to: Date,
) -> Request<CommonActionEvents> {
RequestBuilder::new(http::Method::GET, "/v1/selfinvoice/events/")
.path_param(id)
.query_param("from", from)
.query_param("to", to)
.build()
}
pub fn load_archived_events(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/loadarchivedevents/")
.path_param(id)
.build()
}
pub fn get_all_open_self_invoices(
id: Uuid,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<Vec<SelfInvoiceActionSub>> {
RequestBuilder::new(http::Method::GET, "/v1/selfinvoice/open/")
.path_param(id)
.query_param_opt("offset", offset)
.query_param_opt("limit", limit)
.query_param_opt("sortingfield", sortingfield)
.query_param_opt("asc", asc)
.build()
}
pub fn pause_a_self_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/pause/")
.path_param(id)
.build()
}
pub fn preview_a_self_invoice(id: &str) -> Request<Vec<u8>> {
RequestBuilder::new(http::Method::GET, "/v1/selfinvoice/preview/")
.path_param(id)
.build()
}
pub fn preview_a_self_invoice_post(body: &SelfInvoiceActionEntry) -> Request<Vec<u8>> {
RequestBuilder::new(http::Method::POST, "/v1/selfinvoice/preview")
.body(body)
.build()
}
pub fn resume_a_self_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/resume/")
.path_param(id)
.build()
}
pub fn send_invoice_for_a_self_invoice(
id: &str,
method: &DeliveryMethodType,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/sendinvoice/")
.path_param(id)
.query_param("method", *method)
.build()
}
pub fn send_payment_for_a_self_invoice(body: &SelfInvoicePayment) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/selfinvoice/sendpayment")
.body(body)
.build()
}