@communecter/cocolight-api-client 1.0.22 → 1.0.24
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/cocolight-api-client.browser.js +2 -2
- package/dist/cocolight-api-client.cjs +1 -1
- package/dist/cocolight-api-client.mjs.js +1 -1
- package/package.json +1 -1
- package/src/api/Badge.js +20 -12
- package/src/api/BaseEntity.js +642 -21
- package/src/api/EndpointApi.js +20 -4
- package/src/api/EndpointApi.types.d.ts +23 -2
- package/src/api/Event.js +38 -11
- package/src/api/Organization.js +129 -45
- package/src/api/Poi.js +38 -12
- package/src/api/Project.js +158 -8
- package/src/api/User.js +273 -18
- package/src/endpoints.module.js +2 -2
- package/src/index.js +21 -1
- package/src/utils/reactive.js +279 -0
package/package.json
CHANGED
package/src/api/Badge.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApiError } from "../error.js";
|
|
1
2
|
import BaseEntity from "./BaseEntity.js";
|
|
2
3
|
|
|
3
4
|
export class Badge extends BaseEntity {
|
|
@@ -25,6 +26,9 @@ export class Badge extends BaseEntity {
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
async _add(payload) {
|
|
29
|
+
if (!this._calledFromSave) {
|
|
30
|
+
throw new ApiError("utilisation invalide de _add, utilisez save");
|
|
31
|
+
}
|
|
28
32
|
payload.id = this._newId?.();
|
|
29
33
|
if (payload.slug) delete payload.slug;
|
|
30
34
|
|
|
@@ -46,6 +50,10 @@ export class Badge extends BaseEntity {
|
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
async _update(payload) {
|
|
53
|
+
// TODO: qui peut modifier un badge ?
|
|
54
|
+
if (!this._calledFromSave) {
|
|
55
|
+
throw new ApiError("utilisation invalide de _update, utilisez save");
|
|
56
|
+
}
|
|
49
57
|
if (payload.id) delete payload.id;
|
|
50
58
|
let hasChanged = false;
|
|
51
59
|
|
|
@@ -67,51 +75,51 @@ export class Badge extends BaseEntity {
|
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
async getOrganizations() {
|
|
70
|
-
throw new
|
|
78
|
+
throw new ApiError(`getOrganizations n'existe pas dans ${this.constructor.name}`);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
async getProjects() {
|
|
74
|
-
throw new
|
|
82
|
+
throw new ApiError(`getProjects n'existe pas dans ${this.constructor.name}`);
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
async getEvents() {
|
|
78
|
-
throw new
|
|
86
|
+
throw new ApiError(`getEvents n'existe pas dans ${this.constructor.name}`);
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
async getPois() {
|
|
82
|
-
throw new
|
|
90
|
+
throw new ApiError(`getPois n'existe pas dans ${this.constructor.name}`);
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
async getBadgesIssuer() {
|
|
86
|
-
throw new
|
|
94
|
+
throw new ApiError(`getBadgesIssuer n'existe pas dans ${this.constructor.name}`);
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
async getNews() {
|
|
90
|
-
throw new
|
|
98
|
+
throw new ApiError(`getNews n'existe pas dans ${this.constructor.name}`);
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
async getSubscribers() {
|
|
94
|
-
throw new
|
|
102
|
+
throw new ApiError(`getSubscribers n'existe pas dans ${this.constructor.name}`);
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
async project() {
|
|
98
|
-
throw new
|
|
106
|
+
throw new ApiError(`project n'existe pas dans ${this.constructor.name}`);
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
async poi() {
|
|
102
|
-
throw new
|
|
110
|
+
throw new ApiError(`poi n'existe pas dans ${this.constructor.name}`);
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
async event() {
|
|
106
|
-
throw new
|
|
114
|
+
throw new ApiError(`event n'existe pas dans ${this.constructor.name}`);
|
|
107
115
|
}
|
|
108
116
|
|
|
109
117
|
async badge() {
|
|
110
|
-
throw new
|
|
118
|
+
throw new ApiError(`badge n'existe pas dans ${this.constructor.name}`);
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
async news() {
|
|
114
|
-
throw new
|
|
122
|
+
throw new ApiError(`news n'existe pas dans ${this.constructor.name}`);
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
}
|