DocumentsClient

class moloni.api.DocumentsClient(environment: MoloniBaseUrl = MoloniBaseUrl.PROD, *, auth_config: AuthConfig = AuthConfig(client_id=None, client_secret=None, refresh_token=None, username=None, password=None), version: str = 'v1', validate: bool = True, log_level: str = 'INFO')
count(self, data: DocumentsCountModel | dict, **kwargs)
Parameters:

data (Union[DocumentsCountModel, dict]) –

A model instance or dictionary containing the following fields:

  • company_id (Union[str, int]): company_id of the DocumentsCountModel.

  • customer_id (Union[str, int]): customer_id of the DocumentsCountModel.

  • date (str): date of the DocumentsCountModel.

  • document_set_id (Union[str, int]): document_set_id of the DocumentsCountModel.

  • expiration_date (str): expiration_date of the DocumentsCountModel.

  • number (str): number of the DocumentsCountModel.

  • our_reference (str): our_reference of the DocumentsCountModel.

  • salesman_id (Union[str, int]): salesman_id of the DocumentsCountModel.

  • supplier_id (Union[str, int]): supplier_id of the DocumentsCountModel.

  • year (str): year of the DocumentsCountModel.

  • your_reference (str): your_reference of the DocumentsCountModel.

Returns:

The response from the API.

Return type:

ApiResponse

get_all(self, data: DocumentsGetAllModel | dict, **kwargs)
Parameters:

data (Union[DocumentsGetAllModel, dict]) –

A model instance or dictionary containing the following fields:

  • company_id (Union[str, int]): company_id of the DocumentsGetAllModel.

  • customer_id (Union[str, int]): customer_id of the DocumentsGetAllModel.

  • date (str): date of the DocumentsGetAllModel.

  • document_set_id (Union[str, int]): document_set_id of the DocumentsGetAllModel.

  • expiration_date (str): expiration_date of the DocumentsGetAllModel.

  • number (str): number of the DocumentsGetAllModel.

  • offset (str): offset of the DocumentsGetAllModel.

  • our_reference (str): our_reference of the DocumentsGetAllModel.

  • qty (str): qty of the DocumentsGetAllModel.

  • salesman_id (Union[str, int]): salesman_id of the DocumentsGetAllModel.

  • supplier_id (Union[str, int]): supplier_id of the DocumentsGetAllModel.

  • year (str): year of the DocumentsGetAllModel.

  • your_reference (str): your_reference of the DocumentsGetAllModel.

Returns:

The response from the API.

Return type:

ApiResponse

get_all_document_types(self, data: DocumentsGetAllDocumentTypesModel | dict, **kwargs)
Parameters:

data (Union[DocumentsGetAllDocumentTypesModel, dict]) –

A model instance or dictionary containing the following fields:

  • language_id (Union[str, int]): language_id of the DocumentsGetAllDocumentTypesModel.

Returns:

The response from the API.

Return type:

ApiResponse

get_one(self, data: DocumentsGetOneModel | dict, **kwargs)
Parameters:

data (Union[DocumentsGetOneModel, dict]) –

A model instance or dictionary containing the following fields:

  • company_id (Union[str, int]): company_id of the DocumentsGetOneModel.

  • customer_id (Union[str, int]): customer_id of the DocumentsGetOneModel.

  • date (str): date of the DocumentsGetOneModel.

  • document_id (Union[str, int]): document_id of the DocumentsGetOneModel.

  • document_set_id (Union[str, int]): document_set_id of the DocumentsGetOneModel.

  • expiration_date (str): expiration_date of the DocumentsGetOneModel.

  • number (str): number of the DocumentsGetOneModel.

  • our_reference (str): our_reference of the DocumentsGetOneModel.

  • salesman_id (Union[str, int]): salesman_id of the DocumentsGetOneModel.

  • supplier_id (Union[str, int]): supplier_id of the DocumentsGetOneModel.

  • year (str): year of the DocumentsGetOneModel.

  • your_reference (str): your_reference of the DocumentsGetOneModel.

Returns:

The response from the API.

Return type:

ApiResponse

Parameters:

data (Union[DocumentsGetPdfLinkModel, dict]) –

A model instance or dictionary containing the following fields:

  • company_id (Union[str, int]): company_id of the DocumentsGetPdfLinkModel.

  • document_id (Union[str, int]): document_id of the DocumentsGetPdfLinkModel.

Returns:

The response from the API.

Return type:

ApiResponse

Models:

class moloni.api.DocumentsCountModel(*, company_id: str | int, customer_id: str | int | None = None, date: str | None = None, document_set_id: str | int | None = None, expiration_date: str | None = None, number: str | None = None, our_reference: str | None = None, salesman_id: str | int | None = None, supplier_id: str | int | None = None, year: str | None = None, your_reference: str | None = None)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

company_id: str | int
customer_id: str | int | None
date: str | None
document_set_id: str | int | None
expiration_date: str | None
number: str | None
our_reference: str | None
salesman_id: str | int | None
supplier_id: str | int | None
year: str | None
your_reference: str | None
request(self) ApiResponse

Make an API request using the initialized client.

This method checks if the _api_client attribute is set (i.e., if the client has been initialized via the connect method). If the client is initialized, it will make an API request using the provided method name and the model’s data, excluding the _api_client attribute itself from the request payload. If the client is not initialized, it will raise a ValueError.

Returns:

The response from the API.

Raises:

ValueError – If the client is not initialized via the connect method.

Example

