ffbb-data-client 2.0.0__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.
Files changed (207) hide show
  1. ffbb_api_client_v3/__init__.py +25 -0
  2. ffbb_data_client/__init__.py +175 -0
  3. ffbb_data_client/clients/__init__.py +13 -0
  4. ffbb_data_client/clients/api_ffbb_app_client.py +2475 -0
  5. ffbb_data_client/clients/ffbb_data_client.py +2789 -0
  6. ffbb_data_client/clients/meilisearch_client.py +218 -0
  7. ffbb_data_client/clients/meilisearch_ffbb_client.py +647 -0
  8. ffbb_data_client/config.py +153 -0
  9. ffbb_data_client/data/__init__.py +25 -0
  10. ffbb_data_client/data/collections.json +1364 -0
  11. ffbb_data_client/data/endpoint_discovery.json +1875 -0
  12. ffbb_data_client/data/indexes.json +501 -0
  13. ffbb_data_client/data/openapi.json +35713 -0
  14. ffbb_data_client/data/openapi_full.json +37622 -0
  15. ffbb_data_client/helpers/__init__.py +27 -0
  16. ffbb_data_client/helpers/http_requests_helper.py +73 -0
  17. ffbb_data_client/helpers/http_requests_utils.py +502 -0
  18. ffbb_data_client/helpers/meilisearch_client_extension.py +153 -0
  19. ffbb_data_client/helpers/multi_search_query_helper.py +35 -0
  20. ffbb_data_client/models/__init__.py +241 -0
  21. ffbb_data_client/models/affiche.py +45 -0
  22. ffbb_data_client/models/cartographie.py +82 -0
  23. ffbb_data_client/models/categorie.py +55 -0
  24. ffbb_data_client/models/categorie_type.py +42 -0
  25. ffbb_data_client/models/clock.py +38 -0
  26. ffbb_data_client/models/club_contacts.py +77 -0
  27. ffbb_data_client/models/code.py +7 -0
  28. ffbb_data_client/models/commune.py +66 -0
  29. ffbb_data_client/models/competition_fields.py +309 -0
  30. ffbb_data_client/models/competition_id.py +116 -0
  31. ffbb_data_client/models/competition_id_categorie.py +31 -0
  32. ffbb_data_client/models/competition_id_sexe.py +31 -0
  33. ffbb_data_client/models/competition_id_type_competition.py +27 -0
  34. ffbb_data_client/models/competition_id_type_competition_generique.py +24 -0
  35. ffbb_data_client/models/competition_origine.py +69 -0
  36. ffbb_data_client/models/competition_origine_categorie.py +23 -0
  37. ffbb_data_client/models/competition_origine_type_competition.py +14 -0
  38. ffbb_data_client/models/competition_origine_type_competition_generique.py +24 -0
  39. ffbb_data_client/models/competition_type.py +6 -0
  40. ffbb_data_client/models/competitions_facet_distribution.py +65 -0
  41. ffbb_data_client/models/competitions_facet_stats.py +14 -0
  42. ffbb_data_client/models/competitions_hit.py +232 -0
  43. ffbb_data_client/models/competitions_multi_search_query.py +40 -0
  44. ffbb_data_client/models/competitions_query.py +11 -0
  45. ffbb_data_client/models/configuration_models.py +5 -0
  46. ffbb_data_client/models/contact_info.py +18 -0
  47. ffbb_data_client/models/content_multi_search_query.py +93 -0
  48. ffbb_data_client/models/coordonnees.py +27 -0
  49. ffbb_data_client/models/coordonnees_type.py +5 -0
  50. ffbb_data_client/models/document_flyer.py +205 -0
  51. ffbb_data_client/models/document_flyer_type.py +6 -0
  52. ffbb_data_client/models/engagement_contacts.py +97 -0
  53. ffbb_data_client/models/engagements_facet_distribution.py +59 -0
  54. ffbb_data_client/models/engagements_facet_stats.py +14 -0
  55. ffbb_data_client/models/engagements_hit.py +192 -0
  56. ffbb_data_client/models/engagements_multi_search_query.py +41 -0
  57. ffbb_data_client/models/etat.py +6 -0
  58. ffbb_data_client/models/external_competition_id.py +42 -0
  59. ffbb_data_client/models/external_id.py +72 -0
  60. ffbb_data_client/models/facet_distribution.py +13 -0
  61. ffbb_data_client/models/facet_stats.py +13 -0
  62. ffbb_data_client/models/field_set.py +10 -0
  63. ffbb_data_client/models/folder.py +35 -0
  64. ffbb_data_client/models/formation_session.py +60 -0
  65. ffbb_data_client/models/formations_facet_distribution.py +61 -0
  66. ffbb_data_client/models/formations_facet_stats.py +14 -0
  67. ffbb_data_client/models/formations_hit.py +277 -0
  68. ffbb_data_client/models/formations_multi_search_query.py +41 -0
  69. ffbb_data_client/models/game_stats_model.py +57 -0
  70. ffbb_data_client/models/game_stats_models.py +5 -0
  71. ffbb_data_client/models/generic_search.py +92 -0
  72. ffbb_data_client/models/geo.py +27 -0
  73. ffbb_data_client/models/geo_sort_order.py +6 -0
  74. ffbb_data_client/models/get_commune_response.py +18 -0
  75. ffbb_data_client/models/get_competition_response.py +523 -0
  76. ffbb_data_client/models/get_configuration_response.py +45 -0
  77. ffbb_data_client/models/get_engagement_response.py +23 -0
  78. ffbb_data_client/models/get_entraineur_response.py +18 -0
  79. ffbb_data_client/models/get_formation_response.py +28 -0
  80. ffbb_data_client/models/get_officiel_response.py +18 -0
  81. ffbb_data_client/models/get_organisme_response.py +476 -0
  82. ffbb_data_client/models/get_poule_response.py +68 -0
  83. ffbb_data_client/models/get_pratique_response.py +18 -0
  84. ffbb_data_client/models/get_rencontre_response.py +93 -0
  85. ffbb_data_client/models/get_saisons_response.py +56 -0
  86. ffbb_data_client/models/get_salle_response.py +20 -0
  87. ffbb_data_client/models/get_terrain_response.py +16 -0
  88. ffbb_data_client/models/get_tournoi_response.py +16 -0
  89. ffbb_data_client/models/gradient_color.py +27 -0
  90. ffbb_data_client/models/hit.py +16 -0
  91. ffbb_data_client/models/id_engagement_equipe.py +32 -0
  92. ffbb_data_client/models/id_organisme_equipe.py +51 -0
  93. ffbb_data_client/models/id_organisme_equipe1_logo.py +28 -0
  94. ffbb_data_client/models/id_poule.py +27 -0
  95. ffbb_data_client/models/jour.py +11 -0
  96. ffbb_data_client/models/label.py +15 -0
  97. ffbb_data_client/models/labellisation.py +30 -0
  98. ffbb_data_client/models/live.py +192 -0
  99. ffbb_data_client/models/lives.py +6 -0
  100. ffbb_data_client/models/logo.py +28 -0
  101. ffbb_data_client/models/multi_search_queries.py +24 -0
  102. ffbb_data_client/models/multi_search_query.py +96 -0
  103. ffbb_data_client/models/multi_search_result_competitions.py +14 -0
  104. ffbb_data_client/models/multi_search_result_engagements.py +14 -0
  105. ffbb_data_client/models/multi_search_result_formations.py +12 -0
  106. ffbb_data_client/models/multi_search_result_organismes.py +12 -0
  107. ffbb_data_client/models/multi_search_result_pratiques.py +12 -0
  108. ffbb_data_client/models/multi_search_result_rencontres.py +12 -0
  109. ffbb_data_client/models/multi_search_result_salles.py +12 -0
  110. ffbb_data_client/models/multi_search_result_terrains.py +12 -0
  111. ffbb_data_client/models/multi_search_result_tournois.py +12 -0
  112. ffbb_data_client/models/multi_search_results.py +103 -0
  113. ffbb_data_client/models/multi_search_results_class.py +96 -0
  114. ffbb_data_client/models/nature_sol.py +57 -0
  115. ffbb_data_client/models/niveau.py +10 -0
  116. ffbb_data_client/models/niveau_class.py +27 -0
  117. ffbb_data_client/models/niveau_extractor.py +214 -0
  118. ffbb_data_client/models/niveau_info.py +64 -0
  119. ffbb_data_client/models/niveau_models.py +14 -0
  120. ffbb_data_client/models/niveau_type.py +10 -0
  121. ffbb_data_client/models/objectif.py +7 -0
  122. ffbb_data_client/models/organisateur.py +197 -0
  123. ffbb_data_client/models/organisateur_type.py +6 -0
  124. ffbb_data_client/models/organisme_fields.py +327 -0
  125. ffbb_data_client/models/organisme_id_pere.py +177 -0
  126. ffbb_data_client/models/organismes_facet_distribution.py +46 -0
  127. ffbb_data_client/models/organismes_facet_stats.py +14 -0
  128. ffbb_data_client/models/organismes_hit.py +196 -0
  129. ffbb_data_client/models/organismes_multi_search_query.py +41 -0
  130. ffbb_data_client/models/organismes_query.py +8 -0
  131. ffbb_data_client/models/phase_code.py +23 -0
  132. ffbb_data_client/models/poule.py +35 -0
  133. ffbb_data_client/models/poule_fields.py +261 -0
  134. ffbb_data_client/models/poule_rencontre_item_model.py +69 -0
  135. ffbb_data_client/models/poules_models.py +6 -0
  136. ffbb_data_client/models/poules_query.py +9 -0
  137. ffbb_data_client/models/pratique.py +7 -0
  138. ffbb_data_client/models/pratiques_facet_distribution.py +29 -0
  139. ffbb_data_client/models/pratiques_facet_stats.py +14 -0
  140. ffbb_data_client/models/pratiques_hit.py +310 -0
  141. ffbb_data_client/models/pratiques_hit_type.py +9 -0
  142. ffbb_data_client/models/pratiques_multi_search_query.py +41 -0
  143. ffbb_data_client/models/pratiques_type_class.py +45 -0
  144. ffbb_data_client/models/publication_internet.py +6 -0
  145. ffbb_data_client/models/purple_logo.py +24 -0
  146. ffbb_data_client/models/query_fields_manager.py +75 -0
  147. ffbb_data_client/models/ranking_engagement.py +41 -0
  148. ffbb_data_client/models/rankings_models.py +6 -0
  149. ffbb_data_client/models/rencontres_engagement.py +23 -0
  150. ffbb_data_client/models/rencontres_facet_distribution.py +65 -0
  151. ffbb_data_client/models/rencontres_facet_stats.py +14 -0
  152. ffbb_data_client/models/rencontres_hit.py +271 -0
  153. ffbb_data_client/models/rencontres_multi_search_query.py +41 -0
  154. ffbb_data_client/models/saison.py +23 -0
  155. ffbb_data_client/models/saison_fields.py +36 -0
  156. ffbb_data_client/models/saisons_models.py +6 -0
  157. ffbb_data_client/models/saisons_query.py +9 -0
  158. ffbb_data_client/models/salle.py +56 -0
  159. ffbb_data_client/models/salles_facet_distribution.py +14 -0
  160. ffbb_data_client/models/salles_facet_stats.py +14 -0
  161. ffbb_data_client/models/salles_hit.py +153 -0
  162. ffbb_data_client/models/salles_multi_search_query.py +40 -0
  163. ffbb_data_client/models/sexe.py +9 -0
  164. ffbb_data_client/models/sexe_class.py +31 -0
  165. ffbb_data_client/models/source.py +5 -0
  166. ffbb_data_client/models/status.py +5 -0
  167. ffbb_data_client/models/team_engagement.py +56 -0
  168. ffbb_data_client/models/team_ranking.py +108 -0
  169. ffbb_data_client/models/terrains_categorie_championnat_3x3_libelle.py +5 -0
  170. ffbb_data_client/models/terrains_facet_distribution.py +41 -0
  171. ffbb_data_client/models/terrains_facet_stats.py +14 -0
  172. ffbb_data_client/models/terrains_hit.py +223 -0
  173. ffbb_data_client/models/terrains_multi_search_query.py +42 -0
  174. ffbb_data_client/models/terrains_name.py +5 -0
  175. ffbb_data_client/models/terrains_sexe_enum.py +7 -0
  176. ffbb_data_client/models/terrains_storage.py +5 -0
  177. ffbb_data_client/models/tournoi_type_class.py +35 -0
  178. ffbb_data_client/models/tournoi_type_enum.py +7 -0
  179. ffbb_data_client/models/tournoi_types_3x3.py +43 -0
  180. ffbb_data_client/models/tournoi_types_3x3_libelle.py +60 -0
  181. ffbb_data_client/models/tournoi_types_3x3_libelle_enum.py +10 -0
  182. ffbb_data_client/models/tournois_facet_distribution.py +41 -0
  183. ffbb_data_client/models/tournois_facet_stats.py +14 -0
  184. ffbb_data_client/models/tournois_hit.py +132 -0
  185. ffbb_data_client/models/tournois_hit_type.py +5 -0
  186. ffbb_data_client/models/tournois_libelle.py +7 -0
  187. ffbb_data_client/models/tournois_multi_search_query.py +40 -0
  188. ffbb_data_client/models/type_association.py +23 -0
  189. ffbb_data_client/models/type_association_libelle.py +30 -0
  190. ffbb_data_client/models/type_class.py +23 -0
  191. ffbb_data_client/models/type_competition.py +8 -0
  192. ffbb_data_client/models/type_competition_generique.py +31 -0
  193. ffbb_data_client/models/type_enum.py +7 -0
  194. ffbb_data_client/models/type_league.py +6 -0
  195. ffbb_data_client/py.typed +0 -0
  196. ffbb_data_client/utils/__init__.py +27 -0
  197. ffbb_data_client/utils/cache_manager.py +393 -0
  198. ffbb_data_client/utils/converter_utils.py +329 -0
  199. ffbb_data_client/utils/input_validation.py +360 -0
  200. ffbb_data_client/utils/retry_utils.py +478 -0
  201. ffbb_data_client/utils/secure_logging.py +153 -0
  202. ffbb_data_client/utils/token_manager.py +115 -0
  203. ffbb_data_client-2.0.0.dist-info/METADATA +339 -0
  204. ffbb_data_client-2.0.0.dist-info/RECORD +207 -0
  205. ffbb_data_client-2.0.0.dist-info/WHEEL +5 -0
  206. ffbb_data_client-2.0.0.dist-info/licenses/LICENSE.txt +201 -0
  207. ffbb_data_client-2.0.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,223 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from datetime import datetime
