@metarisc/metarisc-js 0.0.1-alpha.20 → 0.0.1-alpha.21

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.
@@ -0,0 +1,103 @@
1
+ import { Core, MetariscConfig } from "../core";
2
+ import Utils from "../utils";
3
+ import type { AxiosResponse } from "axios";
4
+ import { Client } from "../client";
5
+ import { Collection } from "../collection";
6
+ import { PEI } from '../model/PEI';
7
+ import { Contact } from '../model/Contact';
8
+ import { DescriptifTechnique } from '../model/DescriptifTechnique';
9
+ import { PieceJointe } from '../model/PieceJointe';
10
+
11
+ export class PEIAPI extends Core {
12
+ constructor(config: MetariscConfig, client?: Client) {
13
+ super(config, client);
14
+ }
15
+
16
+ /**
17
+ * Récupération de l'ensemble des données d'un PEI.
18
+ * @param peiId Identifiant unique du PEI
19
+ */
20
+ async getPei(peiId: string): Promise<AxiosResponse<PEI>>
21
+ {
22
+ const pathVariable = { 'pei_id': peiId };
23
+ return this.request({
24
+ method: 'GET',
25
+ endpoint: Utils.constructPath(pathVariable, '/pei/{pei_id}'),
26
+ headers: { },
27
+ params: { },
28
+ body: {}
29
+ });
30
+ }
31
+
32
+ /**
33
+ * Récupération de la liste des Points d'Eau Incendie (PEI) selon des critères de recherche.
34
+ * @param page Numéro de page
35
+ * @param perPage Nombre de résultats demandé
36
+ */
37
+ paginatePei(page?: number, perPage?: number): Collection<PEI>
38
+ {
39
+ const pathVariable = { };
40
+ return this.collect<PEI>({
41
+ method: 'GET',
42
+ endpoint: Utils.constructPath(pathVariable, '/pei'),
43
+ headers: { },
44
+ params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
45
+ body: {}
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Récupération de la liste des contacts d'un Point d'Eau Incendie.
51
+ * @param peiId Identifiant unique du PEI
52
+ * @param page Numéro de page
53
+ * @param perPage Nombre de résultats demandé
54
+ */
55
+ paginatePeiContacts(peiId: string, page?: number, perPage?: number): Collection<Contact>
56
+ {
57
+ const pathVariable = { 'pei_id': peiId };
58
+ return this.collect<Contact>({
59
+ method: 'GET',
60
+ endpoint: Utils.constructPath(pathVariable, '/pei/{pei_id}/contacts'),
61
+ headers: { },
62
+ params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
63
+ body: {}
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Récupération de l'historique d'un POI.
69
+ * @param peiId Identifiant unique du PEI
70
+ * @param page Numéro de page
71
+ * @param perPage Nombre de résultats demandé
72
+ */
73
+ paginatePeiHistorique(peiId: string, page?: number, perPage?: number): Collection<DescriptifTechnique>
74
+ {
75
+ const pathVariable = { 'pei_id': peiId };
76
+ return this.collect<DescriptifTechnique>({
77
+ method: 'GET',
78
+ endpoint: Utils.constructPath(pathVariable, '/pei/{pei_id}/historique'),
79
+ headers: { },
80
+ params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
81
+ body: {}
82
+ });
83
+ }
84
+
85
+ /**
86
+ * Récupération de la liste des pièces jointes d'un Point d'Eau Incendie.
87
+ * @param peiId Identifiant unique du PEI
88
+ * @param page Numéro de page
89
+ * @param perPage Nombre de résultats demandé
90
+ */
91
+ paginatePeiPiecesJointes(peiId: string, page?: number, perPage?: number): Collection<PieceJointe>
92
+ {
93
+ const pathVariable = { 'pei_id': peiId };
94
+ return this.collect<PieceJointe>({
95
+ method: 'GET',
96
+ endpoint: Utils.constructPath(pathVariable, '/pei/{pei_id}/pieces_jointes'),
97
+ headers: { },
98
+ params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
99
+ body: {}
100
+ });
101
+ }
102
+
103
+ }
@@ -4,7 +4,6 @@ import type { AxiosResponse } from "axios";
4
4
  import { Client } from "../client";
5
5
  import { Collection } from "../collection";
6
6
  import { Utilisateur } from '../model/Utilisateur';
7
-
8
7
  import { Email } from '../model/Email';
9
8
 
10
9
  export class UtilisateursAPI extends Core {
@@ -16,21 +15,6 @@ export class UtilisateursAPI extends Core {
16
15
  * L'utilisateur connecté retourné par ce point de terminaison utilise le token d'accès généré par le service OpenID Connect afin de le lier à une identité connue de Metarisc. Si l'utilisateur est inconnu une erreur est retournée.
17
16
  */
18
17
  async getUtilisateursMoi(): Promise<AxiosResponse<Utilisateur>>
19
- {
20
- const pathVariable = { };
21
- return this.request({
22
- method: 'GET',
23
- endpoint: Utils.constructPath(pathVariable, '/@moi'),
24
- headers: { },
25
- params: { },
26
- body: {}
27
- });
28
- }
29
-
30
- /**
31
- * L'utilisateur connecté retourné par ce point de terminaison utilise le token d'accès généré par le service OpenID Connect afin de le lier à une identité connue de Metarisc. Si l'utilisateur est inconnu une erreur est retournée.
32
- */
33
- async getUtilisateursMoi1(): Promise<AxiosResponse<Utilisateur>>
34
18
  {
35
19
  const pathVariable = { };
36
20
  return this.request({
@@ -48,30 +32,13 @@ export class UtilisateursAPI extends Core {
48
32
  * @param perPage Nombre de résultats demandé
49
33
  */
50
34
  paginateMoiEmails(page?: number, perPage?: number): Collection<Email>
51
- {
52
- const pathVariable = { };
53
- return this.collect<Email>({
54
- method: 'GET',
55
- endpoint: Utils.constructPath(pathVariable, '/@moi/emails'),
56
- headers: { },
57
- params: { 'page': page.toString(), 'per_page': perPage.toString() },
58
- body: {}
59
- });
60
- }
61
-
62
- /**
63
- * Liste toutes les adresses mail de l'utilisateur connecté, y compris les adresses non publiquement accessibles.
64
- * @param page Numéro de page
65
- * @param perPage Nombre de résultats demandé
66
- */
67
- paginateMoiEmails1(page?: number, perPage?: number): Collection<Email>
68
35
  {
69
36
  const pathVariable = { };
70
37
  return this.collect<Email>({
71
38
  method: 'GET',
72
39
  endpoint: Utils.constructPath(pathVariable, '/utilisateurs/@moi/emails'),
73
40
  headers: { },
74
- params: { 'page': page.toString(), 'per_page': perPage.toString() },
41
+ params: { 'page': page?.toString(), 'per_page': perPage?.toString() },
75
42
  body: {}
76
43
  });
77
44
  }
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ export { Metarisc } from "./metarisc";
2
2
  export { OAuth2 } from "./auth/oauth2";
3
3
  export { Core } from "./core";
4
4
  export { Collection } from "./collection";
5
- export { PaginationResults, PaginationData } from "./collection"
5
+ export { PaginationResults } from "./collection"
6
6
  export { AuthMethod } from "./client";
7
7
  export { Client } from "./client";
8
8
  export { Tus } from "./tus";
@@ -13,12 +13,10 @@ export { EvenementsAPI } from './api/EvenementsAPI';
13
13
 
14
14
  export { NotificationsAPI } from './api/NotificationsAPI';
15
15
 
16
- export { OrganisationAPI } from './api/OrganisationAPI';
16
+ export { OrganisationsAPI } from './api/OrganisationsAPI';
17
17
 
18
- export { POIAPI } from './api/POIAPI';
18
+ export { PEIAPI } from './api/PEIAPI';
19
19
 
20
20
  export { PingAPI } from './api/PingAPI';
21
21
 
22
- export { SupportAPI } from './api/SupportAPI';
23
-
24
22
  export { UtilisateursAPI } from './api/UtilisateursAPI';
package/src/metarisc.ts CHANGED
@@ -8,34 +8,30 @@ import { EvenementsAPI } from './api/EvenementsAPI';
8
8
 
9
9
  import { NotificationsAPI } from './api/NotificationsAPI';
10
10
 
11
- import { OrganisationAPI } from './api/OrganisationAPI';
11
+ import { OrganisationsAPI } from './api/OrganisationsAPI';
12
12
 
13
- import { POIAPI } from './api/POIAPI';
13
+ import { PEIAPI } from './api/PEIAPI';
14
14
 
15
15
  import { PingAPI } from './api/PingAPI';
16
16
 
17
- import { SupportAPI } from './api/SupportAPI';
18
-
19
17
  import { UtilisateursAPI } from './api/UtilisateursAPI';
20
18
 
21
19
  export class Metarisc extends Core
22
20
  {
23
21
 
24
- public dossiers?: DossiersAPI;
25
-
26
- public evenements?: EvenementsAPI;
22
+ public utilisateurs?: UtilisateursAPI;
27
23
 
28
- public notifications?: NotificationsAPI;
24
+ public dossiers?: DossiersAPI;
29
25
 
30
- public organisations?: OrganisationAPI;
26
+ public organisations?: OrganisationsAPI;
31
27
 
32
- public poi?: POIAPI;
28
+ public pei?: PEIAPI;
33
29
 
34
30
  public ping?: PingAPI;
35
31
 
36
- public support?: SupportAPI;
32
+ public evenements?: EvenementsAPI;
37
33
 
38
- public utilisateurs?: UtilisateursAPI;
34
+ public notifications?: NotificationsAPI;
39
35
 
40
36
  public tus?: Tus;
41
37
 
@@ -48,29 +44,26 @@ export class Metarisc extends Core
48
44
  get: function(metarisc, name, receiver) {
49
45
  switch(name) {
50
46
 
47
+ case 'utilisateurs':
48
+ return new UtilisateursAPI(config, tmpClient);
49
+
51
50
  case 'dossiers':
52
51
  return new DossiersAPI(config, tmpClient);
53
52
 
54
- case 'evenements':
55
- return new EvenementsAPI(config, tmpClient);
56
-
57
- case 'notifications':
58
- return new NotificationsAPI(config, tmpClient);
59
-
60
53
  case 'organisations':
61
- return new OrganisationAPI(config, tmpClient);
54
+ return new OrganisationsAPI(config, tmpClient);
62
55
 
63
- case 'poi':
64
- return new POIAPI(config, tmpClient);
56
+ case 'pei':
57
+ return new PEIAPI(config, tmpClient);
65
58
 
66
59
  case 'ping':
67
60
  return new PingAPI(config, tmpClient);
68
61
 
69
- case 'support':
70
- return new SupportAPI(config, tmpClient);
62
+ case 'evenements':
63
+ return new EvenementsAPI(config, tmpClient);
71
64
 
72
- case 'utilisateurs':
73
- return new UtilisateursAPI(config, tmpClient);
65
+ case 'notifications':
66
+ return new NotificationsAPI(config, tmpClient);
74
67
 
75
68
  case 'tus':
76
69
  return new Tus(config, tmpClient);
@@ -0,0 +1,6 @@
1
+ export type GetEvenementDetails404Response = {
2
+ 'status_code'?: number;
3
+ 'type'?: string;
4
+ 'title'?: string;
5
+ 'detail'?: string;
6
+ };
@@ -0,0 +1,14 @@
1
+ import { AdressePostale } from '../../src/model/AdressePostale';
2
+ import { DescriptifTechnique } from '../../src/model/DescriptifTechnique';
3
+ import { PEIReferencesExterieuresInner } from '../../src/model/PEIReferencesExterieuresInner';
4
+
5
+ export type PEI = {
6
+ 'id'?: string;
7
+ 'date_de_realisation'?: Date;
8
+ 'date_de_derniere_mise_a_jour'?: Date;
9
+ 'statut'?: string;
10
+ 'references_exterieures'?: Array<PEIReferencesExterieuresInner>;
11
+ 'descriptif_technique'?: DescriptifTechnique;
12
+ 'geometrie'?: string;
13
+ 'adresse_postale'?: AdressePostale;
14
+ };
@@ -0,0 +1,4 @@
1
+ export type PEIReferencesExterieuresInner = {
2
+ 'titre'?: string;
3
+ 'valeur'?: string;
4
+ };