Clients

Sous-client pour les endpoints /v1/customers.

Classes: - SyncCustomersClient : Accès synchrone aux endpoints clients. - AsyncCustomersClient : Accès asynchrone aux endpoints clients.

Notes: Utiliser de préférence les objets suivants pour acceder aux endpoints: - henrri_connect.SyncHenrriClient - henrri_connect.AsyncHenrriClient

class henrri_connect.customers.AsyncCustomersClient(client)[source]

Bases : object

Accès asynchrone aux endpoints clients.

Arguments - client (AsyncHenrriClient) : Client HTTP.

Methods - delete : Supprime un client. - delete_contact : Supprime un contact. - list_customers : Liste les clients avec pagination et filtres optionnels. - get_best_sales : Récupère les meilleurs clients. - get_last_used : Récupère le dernier client utilisé. - add : Crée un nouveau client. - get : Récupère un client par son identifiant. - modify : Met à jour un client. - get_address : Récupère l’adresse d’un client. - list_contacts : Liste les contacts d’un client. - add_contact : Crée un nouveau contact. - get_contact : Récupère un contact d’un client. - modify_contact : Met à jour un contact.

async list_customers(*, request, with_selected_fields=True, with_totals=False, only_current_page=True)[source]
Overloads:
  • self, request (CustomerRequest), with_selected_fields (bool), with_totals (bool), only_current_page (bool) → PagedListResponse[Customer]

  • self, request (CustomerRequest), with_selected_fields (bool), with_totals (None), only_current_page (None)

Liste les clients avec pagination et filtres optionnels.

Arguments - request (CustomerRequest) : Paramètres de recherche. - with_selected_fields (bool) : Si True, lance une requête de recherche avancée. - with_totals (bool) : Si True, renvoie les totaux. - only_current_page (bool) : Si True, renvoie uniquement les clients de la page actuelle.

Returns - PagedListResponse[Customer] : Liste paginée de clients.

async add(customer)[source]

Crée un nouveau client.

Arguments - customer (Customer) : Client à créer.

Returns - Customer : Client créé.

Type renvoyé:

Customer

async get_best_sales(*, year)[source]

Récupère les meilleurs clients.

Arguments - year (int) : Année concerne (minimum 2000, maximum 2100).

Returns - PagedListResponse[Customer] : Liste paginée de clients.

Type renvoyé:

PagedListResponse[Customer]

async get_last_used(customer_type, limit)[source]

Récupère les derniers clients utilisés.

Arguments - customer_type (CustomerType) : Type de client. - limit (int) : Nombre de clients maximum.

Returns - Customer : Derniers clients utilisés.

Type renvoyé:

Customer

async get(customer_id)[source]

Récupère un client par son identifiant.

Arguments - customer_id (int) : Identifiant du client.

Returns - Customer : Client.

Type renvoyé:

Customer

async modify(customer_id, customer)[source]

Met à jour un client existant.

Arguments - customer_id (int) : Identifiant du client. - customer (Customer) : Client à mettre à jour.

Returns - Customer : Client mis à jour.

Type renvoyé:

Customer

async delete(customer_id)[source]

Supprime un client.

Arguments - customer_id (int) : Identifiant du client.

Returns - None.

Type renvoyé:

None

async get_address(customer_id)[source]

Récupère l’adresse d’un client.

Arguments - customer_id (int) : Identifiant du client.

Returns - henrri_connect.models.Address : Adresse du client.

Type renvoyé:

Address

async list_contacts(customer_id)[source]

Liste les contacts d’un client.

Arguments - customer_id (int) : Identifiant du client.

Returns - list[Contact] : Liste de contacts.

Type renvoyé:

list[Contact]

async add_contact(customer_id, contact)[source]

Ajoute un contact à un client.

Arguments - customer_id (int) : Identifiant du client. - contact (Contact) : Contact à ajouter.

Returns - Contact : Contact ajouté.

Type renvoyé:

Contact

async get_contact(customer_id, contact_id)[source]

Récupère un contact d’un client.

Arguments - customer_id (int) : Identifiant du client. - contact_id (int) : Identifiant du contact.

Returns - Contact : Contact.

Type renvoyé:

Contact

async modify_contact(customer_id, contact_id, contact)[source]

Met à jour un contact d’un client.

Arguments - customer_id (int) : Identifiant du client. - contact_id (int) : Identifiant du contact. - contact (Contact) : Contact à mettre à jour.

Returns - Contact : Contact mis à jour.

Type renvoyé:

Contact

async delete_contact(customer_id, contact_id)[source]

Supprime un contact d’un client.

Arguments - customer_id (int) : Identifiant du client. - contact_id (int) : Identifiant du contact.

Returns - None.

Type renvoyé:

None

class henrri_connect.customers.CustomerRequest(**data)[source]

Bases : CamelModel

Modèle pour les requêtes de recherches clients dans l’API Henrri Connect.

