billecta 1.14.0

Generated Billecta API
Documentation
//! # Creditors
//!
//! Creditors are the base of all data relations in the API. A creditor is an invoices sender,
//! self invoice sender, supplier invoice receivers, etc. It is the company that you
//! represent.
//!
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()
}
///Deletes a creditor. Note that a creditor can't be deleted if an
///invoice, debtor, product, etc has been created on it. This is due to
///bookkeeping regulations.
pub fn delete_a_creditor(id: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/creditors/creditor/")
        .path_param(id)
        .build()
}
///Get all creditors current user has read access to
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()
}
///Get a subset of all creditors info that current user has read access
///to
pub fn get_creditors_subset_of_information() -> Request<CreditorSubs> {
    RequestBuilder::new(http::Method::GET, "/v1/creditors/creditorsubs").build()
}
///Deletes a saved text template.
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()
}
///A creditor sign in token enabled users in you site to be able to be
///signed in into the Billecta App, a so called seamless sing in between
///our and your system. The call creates a key that is valid for one
///minute. For more information on how to integrate your application with
///the Billecta App and set proper access rights please contact
///support@billecta.com.
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()
}
///Default configuration is a set of default values that has been defined
///by you or the users. They are just a suggestion and a default setting.
///When creating invoice or 'other' data the value should be extracted
///from the default values and sent with the actual invoice or the
///'other' data.
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()
}
///Gets the status of the KYC request. Request is made through the portal
///in company settings
pub fn get_creditors_kyc_information(id: Uuid) -> Request<CreditorKyc> {
    RequestBuilder::new(http::Method::GET, "/v1/creditors/kyc/")
        .path_param(id)
        .build()
}
///Creates or updates the KYC information for the creditor. Mobil BankID
///sign is optional
pub fn create_or_update_kyc_information(body: &CreditorKyc) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/creditors/kyc")
        .body(body)
        .build()
}
///Valid format on logos are png, jpg, bmp. Image is stored in Billecta
///database if method is used. Alternative method for updating logo is to
///send your own URL when creating/updating creditor.
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()
}
///Get all creditors that has been shared to the current calling user.
pub fn get_all_shared_creditors_to_current_api_user() -> Request<CreditorShares> {
    RequestBuilder::new(http::Method::GET, "/v1/creditors/shares").build()
}
///Get all users/shares that the specified creditor has been shared with.
pub fn get_all_shares_on_creditor(id: Uuid) -> Request<CreditorShares> {
    RequestBuilder::new(http::Method::GET, "/v1/creditors/shares/")
        .path_param(id)
        .build()
}
///Update the rights on an already existing creditor share.
pub fn update_creditor_share(body: &CreditorShare) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/creditors/shares")
        .body(body)
        .build()
}
///Sharing a creditor means that you can grant access (you define which
///rights) to another user in Billecta. By that you can for instance
///grant you bookkeeping firm access to your creditor as long as they
///have an account in Billecta. An alternative and more restrictive (for
///you bookkeeping firm) is that you create a specific user account for
///your bookkeeping firm in your domain. The reason why that is more
///restrictive for your bookkeeping firm is that the must have on account
///for each company that manage in Billecta.
pub fn share_a_creditor(body: &CreditorShare) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/creditors/shares")
        .body(body)
        .build()
}
///Unshare a creditor. All users that have been granted access directly
///or indirectly will be lose access to the creditor.
pub fn unshare_a_creditor(id: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/creditors/shares/")
        .path_param(id)
        .build()
}