# Assuming you have a model instance request_model and an API client api_client

..code-block:: python

with request_model.connect(auth_config=auth_config) as api:

response = api.request()

# The above example assumes that the connect method has been used to initialize the client. # The request method then sends the model’s data to the API and returns the API’s response.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'company_id': FieldInfo(annotation=Union[str, int], required=True), 'customer_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'document_set_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'expiration_date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'number': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'our_reference': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'salesman_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'supplier_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'year': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'your_reference': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

class moloni.api.DocumentsGetAllModel(*, company_id: str | int, customer_id: str | int | None = None, date: str | None = None, document_set_id: str | int | None = None, expiration_date: str | None = None, number: str | None = None, offset: str | int | None = 0, our_reference: str | None = None, qty: str | int | None = 25, salesman_id: str | int | None = None, supplier_id: str | int | None = None, year: str | None = None, your_reference: str | None = None)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

company_id: str | int
customer_id: str | int | None
date: str | None
document_set_id: str | int | None
expiration_date: str | None
number: str | None
offset: str | int | None
our_reference: str | None
qty: str | int | None
salesman_id: str | int | None
supplier_id: str | int | None
year: str | None
your_reference: str | None
request(self) ApiResponse

Make an API request using the initialized client.

This method checks if the _api_client attribute is set (i.e., if the client has been initialized via the connect method). If the client is initialized, it will make an API request using the provided method name and the model’s data, excluding the _api_client attribute itself from the request payload. If the client is not initialized, it will raise a ValueError.

Returns:

The response from the API.

Raises:

ValueError – If the client is not initialized via the connect method.

Example

# Assuming you have a model instance request_model and an API client api_client

..code-block:: python

with request_model.connect(auth_config=auth_config) as api:

response = api.request()

# The above example assumes that the connect method has been used to initialize the client. # The request method then sends the model’s data to the API and returns the API’s response.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'company_id': FieldInfo(annotation=Union[str, int], required=True), 'customer_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'document_set_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'expiration_date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'number': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'offset': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=0), 'our_reference': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'qty': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=25), 'salesman_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'supplier_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'year': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'your_reference': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

class moloni.api.DocumentsGetAllDocumentTypesModel(*, language_id: str | int | None = None)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

language_id: str | int | None
request(self) ApiResponse

Make an API request using the initialized client.

This method checks if the _api_client attribute is set (i.e., if the client has been initialized via the connect method). If the client is initialized, it will make an API request using the provided method name and the model’s data, excluding the _api_client attribute itself from the request payload. If the client is not initialized, it will raise a ValueError.

Returns:

The response from the API.

Raises:

ValueError – If the client is not initialized via the connect method.

Example

# Assuming you have a model instance request_model and an API client api_client

..code-block:: python

with request_model.connect(auth_config=auth_config) as api:

response = api.request()

# The above example assumes that the connect method has been used to initialize the client. # The request method then sends the model’s data to the API and returns the API’s response.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'language_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

class moloni.api.DocumentsGetOneModel(*, company_id: str | int, customer_id: str | int | None = None, date: str | None = None, document_id: str | int | None = None, document_set_id: str | int | None = None, expiration_date: str | None = None, number: str | None = None, our_reference: str | None = None, salesman_id: str | int | None = None, supplier_id: str | int | None = None, year: str | None = None, your_reference: str | None = None)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

company_id: str | int
customer_id: str | int | None
date: str | None
document_id: str | int | None
document_set_id: str | int | None
expiration_date: str | None
number: str | None
our_reference: str | None
salesman_id: str | int | None
supplier_id: str | int | None
year: str | None
your_reference: str | None
request(self) ApiResponse

Make an API request using the initialized client.

This method checks if the _api_client attribute is set (i.e., if the client has been initialized via the connect method). If the client is initialized, it will make an API request using the provided method name and the model’s data, excluding the _api_client attribute itself from the request payload. If the client is not initialized, it will raise a ValueError.

Returns:

The response from the API.

Raises:

ValueError – If the client is not initialized via the connect method.

Example

# Assuming you have a model instance request_model and an API client api_client

..code-block:: python

with request_model.connect(auth_config=auth_config) as api:

response = api.request()

# The above example assumes that the connect method has been used to initialize the client. # The request method then sends the model’s data to the API and returns the API’s response.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'company_id': FieldInfo(annotation=Union[str, int], required=True), 'customer_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'document_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'document_set_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'expiration_date': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'number': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'our_reference': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'salesman_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'supplier_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'year': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'your_reference': FieldInfo(annotation=Union[str, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

class moloni.api.DocumentsGetPdfLinkModel(*, company_id: str | int, document_id: str | int | None = None)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

company_id: str | int
document_id: str | int | None
request(self) ApiResponse

Make an API request using the initialized client.

This method checks if the _api_client attribute is set (i.e., if the client has been initialized via the connect method). If the client is initialized, it will make an API request using the provided method name and the model’s data, excluding the _api_client attribute itself from the request payload. If the client is not initialized, it will raise a ValueError.

Returns:

The response from the API.

Raises:

ValueError – If the client is not initialized via the connect method.

Example

# Assuming you have a model instance request_model and an API client api_client

..code-block:: python

with request_model.connect(auth_config=auth_config) as api:

response = api.request()

# The above example assumes that the connect method has been used to initialize the client. # The request method then sends the model’s data to the API and returns the API’s response.

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'company_id': FieldInfo(annotation=Union[str, int], required=True), 'document_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.