@communecter/cocolight-api-client 1.0.131 → 1.0.133

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 (48) hide show
  1. package/dist/cocolight-api-client.browser.js +3 -3
  2. package/dist/cocolight-api-client.cjs +1 -1
  3. package/dist/cocolight-api-client.mjs.js +1 -1
  4. package/dist/cocolight-api-client.vite.mjs.js +1 -1
  5. package/dist/cocolight-api-client.vite.mjs.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/Api.ts +9 -9
  8. package/src/ApiClient.ts +3 -1
  9. package/src/api/Action.ts +4 -0
  10. package/src/api/Answer.ts +846 -6
  11. package/src/api/Badge.ts +5 -0
  12. package/src/api/BaseEntity.ts +190 -11
  13. package/src/api/Classified.ts +4 -0
  14. package/src/api/Comment.ts +3 -0
  15. package/src/api/EndpointApi.ts +16 -1
  16. package/src/api/EndpointApi.types.ts +375 -44
  17. package/src/api/Event.ts +5 -0
  18. package/src/api/Form.ts +102 -2
  19. package/src/api/News.ts +3 -0
  20. package/src/api/Organization.ts +44 -2
  21. package/src/api/Poi.ts +4 -0
  22. package/src/api/Project.ts +48 -0
  23. package/src/api/User.ts +10 -0
  24. package/src/api/serverDataType/Answer.ts +25 -0
  25. package/src/api/serverDataType/Form.ts +84 -4
  26. package/src/api/serverDataType/Organization.ts +13 -0
  27. package/src/api/serverDataType/Project.ts +15 -0
  28. package/src/endpoints.module.ts +1185 -208
  29. package/types/api/Action.d.ts +1 -0
  30. package/types/api/Answer.d.ts +296 -2
  31. package/types/api/Badge.d.ts +1 -0
  32. package/types/api/BaseEntity.d.ts +101 -3
  33. package/types/api/Classified.d.ts +1 -0
  34. package/types/api/Comment.d.ts +1 -0
  35. package/types/api/EndpointApi.d.ts +10 -1
  36. package/types/api/EndpointApi.types.d.ts +334 -41
  37. package/types/api/Event.d.ts +1 -0
  38. package/types/api/Form.d.ts +58 -0
  39. package/types/api/News.d.ts +1 -0
  40. package/types/api/Organization.d.ts +20 -1
  41. package/types/api/Poi.d.ts +1 -0
  42. package/types/api/Project.d.ts +21 -0
  43. package/types/api/User.d.ts +7 -0
  44. package/types/api/serverDataType/Answer.d.ts +22 -0
  45. package/types/api/serverDataType/Form.d.ts +89 -4
  46. package/types/api/serverDataType/Organization.d.ts +13 -0
  47. package/types/api/serverDataType/Project.d.ts +15 -0
  48. package/types/endpoints.module.d.ts +1222 -1005
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@communecter/cocolight-api-client",
3
- "version": "1.0.131",
3
+ "version": "1.0.133",
4
4
  "description": "Client Axios simplifié pour l'API cocolight",
