factpulse 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- factpulse/__init__.py +280 -0
- factpulse/api/__init__.py +13 -0
- factpulse/api/afnorpdppa_api.py +284 -0
- factpulse/api/afnorpdppa_directory_service_api.py +799 -0
- factpulse/api/afnorpdppa_flow_service_api.py +1075 -0
- factpulse/api/chorus_pro_api.py +4506 -0
- factpulse/api/processing_endpoints_unifis_api.py +592 -0
- factpulse/api/sant_api.py +281 -0
- factpulse/api/signature_lectronique_api.py +1358 -0
- factpulse/api/traitement_facture_api.py +3439 -0
- factpulse/api/utilisateur_api.py +282 -0
- factpulse/api_client.py +804 -0
- factpulse/api_response.py +21 -0
- factpulse/configuration.py +585 -0
- factpulse/exceptions.py +216 -0
- factpulse/models/__init__.py +124 -0
- factpulse/models/adresse_electronique.py +90 -0
- factpulse/models/adresse_postale.py +120 -0
- factpulse/models/body_ajouter_fichier_api_v1_chorus_pro_transverses_ajouter_fichier_post.py +104 -0
- factpulse/models/body_completer_facture_api_v1_chorus_pro_factures_completer_post.py +104 -0
- factpulse/models/body_lister_services_structure_api_v1_chorus_pro_structures_id_structure_cpp_services_get.py +102 -0
- factpulse/models/body_rechercher_factures_destinataire_api_v1_chorus_pro_factures_rechercher_destinataire_post.py +104 -0
- factpulse/models/body_rechercher_factures_fournisseur_api_v1_chorus_pro_factures_rechercher_fournisseur_post.py +104 -0
- factpulse/models/body_recycler_facture_api_v1_chorus_pro_factures_recycler_post.py +104 -0
- factpulse/models/body_telecharger_groupe_factures_api_v1_chorus_pro_factures_telecharger_groupe_post.py +104 -0
- factpulse/models/body_traiter_facture_recue_api_v1_chorus_pro_factures_traiter_facture_recue_post.py +104 -0
- factpulse/models/body_valideur_consulter_facture_api_v1_chorus_pro_factures_valideur_consulter_post.py +104 -0
- factpulse/models/body_valideur_rechercher_factures_api_v1_chorus_pro_factures_valideur_rechercher_post.py +104 -0
- factpulse/models/body_valideur_traiter_facture_api_v1_chorus_pro_factures_valideur_traiter_post.py +104 -0
- factpulse/models/cadre_de_facturation.py +102 -0
- factpulse/models/categorie_tva.py +44 -0
- factpulse/models/certificate_info_response.py +114 -0
- factpulse/models/chorus_pro_credentials.py +95 -0
- factpulse/models/code_cadre_facturation.py +39 -0
- factpulse/models/code_raison_reduction.py +42 -0
- factpulse/models/consulter_facture_request.py +98 -0
- factpulse/models/consulter_facture_response.py +142 -0
- factpulse/models/consulter_structure_request.py +100 -0
- factpulse/models/consulter_structure_response.py +142 -0
- factpulse/models/credentials_afnor.py +106 -0
- factpulse/models/credentials_chorus_pro.py +115 -0
- factpulse/models/destinataire.py +116 -0
- factpulse/models/destination.py +140 -0
- factpulse/models/destination_afnor.py +127 -0
- factpulse/models/destination_chorus_pro.py +108 -0
- factpulse/models/direction_flux.py +37 -0
- factpulse/models/donnees_facture_simplifiees.py +124 -0
- factpulse/models/facture_enrichie_info_input.py +123 -0
- factpulse/models/facture_enrichie_info_output.py +133 -0
- factpulse/models/facture_factur_x.py +173 -0
- factpulse/models/flux_resume.py +131 -0
- factpulse/models/format_sortie.py +37 -0
- factpulse/models/fournisseur.py +146 -0
- factpulse/models/generate_certificate_request.py +118 -0
- factpulse/models/generate_certificate_response.py +106 -0
- factpulse/models/http_validation_error.py +95 -0
- factpulse/models/information_signature_api.py +122 -0
- factpulse/models/ligne_de_poste.py +188 -0
- factpulse/models/ligne_de_poste_montant_remise_ht.py +145 -0
- factpulse/models/ligne_de_poste_montant_total_ligne_ht.py +145 -0
- factpulse/models/ligne_de_poste_taux_tva_manuel.py +145 -0
- factpulse/models/ligne_de_tva.py +118 -0
- factpulse/models/mode_depot.py +38 -0
- factpulse/models/mode_paiement.py +41 -0
- factpulse/models/montant_ht_total.py +139 -0
- factpulse/models/montant_total.py +138 -0
- factpulse/models/montant_total_acompte.py +145 -0
- factpulse/models/montant_total_montant_remise_globale_ttc.py +145 -0
- factpulse/models/montant_ttc_total.py +139 -0
- factpulse/models/montant_tva.py +139 -0
- factpulse/models/montantapayer.py +139 -0
- factpulse/models/montantbaseht.py +139 -0
- factpulse/models/montanthttotal.py +139 -0
- factpulse/models/montantttctotal.py +139 -0
- factpulse/models/montanttva.py +139 -0
- factpulse/models/montanttva1.py +139 -0
- factpulse/models/montantunitaireht.py +139 -0
- factpulse/models/obtenir_id_chorus_pro_request.py +100 -0
- factpulse/models/obtenir_id_chorus_pro_response.py +98 -0
- factpulse/models/options_processing.py +103 -0
- factpulse/models/parametres_signature.py +133 -0
- factpulse/models/parametres_structure.py +91 -0
- factpulse/models/pdf_factur_x_info.py +91 -0
- factpulse/models/pdp_credentials.py +93 -0
- factpulse/models/piece_jointe_complementaire.py +95 -0
- factpulse/models/profil_api.py +39 -0
- factpulse/models/profil_flux.py +38 -0
- factpulse/models/quantite.py +139 -0
- factpulse/models/quota_info.py +95 -0
- factpulse/models/rechercher_services_response.py +101 -0
- factpulse/models/rechercher_structure_request.py +119 -0
- factpulse/models/rechercher_structure_response.py +101 -0
- factpulse/models/references.py +124 -0
- factpulse/models/reponse_healthcheck_afnor.py +91 -0
- factpulse/models/reponse_recherche_flux.py +101 -0
- factpulse/models/reponse_soumission_flux.py +109 -0
- factpulse/models/reponse_tache.py +87 -0
- factpulse/models/reponse_validation_erreur.py +87 -0
- factpulse/models/reponse_validation_succes.py +87 -0
- factpulse/models/requete_recherche_flux.py +143 -0
- factpulse/models/requete_soumission_flux.py +123 -0
- factpulse/models/resultat_afnor.py +105 -0
- factpulse/models/resultat_chorus_pro.py +101 -0
- factpulse/models/resultat_validation_pdfapi.py +169 -0
- factpulse/models/scheme_id.py +40 -0
- factpulse/models/service_structure.py +93 -0
- factpulse/models/signature_info.py +101 -0
- factpulse/models/soumettre_facture_complete_request.py +116 -0
- factpulse/models/soumettre_facture_complete_response.py +145 -0
- factpulse/models/soumettre_facture_request.py +164 -0
- factpulse/models/soumettre_facture_response.py +103 -0
- factpulse/models/statut_acquittement.py +38 -0
- factpulse/models/statut_facture.py +96 -0
- factpulse/models/statut_tache.py +99 -0
- factpulse/models/structure_info.py +95 -0
- factpulse/models/syntaxe_flux.py +40 -0
- factpulse/models/tauxmanuel.py +139 -0
- factpulse/models/type_facture.py +37 -0
- factpulse/models/type_flux.py +40 -0
- factpulse/models/type_tva.py +39 -0
- factpulse/models/unite.py +41 -0
- factpulse/models/utilisateur.py +128 -0
- factpulse/models/validation_error.py +99 -0
- factpulse/models/validation_error_loc_inner.py +138 -0
- factpulse/py.typed +0 -0
- factpulse/rest.py +258 -0
- factpulse-1.0.6.dist-info/METADATA +182 -0
- factpulse-1.0.6.dist-info/RECORD +131 -0
- factpulse-1.0.6.dist-info/WHEEL +5 -0
- factpulse-1.0.6.dist-info/licenses/LICENSE +21 -0
- factpulse-1.0.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
API REST FactPulse
|
|
5
|
+
|
|
6
|
+
API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional, Union
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
from pydantic import Field
|
|
26
|
+
|
|
27
|
+
MONTANTHTTOTAL_ANY_OF_SCHEMAS = ["float", "str"]
|
|
28
|
+
|
|
29
|
+
class MontantHtTotal(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
MontantHtTotal
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# data type: float
|
|
35
|
+
anyof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
|
|
36
|
+
# data type: str
|
|
37
|
+
anyof_schema_2_validator: Optional[Annotated[str, Field(strict=True)]] = None
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
actual_instance: Optional[Union[float, str]] = None
|
|
40
|
+
else:
|
|
41
|
+
actual_instance: Any = None
|
|
42
|
+
any_of_schemas: Set[str] = { "float", "str" }
|
|
43
|
+
|
|
44
|
+
model_config = {
|
|
45
|
+
"validate_assignment": True,
|
|
46
|
+
"protected_namespaces": (),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
50
|
+
if args:
|
|
51
|
+
if len(args) > 1:
|
|
52
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
53
|
+
if kwargs:
|
|
54
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
55
|
+
super().__init__(actual_instance=args[0])
|
|
56
|
+
else:
|
|
57
|
+
super().__init__(**kwargs)
|
|
58
|
+
|
|
59
|
+
@field_validator('actual_instance')
|
|
60
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
61
|
+
instance = MontantHtTotal.model_construct()
|
|
62
|
+
error_messages = []
|
|
63
|
+
# validate data type: float
|
|
64
|
+
try:
|
|
65
|
+
instance.anyof_schema_1_validator = v
|
|
66
|
+
return v
|
|
67
|
+
except (ValidationError, ValueError) as e:
|
|
68
|
+
error_messages.append(str(e))
|
|
69
|
+
# validate data type: str
|
|
70
|
+
try:
|
|
71
|
+
instance.anyof_schema_2_validator = v
|
|
72
|
+
return v
|
|
73
|
+
except (ValidationError, ValueError) as e:
|
|
74
|
+
error_messages.append(str(e))
|
|
75
|
+
if error_messages:
|
|
76
|
+
# no match
|
|
77
|
+
raise ValueError("No match found when setting the actual_instance in MontantHtTotal with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
78
|
+
else:
|
|
79
|
+
return v
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
83
|
+
return cls.from_json(json.dumps(obj))
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_json(cls, json_str: str) -> Self:
|
|
87
|
+
"""Returns the object represented by the json string"""
|
|
88
|
+
instance = cls.model_construct()
|
|
89
|
+
error_messages = []
|
|
90
|
+
# deserialize data into float
|
|
91
|
+
try:
|
|
92
|
+
# validation
|
|
93
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
94
|
+
# assign value to actual_instance
|
|
95
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
96
|
+
return instance
|
|
97
|
+
except (ValidationError, ValueError) as e:
|
|
98
|
+
error_messages.append(str(e))
|
|
99
|
+
# deserialize data into str
|
|
100
|
+
try:
|
|
101
|
+
# validation
|
|
102
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
|
103
|
+
# assign value to actual_instance
|
|
104
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
|
105
|
+
return instance
|
|
106
|
+
except (ValidationError, ValueError) as e:
|
|
107
|
+
error_messages.append(str(e))
|
|
108
|
+
|
|
109
|
+
if error_messages:
|
|
110
|
+
# no match
|
|
111
|
+
raise ValueError("No match found when deserializing the JSON string into MontantHtTotal with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
112
|
+
else:
|
|
113
|
+
return instance
|
|
114
|
+
|
|
115
|
+
def to_json(self) -> str:
|
|
116
|
+
"""Returns the JSON representation of the actual instance"""
|
|
117
|
+
if self.actual_instance is None:
|
|
118
|
+
return "null"
|
|
119
|
+
|
|
120
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
121
|
+
return self.actual_instance.to_json()
|
|
122
|
+
else:
|
|
123
|
+
return json.dumps(self.actual_instance)
|
|
124
|
+
|
|
125
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
|
|
126
|
+
"""Returns the dict representation of the actual instance"""
|
|
127
|
+
if self.actual_instance is None:
|
|
128
|
+
return None
|
|
129
|
+
|
|
130
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
131
|
+
return self.actual_instance.to_dict()
|
|
132
|
+
else:
|
|
133
|
+
return self.actual_instance
|
|
134
|
+
|
|
135
|
+
def to_str(self) -> str:
|
|
136
|
+
"""Returns the string representation of the actual instance"""
|
|
137
|
+
return pprint.pformat(self.model_dump())
|
|
138
|
+
|
|
139
|
+
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
API REST FactPulse
|
|
5
|
+
|
|
6
|
+
API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from factpulse.models.montant_total_acompte import MontantTotalAcompte
|
|
23
|
+
from factpulse.models.montant_total_montant_remise_globale_ttc import MontantTotalMontantRemiseGlobaleTtc
|
|
24
|
+
from factpulse.models.montantapayer import Montantapayer
|
|
25
|
+
from factpulse.models.montanthttotal import Montanthttotal
|
|
26
|
+
from factpulse.models.montantttctotal import Montantttctotal
|
|
27
|
+
from factpulse.models.montanttva1 import Montanttva1
|
|
28
|
+
from typing import Optional, Set
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
|
|
31
|
+
class MontantTotal(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
Contient tous les montants totaux de la facture.
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
montant_ht_total: Montanthttotal = Field(alias="montantHtTotal")
|
|
36
|
+
montant_tva: Montanttva1 = Field(alias="montantTva")
|
|
37
|
+
montant_ttc_total: Montantttctotal = Field(alias="montantTtcTotal")
|
|
38
|
+
montant_a_payer: Montantapayer = Field(alias="montantAPayer")
|
|
39
|
+
acompte: Optional[MontantTotalAcompte] = None
|
|
40
|
+
montant_remise_globale_ttc: Optional[MontantTotalMontantRemiseGlobaleTtc] = Field(default=None, alias="montantRemiseGlobaleTtc")
|
|
41
|
+
motif_remise_globale_ttc: Optional[StrictStr] = Field(default=None, alias="motifRemiseGlobaleTtc")
|
|
42
|
+
__properties: ClassVar[List[str]] = ["montantHtTotal", "montantTva", "montantTtcTotal", "montantAPayer", "acompte", "montantRemiseGlobaleTtc", "motifRemiseGlobaleTtc"]
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
populate_by_name=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def to_str(self) -> str:
|
|
52
|
+
"""Returns the string representation of the model using alias"""
|
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> str:
|
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
58
|
+
return json.dumps(self.to_dict())
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of MontantTotal from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
76
|
+
])
|
|
77
|
+
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude=excluded_fields,
|
|
81
|
+
exclude_none=True,
|
|
82
|
+
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of montant_ht_total
|
|
84
|
+
if self.montant_ht_total:
|
|
85
|
+
_dict['montantHtTotal'] = self.montant_ht_total.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of montant_tva
|
|
87
|
+
if self.montant_tva:
|
|
88
|
+
_dict['montantTva'] = self.montant_tva.to_dict()
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of montant_ttc_total
|
|
90
|
+
if self.montant_ttc_total:
|
|
91
|
+
_dict['montantTtcTotal'] = self.montant_ttc_total.to_dict()
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of montant_a_payer
|
|
93
|
+
if self.montant_a_payer:
|
|
94
|
+
_dict['montantAPayer'] = self.montant_a_payer.to_dict()
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of acompte
|
|
96
|
+
if self.acompte:
|
|
97
|
+
_dict['acompte'] = self.acompte.to_dict()
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of montant_remise_globale_ttc
|
|
99
|
+
if self.montant_remise_globale_ttc:
|
|
100
|
+
_dict['montantRemiseGlobaleTtc'] = self.montant_remise_globale_ttc.to_dict()
|
|
101
|
+
# set to None if acompte (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.acompte is None and "acompte" in self.model_fields_set:
|
|
104
|
+
_dict['acompte'] = None
|
|
105
|
+
|
|
106
|
+
# set to None if montant_remise_globale_ttc (nullable) is None
|
|
107
|
+
# and model_fields_set contains the field
|
|
108
|
+
if self.montant_remise_globale_ttc is None and "montant_remise_globale_ttc" in self.model_fields_set:
|
|
109
|
+
_dict['montantRemiseGlobaleTtc'] = None
|
|
110
|
+
|
|
111
|
+
# set to None if motif_remise_globale_ttc (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.motif_remise_globale_ttc is None and "motif_remise_globale_ttc" in self.model_fields_set:
|
|
114
|
+
_dict['motifRemiseGlobaleTtc'] = None
|
|
115
|
+
|
|
116
|
+
return _dict
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
120
|
+
"""Create an instance of MontantTotal from a dict"""
|
|
121
|
+
if obj is None:
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
if not isinstance(obj, dict):
|
|
125
|
+
return cls.model_validate(obj)
|
|
126
|
+
|
|
127
|
+
_obj = cls.model_validate({
|
|
128
|
+
"montantHtTotal": Montanthttotal.from_dict(obj["montantHtTotal"]) if obj.get("montantHtTotal") is not None else None,
|
|
129
|
+
"montantTva": Montanttva1.from_dict(obj["montantTva"]) if obj.get("montantTva") is not None else None,
|
|
130
|
+
"montantTtcTotal": Montantttctotal.from_dict(obj["montantTtcTotal"]) if obj.get("montantTtcTotal") is not None else None,
|
|
131
|
+
"montantAPayer": Montantapayer.from_dict(obj["montantAPayer"]) if obj.get("montantAPayer") is not None else None,
|
|
132
|
+
"acompte": MontantTotalAcompte.from_dict(obj["acompte"]) if obj.get("acompte") is not None else None,
|
|
133
|
+
"montantRemiseGlobaleTtc": MontantTotalMontantRemiseGlobaleTtc.from_dict(obj["montantRemiseGlobaleTtc"]) if obj.get("montantRemiseGlobaleTtc") is not None else None,
|
|
134
|
+
"motifRemiseGlobaleTtc": obj.get("motifRemiseGlobaleTtc")
|
|
135
|
+
})
|
|
136
|
+
return _obj
|
|
137
|
+
|
|
138
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
API REST FactPulse
|
|
5
|
+
|
|
6
|
+
API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional, Union
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
from pydantic import Field
|
|
26
|
+
|
|
27
|
+
MONTANTTOTALACOMPTE_ANY_OF_SCHEMAS = ["float", "str"]
|
|
28
|
+
|
|
29
|
+
class MontantTotalAcompte(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
Acompte versé.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# data type: float
|
|
35
|
+
anyof_schema_1_validator: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = None
|
|
36
|
+
# data type: str
|
|
37
|
+
anyof_schema_2_validator: Optional[Annotated[str, Field(strict=True)]] = None
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
actual_instance: Optional[Union[float, str]] = None
|
|
40
|
+
else:
|
|
41
|
+
actual_instance: Any = None
|
|
42
|
+
any_of_schemas: Set[str] = { "float", "str" }
|
|
43
|
+
|
|
44
|
+
model_config = {
|
|
45
|
+
"validate_assignment": True,
|
|
46
|
+
"protected_namespaces": (),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
50
|
+
if args:
|
|
51
|
+
if len(args) > 1:
|
|
52
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
53
|
+
if kwargs:
|
|
54
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
55
|
+
super().__init__(actual_instance=args[0])
|
|
56
|
+
else:
|
|
57
|
+
super().__init__(**kwargs)
|
|
58
|
+
|
|
59
|
+
@field_validator('actual_instance')
|
|
60
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
61
|
+
if v is None:
|
|
62
|
+
return v
|
|
63
|
+
|
|
64
|
+
instance = MontantTotalAcompte.model_construct()
|
|
65
|
+
error_messages = []
|
|
66
|
+
# validate data type: float
|
|
67
|
+
try:
|
|
68
|
+
instance.anyof_schema_1_validator = v
|
|
69
|
+
return v
|
|
70
|
+
except (ValidationError, ValueError) as e:
|
|
71
|
+
error_messages.append(str(e))
|
|
72
|
+
# validate data type: str
|
|
73
|
+
try:
|
|
74
|
+
instance.anyof_schema_2_validator = v
|
|
75
|
+
return v
|
|
76
|
+
except (ValidationError, ValueError) as e:
|
|
77
|
+
error_messages.append(str(e))
|
|
78
|
+
if error_messages:
|
|
79
|
+
# no match
|
|
80
|
+
raise ValueError("No match found when setting the actual_instance in MontantTotalAcompte with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
81
|
+
else:
|
|
82
|
+
return v
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
86
|
+
return cls.from_json(json.dumps(obj))
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_json(cls, json_str: str) -> Self:
|
|
90
|
+
"""Returns the object represented by the json string"""
|
|
91
|
+
instance = cls.model_construct()
|
|
92
|
+
if json_str is None:
|
|
93
|
+
return instance
|
|
94
|
+
|
|
95
|
+
error_messages = []
|
|
96
|
+
# deserialize data into float
|
|
97
|
+
try:
|
|
98
|
+
# validation
|
|
99
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
100
|
+
# assign value to actual_instance
|
|
101
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
102
|
+
return instance
|
|
103
|
+
except (ValidationError, ValueError) as e:
|
|
104
|
+
error_messages.append(str(e))
|
|
105
|
+
# deserialize data into str
|
|
106
|
+
try:
|
|
107
|
+
# validation
|
|
108
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
|
109
|
+
# assign value to actual_instance
|
|
110
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
|
111
|
+
return instance
|
|
112
|
+
except (ValidationError, ValueError) as e:
|
|
113
|
+
error_messages.append(str(e))
|
|
114
|
+
|
|
115
|
+
if error_messages:
|
|
116
|
+
# no match
|
|
117
|
+
raise ValueError("No match found when deserializing the JSON string into MontantTotalAcompte with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
118
|
+
else:
|
|
119
|
+
return instance
|
|
120
|
+
|
|
121
|
+
def to_json(self) -> str:
|
|
122
|
+
"""Returns the JSON representation of the actual instance"""
|
|
123
|
+
if self.actual_instance is None:
|
|
124
|
+
return "null"
|
|
125
|
+
|
|
126
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
127
|
+
return self.actual_instance.to_json()
|
|
128
|
+
else:
|
|
129
|
+
return json.dumps(self.actual_instance)
|
|
130
|
+
|
|
131
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
|
|
132
|
+
"""Returns the dict representation of the actual instance"""
|
|
133
|
+
if self.actual_instance is None:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
137
|
+
return self.actual_instance.to_dict()
|
|
138
|
+
else:
|
|
139
|
+
return self.actual_instance
|
|
140
|
+
|
|
141
|
+
def to_str(self) -> str:
|
|
142
|
+
"""Returns the string representation of the actual instance"""
|
|
143
|
+
return pprint.pformat(self.model_dump())
|
|
144
|
+
|
|
145
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
API REST FactPulse
|
|
5
|
+
|
|
6
|
+
API REST pour la facturation électronique en France : Factur-X, AFNOR PDP/PA, signatures électroniques. ## 🎯 Fonctionnalités principales ### 📄 Génération de factures Factur-X - **Formats** : XML seul ou PDF/A-3 avec XML embarqué - **Profils** : MINIMUM, BASIC, EN16931, EXTENDED - **Normes** : EN 16931 (directive UE 2014/55), ISO 19005-3 (PDF/A-3), CII (UN/CEFACT) - **🆕 Format simplifié** : Génération à partir de SIRET + auto-enrichissement (API Chorus Pro + Recherche Entreprises) ### ✅ Validation et conformité - **Validation XML** : Schematron (45 à 210+ règles selon profil) - **Validation PDF** : PDF/A-3, métadonnées XMP Factur-X, signatures électroniques - **VeraPDF** : Validation stricte PDF/A (146+ règles ISO 19005-3) - **Traitement asynchrone** : Support Celery pour validations lourdes (VeraPDF) ### 📡 Intégration AFNOR PDP/PA (XP Z12-013) - **Soumission de flux** : Envoi de factures vers Plateformes de Dématérialisation Partenaires - **Recherche de flux** : Consultation des factures soumises - **Téléchargement** : Récupération des PDF/A-3 avec XML - **Directory Service** : Recherche d'entreprises (SIREN/SIRET) - **Multi-client** : Support de plusieurs configs PDP par utilisateur (stored credentials ou zero-storage) ### ✍️ Signature électronique PDF - **Standards** : PAdES-B-B, PAdES-B-T (horodatage RFC 3161), PAdES-B-LT (archivage long terme) - **Niveaux eIDAS** : SES (auto-signé), AdES (CA commerciale), QES (PSCO) - **Validation** : Vérification intégrité cryptographique et certificats - **Génération de certificats** : Certificats X.509 auto-signés pour tests ### 🔄 Traitement asynchrone - **Celery** : Génération, validation et signature asynchrones - **Polling** : Suivi d'état via `/taches/{id_tache}/statut` - **Pas de timeout** : Idéal pour gros fichiers ou validations lourdes ## 🔒 Authentification Toutes les requêtes nécessitent un **token JWT** dans le header Authorization : ``` Authorization: Bearer YOUR_JWT_TOKEN ``` ### Comment obtenir un token JWT ? #### 🔑 Méthode 1 : API `/api/token/` (Recommandée) **URL :** `https://www.factpulse.fr/api/token/` Cette méthode est **recommandée** pour l'intégration dans vos applications et workflows CI/CD. **Prérequis :** Avoir défini un mot de passe sur votre compte **Pour les utilisateurs inscrits via email/password :** - Vous avez déjà un mot de passe, utilisez-le directement **Pour les utilisateurs inscrits via OAuth (Google/GitHub) :** - Vous devez d'abord définir un mot de passe sur : https://www.factpulse.fr/accounts/password/set/ - Une fois le mot de passe créé, vous pourrez utiliser l'API **Exemple de requête :** ```bash curl -X POST https://www.factpulse.fr/api/token/ \\ -H \"Content-Type: application/json\" \\ -d '{ \"username\": \"votre_email@example.com\", \"password\": \"votre_mot_de_passe\" }' ``` **Réponse :** ```json { \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\", // Token d'accès (validité: 30 min) \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGc...\" // Token de rafraîchissement (validité: 7 jours) } ``` **Avantages :** - ✅ Automatisation complète (CI/CD, scripts) - ✅ Gestion programmatique des tokens - ✅ Support du refresh token pour renouveler automatiquement l'accès - ✅ Intégration facile dans n'importe quel langage/outil #### 🖥️ Méthode 2 : Génération via Dashboard (Alternative) **URL :** https://www.factpulse.fr/dashboard/ Cette méthode convient pour des tests rapides ou une utilisation occasionnelle via l'interface graphique. **Fonctionnement :** - Connectez-vous au dashboard - Utilisez les boutons \"Generate Test Token\" ou \"Generate Production Token\" - Fonctionne pour **tous** les utilisateurs (OAuth et email/password), sans nécessiter de mot de passe **Types de tokens :** - **Token Test** : Validité 24h, quota 1000 appels/jour (gratuit) - **Token Production** : Validité 7 jours, quota selon votre forfait **Avantages :** - ✅ Rapide pour tester l'API - ✅ Aucun mot de passe requis - ✅ Interface visuelle simple **Inconvénients :** - ❌ Nécessite une action manuelle - ❌ Pas de refresh token - ❌ Moins adapté pour l'automatisation ### 📚 Documentation complète Pour plus d'informations sur l'authentification et l'utilisation de l'API : https://www.factpulse.fr/documentation-api/
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
from inspect import getfullargspec
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
21
|
+
from typing import Optional, Union
|
|
22
|
+
from typing_extensions import Annotated
|
|
23
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
from pydantic import Field
|
|
26
|
+
|
|
27
|
+
MONTANTTOTALMONTANTREMISEGLOBALETTC_ANY_OF_SCHEMAS = ["float", "str"]
|
|
28
|
+
|
|
29
|
+
class MontantTotalMontantRemiseGlobaleTtc(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
Montant de la remise globale TTC.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# data type: float
|
|
35
|
+
anyof_schema_1_validator: Optional[Union[Annotated[float, Field(strict=True, ge=0.0)], Annotated[int, Field(strict=True, ge=0)]]] = None
|
|
36
|
+
# data type: str
|
|
37
|
+
anyof_schema_2_validator: Optional[Annotated[str, Field(strict=True)]] = None
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
actual_instance: Optional[Union[float, str]] = None
|
|
40
|
+
else:
|
|
41
|
+
actual_instance: Any = None
|
|
42
|
+
any_of_schemas: Set[str] = { "float", "str" }
|
|
43
|
+
|
|
44
|
+
model_config = {
|
|
45
|
+
"validate_assignment": True,
|
|
46
|
+
"protected_namespaces": (),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
50
|
+
if args:
|
|
51
|
+
if len(args) > 1:
|
|
52
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
53
|
+
if kwargs:
|
|
54
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
55
|
+
super().__init__(actual_instance=args[0])
|
|
56
|
+
else:
|
|
57
|
+
super().__init__(**kwargs)
|
|
58
|
+
|
|
59
|
+
@field_validator('actual_instance')
|
|
60
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
61
|
+
if v is None:
|
|
62
|
+
return v
|
|
63
|
+
|
|
64
|
+
instance = MontantTotalMontantRemiseGlobaleTtc.model_construct()
|
|
65
|
+
error_messages = []
|
|
66
|
+
# validate data type: float
|
|
67
|
+
try:
|
|
68
|
+
instance.anyof_schema_1_validator = v
|
|
69
|
+
return v
|
|
70
|
+
except (ValidationError, ValueError) as e:
|
|
71
|
+
error_messages.append(str(e))
|
|
72
|
+
# validate data type: str
|
|
73
|
+
try:
|
|
74
|
+
instance.anyof_schema_2_validator = v
|
|
75
|
+
return v
|
|
76
|
+
except (ValidationError, ValueError) as e:
|
|
77
|
+
error_messages.append(str(e))
|
|
78
|
+
if error_messages:
|
|
79
|
+
# no match
|
|
80
|
+
raise ValueError("No match found when setting the actual_instance in MontantTotalMontantRemiseGlobaleTtc with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
81
|
+
else:
|
|
82
|
+
return v
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
86
|
+
return cls.from_json(json.dumps(obj))
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_json(cls, json_str: str) -> Self:
|
|
90
|
+
"""Returns the object represented by the json string"""
|
|
91
|
+
instance = cls.model_construct()
|
|
92
|
+
if json_str is None:
|
|
93
|
+
return instance
|
|
94
|
+
|
|
95
|
+
error_messages = []
|
|
96
|
+
# deserialize data into float
|
|
97
|
+
try:
|
|
98
|
+
# validation
|
|
99
|
+
instance.anyof_schema_1_validator = json.loads(json_str)
|
|
100
|
+
# assign value to actual_instance
|
|
101
|
+
instance.actual_instance = instance.anyof_schema_1_validator
|
|
102
|
+
return instance
|
|
103
|
+
except (ValidationError, ValueError) as e:
|
|
104
|
+
error_messages.append(str(e))
|
|
105
|
+
# deserialize data into str
|
|
106
|
+
try:
|
|
107
|
+
# validation
|
|
108
|
+
instance.anyof_schema_2_validator = json.loads(json_str)
|
|
109
|
+
# assign value to actual_instance
|
|
110
|
+
instance.actual_instance = instance.anyof_schema_2_validator
|
|
111
|
+
return instance
|
|
112
|
+
except (ValidationError, ValueError) as e:
|
|
113
|
+
error_messages.append(str(e))
|
|
114
|
+
|
|
115
|
+
if error_messages:
|
|
116
|
+
# no match
|
|
117
|
+
raise ValueError("No match found when deserializing the JSON string into MontantTotalMontantRemiseGlobaleTtc with anyOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
118
|
+
else:
|
|
119
|
+
return instance
|
|
120
|
+
|
|
121
|
+
def to_json(self) -> str:
|
|
122
|
+
"""Returns the JSON representation of the actual instance"""
|
|
123
|
+
if self.actual_instance is None:
|
|
124
|
+
return "null"
|
|
125
|
+
|
|
126
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
127
|
+
return self.actual_instance.to_json()
|
|
128
|
+
else:
|
|
129
|
+
return json.dumps(self.actual_instance)
|
|
130
|
+
|
|
131
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
|
|
132
|
+
"""Returns the dict representation of the actual instance"""
|
|
133
|
+
if self.actual_instance is None:
|
|
134
|
+
return None
|
|
135
|
+
|
|
136
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
137
|
+
return self.actual_instance.to_dict()
|
|
138
|
+
else:
|
|
139
|
+
return self.actual_instance
|
|
140
|
+
|
|
141
|
+
def to_str(self) -> str:
|
|
142
|
+
"""Returns the string representation of the actual instance"""
|
|
143
|
+
return pprint.pformat(self.model_dump())
|
|
144
|
+
|
|
145
|
+
|