Attributs: - page: Numéro de page (par défaut 1). - limit: Nombre de clients par page (par défaut 50). - search: Chaîne de recherche (obligatoire). - sort_by: Champ de tri. - sort_order: Ordre de tri (Ascending ou Descending). - min_id: Identifiant minimal de client (entre 1 et 2 147 483 647). - from_date: Date de début. - to_date: Date de fin.

page: int
limit: int
search: str
sort_by: str | None
sort_order: SortOrder | None
min_id: int | None
from_date: str
to_date: str
model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

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

class henrri_connect.customers.CustomerType(*values)[source]

Bases : str, Enum

Type de client pour les clients dans l’API Henrri Connect.

Attributs - INDIVIDUAL: Client individuel. - COMPANY: Client entreprise.

INDIVIDUAL = 'individual'
COMPANY = 'professional'
class henrri_connect.customers.SyncCustomersClient(client)[source]

Bases : object

Accès synchrone aux endpoints clients.

Arguments - client (SyncHenrriClient) : Client HTTP.

Methodes - list_customers : Liste les clients avec pagination et filtres optionnels. - add : Crée un nouveau client. - get_best_sales : Récupère les meilleurs clients. - get_last_used : Récupère le dernier client utilisé. - get : Récupère un client par son identifiant. - modify : Met à jour un client existant. - delete : Supprime un client. - get_address : Récupère l’adresse d’un client. - list_contacts : Liste les contacts d’un client avec pagination et filtres optionnels. - add_contact : Crée un nouveau contact. - get_contact : Récupère un contact d’un client. - modify_contact : Met à jour un contact existant. - delete_contact : Supprime un contact.

list_customers(*, request, with_selected_fields=True, with_totals=False, only_current_page=True)[source]
Overloads:
  • self, request (CustomerRequest), with_selected_fields (bool), with_totals (bool), only_current_page (bool) → PagedListResponse[Customer]

  • self, request (CustomerRequest), with_selected_fields (bool), with_totals (None), only_current_page (None)

Liste les clients avec pagination et filtres optionnels.

Arguments - request (CustomerRequest) : Paramètres de recherche. - with_selected_fields (bool) : Si True, lance une requête de recherche avancée. - with_totals (bool) : Si True, renvoie les totaux. - only_current_page (bool) : Si True, renvoie uniquement les clients de la page actuelle.

Returns - PagedListResponse[Customer] : Liste paginée de clients.

add(customer)[source]

Crée un nouveau client.

Arguments - customer (Customer) : Client à créer.

Returns - Customer : Client créé.

Type renvoyé:

Customer

get_best_sales(*, year)[source]

Récupère les meilleurs clients.

Arguments - year (int) : Année concerne (minimum 2000, maximum 2100).

Returns - PagedListResponse[Customer] : Liste de clients.

Type renvoyé:

PagedListResponse[Customer]

get_last_used(customer_type, limit)[source]

Récupère les derniers clients utilisés.

Arguments - customer_type (CustomerType) : Type de client. - limit (int) : Nombre de clients maximum.

Returns - Customer : Derniers clients utilisés.

Type renvoyé:

Customer

get(customer_id)[source]

Récupère un client par son identifiant.

Arguments - customer_id (int) : Identifiant du client.

Returns - Customer : Client.

Type renvoyé:

Customer

modify(customer_id, customer)[source]

Met à jour un client existant.

Arguments - customer_id (int) : Identifiant du client. - customer (Customer) : Client à mettre à jour.

Returns - Customer : Client mis à jour.

Type renvoyé:

Customer

delete(customer_id)[source]

Supprime un client.

Arguments - customer_id (int) : Identifiant du client.

Returns - None

Type renvoyé:

None

get_address(customer_id)[source]

Récupère l’adresse d’un client.

Arguments - customer_id (int) : Identifiant du client.

Returns - Address : Adresse du client.

Type renvoyé:

Address

list_contacts(customer_id)[source]

Liste les contacts d’un client.

Arguments - customer_id (int) : Identifiant du client.

Returns - list[Contact] : Liste de contacts.

Type renvoyé:

list[Contact]

add_contact(customer_id, contact)[source]

Ajoute un contact à un client.

Arguments - customer_id (int) : Identifiant du client. - contact (Contact) : Contact à ajouter.

Returns - Contact : Contact ajouté.

Type renvoyé:

Contact

get_contact(customer_id, contact_id)[source]

Récupère un contact d’un client.

Arguments - customer_id (int) : Identifiant du client. - contact_id (int) : Identifiant du contact.

Returns - Contact : Contact.

Type renvoyé:

Contact

modify_contact(customer_id, contact_id, contact)[source]

Met à jour un contact d’un client.

Arguments - customer_id (int) : Identifiant du client. - contact_id (int) : Identifiant du contact. - contact (Contact) : Contact à mettre à jour.

Returns - Contact : Contact mis à jour.

Type renvoyé:

Contact

delete_contact(customer_id, contact_id)[source]

Supprime un contact d’un client.

Arguments - customer_id (int) : Identifiant du client. - contact_id (int) : Identifiant du contact.

Returns - None

Type renvoyé:

None