5
5
  "repository": {
6
6
  "type": "git",
package/src/Api.ts CHANGED
@@ -132,9 +132,9 @@ export default class Api {
132
132
  async user(userData: EntityData): Promise<User> {
133
133
  try {
134
134
  if (!userData.id && !userData.slug) {
135
- return new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Classified, Action });
135
+ return new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
136
136
  } else {
137
- const user = new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Classified, Action });
137
+ const user = new User(this._client, userData, { EndpointApi, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
138
138
  await user.get();
139
139
  return user;
140
140
  }
@@ -150,7 +150,7 @@ export default class Api {
150
150
  */
151
151
  async organization(organizationData: EntityData): Promise<Organization> {
152
152
  try {
153
- const organization = new Organization(this._client, organizationData, { EndpointApi, User, Project, Event, Poi, Badge, News, Comment, Answer, Classified, Action });
153
+ const organization = new Organization(this._client, organizationData, { EndpointApi, User, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
154
154
  if (!organizationData.id && !organizationData.slug) {
155
155
  throw new Error("Vous devez fournir un id ou un slug pour créer une instance Organization.");
156
156
  }
@@ -167,7 +167,7 @@ export default class Api {
167
167
  */
168
168
  async project(projectData: EntityData): Promise<Project> {
169
169
  try {
170
- const project = new Project(this._client, projectData, { EndpointApi, User, Organization, Event, Poi, Badge, News, Comment, Answer, Classified, Action });
170
+ const project = new Project(this._client, projectData, { EndpointApi, User, Organization, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
171
171
  if (!projectData.id && !projectData.slug) {
172
172
  throw new Error("Vous devez fournir un id ou un slug pour créer une instance Project.");
173
173
  }
@@ -184,7 +184,7 @@ export default class Api {
184
184
  */
185
185
  async event(eventData: EntityData): Promise<Event> {
186
186
  try {
187
- const event = new Event(this._client, eventData, { EndpointApi, User, Organization, Project, Poi, Badge, News, Comment });
187
+ const event = new Event(this._client, eventData, { EndpointApi, User, Organization, Project, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
188
188
  if (!eventData.id && !eventData.slug) {
189
189
  throw new Error("Vous devez fournir un id ou un slug pour créer une instance Event.");
190
190
  }
@@ -201,7 +201,7 @@ export default class Api {
201
201
  */
202
202
  async poi(poiData: EntityData): Promise<Poi> {
203
203
  try {
204
- const poi = new Poi(this._client, poiData, { EndpointApi, User, Organization, Project, Poi, Badge, News, Comment });
204
+ const poi = new Poi(this._client, poiData, { EndpointApi, User, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
205
205
  if (!poiData.id && !poiData.slug) {
206
206
  throw new Error("Vous devez fournir un id ou un slug pour créer une instance Poi.");
207
207
  }
@@ -218,7 +218,7 @@ export default class Api {
218
218
  */
219
219
  async answer(answerData: { id: string }): Promise<Answer> {
220
220
  try {
221
- const answer = new Answer(this._client, answerData, { EndpointApi, User, Organization, Project, Event, Poi, Badge, News, Comment });
221
+ const answer = new Answer(this._client, answerData, { EndpointApi, User, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
222
222
  if (!answerData.id) {
223
223
  throw new Error("Vous devez fournir un id pour créer une instance Answer.");
224
224
  }
@@ -235,7 +235,7 @@ export default class Api {
235
235
  */
236
236
  async form(formData: { id: string }): Promise<Form> {
237
237
  try {
238
- const form = new Form(this._client, formData, { EndpointApi, User, Organization, Project });
238
+ const form = new Form(this._client, formData, { EndpointApi, User, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
239
239
  if (!formData.id) {
240
240
  throw new Error("Vous devez fournir un id pour créer une instance Form.");
241
241
  }
@@ -249,7 +249,7 @@ export default class Api {
249
249
 
250
250
  async classified(classifiedData: EntityData): Promise<Classified> {
251
251
  try {
252
- const classified = new Classified(this._client, classifiedData, { EndpointApi, User, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified });
252
+ const classified = new Classified(this._client, classifiedData, { EndpointApi, User, Organization, Project, Event, Poi, Badge, News, Comment, Answer, Form, Classified, Action });
253
253
  if (!classifiedData.id && !classifiedData.slug) {
254
254
  throw new Error("Vous devez fournir un id ou un slug pour créer une instance Classified.");
255
255
  }
package/src/ApiClient.ts CHANGED
@@ -1646,7 +1646,9 @@ export default class ApiClient extends EventEmitter {
1646
1646
  "imageThumbPath",
1647
1647
  "docPath",
1648
1648
  "imageThumb",
1649
- "imageMediumPath"
1649
+ "imageMediumPath",
1650
+ "logo",
1651
+ "logoMin"
1650
1652
  ];
1651
1653
 
1652
1654
  /**
package/src/api/Action.ts CHANGED
@@ -600,4 +600,8 @@ export class Action extends BaseEntity<ActionItemNormalized> {
600
600
  private _isIsoDateTime(value: string): boolean {
601
601
  return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/.test(value);
602
602
  }
603
+
604
+ override async form(): Promise<never> {
605
+ throw new ApiError(`form n'existe pas dans ${this.constructor.name}`, 501);
606
+ }
603
607
  }