5
+ from typing import Any
6
+
7
+ from ..utils.converter_utils import (
8
+ from_datetime,
9
+ from_enum,
10
+ from_int,
11
+ from_list,
12
+ from_obj,
13
+ from_str,
14
+ )
15
+ from .cartographie import Cartographie
16
+ from .commune import Commune
17
+ from .document_flyer import DocumentFlyer
18
+ from .geo import Geo
19
+ from .hit import Hit
20
+ from .terrains_categorie_championnat_3x3_libelle import CategorieChampionnat3X3Libelle
21
+ from .terrains_sexe_enum import SexeEnum
22
+ from .tournoi_type_enum import TournoiTypeEnum
23
+ from .tournoi_types_3x3 import TournoiTypes3X3
24
+
25
+
26
+ @dataclass
27
+ class TerrainsHit(Hit):
28
+ nom: str | None = None
29
+ sexe: SexeEnum | None = None
30
+ adresse: str | None = None
31
+ nom_organisateur: str | None = None
32
+ description: str | None = None
33
+ site_choisi: str | None = None
34
+ id: int | None = None
35
+ code: str | None = None
36
+ date_created: datetime | None = None
37
+ date_updated: datetime | None = None
38
+ age_max: int | None = None
39
+ age_min: int | None = None
40
+ categorie_championnat3_x3_id: int | None = None
41
+ categorie_championnat3_x3_libelle: CategorieChampionnat3X3Libelle | None = None
42
+ debut: datetime | None = None
43
+ fin: datetime | None = None
44
+ mail_organisateur: str | None = None
45
+ nb_participant_prevu: int | None = None
46
+ tarif_organisateur: int | None = None
47
+ telephone_organisateur: str | None = None
48
+ url_organisateur: str | None = None
49
+ adresse_complement: str | None = None
50
+ tournoi_types3_x3: list[TournoiTypes3X3] | None = None
51
+ cartographie: Cartographie | None = None
52
+ commune: Commune | None = None
53
+ document_flyer: DocumentFlyer | None = None
54
+ tournoi_type: TournoiTypeEnum | None = None
55
+ geo: Geo | None = None
56
+ debut_timestamp: int | None = None
57
+ fin_timestamp: int | None = None
58
+ thumbnail: str | None = None
59
+ lower_nom: str | None = field(init=False, default=None, repr=False)
60
+ lower_addresse: str | None = field(init=False, default=None, repr=False)
61
+ lower_nom_organisateur: str | None = field(init=False, default=None, repr=False)
62
+ lower_description: str | None = field(init=False, default=None, repr=False)
63
+ lower_site_choisi: str | None = field(init=False, default=None, repr=False)
64
+ lower_code: str | None = field(init=False, default=None, repr=False)
65
+
66
+ def __post_init__(self) -> None:
67
+ self.lower_nom = self.nom.lower() if self.nom else None
68
+ self.lower_addresse = self.adresse.lower() if self.adresse else None
69
+ self.lower_nom_organisateur = (
70
+ self.nom_organisateur.lower() if self.nom_organisateur else None
71
+ )
72
+ self.lower_description = self.description.lower() if self.description else None
73
+ self.lower_site_choisi = self.site_choisi.lower() if self.site_choisi else None
74
+ self.lower_code = self.code.lower() if self.code else None
75
+
76
+ @staticmethod
77
+ def from_dict(obj: Any) -> TerrainsHit:
78
+ assert isinstance(obj, dict)
79
+ nom = from_str(obj, "nom")
80
+ sexe = from_enum(SexeEnum, obj, "sexe")
81
+ adresse = from_str(obj, "adresse")
82
+ nom_organisateur = from_str(obj, "nomOrganisateur")
83
+ description = from_str(obj, "description")
84
+ site_choisi = from_str(obj, "siteChoisi")
85
+ id = from_int(obj, "id")
86
+ code = from_str(obj, "code")
87
+ date_created = from_datetime(obj, "date_created")
88
+ date_updated = from_datetime(obj, "date_updated")
89
+ age_max = from_int(obj, "ageMax")
90
+ age_min = from_int(obj, "ageMin")
91
+ categorie_championnat3_x3_id = from_int(obj, "categorieChampionnat3x3Id")
92
+ categorie_championnat3_x3_libelle = from_enum(
93
+ CategorieChampionnat3X3Libelle, obj, "categorieChampionnat3x3Libelle"
94
+ )
95
+ debut = from_datetime(obj, "debut")
96
+ fin = from_datetime(obj, "fin")
97
+ mail_organisateur = from_str(obj, "mailOrganisateur")
98
+ nb_participant_prevu = from_int(obj, "nbParticipantPrevu")
99
+ tarif_organisateur = from_int(obj, "tarifOrganisateur")
100
+ telephone_organisateur = from_str(obj, "telephoneOrganisateur")
101
+ url_organisateur = from_str(obj, "urlOrganisateur")
102
+ adresse_complement = from_str(obj, "adresseComplement")
103
+ tournoi_types3_x3 = from_list(TournoiTypes3X3.from_dict, obj, "tournoiTypes3x3")
104
+ cartographie = from_obj(Cartographie.from_dict, obj, "cartographie")
105
+ commune = from_obj(Commune.from_dict, obj, "commune")
106
+ document_flyer = from_obj(DocumentFlyer.from_dict, obj, "document_flyer")
107
+ tournoi_type = from_enum(TournoiTypeEnum, obj, "tournoiType")
108
+ geo = from_obj(Geo.from_dict, obj, "_geo")
109
+ debut_timestamp = from_int(obj, "debut_timestamp")
110
+ fin_timestamp = from_int(obj, "fin_timestamp")
111
+ thumbnail = from_str(obj, "thumbnail")
112
+ return TerrainsHit(
113
+ nom=nom,
114
+ sexe=sexe,
115
+ adresse=adresse,
116
+ nom_organisateur=nom_organisateur,
117
+ description=description,
118
+ site_choisi=site_choisi,
119
+ id=id,
120
+ code=code,
121
+ date_created=date_created,
122
+ date_updated=date_updated,
123
+ age_max=age_max,
124
+ age_min=age_min,
125
+ categorie_championnat3_x3_id=categorie_championnat3_x3_id,
126
+ categorie_championnat3_x3_libelle=categorie_championnat3_x3_libelle,
127
+ debut=debut,
128
+ fin=fin,
129
+ mail_organisateur=mail_organisateur,
130
+ nb_participant_prevu=nb_participant_prevu,
131
+ tarif_organisateur=tarif_organisateur,
132
+ telephone_organisateur=telephone_organisateur,
133
+ url_organisateur=url_organisateur,
134
+ adresse_complement=adresse_complement,
135
+ tournoi_types3_x3=tournoi_types3_x3,
136
+ cartographie=cartographie,
137
+ commune=commune,
138
+ document_flyer=document_flyer,
139
+ tournoi_type=tournoi_type,
140
+ geo=geo,
141
+ debut_timestamp=debut_timestamp,
142
+ fin_timestamp=fin_timestamp,
143
+ thumbnail=thumbnail,
144
+ )
145
+
146
+ def to_dict(self) -> dict:
147
+ result: dict = {}
148
+ if self.nom is not None:
149
+ result["nom"] = self.nom
150
+ if self.sexe is not None:
151
+ result["sexe"] = self.sexe.value
152
+ if self.adresse is not None:
153
+ result["adresse"] = self.adresse
154
+ if self.nom_organisateur is not None:
155
+ result["nomOrganisateur"] = self.nom_organisateur
156
+ if self.description is not None:
157
+ result["description"] = self.description
158
+ if self.site_choisi is not None:
159
+ result["siteChoisi"] = self.site_choisi
160
+ if self.id is not None:
161
+ result["id"] = str(self.id)
162
+ if self.code is not None:
163
+ result["code"] = self.code
164
+ if self.date_created is not None:
165
+ result["date_created"] = self.date_created.isoformat()
166
+ if self.date_updated is not None:
167
+ result["date_updated"] = self.date_updated.isoformat()
168
+ if self.age_max is not None:
169
+ result["ageMax"] = self.age_max
170
+ if self.age_min is not None:
171
+ result["ageMin"] = self.age_min
172
+ if self.categorie_championnat3_x3_id is not None:
173
+ result["categorieChampionnat3x3Id"] = str(self.categorie_championnat3_x3_id)
174
+ if self.categorie_championnat3_x3_libelle is not None:
175
+ result["categorieChampionnat3x3Libelle"] = (
176
+ self.categorie_championnat3_x3_libelle.value
177
+ )
178
+ if self.debut is not None:
179
+ result["debut"] = self.debut.isoformat()
180
+ if self.fin is not None:
181
+ result["fin"] = self.fin.isoformat()
182
+ if self.mail_organisateur is not None:
183
+ result["mailOrganisateur"] = self.mail_organisateur
184
+ if self.nb_participant_prevu is not None:
185
+ result["nbParticipantPrevu"] = str(self.nb_participant_prevu)
186
+ if self.tarif_organisateur is not None:
187
+ result["tarifOrganisateur"] = str(self.tarif_organisateur)
188
+ if self.telephone_organisateur is not None:
189
+ result["telephoneOrganisateur"] = self.telephone_organisateur
190
+ if self.url_organisateur is not None:
191
+ result["urlOrganisateur"] = self.url_organisateur
192
+ if self.adresse_complement is not None:
193
+ result["adresseComplement"] = self.adresse_complement
194
+ if self.tournoi_types3_x3 is not None:
195
+ result["tournoiTypes3x3"] = [t.to_dict() for t in self.tournoi_types3_x3]
196
+ if self.cartographie is not None:
197
+ result["cartographie"] = self.cartographie.to_dict()
198
+ if self.commune is not None:
199
+ result["commune"] = self.commune.to_dict()
200
+ if self.document_flyer is not None:
201
+ result["document_flyer"] = self.document_flyer.to_dict()
202
+ if self.tournoi_type is not None:
203
+ result["tournoiType"] = self.tournoi_type.value
204
+ if self.geo is not None:
205
+ result["_geo"] = self.geo.to_dict()
206
+ if self.debut_timestamp is not None:
207
+ result["debut_timestamp"] = self.debut_timestamp
208
+ if self.fin_timestamp is not None:
209
+ result["fin_timestamp"] = self.fin_timestamp
210
+ if self.thumbnail is not None:
211
+ result["thumbnail"] = self.thumbnail
212
+ return result
213
+
214
+ def is_valid_for_query(self, query: str) -> bool:
215
+ return bool(
216
+ not query
217
+ or (self.lower_nom and query in self.lower_nom)
218
+ or (self.lower_addresse and query in self.lower_addresse)
219
+ or (self.lower_description and query in self.lower_description)
220
+ or (self.lower_code and query in self.lower_code)
221
+ or (self.lower_nom_organisateur and query in self.lower_nom_organisateur)
222
+ or (self.lower_site_choisi and query in self.lower_site_choisi)
223
+ )
@@ -0,0 +1,42 @@
1
+ from __future__ import annotations
2
+
3
+ from ..config import MEILISEARCH_INDEX_TERRAINS
4
+ from .multi_search_query import MultiSearchQuery
5
+ from .multi_search_result_terrains import TerrainsMultiSearchResult
6
+ from .multi_search_results import MultiSearchResult
7
+ from .terrains_facet_distribution import TerrainsFacetDistribution
8
+ from .terrains_facet_stats import TerrainsFacetStats
9
+
10
+
11
+ class TerrainsMultiSearchQuery(MultiSearchQuery):
12
+ def __init__(
13
+ self,
14
+ q: str | None,
15
+ facets: list[str] | None = None,
16
+ limit: int | None = 10,
17
+ offset: int | None = 0,
18
+ filter: list[str] | None = None,
19
+ sort: list[str] | None = None,
20
+ ):
21
+ super().__init__(
22
+ index_uid=MEILISEARCH_INDEX_TERRAINS,
23
+ q=q,
24
+ facets=facets,
25
+ limit=limit,
26
+ offset=offset,
27
+ filter=filter,
28
+ sort=sort,
29
+ )
30
+
31
+ def is_valid_result(self, result: MultiSearchResult):
32
+ return result and (
33
+ isinstance(result, TerrainsMultiSearchResult)
34
+ and (
35
+ result.facet_distribution is None
36
+ or isinstance(result.facet_distribution, TerrainsFacetDistribution)
37
+ )
38
+ and (
39
+ result.facet_stats is None
40
+ or isinstance(result.facet_stats, TerrainsFacetStats)
41
+ )
42
+ )
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Name(Enum):
5
+ TOURNOIS = "Tournois"
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+
4
+ class SexeEnum(Enum):
5
+ FEMININE = "Féminin"
6
+ MASCULINE = "Masculin"
7
+ MIXTE = "Mixte"
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Storage(Enum):
5
+ MINIO = "minio"
@@ -0,0 +1,35 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any
5
+
6
+ from ..utils.converter_utils import from_int
7
+
8
+
9
+ @dataclass
10
+ class TournoiTypeClass:
11
+ open_plus: int | None = None
12
+ open_plus_access: int | None = None
13
+ open_start: int | None = None
14
+
15
+ @staticmethod
16
+ def from_dict(obj: Any) -> TournoiTypeClass:
17
+ assert isinstance(obj, dict)
18
+ open_plus = from_int(obj, "Open Plus")
19
+ open_plus_access = from_int(obj, "Open Plus Access")
20
+ open_start = from_int(obj, "Open Start")
21
+ return TournoiTypeClass(
22
+ open_plus=open_plus,
23
+ open_plus_access=open_plus_access,
24
+ open_start=open_start,
25
+ )
26
+
27
+ def to_dict(self) -> dict:
28
+ result: dict = {}
29
+ if self.open_plus is not None:
30
+ result["Open Plus"] = self.open_plus
31
+ if self.open_plus_access is not None:
32
+ result["Open Plus Access"] = self.open_plus_access
33
+ if self.open_start is not None:
34
+ result["Open Start"] = self.open_start
35
+ return result
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TournoiTypeEnum(Enum):
5
+ OPEN_PLUS = "Open Plus"
6
+ OPEN_PLUS_ACCESS = "Open Plus Access"
7
+ OPEN_START = "Open Start"
@@ -0,0 +1,43 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any
5
+ from uuid import UUID
6
+
7
+ from ..utils.converter_utils import from_enum, from_int, from_uuid
8
+ from .tournoi_types_3x3_libelle_enum import Libelle
9
+ from .type_league import TypeLeague
10
+
11
+
12
+ @dataclass
13
+ class TournoiTypes3X3:
14
+ libelle: Libelle | None = None
15
+ logo: UUID | None = None
16
+ type_league: TypeLeague | None = None
17
+ type_tournois: int | None = None
18
+
19
+ @staticmethod
20
+ def from_dict(obj: Any) -> TournoiTypes3X3:
21
+ assert isinstance(obj, dict)
22
+ libelle = from_enum(Libelle, obj, "libelle")
23
+ logo = from_uuid(obj, "logo")
24
+ type_league = from_enum(TypeLeague, obj, "type_league")
25
+ type_tournois = from_int(obj, "type_tournois")
26
+ return TournoiTypes3X3(
27
+ libelle=libelle,
28
+ logo=logo,
29
+ type_league=type_league,
30
+ type_tournois=type_tournois,
31
+ )
32
+
33
+ def to_dict(self) -> dict:
34
+ result: dict = {}
35
+ if self.libelle is not None:
36
+ result["libelle"] = self.libelle.value
37
+ if self.logo is not None:
38
+ result["logo"] = str(self.logo)
39
+ if self.type_league is not None:
40
+ result["type_league"] = self.type_league.value
41
+ if self.type_tournois is not None:
42
+ result["type_tournois"] = str(self.type_tournois)
43
+ return result
@@ -0,0 +1,60 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any
5
+
6
+ from ..utils.converter_utils import from_int
7
+
8
+
9
+ @dataclass
10
+ class TournoiTypes3X3Libelle:
11
+ open_plus_junior_league_3_x3: int | None = None
12
+ open_plus_super_league_3_x3: int | None = None
13
+ open_plus_access_junior_league_3_x3: int | None = None
14
+ open_plus_access_super_league_3_x3: int | None = None
15
+ open_start_junior_league_3_x3: int | None = None
16
+ open_start_super_league_3_x3: int | None = None
17
+
18
+ @staticmethod
19
+ def from_dict(obj: Any) -> TournoiTypes3X3Libelle:
20
+ assert isinstance(obj, dict)
21
+ open_plus_junior_league_3_x3 = from_int(obj, "Open Plus - Junior league 3x3")
22
+ open_plus_super_league_3_x3 = from_int(obj, "Open Plus - Super league 3x3")
23
+ open_plus_access_junior_league_3_x3 = from_int(
24
+ obj, "Open Plus Access - Junior league 3x3"
25
+ )
26
+ open_plus_access_super_league_3_x3 = from_int(
27
+ obj, "Open Plus Access - Super league 3x3"
28
+ )
29
+ open_start_junior_league_3_x3 = from_int(obj, "Open Start - Junior league 3x3")
30
+ open_start_super_league_3_x3 = from_int(obj, "Open Start - Super league 3x3")
31
+ return TournoiTypes3X3Libelle(
32
+ open_plus_junior_league_3_x3=open_plus_junior_league_3_x3,
33
+ open_plus_super_league_3_x3=open_plus_super_league_3_x3,
34
+ open_plus_access_junior_league_3_x3=open_plus_access_junior_league_3_x3,
35
+ open_plus_access_super_league_3_x3=open_plus_access_super_league_3_x3,
36
+ open_start_junior_league_3_x3=open_start_junior_league_3_x3,
37
+ open_start_super_league_3_x3=open_start_super_league_3_x3,
38
+ )
39
+
40
+ def to_dict(self) -> dict:
41
+ result: dict = {}
42
+ if self.open_plus_junior_league_3_x3 is not None:
43
+ result["Open Plus - Junior league 3x3"] = self.open_plus_junior_league_3_x3
44
+ if self.open_plus_super_league_3_x3 is not None:
45
+ result["Open Plus - Super league 3x3"] = self.open_plus_super_league_3_x3
46
+ if self.open_plus_access_junior_league_3_x3 is not None:
47
+ result["Open Plus Access - Junior league 3x3"] = (
48
+ self.open_plus_access_junior_league_3_x3
49
+ )
50
+ if self.open_plus_access_super_league_3_x3 is not None:
51
+ result["Open Plus Access - Super league 3x3"] = (
52
+ self.open_plus_access_super_league_3_x3
53
+ )
54
+ if self.open_start_junior_league_3_x3 is not None:
55
+ result["Open Start - Junior league 3x3"] = (
56
+ self.open_start_junior_league_3_x3
57
+ )
58
+ if self.open_start_super_league_3_x3 is not None:
59
+ result["Open Start - Super league 3x3"] = self.open_start_super_league_3_x3
60
+ return result
@@ -0,0 +1,10 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Libelle(Enum):
5
+ OPEN_PLUS_ACCESS_JUNIOR_LEAGUE_3_X3 = "Open Plus Access - Junior league 3x3"
6
+ OPEN_PLUS_ACCESS_SUPER_LEAGUE_3_X3 = "Open Plus Access - Super league 3x3"
7
+ OPEN_PLUS_JUNIOR_LEAGUE_3_X3 = "Open Plus - Junior league 3x3"
8
+ OPEN_PLUS_SUPER_LEAGUE_3_X3 = "Open Plus - Super league 3x3"
9
+ OPEN_START_JUNIOR_LEAGUE_3_X3 = "Open Start - Junior league 3x3"
10
+ OPEN_START_SUPER_LEAGUE_3_X3 = "Open Start - Super league 3x3"
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import Any
5
+
6
+ from ..utils.converter_utils import from_obj
7
+ from .facet_distribution import FacetDistribution
8
+ from .sexe_class import SexeClass
9
+ from .tournoi_type_class import TournoiTypeClass
10
+ from .tournoi_types_3x3_libelle import TournoiTypes3X3Libelle
11
+
12
+
13
+ @dataclass
14
+ class TournoisFacetDistribution(FacetDistribution):
15
+ sexe: SexeClass | None = None
16
+ tournoi_type: TournoiTypeClass | None = None
17
+ tournoi_types3_x3_libelle: TournoiTypes3X3Libelle | None = None
18
+
19
+ @staticmethod
20
+ def from_dict(obj: Any) -> TournoisFacetDistribution:
21
+ assert isinstance(obj, dict)
22
+ sexe = from_obj(SexeClass.from_dict, obj, "sexe")
23
+ tournoi_type = from_obj(TournoiTypeClass.from_dict, obj, "tournoiType")
24
+ tournoi_types3_x3_libelle = from_obj(
25
+ TournoiTypes3X3Libelle.from_dict, obj, "tournoiTypes3x3.libelle"
26
+ )
27
+ return TournoisFacetDistribution(
28
+ sexe=sexe,
29
+ tournoi_type=tournoi_type,
30
+ tournoi_types3_x3_libelle=tournoi_types3_x3_libelle,
31
+ )
32
+
33
+ def to_dict(self) -> dict:
34
+ result: dict = {}
35
+ if self.sexe is not None:
36
+ result["sexe"] = self.sexe.to_dict()
37
+ if self.tournoi_type is not None:
38
+ result["tournoiType"] = self.tournoi_type.to_dict()
39
+ if self.tournoi_types3_x3_libelle is not None:
40
+ result["tournoiTypes3x3.libelle"] = self.tournoi_types3_x3_libelle.to_dict()
41
+ return result
@@ -0,0 +1,14 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from .facet_stats import FacetStats
6
+
7
+
8
+ class TournoisFacetStats(FacetStats):
9
+ @staticmethod
10
+ def from_dict(obj: Any) -> TournoisFacetStats:
11
+ return TournoisFacetStats()
12
+
13
+ def to_dict(self) -> dict:
14
+ return super().to_dict()
@@ -0,0 +1,132 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from datetime import datetime
5
+ from typing import Any
6
+
7
+ from ..utils.converter_utils import (
8
+ from_bool,
9
+ from_datetime,
10
+ from_enum,
11
+ from_int,
12
+ from_obj,
13
+ from_str,
14
+ )
15
+ from .cartographie import Cartographie
16
+ from .commune import Commune
17
+ from .geo import Geo
18
+ from .hit import Hit
19
+ from .nature_sol import NatureSol
20
+ from .tournois_hit_type import HitType
21
+
22
+
23
+ @dataclass
24
+ class TournoisHit(Hit):
25
+ nom: str | None = None
26
+ rue: str | None = None
27
+ id: int | None = None
28
+ acces_libre: bool | None = None
29
+ date_created: datetime | None = None
30
+ date_updated: datetime | None = None
31
+ largeur: int | None = None
32
+ longueur: int | None = None
33
+ numero: int | None = None
34
+ cartographie: Cartographie | None = None
35
+ commune: Commune | None = None
36
+ nature_sol: NatureSol | None = None
37
+ geo: Geo | None = None
38
+ thumbnail: str | None = None
39
+ type: HitType | None = None
40
+ lower_nom: str | None = field(init=False, default=None, repr=False)
41
+ lower_rue: str | None = field(init=False, default=None, repr=False)
42
+
43
+ def __post_init__(self) -> None:
44
+ self.lower_nom = self.nom.lower() if self.nom else None
45
+ self.lower_rue = self.rue.lower() if self.rue else None
46
+
47
+ @staticmethod
48
+ def from_dict(obj: Any) -> TournoisHit:
49
+ assert isinstance(obj, dict)
50
+ nom = from_str(obj, "nom")
51
+ rue = from_str(obj, "rue")
52
+ id = from_int(obj, "id")
53
+ acces_libre = from_bool(obj, "accesLibre")
54
+ date_created = from_datetime(obj, "date_created")
55
+ date_updated = from_datetime(obj, "date_updated")
56
+ largeur = from_int(obj, "largeur")
57
+ longueur = from_int(obj, "longueur")
58
+ numero = from_int(obj, "numero")
59
+ cartographie = from_obj(Cartographie.from_dict, obj, "cartographie")
60
+ commune = from_obj(Commune.from_dict, obj, "commune")
61
+ nature_sol = from_obj(NatureSol.from_dict, obj, "natureSol")
62
+ geo = from_obj(Geo.from_dict, obj, "_geo")
63
+ thumbnail = from_str(obj, "thumbnail")
64
+ type = from_enum(HitType, obj, "type")
65
+ return TournoisHit(
66
+ nom=nom,
67
+ rue=rue,
68
+ id=id,
69
+ acces_libre=acces_libre,
70
+ date_created=date_created,
71
+ date_updated=date_updated,
72
+ largeur=largeur,
73
+ longueur=longueur,
74
+ numero=numero,
75
+ cartographie=cartographie,
76
+ commune=commune,
77
+ nature_sol=nature_sol,
78
+ geo=geo,
79
+ thumbnail=thumbnail,
80
+ type=type,
81
+ )
82
+
83
+ def to_dict(self) -> dict:
84
+ result: dict = {}
85
+ if self.nom is not None:
86
+ result["nom"] = self.nom
87
+ if self.rue is not None:
88
+ result["rue"] = self.rue
89
+ if self.id is not None:
90
+ result["id"] = str(self.id)
91
+ if self.acces_libre is not None:
92
+ result["accesLibre"] = self.acces_libre
93
+ if self.date_created is not None:
94
+ result["date_created"] = self.date_created.isoformat()
95
+ if self.date_updated is not None:
96
+ result["date_updated"] = self.date_updated.isoformat()
97
+ if self.largeur is not None:
98
+ result["largeur"] = self.largeur
99
+ if self.longueur is not None:
100
+ result["longueur"] = self.longueur
101
+ if self.numero is not None:
102
+ result["numero"] = self.numero
103
+ if self.cartographie is not None:
104
+ result["cartographie"] = self.cartographie.to_dict()
105
+ if self.commune is not None:
106
+ result["commune"] = self.commune.to_dict()
107
+ if self.nature_sol is not None:
108
+ result["natureSol"] = self.nature_sol.to_dict()
109
+ if self.geo is not None:
110
+ result["_geo"] = self.geo.to_dict()
111
+ if self.thumbnail is not None:
112
+ result["thumbnail"] = self.thumbnail
113
+ if self.type is not None:
114
+ result["type"] = self.type.value
115
+ return result
116
+
117
+ def is_valid_for_query(self, query: str) -> bool:
118
+ return bool(
119
+ not query
120
+ or (self.lower_nom and query in self.lower_nom)
121
+ or (self.lower_rue and query in self.lower_rue)
122
+ or (
123
+ self.commune
124
+ and (
125
+ (self.commune.lower_libelle and query in self.commune.lower_libelle)
126
+ or (
127
+ self.commune.lower_departement
128
+ and query in self.commune.lower_departement
129
+ )
130
+ )
131
+ )
132
+ )
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+
4
+ class HitType(Enum):
5
+ TERRAIN = "Terrain"
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Libelle(Enum):
5
+ BITUME = "BITUME"
6
+ BÉTON = "Béton"
7
+ SOL_SYNTHÉTIQUE = "Sol synthétique"