-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructures_recherches.go
114 lines (98 loc) · 4.2 KB
/
structures_recherches.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package choruspro
import (
"context"
"net/http"
)
// StructureRecherche est la structure de données représentant
// une structure de la liste des structures.
type StructureRecherche struct {
Designation string `json:"designationStructure"`
IdStructureCPP int64 `json:"idStructureCPP"`
Identifiant string `json:"identifiantStructure"`
Statut string `json:"statut"`
TypeIdentifiant string `json:"typeIdentifiantStructure"`
}
// RechercherStructuresResponse est la structure de données représentant
// la réponse de la méthode RechercherStructures.
type RechercherStructuresResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Structures []StructureRecherche `json:"listeStructures"`
Pagination *PaginationResponse `json:"parametresRetour"`
}
// CriteresRechercheStructures est la structure de données représentant
// les critères de recherche d'une structure.
type CriteresRechercheStructures struct {
AdresseCodePays string `json:"adresseCodePays"`
AdresseCodePostal string `json:"adresseCodePostal"`
AdresseVille string `json:"adresseVille"`
EstMOA bool `json:"estMOA"`
EstMOAUniquement bool `json:"estMOAUniquement"`
Identifiant string `json:"identifiantStructure"`
Libelle string `json:"libelleStructure"`
Nom string `json:"nomStructure"`
Prenom string `json:"prenomStructure"`
RaisonSociale string `json:"raisonSocialeStructure"`
Statut string `json:"statutStructure"`
TypeIdentifiant string `json:"typeIdentifiantStructure"`
Type string `json:"typeStructure"`
}
// RechercherStructuresOptions est la structure de données utilisée
// pour appeler la méthode RechercherStructures.
type RechercherStructuresOptions struct {
Pagination *PaginationOptions `json:"parametres"`
RestreindreStructuresPrivees bool `json:"restreindreStructuresPrivees"`
Criteres *CriteresRechercheStructures `json:"structure"`
}
// La méthode RechercherStructures permet à un gestionnaire de rechercher des structures.
func (s *StructuresService) RechercherStructures(ctx context.Context, opts RechercherStructuresOptions) (*RechercherStructuresResponse, error) {
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/structures/v1/rechercher", opts)
if err != nil {
return nil, err
}
res := new(RechercherStructuresResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}
// ServiceRecherche est la structure de données représentant
// un service de la liste des services.
type ServiceRecherche struct {
Code string `json:"codeService"`
EstActif bool `json:"estActif"`
Id int64 `json:"idService"`
Libelle string `json:"libelleService"`
Statut string `json:"statutService"`
}
// RechercherServicesResponse est la structure de données représentant
// la réponse de la méthode RechercherServices.
type RechercherServicesResponse struct {
CodeRetour int32 `json:"codeRetour"`
Libelle string `json:"libelle"`
Services []ServiceRecherche `json:"listeServices"`
Pagination *PaginationResponse `json:"parametresRetour"`
}
// RechercherServicesOptions est la structure de données utilisée
// pour appeler la méthode RechercherServices.
type RechercherServicesOptions struct {
IdUtilisateurCourant int64 `json:"idUtilisateurCourant"`
IdStructure int64 `json:"idStructure"`
Pagination *PaginationOptions `json:"parametresRechercherServicesStructure"`
}
// La méthode RechercherServices permet de rechercher les services
// appartenant à une structure publique ou à une structure à laquelle
// l'utilisateur est rattaché.
func (s *StructuresService) RechercherServices(ctx context.Context, opts RechercherServicesOptions) (*RechercherServicesResponse, error) {
req, err := s.client.newRequest(ctx, http.MethodPost, "cpro/structures/v1/rechercher/services", opts)
if err != nil {
return nil, err
}
res := new(RechercherServicesResponse)
err = s.client.doRequest(ctx, req, res)
if err != nil {
return nil, err
}
return res, nil
}