@communecter/cocolight-api-client 1.0.51 → 1.0.54
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.
- package/dist/123.cocolight-api-client.browser.js +1 -1
- package/dist/123.cocolight-api-client.cjs +1 -1
- package/dist/774.cocolight-api-client.mjs.js +1 -1
- package/dist/cocolight-api-client.browser.js +1 -1
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js +1 -1
- package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
- package/package.json +15 -9
- package/src/Api.js +41 -23
- package/src/ApiClient.js +33 -18
- package/src/api/EndpointApi.js +95 -95
- package/src/error.js +63 -10
- package/src/index.js +65 -2
- package/src/utils/FileStorageStrategy.node.js +28 -2
- package/src/utils/MultiServerFileStorageStrategy.node.js +24 -2
- package/src/utils/MultiServerTokenStorageStrategy.js +84 -27
- package/src/utils/TokenStorage.js +79 -19
- package/src/utils/createDefaultMultiServerTokenStorageStrategy.js +33 -27
- package/src/utils/createDefaultTokenStorageStrategy.js +29 -23
- package/types/Api.d.ts +131 -0
- package/types/ApiClient.d.ts +377 -0
- package/types/EJSONType.d.ts +27 -0
- package/types/api/Badge.d.ts +24 -0
- package/types/api/BaseEntity.d.ts +1017 -0
- package/types/api/EndpointApi.d.ts +933 -0
- package/types/api/EntityRegistry.d.ts +22 -0
- package/types/api/Event.d.ts +38 -0
- package/types/api/News.d.ts +45 -0
- package/types/api/Organization.d.ts +87 -0
- package/types/api/Poi.d.ts +25 -0
- package/types/api/Project.d.ts +81 -0
- package/types/api/User.d.ts +203 -0
- package/types/api/UserApi.d.ts +13 -0
- package/types/endpoints.module.d.ts +14852 -0
- package/types/error.d.ts +80 -0
- package/types/index.d.ts +52 -0
- package/types/mixin/UserMixin.d.ts +1 -0
- package/types/utils/FileOfflineStorageStrategy.node.d.ts +10 -0
- package/types/utils/FileStorageStrategy.node.d.ts +25 -0
- package/types/utils/MultiServerFileStorageStrategy.node.d.ts +22 -0
- package/types/utils/MultiServerTokenStorageStrategy.d.ts +65 -0
- package/types/utils/OfflineClientManager.d.ts +94 -0
- package/types/utils/OfflineQueueStorageStrategy.d.ts +13 -0
- package/types/utils/TokenStorage.d.ts +76 -0
- package/types/utils/createDefaultMultiServerTokenStorageStrategy.d.ts +11 -0
- package/types/utils/createDefaultOfflineStrategy.d.ts +3 -0
- package/types/utils/createDefaultTokenStorageStrategy.d.ts +12 -0
- package/types/utils/reactive.d.ts +60 -0
- package/types/utils/stream-utils.node.d.ts +2 -0
- /package/{src → types}/api/EndpointApi.types.d.ts +0 -0
|
@@ -1,88 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Stratégie abstraite de stockage des tokens d'accès et de rafraîchissement.
|
|
3
|
+
*
|
|
4
|
+
* @interface
|
|
5
|
+
*/
|
|
3
6
|
export class TokenStorageStrategy {
|
|
7
|
+
/**
|
|
8
|
+
* Récupère le token d'accès actuellement stocké.
|
|
9
|
+
*
|
|
10
|
+
* @abstract
|
|
11
|
+
* @returns {string|null} Le token d'accès, ou `null` si non défini.
|
|
12
|
+
*/
|
|
4
13
|
getAccessToken() {
|
|
5
14
|
throw new Error("getAccessToken() doit être implémenté");
|
|
6
15
|
}
|
|
7
|
-
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Définit le token d'accès.
|
|
19
|
+
*
|
|
20
|
+
* @abstract
|
|
21
|
+
* @param {string} token - Le token d'accès à stocker.
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
8
24
|
// eslint-disable-next-line no-unused-vars
|
|
9
25
|
setAccessToken(token) {
|
|
10
26
|
throw new Error("setAccessToken() doit être implémenté");
|
|
11
27
|
}
|
|
12
|
-
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Récupère le token de rafraîchissement actuellement stocké.
|
|
31
|
+
*
|
|
32
|
+
* @abstract
|
|
33
|
+
* @returns {string|null} Le token de rafraîchissement, ou `null` si non défini.
|
|
34
|
+
*/
|
|
13
35
|
getRefreshToken() {
|
|
14
36
|
throw new Error("getRefreshToken() doit être implémenté");
|
|
15
37
|
}
|
|
16
|
-
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Définit le token de rafraîchissement.
|
|
41
|
+
*
|
|
42
|
+
* @abstract
|
|
43
|
+
* @param {string} token - Le token de rafraîchissement à stocker.
|
|
44
|
+
* @returns {void}
|
|
45
|
+
*/
|
|
17
46
|
// eslint-disable-next-line no-unused-vars
|
|
18
47
|
setRefreshToken(token) {
|
|
19
48
|
throw new Error("setRefreshToken() doit être implémenté");
|
|
20
49
|
}
|
|
21
|
-
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Supprime les tokens stockés.
|
|
53
|
+
*
|
|
54
|
+
* @abstract
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
22
57
|
clear() {
|
|
23
58
|
throw new Error("clear() doit être implémenté");
|
|
24
59
|
}
|
|
25
60
|
}
|
|
26
|
-
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Stratégie de stockage des tokens uniquement en mémoire (volatile).
|
|
64
|
+
*
|
|
65
|
+
* @implements {TokenStorageStrategy}
|
|
66
|
+
*/
|
|
27
67
|
export class MemoryStorageStrategy extends TokenStorageStrategy {
|
|
28
68
|
constructor() {
|
|
29
69
|
super();
|
|
70
|
+
/** @type {string|null} */
|
|
30
71
|
this._accessToken = null;
|
|
72
|
+
/** @type {string|null} */
|
|
31
73
|
this._refreshToken = null;
|
|
32
74
|
}
|
|
33
|
-
|
|
75
|
+
|
|
76
|
+
/** @inheritdoc */
|
|
34
77
|
getAccessToken() {
|
|
35
78
|
return this._accessToken;
|
|
36
79
|
}
|
|
37
|
-
|
|
80
|
+
|
|
81
|
+
/** @inheritdoc */
|
|
38
82
|
setAccessToken(token) {
|
|
39
83
|
this._accessToken = token;
|
|
40
84
|
}
|
|
41
|
-
|
|
85
|
+
|
|
86
|
+
/** @inheritdoc */
|
|
42
87
|
getRefreshToken() {
|
|
43
88
|
return this._refreshToken;
|
|
44
89
|
}
|
|
45
|
-
|
|
90
|
+
|
|
91
|
+
/** @inheritdoc */
|
|
46
92
|
setRefreshToken(token) {
|
|
47
93
|
this._refreshToken = token;
|
|
48
94
|
}
|
|
49
|
-
|
|
95
|
+
|
|
96
|
+
/** @inheritdoc */
|
|
50
97
|
clear() {
|
|
51
98
|
this._accessToken = null;
|
|
52
99
|
this._refreshToken = null;
|
|
53
100
|
}
|
|
54
101
|
}
|
|
55
|
-
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Stratégie de stockage des tokens via `localStorage` (persistance navigateur).
|
|
105
|
+
*
|
|
106
|
+
* @implements {TokenStorageStrategy}
|
|
107
|
+
*/
|
|
56
108
|
export class LocalStorageStrategy extends TokenStorageStrategy {
|
|
109
|
+
/**
|
|
110
|
+
* @param {string} [prefix="cocolight"] - Préfixe utilisé pour les clés dans `localStorage`.
|
|
111
|
+
*/
|
|
57
112
|
constructor(prefix = "cocolight") {
|
|
58
113
|
super();
|
|
114
|
+
/** @type {string} */
|
|
59
115
|
this.prefix = prefix;
|
|
60
116
|
}
|
|
61
|
-
|
|
117
|
+
|
|
118
|
+
/** @inheritdoc */
|
|
62
119
|
getAccessToken() {
|
|
63
120
|
return typeof localStorage !== "undefined"
|
|
64
121
|
? localStorage.getItem(`${this.prefix}_accessToken`)
|
|
65
122
|
: null;
|
|
66
123
|
}
|
|
67
|
-
|
|
124
|
+
|
|
125
|
+
/** @inheritdoc */
|
|
68
126
|
setAccessToken(token) {
|
|
69
127
|
if (typeof localStorage !== "undefined") {
|
|
70
128
|
localStorage.setItem(`${this.prefix}_accessToken`, token);
|
|
71
129
|
}
|
|
72
130
|
}
|
|
73
|
-
|
|
131
|
+
|
|
132
|
+
/** @inheritdoc */
|
|
74
133
|
getRefreshToken() {
|
|
75
134
|
return typeof localStorage !== "undefined"
|
|
76
135
|
? localStorage.getItem(`${this.prefix}_refreshToken`)
|
|
77
136
|
: null;
|
|
78
137
|
}
|
|
79
|
-
|
|
138
|
+
|
|
139
|
+
/** @inheritdoc */
|
|
80
140
|
setRefreshToken(token) {
|
|
81
141
|
if (typeof localStorage !== "undefined") {
|
|
82
142
|
localStorage.setItem(`${this.prefix}_refreshToken`, token);
|
|
83
143
|
}
|
|
84
144
|
}
|
|
85
|
-
|
|
145
|
+
|
|
146
|
+
/** @inheritdoc */
|
|
86
147
|
clear() {
|
|
87
148
|
if (typeof localStorage !== "undefined") {
|
|
88
149
|
localStorage.removeItem(`${this.prefix}_accessToken`);
|
|
@@ -90,4 +151,3 @@ export class LocalStorageStrategy extends TokenStorageStrategy {
|
|
|
90
151
|
}
|
|
91
152
|
}
|
|
92
153
|
}
|
|
93
|
-
|
|
@@ -2,44 +2,50 @@ import {
|
|
|
2
2
|
MultiServerMemoryStorageStrategy,
|
|
3
3
|
MultiServerLocalStorageStrategy,
|
|
4
4
|
} from "./MultiServerTokenStorageStrategy.js";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
/** @typedef {import("./MultiServerTokenStorageStrategy.js").MultiServerTokenStorageStrategy} MultiServerTokenStorageStrategy */
|
|
7
|
+
/** @typedef {import("./MultiServerFileStorageStrategy.node.js").MultiServerFileStorageStrategy} MultiServerFileStorageStrategy */
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* - "file" : Node.js uniquement
|
|
13
|
-
* - "auto" : choisit automatiquement selon l’environnement
|
|
14
|
-
* @returns {Promise<MultiServerTokenStorageStrategy>}
|
|
15
|
-
*/
|
|
10
|
+
* Crée une stratégie multi-serveurs adaptée à l’environnement.
|
|
11
|
+
*
|
|
12
|
+
* @param {'memory'|'localStorage'|'file'|'auto'} [strategyType="auto"]
|
|
13
|
+
* @returns {Promise<MultiServerTokenStorageStrategy>}
|
|
14
|
+
*/
|
|
16
15
|
export async function createDefaultMultiServerTokenStorageStrategy(strategyType = "auto") {
|
|
17
16
|
if (strategyType === "memory") {
|
|
18
|
-
|
|
17
|
+
/** @type {MultiServerTokenStorageStrategy} */
|
|
18
|
+
const s = new MultiServerMemoryStorageStrategy();
|
|
19
|
+
return s;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
|
|
21
22
|
if (strategyType === "localStorage") {
|
|
22
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") {
|
|
24
|
+
/** @type {MultiServerTokenStorageStrategy} */
|
|
25
|
+
const s = new MultiServerLocalStorageStrategy();
|
|
26
|
+
return s;
|
|
26
27
|
}
|
|
28
|
+
throw new Error("localStorage n’est pas disponible dans cet environnement.");
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
|
|
29
31
|
if (strategyType === "file") {
|
|
30
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
32
|
+
if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") {
|
|
31
33
|
throw new Error("Le stockage fichier n’est pas disponible côté navigateur.");
|
|
32
34
|
}
|
|
33
35
|
const { MultiServerFileStorageStrategy } = await import("./MultiServerFileStorageStrategy.node.js");
|
|
34
|
-
|
|
36
|
+
/** @type {MultiServerTokenStorageStrategy} */
|
|
37
|
+
const s = new MultiServerFileStorageStrategy();
|
|
38
|
+
return s;
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
if (typeof window !== "undefined" && window.localStorage) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return new MultiServerFileStorageStrategy();
|
|
40
|
+
|
|
41
|
+
// auto
|
|
42
|
+
if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") {
|
|
43
|
+
/** @type {MultiServerTokenStorageStrategy} */
|
|
44
|
+
const s = new MultiServerLocalStorageStrategy();
|
|
45
|
+
return s;
|
|
43
46
|
}
|
|
47
|
+
const { MultiServerFileStorageStrategy } = await import("./MultiServerFileStorageStrategy.node.js");
|
|
48
|
+
/** @type {MultiServerTokenStorageStrategy} */
|
|
49
|
+
const s = new MultiServerFileStorageStrategy();
|
|
50
|
+
return s;
|
|
44
51
|
}
|
|
45
|
-
|
|
@@ -1,43 +1,49 @@
|
|
|
1
1
|
import { LocalStorageStrategy, MemoryStorageStrategy } from "./TokenStorage.js";
|
|
2
2
|
|
|
3
|
+
/** @typedef {import("./TokenStorage.js").TokenStorageStrategy} TokenStorageStrategy */
|
|
4
|
+
/** @typedef {import("./FileStorageStrategy.node.js").FileStorageStrategy} FileStorageStrategy */
|
|
5
|
+
|
|
3
6
|
/**
|
|
4
7
|
* Crée une stratégie de stockage de jetons par défaut en fonction de l'option fournie.
|
|
5
8
|
*
|
|
6
|
-
* @param {
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - "localStorage" : Utilise le localStorage du navigateur (si disponible).
|
|
10
|
-
* - "file" : Utilise une stratégie de stockage basée sur des fichiers (non disponible dans les environnements navigateur).
|
|
11
|
-
* - "auto" : Sélectionne automatiquement la meilleure stratégie de stockage disponible.
|
|
12
|
-
*
|
|
13
|
-
* @returns {Promise<Object>} Une promesse qui se résout avec une instance de la stratégie de stockage sélectionnée.
|
|
14
|
-
*
|
|
15
|
-
* @throws {Error} Lève une erreur si la stratégie sélectionnée n'est pas disponible dans l'environnement actuel.
|
|
9
|
+
* @param {'memory'|'localStorage'|'file'|'auto'} [tokenStorageStrategy='auto'] - Stratégie souhaitée.
|
|
10
|
+
* @returns {Promise<TokenStorageStrategy>} Une promesse résolue avec la stratégie sélectionnée.
|
|
11
|
+
* @throws {Error} Lève une erreur si la stratégie choisie n'est pas disponible.
|
|
16
12
|
*/
|
|
17
13
|
export async function createDefaultTokenStorageStrategy(tokenStorageStrategy = "auto") {
|
|
18
14
|
if (tokenStorageStrategy === "memory") {
|
|
19
|
-
|
|
15
|
+
/** @type {TokenStorageStrategy} */
|
|
16
|
+
const storage = new MemoryStorageStrategy();
|
|
17
|
+
return storage;
|
|
20
18
|
}
|
|
19
|
+
|
|
21
20
|
if (tokenStorageStrategy === "localStorage") {
|
|
22
21
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
/** @type {TokenStorageStrategy} */
|
|
23
|
+
const storage = new LocalStorageStrategy();
|
|
24
|
+
return storage;
|
|
26
25
|
}
|
|
26
|
+
throw new Error("localStorage is not available in this environment.");
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
if (tokenStorageStrategy === "file") {
|
|
29
30
|
if (typeof window !== "undefined" && window.localStorage) {
|
|
30
31
|
throw new Error("file storage is not available in this environment.");
|
|
31
32
|
}
|
|
32
33
|
const { FileStorageStrategy } = await import("./FileStorageStrategy.node.js");
|
|
33
|
-
|
|
34
|
+
/** @type {TokenStorageStrategy} */
|
|
35
|
+
const storage = new FileStorageStrategy();
|
|
36
|
+
return storage;
|
|
34
37
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
38
|
+
|
|
39
|
+
// 'auto'
|
|
40
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
41
|
+
/** @type {TokenStorageStrategy} */
|
|
42
|
+
const storage = new LocalStorageStrategy();
|
|
43
|
+
return storage;
|
|
42
44
|
}
|
|
43
|
-
}
|
|
45
|
+
const { FileStorageStrategy } = await import("./FileStorageStrategy.node.js");
|
|
46
|
+
/** @type {TokenStorageStrategy} */
|
|
47
|
+
const storage = new FileStorageStrategy();
|
|
48
|
+
return storage;
|
|
49
|
+
}
|
package/types/Api.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/** @typedef {import("./ApiClient.js").default} ApiClient */
|
|
2
|
+
/** @typedef {import("./ApiClient.js").ApiClientOptions} ApiClientOptions */
|
|
3
|
+
export default class Api {
|
|
4
|
+
/**
|
|
5
|
+
* Authentifie l'utilisateur et retourne une instance d'Api.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} email - L'adresse email.
|
|
8
|
+
* @param {string} password - Le mot de passe.
|
|
9
|
+
* @param {ApiClientOptions|ApiClient} options - Options pour l'ApiClient ou instance existante.
|
|
10
|
+
* @returns {Promise<Api>}
|
|
11
|
+
* @throws {ApiAuthenticationError|ApiClientError|ApiError}
|
|
12
|
+
*/
|
|
13
|
+
static userLogin(email: string, password: string, options: ApiClientOptions | ApiClient): Promise<Api>;
|
|
14
|
+
/**
|
|
15
|
+
* Crée une instance de UserApi avec les options fournies.
|
|
16
|
+
*
|
|
17
|
+
* @param {ApiClientOptions|ApiClient} options - Options pour ApiClient ou instance d'ApiClient.
|
|
18
|
+
* @returns {UserApi}
|
|
19
|
+
* @throws {Error}
|
|
20
|
+
*/
|
|
21
|
+
static userApi(options: ApiClientOptions | ApiClient): UserApi;
|
|
22
|
+
/**
|
|
23
|
+
* Connecte un utilisateur avec un UserApi existant.
|
|
24
|
+
*
|
|
25
|
+
* @param {UserApi} userApi - Instance UserApi utilisée pour l'authentification.
|
|
26
|
+
* @param {string} email - Email de l'utilisateur.
|
|
27
|
+
* @param {string} password - Mot de passe de l'utilisateur.
|
|
28
|
+
* @returns {Promise<Api>}
|
|
29
|
+
* @throws {ApiAuthenticationError|ApiClientError|ApiError}
|
|
30
|
+
*/
|
|
31
|
+
static userApiLogin(userApi: UserApi, email: string, password: string): Promise<Api>;
|
|
32
|
+
/**
|
|
33
|
+
* Construit une instance d'Api.
|
|
34
|
+
*
|
|
35
|
+
* @param {User|null} loggedUser - L'utilisateur connecté ou null.
|
|
36
|
+
* @param {ApiClient} client - L'instance d'ApiClient.
|
|
37
|
+
*/
|
|
38
|
+
constructor(loggedUser: User | null, client: ApiClient);
|
|
39
|
+
_loggedUser: User;
|
|
40
|
+
_client: import("./ApiClient.js").default;
|
|
41
|
+
/**
|
|
42
|
+
* Retourne l'utilisateur connecté.
|
|
43
|
+
*
|
|
44
|
+
* @returns {Promise<User>} L'utilisateur connecté.
|
|
45
|
+
* @throws {ApiAuthenticationError} Si l'utilisateur n'est pas authentifié.
|
|
46
|
+
*/
|
|
47
|
+
me(): Promise<User>;
|
|
48
|
+
/**
|
|
49
|
+
* Crée une instance User (autre que le connecté).
|
|
50
|
+
*
|
|
51
|
+
* @param {{id?: string, slug?: string, [k: string]: any}} userData
|
|
52
|
+
* @returns {Promise<User>}
|
|
53
|
+
* @throws {Error}
|
|
54
|
+
*/
|
|
55
|
+
user(userData: {
|
|
56
|
+
id?: string;
|
|
57
|
+
slug?: string;
|
|
58
|
+
[k: string]: any;
|
|
59
|
+
}): Promise<User>;
|
|
60
|
+
/**
|
|
61
|
+
* Creates an Organization object and optionally retrieves its profile.
|
|
62
|
+
*
|
|
63
|
+
* @param {{id?: string, slug?: string, [k: string]: any}} organizationData - The data required to initialize the Organization object.
|
|
64
|
+
* @returns {Promise<Organization>} A promise that resolves to the created Organization object.
|
|
65
|
+
* @throws {Error} Throws an error if the organization creation or profile retrieval fails.
|
|
66
|
+
*/
|
|
67
|
+
organization(organizationData: {
|
|
68
|
+
id?: string;
|
|
69
|
+
slug?: string;
|
|
70
|
+
[k: string]: any;
|
|
71
|
+
}): Promise<Organization>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new Project instance and optionally retrieves its profile.
|
|
74
|
+
*
|
|
75
|
+
* @param {{id?: string, slug?: string, [k: string]: any}} projectData - The data used to initialize the Project instance.
|
|
76
|
+
* @returns {Promise<Project>} A promise that resolves to the created Project instance.
|
|
77
|
+
* @throws {Error} If an error occurs during project creation or profile retrieval.
|
|
78
|
+
*/
|
|
79
|
+
project(projectData: {
|
|
80
|
+
id?: string;
|
|
81
|
+
slug?: string;
|
|
82
|
+
[k: string]: any;
|
|
83
|
+
}): Promise<Project>;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new Event instance and optionally retrieves its profile.
|
|
86
|
+
*
|
|
87
|
+
* @param {{id?: string, slug?: string, [k: string]: any}} eventData
|
|
88
|
+
* @returns {Promise<Event>}
|
|
89
|
+
* @throws {Error}
|
|
90
|
+
*/
|
|
91
|
+
event(eventData: {
|
|
92
|
+
id?: string;
|
|
93
|
+
slug?: string;
|
|
94
|
+
[k: string]: any;
|
|
95
|
+
}): Promise<Event>;
|
|
96
|
+
/**
|
|
97
|
+
* Retourne une entité à partir d'un slug.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} slug
|
|
100
|
+
* @returns {Promise<User|Organization|Project|Event|Poi|Badge|News>}
|
|
101
|
+
* @throws {ApiResponseError|ApiClientError|ApiError}
|
|
102
|
+
*/
|
|
103
|
+
entitySlug(slug: string): Promise<User | Organization | Project | Event | Poi | Badge | News>;
|
|
104
|
+
/**
|
|
105
|
+
* Retourne l'instance d'ApiClient.
|
|
106
|
+
* @returns {ApiClient}
|
|
107
|
+
*/
|
|
108
|
+
get client(): ApiClient;
|
|
109
|
+
/**
|
|
110
|
+
* Retourne l'instance d'EndpointApi.
|
|
111
|
+
* @returns {EndpointApi}
|
|
112
|
+
*/
|
|
113
|
+
get endpointApi(): EndpointApi;
|
|
114
|
+
/**
|
|
115
|
+
* Déconnecte l'utilisateur et réinitialise la session.
|
|
116
|
+
* @returns {void}
|
|
117
|
+
*/
|
|
118
|
+
logout(): void;
|
|
119
|
+
loggedUser: any;
|
|
120
|
+
}
|
|
121
|
+
export type ApiClient = import("./ApiClient.js").default;
|
|
122
|
+
export type ApiClientOptions = import("./ApiClient.js").ApiClientOptions;
|
|
123
|
+
import { User } from "./api/User.js";
|
|
124
|
+
import { Organization } from "./api/Organization.js";
|
|
125
|
+
import { Project } from "./api/Project.js";
|
|
126
|
+
import { Event } from "./api/Event.js";
|
|
127
|
+
import { Poi } from "./api/Poi.js";
|
|
128
|
+
import { Badge } from "./api/Badge.js";
|
|
129
|
+
import { News } from "./api/News.js";
|
|
130
|
+
import EndpointApi from "./api/EndpointApi.js";
|
|
131
|
+
import { UserApi } from "./api/UserApi.js";
|