CompaniesClient
- class moloni.api.CompaniesClient(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')
- get_all(self, **kwargs)
Args:
- Returns:
The response from the API.
- Return type:
- get_one(self, data: CompaniesGetOneModel | dict, **kwargs)
- Parameters:
data (Union[CompaniesGetOneModel, dict]) –
A model instance or dictionary containing the following fields:
company_id (Union[str, int]): company_id of the CompaniesGetOneModel.
- Returns:
The response from the API.
- Return type:
- update(self, data: CompaniesUpdateModel | dict, **kwargs)
- Parameters:
data (Union[CompaniesUpdateModel, dict]) –
A model instance or dictionary containing the following fields:
address (str): address of the CompaniesUpdateModel.
capital (str): capital of the CompaniesUpdateModel.
city (str): city of the CompaniesUpdateModel.
commercial_registration_number (str): commercial_registration_number of the CompaniesUpdateModel.
company_id (Union[str, int]): company_id of the CompaniesUpdateModel.
country_id (Union[str, int]): country_id of the CompaniesUpdateModel.
currency_id (Union[str, int]): currency_id of the CompaniesUpdateModel.
customer_series (str): customer_series of the CompaniesUpdateModel.
decimal_places (str): decimal_places of the CompaniesUpdateModel.
decimal_separator (str): decimal_separator of the CompaniesUpdateModel.
delivery_method_id (Union[str, int]): delivery_method_id of the CompaniesUpdateModel.
detached_series_doc_number (str): detached_series_doc_number of the CompaniesUpdateModel.
docs_commercial_info_on_footer (str): docs_commercial_info_on_footer of the CompaniesUpdateModel.
docs_company_info_position (str): docs_company_info_position of the CompaniesUpdateModel.
docs_copies (str): docs_copies of the CompaniesUpdateModel.
docs_footer (str): docs_footer of the CompaniesUpdateModel.
docs_pdf_model_id (Union[str, int]): docs_pdf_model_id of the CompaniesUpdateModel.
docs_qty_products_page (str): docs_qty_products_page of the CompaniesUpdateModel.
docs_show_client_phone (str): docs_show_client_phone of the CompaniesUpdateModel.
docs_show_client_vat_prefix (str): docs_show_client_vat_prefix of the CompaniesUpdateModel.
docs_show_company_notes (str): docs_show_company_notes of the CompaniesUpdateModel.
docs_show_related (str): docs_show_related of the CompaniesUpdateModel.
docs_show_values_on_movement_docs (str): docs_show_values_on_movement_docs of the CompaniesUpdateModel.
docs_show_values_on_return_docs (str): docs_show_values_on_return_docs of the CompaniesUpdateModel.
docs_show_values_orders_docs (str): docs_show_values_orders_docs of the CompaniesUpdateModel.
docs_show_values_with_taxes (str): docs_show_values_with_taxes of the CompaniesUpdateModel.
email (str): email of the CompaniesUpdateModel.
fax (str): fax of the CompaniesUpdateModel.
is_retailer_or_tsp (bool): is_retailer_or_tsp of the CompaniesUpdateModel.
mails_sender_address (str): mails_sender_address of the CompaniesUpdateModel.
mails_sender_name (str): mails_sender_name of the CompaniesUpdateModel.
maturity_date_id (Union[str, int]): maturity_date_id of the CompaniesUpdateModel.
maturity_on_week_day (str): maturity_on_week_day of the CompaniesUpdateModel.
name (str): name of the CompaniesUpdateModel.
notes (str): notes of the CompaniesUpdateModel.
notify_late_documents (str): notify_late_documents of the CompaniesUpdateModel.
numeric_code_ordering (str): numeric_code_ordering of the CompaniesUpdateModel.
payment_method_id (Union[str, int]): payment_method_id of the CompaniesUpdateModel.
phone (str): phone of the CompaniesUpdateModel.
registry_office (str): registry_office of the CompaniesUpdateModel.
show_home_charts (str): show_home_charts of the CompaniesUpdateModel.
show_inactive_customers (str): show_inactive_customers of the CompaniesUpdateModel.
show_inactive_products (str): show_inactive_products of the CompaniesUpdateModel.
thousands_separator (str): thousands_separator of the CompaniesUpdateModel.
vat (str): vat of the CompaniesUpdateModel.
website (str): website of the CompaniesUpdateModel.
zip_code (str): zip_code of the CompaniesUpdateModel.
- Returns:
The response from the API.
- Return type:
Models:
- class moloni.api.CompaniesGetOneModel(*, company_id: str | int)
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
- 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)}
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.CompaniesUpdateModel(*, company_id: str | int, address: str | None = None, capital: str | None = None, city: str | None = None, commercial_registration_number: str | None = None, country_id: str | int | None = None, currency_id: str | int | None = None, customer_series: str | None = None, decimal_places: str | None = None, decimal_separator: str | None = None, delivery_method_id: str | int | None = None, detached_series_doc_number: str | None = None, docs_commercial_info_on_footer: str | None = None, docs_company_info_position: str | None = None, docs_copies: str | None = None, docs_footer: str | None = None, docs_pdf_model_id: str | int | None = None, docs_qty_products_page: str | None = None, docs_show_client_phone: str | None = None, docs_show_client_vat_prefix: str | None = None, docs_show_company_notes: str | None = None, docs_show_related: str | None = None, docs_show_values_on_movement_docs: str | None = None, docs_show_values_on_return_docs: str | None = None, docs_show_values_orders_docs: str | None = None, docs_show_values_with_taxes: str | None = None, email: str | None = None, fax: str | None = None, is_retailer_or_tsp: bool | None = None, mails_sender_address: str | None = None, mails_sender_name: str | None = None, maturity_date_id: str | int | None = None, maturity_on_week_day: str | None = None, name: str | None = None, notes: str | None = None, notify_late_documents: str | None = None, numeric_code_ordering: str | None = None, payment_method_id: str | int | None = None, phone: str | None = None, registry_office: str | None = None, show_home_charts: str | None = None, show_inactive_customers: str | None = None, show_inactive_products: str | None = None, thousands_separator: str | None = None, vat: str | None = None, website: str | None = None, zip_code: 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
- address: str | None
- capital: str | None
- city: str | None
- commercial_registration_number: str | None
- country_id: str | int | None
- currency_id: str | int | None
- customer_series: str | None
- decimal_places: str | None
- decimal_separator: str | None
- delivery_method_id: str | int | None
- detached_series_doc_number: str | None
- docs_company_info_position: str | None
- docs_copies: str | None
- docs_pdf_model_id: str | int | None
- docs_qty_products_page: str | None
- docs_show_client_phone: str | None
- docs_show_client_vat_prefix: str | None
- docs_show_company_notes: str | None
- docs_show_values_on_movement_docs: str | None
- docs_show_values_on_return_docs: str | None
- docs_show_values_orders_docs: str | None
- docs_show_values_with_taxes: str | None
- email: str | None
- fax: str | None
- is_retailer_or_tsp: bool | None
- mails_sender_address: str | None
- mails_sender_name: str | None
- maturity_date_id: str | int | None
- maturity_on_week_day: str | None
- name: str | None
- notes: str | None
- notify_late_documents: str | None
- numeric_code_ordering: str | None
- payment_method_id: str | int | None
- phone: str | None
- registry_office: str | None
- show_home_charts: str | None
- show_inactive_customers: str | None
- show_inactive_products: str | None
- thousands_separator: str | None
- vat: str | None
- website: str | None
- zip_code: 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]] = {'address': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'capital': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'city': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'commercial_registration_number': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'company_id': FieldInfo(annotation=Union[str, int], required=True), 'country_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'currency_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'customer_series': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'decimal_places': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'decimal_separator': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'delivery_method_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'detached_series_doc_number': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_commercial_info_on_footer': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_company_info_position': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_copies': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_footer': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_pdf_model_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'docs_qty_products_page': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_client_phone': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_client_vat_prefix': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_company_notes': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_related': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_values_on_movement_docs': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_values_on_return_docs': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_values_orders_docs': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'docs_show_values_with_taxes': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'email': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'fax': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'is_retailer_or_tsp': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None), 'mails_sender_address': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'mails_sender_name': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'maturity_date_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'maturity_on_week_day': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'name': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'notes': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'notify_late_documents': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'numeric_code_ordering': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'payment_method_id': FieldInfo(annotation=Union[str, int, NoneType], required=False, default=None), 'phone': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'registry_office': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'show_home_charts': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'show_inactive_customers': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'show_inactive_products': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'thousands_separator': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'vat': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'website': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'zip_code': 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.