eventhr-http-client 0.1.1 → 2.0.0

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/lib/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import y from "axios";
2
- import { useMutation as o, useQuery as i, QueryClient as m } from "@tanstack/react-query";
3
- const r = y.create({
1
+ import F from "axios";
2
+ import { useMutation as i, useQuery as o, QueryClient as q } from "@tanstack/react-query";
3
+ const c = F.create({
4
4
  baseURL: "",
5
5
  headers: {
6
6
  "Content-Type": "application/json"
7
7
  }
8
- }), g = (e) => {
9
- r.defaults.baseURL = e;
10
- }, w = (e) => {
11
- Object.assign(r.defaults.headers.common, e);
12
- }, C = (e) => {
13
- delete r.defaults.headers.common[e];
14
- }, $ = (e, t) => r.interceptors.request.use(e, t), f = (e) => {
15
- r.interceptors.request.eject(e);
8
+ }), f = (e) => {
9
+ c.defaults.baseURL = e;
10
+ }, A = (e) => {
11
+ Object.assign(c.defaults.headers.common, e);
12
+ }, E = (e) => {
13
+ delete c.defaults.headers.common[e];
14
+ }, M = (e, t) => c.interceptors.request.use(e, t), Q = (e) => {
15
+ c.interceptors.request.eject(e);
16
16
  };
17
- class a {
17
+ class r {
18
18
  constructor() {
19
- this.client = r;
19
+ this.client = c;
20
20
  }
21
21
  list(...t) {
22
22
  throw new Error(`list() not implemented on ${this.constructor.name}`);
@@ -34,13 +34,16 @@ class a {
34
34
  throw new Error(`remove() not implemented on ${this.constructor.name}`);
35
35
  }
36
36
  }
37
- class F extends a {
37
+ class K extends r {
38
38
  constructor() {
39
39
  super(...arguments), this.endpoint = "api/v1/events";
40
40
  }
41
41
  getAll(t) {
42
42
  return this.client.get(this.endpoint, { params: t });
43
43
  }
44
+ getById(t) {
45
+ return this.client.get(`${this.endpoint}/${t}`);
46
+ }
44
47
  create(t) {
45
48
  return this.client.post(this.endpoint, t);
46
49
  }
@@ -51,20 +54,23 @@ class F extends a {
51
54
  return this.client.delete(`${this.endpoint}/${t}`);
52
55
  }
53
56
  }
54
- const q = new F(), l = { v1: q };
55
- class E extends a {
57
+ const b = new K(), u = { v1: b };
58
+ class I extends r {
56
59
  constructor() {
57
60
  super(...arguments), this.endpoint = "api/v1/authentication/user";
58
61
  }
59
62
  login(t) {
60
63
  return this.client.post(this.endpoint, t);
61
64
  }
65
+ social(t) {
66
+ return this.client.post(`${this.endpoint}/social`, t);
67
+ }
62
68
  refresh(t) {
63
69
  return this.client.post(`${this.endpoint}/refresh`, t);
64
70
  }
65
71
  }
66
- const M = new E(), d = { v1: M };
67
- class U extends a {
72
+ const B = new I(), y = { v1: B };
73
+ class U extends r {
68
74
  constructor() {
69
75
  super(...arguments), this.endpoint = "api/v1/categories";
70
76
  }
@@ -81,8 +87,8 @@ class U extends a {
81
87
  return this.client.delete(`${this.endpoint}/${t}`);
82
88
  }
83
89
  }
84
- const Q = new U(), u = { v1: Q };
85
- class A extends a {
90
+ const O = new U(), d = { v1: O };
91
+ class G extends r {
86
92
  constructor() {
87
93
  super(...arguments), this.endpoint = "api/v1/collections";
88
94
  }
@@ -102,8 +108,8 @@ class A extends a {
102
108
  return this.client.delete(`${this.endpoint}/${t}`);
103
109
  }
104
110
  }
105
- const K = new A(), c = { v1: K };
106
- class x extends a {
111
+ const x = new G(), l = { v1: x };
112
+ class P extends r {
107
113
  constructor() {
108
114
  super(...arguments), this.endpoint = "api/v1/users";
109
115
  }
@@ -116,12 +122,21 @@ class x extends a {
116
122
  create(t) {
117
123
  return this.client.post(this.endpoint, t);
118
124
  }
125
+ createOrganizer(t) {
126
+ return this.client.post(`${this.endpoint}/organizer`, t);
127
+ }
128
+ createSubOrganizer(t) {
129
+ return this.client.post(`${this.endpoint}/sub-organizer`, t);
130
+ }
131
+ verify(t) {
132
+ return this.client.patch(`${this.endpoint}/${t}/verify`);
133
+ }
119
134
  edit(t, n) {
120
135
  return this.client.put(`${this.endpoint}/${t}`, n);
121
136
  }
122
137
  }
123
- const H = new x(), p = { v1: H };
124
- class I extends a {
138
+ const z = new P(), a = { v1: z };
139
+ class D extends r {
125
140
  constructor() {
126
141
  super(...arguments), this.endpoint = "api/v1/files";
127
142
  }
@@ -135,28 +150,107 @@ class I extends a {
135
150
  return this.client.delete(`${this.endpoint}/${t}`);
136
151
  }
137
152
  }
138
- const R = new I(), h = { v1: R };
139
- class _ {
153
+ const H = new D(), g = { v1: H };
154
+ class R extends r {
155
+ constructor() {
156
+ super(...arguments), this.endpoint = "api/v1/onboardings";
157
+ }
158
+ getByUser() {
159
+ return this.client.get(this.endpoint);
160
+ }
161
+ create(t) {
162
+ return this.client.post(this.endpoint, t);
163
+ }
164
+ update(t) {
165
+ return this.client.put(this.endpoint, t);
166
+ }
167
+ }
168
+ const _ = new R(), h = { v1: _ };
169
+ class S extends r {
170
+ constructor() {
171
+ super(...arguments), this.endpoint = "api/v1/event-attendances";
172
+ }
173
+ getAll(t) {
174
+ return this.client.get(this.endpoint, { params: t });
175
+ }
176
+ create(t) {
177
+ return this.client.post(this.endpoint, t);
178
+ }
179
+ remove(t) {
180
+ return this.client.delete(`${this.endpoint}/${t}`);
181
+ }
182
+ }
183
+ const T = new S(), v = { v1: T };
184
+ class j extends r {
185
+ constructor() {
186
+ super(...arguments), this.endpoint = "api/v1/forgot-password";
187
+ }
188
+ create(t) {
189
+ return this.client.post(this.endpoint, t);
190
+ }
191
+ changePassword(t, n) {
192
+ return this.client.patch(`${this.endpoint}/${t}/change`, n);
193
+ }
194
+ }
195
+ const L = new j(), m = { v1: L };
196
+ class V extends r {
197
+ constructor() {
198
+ super(...arguments), this.endpoint = "api/v1/countries";
199
+ }
200
+ getAll(t) {
201
+ return this.client.get(this.endpoint, { params: t });
202
+ }
203
+ getById(t) {
204
+ return this.client.get(`${this.endpoint}/${t}`);
205
+ }
206
+ }
207
+ const Y = new V(), w = { v1: Y };
208
+ class k extends r {
209
+ constructor() {
210
+ super(...arguments), this.endpoint = "api/v1/counties";
211
+ }
212
+ getAll(t) {
213
+ return this.client.get(this.endpoint, { params: t });
214
+ }
215
+ getById(t) {
216
+ return this.client.get(`${this.endpoint}/${t}`);
217
+ }
218
+ }
219
+ const N = new k(), C = { v1: N };
220
+ class W extends r {
221
+ constructor() {
222
+ super(...arguments), this.endpoint = "api/v1/cities";
223
+ }
224
+ getAll(t) {
225
+ return this.client.get(this.endpoint, { params: t });
226
+ }
227
+ getById(t) {
228
+ return this.client.get(`${this.endpoint}/${t}`);
229
+ }
230
+ }
231
+ const J = new W(), $ = { v1: J };
232
+ class X {
140
233
  constructor() {
141
- this.Auth = d, this.Events = l, this.Categories = u, this.Collections = c, this.Users = p, this.Files = h;
234
+ this.Auth = y, this.Events = u, this.Categories = d, this.Collections = l, this.Users = a, this.Files = g, this.Onboardings = h, this.EventAttendances = v, this.ForgotPassword = m, this.Countries = w, this.Counties = C, this.Cities = $;
142
235
  }
143
236
  configure({ baseUrl: t, headers: n }) {
144
- t !== void 0 && g(t), n !== void 0 && w(n);
237
+ t !== void 0 && f(t), n !== void 0 && A(n);
145
238
  }
146
239
  removeHeader(t) {
147
- C(t);
240
+ E(t);
148
241
  }
149
242
  addInterceptor(t, n) {
150
- return $(t, n);
243
+ return M(t, n);
151
244
  }
152
245
  removeInterceptor(t) {
153
- f(t);
246
+ Q(t);
154
247
  }
155
248
  }
156
- const T = new _(), s = {
249
+ const et = new X(), s = {
157
250
  events: {
158
251
  all: ["events"],
159
- list: (e) => [...s.events.all, "list", e]
252
+ list: (e) => [...s.events.all, "list", e],
253
+ detail: (e) => [...s.events.all, "detail", e]
160
254
  },
161
255
  categories: {
162
256
  all: ["categories"],
@@ -174,27 +268,54 @@ const T = new _(), s = {
174
268
  },
175
269
  files: {
176
270
  all: ["files"]
271
+ },
272
+ onboardings: {
273
+ all: ["onboardings"],
274
+ detail: () => [...s.onboardings.all, "detail"]
275
+ },
276
+ eventAttendances: {
277
+ all: ["event-attendances"],
278
+ list: (e) => [...s.eventAttendances.all, "list", e]
279
+ },
280
+ countries: {
281
+ all: ["countries"],
282
+ list: (e) => [...s.countries.all, "list", e],
283
+ detail: (e) => [...s.countries.all, "detail", e]
284
+ },
285
+ counties: {
286
+ all: ["counties"],
287
+ list: (e) => [...s.counties.all, "list", e],
288
+ detail: (e) => [...s.counties.all, "detail", e]
289
+ },
290
+ cities: {
291
+ all: ["cities"],
292
+ list: (e) => [...s.cities.all, "list", e],
293
+ detail: (e) => [...s.cities.all, "detail", e]
177
294
  }
178
- }, B = (e, t) => i({
295
+ }, nt = (e, t) => o({
179
296
  queryKey: s.events.list(e),
180
- queryFn: async () => (await l.v1.getAll(e)).data,
297
+ queryFn: async () => (await u.v1.getAll(e)).data,
298
+ ...t
299
+ }), st = (e, t) => o({
300
+ queryKey: s.events.detail(e),
301
+ queryFn: async () => (await u.v1.getById(e)).data,
181
302
  ...t
182
- }), j = (e) => o({
303
+ }), it = (e) => i({
183
304
  mutationFn: async (t) => {
184
- await l.v1.create(t);
305
+ await u.v1.create(t);
185
306
  },
186
307
  ...e
187
- }), L = (e) => o({
308
+ }), ot = (e) => i({
188
309
  mutationFn: async ({ id: t, data: n }) => {
189
- await l.v1.update(t, n);
310
+ await u.v1.update(t, n);
190
311
  },
191
312
  ...e
192
- }), O = (e) => o({
313
+ }), rt = (e) => i({
193
314
  mutationFn: async ({ id: t }) => {
194
- await l.v1.remove(t);
315
+ await u.v1.remove(t);
195
316
  },
196
317
  ...e
197
- }), v = new m({
318
+ }), p = new q({
198
319
  defaultOptions: {
199
320
  queries: {
200
321
  retry: 1,
@@ -205,122 +326,225 @@ const T = new _(), s = {
205
326
  retry: 0
206
327
  }
207
328
  }
208
- }), P = () => v.invalidateQueries({ queryKey: s.events.all }), b = (e) => o({
209
- mutationFn: async (t) => (await d.v1.login(t)).data,
329
+ }), at = () => p.invalidateQueries({ queryKey: s.events.all }), ct = (e) => i({
330
+ mutationFn: async (t) => (await y.v1.login(t)).data,
331
+ ...e
332
+ }), ut = (e) => i({
333
+ mutationFn: async (t) => (await y.v1.social(t)).data,
210
334
  ...e
211
- }), Y = (e) => o({
212
- mutationFn: async (t) => (await d.v1.refresh(t)).data,
335
+ }), lt = (e) => i({
336
+ mutationFn: async (t) => (await y.v1.refresh(t)).data,
213
337
  ...e
214
- }), k = (e, t) => i({
338
+ }), dt = (e, t) => o({
215
339
  queryKey: s.categories.list(e),
216
- queryFn: async () => (await u.v1.getAll(e)).data,
340
+ queryFn: async () => (await d.v1.getAll(e)).data,
217
341
  ...t
218
- }), N = (e) => o({
342
+ }), pt = (e) => i({
219
343
  mutationFn: async (t) => {
220
- await u.v1.create(t);
344
+ await d.v1.create(t);
221
345
  },
222
346
  ...e
223
- }), S = (e) => o({
347
+ }), yt = (e) => i({
224
348
  mutationFn: async ({ id: t, data: n }) => {
225
- await u.v1.update(t, n);
349
+ await d.v1.update(t, n);
226
350
  },
227
351
  ...e
228
- }), V = (e) => o({
352
+ }), ht = (e) => i({
229
353
  mutationFn: async ({ id: t }) => {
230
- await u.v1.remove(t);
354
+ await d.v1.remove(t);
231
355
  },
232
356
  ...e
233
- }), W = () => v.invalidateQueries({ queryKey: s.categories.all }), z = (e, t) => i({
357
+ }), vt = () => p.invalidateQueries({ queryKey: s.categories.all }), gt = (e, t) => o({
234
358
  queryKey: s.collections.list(e),
235
- queryFn: async () => (await c.v1.getAll(e)).data,
359
+ queryFn: async () => (await l.v1.getAll(e)).data,
236
360
  ...t
237
- }), J = (e, t) => i({
361
+ }), mt = (e, t) => o({
238
362
  queryKey: s.collections.detail(e),
239
- queryFn: async () => (await c.v1.getById(e)).data,
363
+ queryFn: async () => (await l.v1.getById(e)).data,
240
364
  ...t
241
- }), X = (e) => o({
365
+ }), wt = (e) => i({
242
366
  mutationFn: async (t) => {
243
- await c.v1.create(t);
367
+ await l.v1.create(t);
244
368
  },
245
369
  ...e
246
- }), Z = (e) => o({
370
+ }), Ct = (e) => i({
247
371
  mutationFn: async ({ id: t, data: n }) => {
248
- await c.v1.update(t, n);
372
+ await l.v1.update(t, n);
249
373
  },
250
374
  ...e
251
- }), tt = (e) => o({
375
+ }), $t = (e) => i({
252
376
  mutationFn: async ({ id: t }) => {
253
- await c.v1.remove(t);
377
+ await l.v1.remove(t);
254
378
  },
255
379
  ...e
256
- }), et = () => v.invalidateQueries({ queryKey: s.collections.all }), nt = (e, t) => i({
380
+ }), Ft = () => p.invalidateQueries({ queryKey: s.collections.all }), qt = (e, t) => o({
257
381
  queryKey: s.users.list(e),
258
- queryFn: async () => (await p.v1.getAll(e)).data,
382
+ queryFn: async () => (await a.v1.getAll(e)).data,
259
383
  ...t
260
- }), st = (e) => i({
384
+ }), ft = (e) => o({
261
385
  queryKey: s.users.profile(),
262
- queryFn: async () => (await p.v1.getProfile()).data,
386
+ queryFn: async () => (await a.v1.getProfile()).data,
263
387
  ...e
264
- }), ot = (e) => o({
388
+ }), At = (e) => i({
265
389
  mutationFn: async (t) => {
266
- await p.v1.create(t);
390
+ await a.v1.create(t);
267
391
  },
268
392
  ...e
269
- }), it = (e) => o({
393
+ }), Et = (e) => i({
270
394
  mutationFn: async ({ id: t, data: n }) => {
271
- await p.v1.edit(t, n);
395
+ await a.v1.edit(t, n);
272
396
  },
273
397
  ...e
274
- }), rt = (e) => o({
275
- mutationFn: async (t) => (await h.v1.upload(t)).data,
398
+ }), Mt = (e) => i({
399
+ mutationFn: async (t) => {
400
+ await a.v1.createOrganizer(t);
401
+ },
276
402
  ...e
277
- }), at = (e) => o({
403
+ }), Qt = (e) => i({
404
+ mutationFn: async (t) => {
405
+ await a.v1.createSubOrganizer(t);
406
+ },
407
+ ...e
408
+ }), Kt = (e) => i({
409
+ mutationFn: async ({ userId: t }) => {
410
+ await a.v1.verify(t);
411
+ },
412
+ ...e
413
+ }), bt = (e) => i({
414
+ mutationFn: async (t) => (await g.v1.upload(t)).data,
415
+ ...e
416
+ }), It = (e) => i({
417
+ mutationFn: async ({ id: t }) => {
418
+ await g.v1.remove(t);
419
+ },
420
+ ...e
421
+ }), Bt = (e) => o({
422
+ queryKey: s.onboardings.detail(),
423
+ queryFn: async () => (await h.v1.getByUser()).data,
424
+ ...e
425
+ }), Ut = (e) => i({
426
+ mutationFn: async (t) => (await h.v1.create(t)).data,
427
+ ...e
428
+ }), Ot = (e) => i({
429
+ mutationFn: async (t) => (await h.v1.update(t)).data,
430
+ ...e
431
+ }), Gt = () => p.invalidateQueries({ queryKey: s.onboardings.all }), xt = (e, t) => o({
432
+ queryKey: s.eventAttendances.list(e),
433
+ queryFn: async () => (await v.v1.getAll(e)).data,
434
+ ...t
435
+ }), Pt = (e) => i({
436
+ mutationFn: async (t) => {
437
+ await v.v1.create(t);
438
+ },
439
+ ...e
440
+ }), zt = (e) => i({
278
441
  mutationFn: async ({ id: t }) => {
279
- await h.v1.remove(t);
442
+ await v.v1.remove(t);
443
+ },
444
+ ...e
445
+ }), Dt = () => p.invalidateQueries({ queryKey: s.eventAttendances.all }), Ht = (e) => i({
446
+ mutationFn: async (t) => {
447
+ await m.v1.create(t);
448
+ },
449
+ ...e
450
+ }), Rt = (e) => i({
451
+ mutationFn: async ({ id: t, data: n }) => {
452
+ await m.v1.changePassword(t, n);
280
453
  },
281
454
  ...e
455
+ }), _t = (e, t) => o({
456
+ queryKey: s.countries.list(e),
457
+ queryFn: async () => (await w.v1.getAll(e)).data,
458
+ ...t
459
+ }), St = (e, t) => o({
460
+ queryKey: s.countries.detail(e),
461
+ queryFn: async () => (await w.v1.getById(e)).data,
462
+ ...t
463
+ }), Tt = (e, t) => o({
464
+ queryKey: s.counties.list(e),
465
+ queryFn: async () => (await C.v1.getAll(e)).data,
466
+ ...t
467
+ }), jt = (e, t) => o({
468
+ queryKey: s.counties.detail(e),
469
+ queryFn: async () => (await C.v1.getById(e)).data,
470
+ ...t
471
+ }), Lt = (e, t) => o({
472
+ queryKey: s.cities.list(e),
473
+ queryFn: async () => (await $.v1.getAll(e)).data,
474
+ ...t
475
+ }), Vt = (e, t) => o({
476
+ queryKey: s.cities.detail(e),
477
+ queryFn: async () => (await $.v1.getById(e)).data,
478
+ ...t
282
479
  });
283
480
  export {
284
- d as Auth,
285
- u as Categories,
286
- c as Collections,
481
+ y as Auth,
482
+ d as Categories,
483
+ $ as Cities,
484
+ l as Collections,
485
+ C as Counties,
486
+ w as Countries,
287
487
  s as EVENTHR_QUERY_KEYS,
288
- _ as EventhrHttpClient,
289
- l as Events,
290
- h as Files,
291
- a as HttpClient,
292
- p as Users,
293
- $ as addRequestInterceptor,
294
- T as default,
295
- r as instance,
296
- W as invalidateCategoriesCache,
297
- et as invalidateCollectionsCache,
298
- P as invalidateEventsCache,
299
- v as queryClient,
300
- C as removeHeader,
301
- f as removeRequestInterceptor,
302
- g as setBaseUrl,
303
- w as setHeaders,
304
- N as useCreateCategoryMutation,
305
- X as useCreateCollectionMutation,
306
- j as useCreateEventMutation,
307
- ot as useCreateUserMutation,
308
- V as useDeleteCategoryMutation,
309
- tt as useDeleteCollectionMutation,
310
- O as useDeleteEventMutation,
311
- at as useDeleteFileMutation,
312
- it as useEditUserMutation,
313
- k as useGetCategoriesQuery,
314
- J as useGetCollectionByIdQuery,
315
- z as useGetCollectionsQuery,
316
- B as useGetEventsQuery,
317
- st as useGetProfileQuery,
318
- nt as useGetUsersQuery,
319
- b as useLoginMutation,
320
- Y as useRefreshTokenMutation,
321
- S as useUpdateCategoryMutation,
322
- Z as useUpdateCollectionMutation,
323
- L as useUpdateEventMutation,
324
- rt as useUploadFileMutation
488
+ v as EventAttendances,
489
+ X as EventhrHttpClient,
490
+ u as Events,
491
+ g as Files,
492
+ m as ForgotPassword,
493
+ r as HttpClient,
494
+ h as Onboardings,
495
+ a as Users,
496
+ M as addRequestInterceptor,
497
+ et as default,
498
+ c as instance,
499
+ vt as invalidateCategoriesCache,
500
+ Ft as invalidateCollectionsCache,
501
+ Dt as invalidateEventAttendancesCache,
502
+ at as invalidateEventsCache,
503
+ Gt as invalidateOnboardingsCache,
504
+ p as queryClient,
505
+ E as removeHeader,
506
+ Q as removeRequestInterceptor,
507
+ f as setBaseUrl,
508
+ A as setHeaders,
509
+ Rt as useChangePasswordMutation,
510
+ pt as useCreateCategoryMutation,
511
+ wt as useCreateCollectionMutation,
512
+ Pt as useCreateEventAttendanceMutation,
513
+ it as useCreateEventMutation,
514
+ Ht as useCreateForgotPasswordMutation,
515
+ Ut as useCreateOnboardingMutation,
516
+ Mt as useCreateOrganizerMutation,
517
+ Qt as useCreateSubOrganizerMutation,
518
+ At as useCreateUserMutation,
519
+ ht as useDeleteCategoryMutation,
520
+ $t as useDeleteCollectionMutation,
521
+ zt as useDeleteEventAttendanceMutation,
522
+ rt as useDeleteEventMutation,
523
+ It as useDeleteFileMutation,
524
+ Et as useEditUserMutation,
525
+ dt as useGetCategoriesQuery,
526
+ Lt as useGetCitiesQuery,
527
+ Vt as useGetCityByIdQuery,
528
+ mt as useGetCollectionByIdQuery,
529
+ gt as useGetCollectionsQuery,
530
+ Tt as useGetCountiesQuery,
531
+ _t as useGetCountriesQuery,
532
+ St as useGetCountryByIdQuery,
533
+ jt as useGetCountyByIdQuery,
534
+ xt as useGetEventAttendancesQuery,
535
+ st as useGetEventByIdQuery,
536
+ nt as useGetEventsQuery,
537
+ Bt as useGetOnboardingQuery,
538
+ ft as useGetProfileQuery,
539
+ qt as useGetUsersQuery,
540
+ ct as useLoginMutation,
541
+ lt as useRefreshTokenMutation,
542
+ ut as useSocialAuthMutation,
543
+ yt as useUpdateCategoryMutation,
544
+ Ct as useUpdateCollectionMutation,
545
+ ot as useUpdateEventMutation,
546
+ Ot as useUpdateOnboardingMutation,
547
+ bt as useUploadFileMutation,
548
+ Kt as useVerifyUserMutation
325
549
  };
326
550
  //# sourceMappingURL=index.js.map