@selfcommunity/api-services 0.4.55 → 0.5.0-alpha.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/cjs/constants/Endpoints.js +146 -0
- package/lib/cjs/index.d.ts +4 -2
- package/lib/cjs/index.js +8 -1
- package/lib/cjs/services/event/index.d.ts +316 -0
- package/lib/cjs/services/event/index.js +467 -0
- package/lib/cjs/services/onboarding/index.d.ts +80 -0
- package/lib/cjs/services/onboarding/index.js +102 -0
- package/lib/cjs/services/preference/index.d.ts +8 -0
- package/lib/cjs/services/preference/index.js +13 -0
- package/lib/cjs/services/suggestion/index.d.ts +9 -1
- package/lib/cjs/services/suggestion/index.js +13 -0
- package/lib/cjs/types/event.d.ts +108 -0
- package/lib/cjs/types/event.js +2 -0
- package/lib/cjs/types/index.d.ts +3 -1
- package/lib/cjs/types/index.js +3 -1
- package/lib/cjs/types/onBoarding.d.ts +30 -0
- package/lib/cjs/types/onBoarding.js +18 -0
- package/lib/esm/constants/Endpoints.js +146 -0
- package/lib/esm/index.d.ts +4 -2
- package/lib/esm/index.js +4 -2
- package/lib/esm/services/event/index.d.ts +316 -0
- package/lib/esm/services/event/index.js +462 -0
- package/lib/esm/services/onboarding/index.d.ts +80 -0
- package/lib/esm/services/onboarding/index.js +97 -0
- package/lib/esm/services/preference/index.d.ts +8 -0
- package/lib/esm/services/preference/index.js +13 -0
- package/lib/esm/services/suggestion/index.d.ts +9 -1
- package/lib/esm/services/suggestion/index.js +13 -0
- package/lib/esm/types/event.d.ts +108 -0
- package/lib/esm/types/event.js +1 -0
- package/lib/esm/types/index.d.ts +3 -1
- package/lib/esm/types/index.js +2 -1
- package/lib/esm/types/onBoarding.d.ts +30 -0
- package/lib/esm/types/onBoarding.js +15 -0
- package/lib/umd/api-services.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { apiRequest } from '../../utils/apiRequest';
|
|
3
|
+
import Endpoints from '../../constants/Endpoints';
|
|
4
|
+
import { urlParams } from '../../utils/url';
|
|
5
|
+
/**
|
|
6
|
+
* Contains all the endpoints needed to manage events.
|
|
7
|
+
*/
|
|
8
|
+
export class EventApiClient {
|
|
9
|
+
/**
|
|
10
|
+
* This endpoint retrieves all the events of the logged-in user.
|
|
11
|
+
* @param params
|
|
12
|
+
* @param config
|
|
13
|
+
*/
|
|
14
|
+
static getUserEvents(params, config) {
|
|
15
|
+
const p = urlParams(params);
|
|
16
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUserEvents.url({})}?${p.toString()}`, method: Endpoints.GetUserEvents.method }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* This endpoint retrieves a specific user events.
|
|
20
|
+
* @param id
|
|
21
|
+
* @param params
|
|
22
|
+
* @param config
|
|
23
|
+
*/
|
|
24
|
+
static getUserSubscribedEvents(id, params, config) {
|
|
25
|
+
const p = urlParams(params);
|
|
26
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUserSubscribedEvents.url({ id })}?${p.toString()}`, method: Endpoints.GetUserSubscribedEvents.method }));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This endpoint returns all events cretaed by a specific event.
|
|
30
|
+
* @param id
|
|
31
|
+
* @param params
|
|
32
|
+
* @param config
|
|
33
|
+
*/
|
|
34
|
+
static getUserCreatedEvents(params, config) {
|
|
35
|
+
const p = urlParams(params);
|
|
36
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUserCreatedEvents.url({})}?${p.toString()}`, method: Endpoints.GetUserCreatedEvents.method }));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This endpoint performs events search
|
|
40
|
+
* @param params
|
|
41
|
+
* @param config
|
|
42
|
+
*/
|
|
43
|
+
static searchEvents(params, config) {
|
|
44
|
+
const p = urlParams(params);
|
|
45
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.SearchEvents.url({})}?${p.toString()}`, method: Endpoints.SearchEvents.method }));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* This endpoint retrieves a specific event.
|
|
49
|
+
* @param id
|
|
50
|
+
* @param config
|
|
51
|
+
*/
|
|
52
|
+
static getSpecificEventInfo(id, config) {
|
|
53
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetEventInfo.url({ id }), method: Endpoints.GetEventInfo.method }));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* This endpoint performs events search
|
|
57
|
+
* @param id
|
|
58
|
+
* @param params
|
|
59
|
+
* @param config
|
|
60
|
+
*/
|
|
61
|
+
static getEventFeed(id, params, config) {
|
|
62
|
+
const p = urlParams(params);
|
|
63
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetEventFeed.url({ id })}?${p.toString()}`, method: Endpoints.GetEventFeed.method }));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* This endpoint creates an event.
|
|
67
|
+
* @param data
|
|
68
|
+
* @param config
|
|
69
|
+
*/
|
|
70
|
+
static createEvent(data, config) {
|
|
71
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreateEvent.url({}), method: Endpoints.CreateEvent.method, data: data }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* This endpoint updates an event.
|
|
75
|
+
* @param id
|
|
76
|
+
* @param data
|
|
77
|
+
* @param config
|
|
78
|
+
*/
|
|
79
|
+
static updateEvent(id, data, config) {
|
|
80
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.UpdateEvent.url({ id }), method: Endpoints.UpdateEvent.method, data: data }));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* This endpoint patches an event.
|
|
84
|
+
* @param id
|
|
85
|
+
* @param data
|
|
86
|
+
* @param config
|
|
87
|
+
*/
|
|
88
|
+
static patchEvent(id, data, config) {
|
|
89
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.PatchEvent.url({ id }), method: Endpoints.PatchEvent.method, data: data }));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* This endpoint deletes an event.
|
|
93
|
+
* @param id
|
|
94
|
+
* @param config
|
|
95
|
+
*/
|
|
96
|
+
static deleteEvent(id, config) {
|
|
97
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.DeleteEvent.url({ id }), method: Endpoints.DeleteEvent.method }));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* This endpoint changes the event avatar
|
|
101
|
+
* @param id
|
|
102
|
+
* @param data
|
|
103
|
+
* @param config
|
|
104
|
+
*/
|
|
105
|
+
static changeEventCover(id, data, config) {
|
|
106
|
+
return apiRequest(Object.assign({ url: Endpoints.PatchEvent.url({ id }), method: Endpoints.PatchEvent.method, data }, config));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* This endpoint returns all subscribers of a specific event.
|
|
110
|
+
* @param id
|
|
111
|
+
* @param params
|
|
112
|
+
* @param config
|
|
113
|
+
*/
|
|
114
|
+
static getEventMembers(id, params, config) {
|
|
115
|
+
const p = urlParams(params);
|
|
116
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetEventSubscribers.url({ id })}?${p.toString()}`, method: Endpoints.GetEventSubscribers.method }));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* This endpoint returns all waiting approval subscribers
|
|
120
|
+
* @param id
|
|
121
|
+
* @param params
|
|
122
|
+
* @param config
|
|
123
|
+
*/
|
|
124
|
+
static getEventWaitingApprovalSubscribers(id, params, config) {
|
|
125
|
+
const p = urlParams(params);
|
|
126
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetEventWaitingApprovalSubscribers.url({ id })}?${p.toString()}`, method: Endpoints.GetEventSubscribers.method }));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* This endpoint returns a list of suggested users to invite to the event.
|
|
130
|
+
* @param id
|
|
131
|
+
* @param search
|
|
132
|
+
* @param config
|
|
133
|
+
*/
|
|
134
|
+
static getEventSuggestedUsers(id, search, config) {
|
|
135
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetEventSuggestedUsers.url({ id, search }), method: Endpoints.GetEventSuggestedUsers.method }));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* This endpoint returns a list of suggested users to invite to the events.
|
|
139
|
+
* @param search
|
|
140
|
+
* @param config
|
|
141
|
+
*/
|
|
142
|
+
static getEventsSuggestedUsers(search, config) {
|
|
143
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetEventsSuggestedUsers.url({ search }), method: Endpoints.GetEventsSuggestedUsers.method }));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* This endpoint returns a list of invited users.
|
|
147
|
+
* @param id
|
|
148
|
+
* @param params
|
|
149
|
+
* @param config
|
|
150
|
+
*/
|
|
151
|
+
static getEventInvitedUsers(id, params, config) {
|
|
152
|
+
const p = urlParams(params);
|
|
153
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetEventInvitedUsers.url({ id })}?${p.toString()}`, method: Endpoints.GetEventInvitedUsers.method }));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* This endpoint returns a list of users attending the event.
|
|
157
|
+
* @param id
|
|
158
|
+
* @param params
|
|
159
|
+
* @param config
|
|
160
|
+
*/
|
|
161
|
+
static getUsersGoingToEvent(id, params, config) {
|
|
162
|
+
const p = urlParams(params);
|
|
163
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUsersGoingToEvent.url({ id })}?${p.toString()}`, method: Endpoints.GetUsersGoingToEvent.method }));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* This endpoint returns a list of users not attending the event.
|
|
167
|
+
* @param id
|
|
168
|
+
* @param params
|
|
169
|
+
* @param config
|
|
170
|
+
*/
|
|
171
|
+
static getUsersNotGoingToEvent(id, params, config) {
|
|
172
|
+
const p = urlParams(params);
|
|
173
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUsersNotGoingToEvent.url({ id })}?${p.toString()}`, method: Endpoints.GetUsersNotGoingToEvent.method }));
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* This endpoint subscribes to an event.
|
|
177
|
+
* @param id
|
|
178
|
+
* @param config
|
|
179
|
+
*/
|
|
180
|
+
static subscribeToEvent(id, config) {
|
|
181
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.SubscribeToEvent.url({ id }), method: Endpoints.SubscribeToEvent.method }));
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* This endpoint unsubscribes from an event.
|
|
185
|
+
* @param id
|
|
186
|
+
* @param config
|
|
187
|
+
*/
|
|
188
|
+
static unsubscribeFromEvent(id, config) {
|
|
189
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.UnsubscribeFromEvent.url({ id }), method: Endpoints.UnsubscribeFromEvent.method }));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* This endpoint allows to invite or accept an event invite.
|
|
193
|
+
* @param id
|
|
194
|
+
* @param data
|
|
195
|
+
* @param config
|
|
196
|
+
*/
|
|
197
|
+
static inviteOrAcceptEventRequest(id, data, config) {
|
|
198
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.InviteOrAcceptEventRequest.url({ id }), method: Endpoints.InviteOrAcceptEventRequest.method, data: data }));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* This endpoint allows to remove invites.
|
|
202
|
+
* @param id
|
|
203
|
+
* @param data
|
|
204
|
+
* @param config
|
|
205
|
+
*/
|
|
206
|
+
static removeInviteEvent(id, data, config) {
|
|
207
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.RemoveInviteEvent.url({ id }), method: Endpoints.RemoveInviteEvent.method, data: data }));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* This endpoint retrieves the event subscription status.
|
|
211
|
+
* @param id
|
|
212
|
+
* @param config
|
|
213
|
+
*/
|
|
214
|
+
static getEventSubscriptionStatus(id, config) {
|
|
215
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetEventSubscriptionStatus.url({ id }), method: Endpoints.GetEventSubscriptionStatus.method }));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* This endpoint allows to attend an event
|
|
219
|
+
* @param id
|
|
220
|
+
* @param config
|
|
221
|
+
*/
|
|
222
|
+
static goToEvent(id, config) {
|
|
223
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GoToEvent.url({ id }), method: Endpoints.GoToEvent.method }));
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* This endpoint allows to remove an event participation
|
|
227
|
+
* @param id
|
|
228
|
+
* @param config
|
|
229
|
+
*/
|
|
230
|
+
static removeGoingToEvent(id, config) {
|
|
231
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.RemoveGoingToEvent.url({ id }), method: Endpoints.RemoveGoingToEvent.method }));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* This endpoint allows to not attend an event
|
|
235
|
+
* @param id
|
|
236
|
+
* @param config
|
|
237
|
+
*/
|
|
238
|
+
static notGoingToEvent(id, config) {
|
|
239
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.NotGoingToEvent.url({ id }), method: Endpoints.NotGoingToEvent.method }));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* This endpoint allows to remove the event not attending
|
|
243
|
+
* @param id
|
|
244
|
+
* @param config
|
|
245
|
+
*/
|
|
246
|
+
static removeNotGoingToEvent(id, config) {
|
|
247
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.RemoveNotGoingToEvent.url({ id }), method: Endpoints.RemoveNotGoingToEvent.method }));
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* This endpoint returns all events related of a specific event.
|
|
251
|
+
* @param id
|
|
252
|
+
* @param params
|
|
253
|
+
* @param config
|
|
254
|
+
*/
|
|
255
|
+
static getEventRelated(id, params, config) {
|
|
256
|
+
const p = urlParams(params);
|
|
257
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetEventRelated.url({ id })}?${p.toString()}`, method: Endpoints.GetEventRelated.method }));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* This endpoint show a specific event.
|
|
261
|
+
* @param id
|
|
262
|
+
* @param config
|
|
263
|
+
*/
|
|
264
|
+
static showEvent(id, config) {
|
|
265
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.ShowEvent.url({ id }), method: Endpoints.ShowEvent.method }));
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* This endpoint hide a specific event.
|
|
269
|
+
* @param id
|
|
270
|
+
* @param config
|
|
271
|
+
*/
|
|
272
|
+
static hideEvent(id, config) {
|
|
273
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.hideEvent.url({ id }), method: Endpoints.hideEvent.method }));
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
*
|
|
278
|
+
:::tip Incubator service can be used in the following way:
|
|
279
|
+
|
|
280
|
+
```jsx
|
|
281
|
+
1. Import the service from our library:
|
|
282
|
+
|
|
283
|
+
import {EventService} from "@selfcommunity/api-services";
|
|
284
|
+
```
|
|
285
|
+
```jsx
|
|
286
|
+
2. Create a function and put the service inside it!
|
|
287
|
+
The async function `searchEvents` will return the events matching the search query.
|
|
288
|
+
|
|
289
|
+
async searchEvents() {
|
|
290
|
+
return await EventService.searchEvents();
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
```jsx
|
|
294
|
+
In case of required `params`, just add them inside the brackets.
|
|
295
|
+
|
|
296
|
+
async getSpecificEventInfo(eventId) {
|
|
297
|
+
return await EventService.getSpecificEventInfo(eventId);
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
```jsx
|
|
301
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
302
|
+
|
|
303
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
304
|
+
|
|
305
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
306
|
+
|
|
307
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
308
|
+
```
|
|
309
|
+
:::
|
|
310
|
+
*/
|
|
311
|
+
export default class EventService {
|
|
312
|
+
static getUserEvents(params, config) {
|
|
313
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
return EventApiClient.getUserEvents(params, config);
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
static getUserSubscribedEvents(id, params, config) {
|
|
318
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
319
|
+
return EventApiClient.getUserSubscribedEvents(id, params, config);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
static getUserCretaedEvents(params, config) {
|
|
323
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
324
|
+
return EventApiClient.getUserCreatedEvents(params, config);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
static searchEvents(params, config) {
|
|
328
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
329
|
+
return EventApiClient.searchEvents(params, config);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
static getSpecificEventInfo(id, config) {
|
|
333
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
334
|
+
return EventApiClient.getSpecificEventInfo(id, config);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
static getEventFeed(id, params, config) {
|
|
338
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
339
|
+
return EventApiClient.getEventFeed(id, params, config);
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
static createEvent(data, config) {
|
|
343
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
344
|
+
return EventApiClient.createEvent(data, config);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
static updateEvent(id, data, config) {
|
|
348
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
+
return EventApiClient.updateEvent(id, data, config);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
static patchEvent(id, data, config) {
|
|
353
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
return EventApiClient.patchEvent(id, data, config);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
static deleteEvent(id, config) {
|
|
358
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
359
|
+
return EventApiClient.deleteEvent(id, config);
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
static changeEventCover(id, data, config) {
|
|
363
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
364
|
+
return EventApiClient.changeEventCover(id, data, config);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
static getEventMembers(id, params, config) {
|
|
368
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
369
|
+
return EventApiClient.getEventMembers(id, params, config);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
static getEventWaitingApprovalSubscribers(id, params, config) {
|
|
373
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
374
|
+
return EventApiClient.getEventWaitingApprovalSubscribers(id, params, config);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
static getEventSuggestedUsers(id, search, config) {
|
|
378
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
379
|
+
return EventApiClient.getEventSuggestedUsers(id, search, config);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
static getEventsSuggestedUsers(search, config) {
|
|
383
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
384
|
+
return EventApiClient.getEventsSuggestedUsers(search, config);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
static getEventInvitedUsers(id, params, config) {
|
|
388
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
389
|
+
return EventApiClient.getEventInvitedUsers(id, params, config);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
static getUsersGoingToEvent(id, params, config) {
|
|
393
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
return EventApiClient.getUsersGoingToEvent(id, params, config);
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
static getUsersNotGoingToEvent(id, params, config) {
|
|
398
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
399
|
+
return EventApiClient.getUsersNotGoingToEvent(id, params, config);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
static subscribeToEvent(id, config) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
404
|
+
return EventApiClient.subscribeToEvent(id, config);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
static unsubscribeFromEvent(id, config) {
|
|
408
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
409
|
+
return EventApiClient.unsubscribeFromEvent(id, config);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
static inviteOrAcceptEventRequest(id, data, config) {
|
|
413
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
414
|
+
return EventApiClient.inviteOrAcceptEventRequest(id, data, config);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
static removeInviteEvent(id, data, config) {
|
|
418
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
+
return EventApiClient.removeInviteEvent(id, data, config);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
static getEventSubscriptionStatus(id, config) {
|
|
423
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
return EventApiClient.getEventSubscriptionStatus(id, config);
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
static goToEvent(id, config) {
|
|
428
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
429
|
+
return EventApiClient.goToEvent(id, config);
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
static removeGoingToEvent(id, config) {
|
|
433
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
434
|
+
return EventApiClient.removeGoingToEvent(id, config);
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
static notGoingToEvent(id, config) {
|
|
438
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
439
|
+
return EventApiClient.notGoingToEvent(id, config);
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
static removeNotGoingToEvent(id, config) {
|
|
443
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
444
|
+
return EventApiClient.removeNotGoingToEvent(id, config);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
static getEventRelated(id, params, config) {
|
|
448
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
449
|
+
return EventApiClient.getEventRelated(id, params, config);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
static showEvent(id, config) {
|
|
453
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
454
|
+
return EventApiClient.showEvent(id, config);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
static hideEvent(id, config) {
|
|
458
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
459
|
+
return EventApiClient.hideEvent(id, config);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { BaseSearchParams, OnBoardingStep, SCPaginatedResponse } from '../../types';
|
|
3
|
+
import { SCStepType } from '@selfcommunity/types';
|
|
4
|
+
import { StartStepParams } from '../../types/onBoarding';
|
|
5
|
+
export interface OnBoardingApiClientInterface {
|
|
6
|
+
getAllSteps(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCStepType>>;
|
|
7
|
+
getAStep(step: OnBoardingStep, config?: AxiosRequestConfig): Promise<any>;
|
|
8
|
+
startAStep(step: OnBoardingStep, params?: StartStepParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCStepType>>;
|
|
9
|
+
completeAStep(step: OnBoardingStep, config?: AxiosRequestConfig): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Contains all the endpoints needed to manage OnBoarding content.
|
|
13
|
+
*/
|
|
14
|
+
export declare class OnBoardingApiClient {
|
|
15
|
+
/**
|
|
16
|
+
* This endpoint retrieves all onboarding steps.
|
|
17
|
+
* @param params
|
|
18
|
+
* @param config
|
|
19
|
+
*/
|
|
20
|
+
static getAllSteps(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCStepType>>;
|
|
21
|
+
/**
|
|
22
|
+
* This endpoint retrieves a specific step identified by the step id.
|
|
23
|
+
* @param step
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
static getAStep(step: OnBoardingStep, config?: AxiosRequestConfig): Promise<SCStepType>;
|
|
27
|
+
/**
|
|
28
|
+
* This endpoint performs step content generation.
|
|
29
|
+
* @param step
|
|
30
|
+
* @param params
|
|
31
|
+
* @param config
|
|
32
|
+
*/
|
|
33
|
+
static startAStep(step: OnBoardingStep, params?: StartStepParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCStepType>>;
|
|
34
|
+
/**
|
|
35
|
+
* This endpoint marks a step complete.
|
|
36
|
+
* @param step
|
|
37
|
+
* @param config
|
|
38
|
+
*/
|
|
39
|
+
static completeAStep(step: OnBoardingStep, config?: AxiosRequestConfig): Promise<any>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
:::tip OnBoarding service can be used in the following way:
|
|
44
|
+
```jsx
|
|
45
|
+
1. Import the service from our library:
|
|
46
|
+
|
|
47
|
+
import {OnBoardingService} from "@selfcommunity/api-services";
|
|
48
|
+
```
|
|
49
|
+
```jsx
|
|
50
|
+
2. Create a function and put the service inside it!
|
|
51
|
+
The async function `getAStep` will return the paginated list of categories.
|
|
52
|
+
|
|
53
|
+
async getAStep() {
|
|
54
|
+
return await OnBoardingService.getAStep();
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
```jsx
|
|
58
|
+
In case of required `params`, just add them inside the brackets.
|
|
59
|
+
|
|
60
|
+
async create(data) {
|
|
61
|
+
return await OnBoardingService.getAStep(step);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
```jsx
|
|
65
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
66
|
+
|
|
67
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
68
|
+
|
|
69
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
70
|
+
|
|
71
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
72
|
+
```
|
|
73
|
+
:::
|
|
74
|
+
*/
|
|
75
|
+
export default class OnBoardingService {
|
|
76
|
+
static getAllSteps(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCStepType>>;
|
|
77
|
+
static getAStep(step: OnBoardingStep, config?: AxiosRequestConfig): Promise<SCStepType>;
|
|
78
|
+
static startAStep(step: OnBoardingStep, params?: StartStepParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCStepType>>;
|
|
79
|
+
static completeAStep(step: OnBoardingStep, config?: AxiosRequestConfig): Promise<any>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import Endpoints from '../../constants/Endpoints';
|
|
3
|
+
import { apiRequest } from '../../utils/apiRequest';
|
|
4
|
+
/**
|
|
5
|
+
* Contains all the endpoints needed to manage OnBoarding content.
|
|
6
|
+
*/
|
|
7
|
+
export class OnBoardingApiClient {
|
|
8
|
+
/**
|
|
9
|
+
* This endpoint retrieves all onboarding steps.
|
|
10
|
+
* @param params
|
|
11
|
+
* @param config
|
|
12
|
+
*/
|
|
13
|
+
static getAllSteps(params, config) {
|
|
14
|
+
return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.GetAllSteps.url({}), method: Endpoints.GetAllSteps.method }));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This endpoint retrieves a specific step identified by the step id.
|
|
18
|
+
* @param step
|
|
19
|
+
* @param config
|
|
20
|
+
*/
|
|
21
|
+
static getAStep(step, config) {
|
|
22
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetAStep.url({ step }), method: Endpoints.GetAStep.method }));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This endpoint performs step content generation.
|
|
26
|
+
* @param step
|
|
27
|
+
* @param params
|
|
28
|
+
* @param config
|
|
29
|
+
*/
|
|
30
|
+
static startAStep(step, params, config) {
|
|
31
|
+
return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.StartAStep.url({ step }), method: Endpoints.StartAStep.method }));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* This endpoint marks a step complete.
|
|
35
|
+
* @param step
|
|
36
|
+
* @param config
|
|
37
|
+
*/
|
|
38
|
+
static completeAStep(step, config) {
|
|
39
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CompleteAStep.url({ step }), method: Endpoints.CompleteAStep.method }));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
:::tip OnBoarding service can be used in the following way:
|
|
45
|
+
```jsx
|
|
46
|
+
1. Import the service from our library:
|
|
47
|
+
|
|
48
|
+
import {OnBoardingService} from "@selfcommunity/api-services";
|
|
49
|
+
```
|
|
50
|
+
```jsx
|
|
51
|
+
2. Create a function and put the service inside it!
|
|
52
|
+
The async function `getAStep` will return the paginated list of categories.
|
|
53
|
+
|
|
54
|
+
async getAStep() {
|
|
55
|
+
return await OnBoardingService.getAStep();
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
```jsx
|
|
59
|
+
In case of required `params`, just add them inside the brackets.
|
|
60
|
+
|
|
61
|
+
async create(data) {
|
|
62
|
+
return await OnBoardingService.getAStep(step);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
```jsx
|
|
66
|
+
If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
|
|
67
|
+
|
|
68
|
+
1. Declare it(or declare them, it is possible to add multiple params)
|
|
69
|
+
|
|
70
|
+
const headers = headers: {Authorization: `Bearer ${yourToken}`}
|
|
71
|
+
|
|
72
|
+
2. Add it inside the brackets and pass it to the function, as shown in the previous example!
|
|
73
|
+
```
|
|
74
|
+
:::
|
|
75
|
+
*/
|
|
76
|
+
export default class OnBoardingService {
|
|
77
|
+
static getAllSteps(params, config) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
return OnBoardingApiClient.getAllSteps(params, config);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
static getAStep(step, config) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
return OnBoardingApiClient.getAStep(step, config);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
static startAStep(step, params, config) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
return OnBoardingApiClient.startAStep(step, params, config);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
static completeAStep(step, config) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
return OnBoardingApiClient.completeAStep(step, config);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -5,6 +5,7 @@ export interface PreferenceApiClientInterface {
|
|
|
5
5
|
getAllPreferences(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPreferenceType>>;
|
|
6
6
|
searchPreferences(search?: string, section?: string, keys?: string, ordering?: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPreferenceType>>;
|
|
7
7
|
getSpecificPreference(id: number | string, config?: AxiosRequestConfig): Promise<SCPreferenceType>;
|
|
8
|
+
updatePreferences(data: any, config?: AxiosRequestConfig): Promise<SCPreferenceType | SCPreferenceType[]>;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* Contains all the endpoints needed to manage dynamic preferences.
|
|
@@ -30,6 +31,12 @@ export declare class PreferenceApiClient {
|
|
|
30
31
|
* @param config
|
|
31
32
|
*/
|
|
32
33
|
static getSpecificPreference(id: number | string, config?: AxiosRequestConfig): Promise<SCPreferenceType>;
|
|
34
|
+
/**
|
|
35
|
+
* This endpoint patches one or more dynamic preferences.
|
|
36
|
+
* @param data
|
|
37
|
+
* @param config
|
|
38
|
+
*/
|
|
39
|
+
static updatePreferences(data: any, config?: AxiosRequestConfig): Promise<SCPreferenceType | SCPreferenceType[]>;
|
|
33
40
|
}
|
|
34
41
|
/**
|
|
35
42
|
*
|
|
@@ -70,4 +77,5 @@ export default class PreferenceService {
|
|
|
70
77
|
static getAllPreferences(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPreferenceType>>;
|
|
71
78
|
static searchPreferences(search?: string, section?: string, keys?: string, ordering?: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCPreferenceType>>;
|
|
72
79
|
static getSpecificPreference(id: number | string, config?: AxiosRequestConfig): Promise<SCPreferenceType>;
|
|
80
|
+
static updatePreferences(data: any, config?: AxiosRequestConfig): Promise<SCPreferenceType | SCPreferenceType[]>;
|
|
73
81
|
}
|
|
@@ -33,6 +33,14 @@ export class PreferenceApiClient {
|
|
|
33
33
|
static getSpecificPreference(id, config) {
|
|
34
34
|
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetPreference.url({ id }), method: Endpoints.Preferences.method }));
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This endpoint patches one or more dynamic preferences.
|
|
38
|
+
* @param data
|
|
39
|
+
* @param config
|
|
40
|
+
*/
|
|
41
|
+
static updatePreferences(data, config) {
|
|
42
|
+
return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.UpdatePreferences.url(), method: Endpoints.UpdatePreferences.method, data: data }));
|
|
43
|
+
}
|
|
36
44
|
}
|
|
37
45
|
/**
|
|
38
46
|
*
|
|
@@ -85,4 +93,9 @@ export default class PreferenceService {
|
|
|
85
93
|
return PreferenceApiClient.getSpecificPreference(id, config);
|
|
86
94
|
});
|
|
87
95
|
}
|
|
96
|
+
static updatePreferences(data, config) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
return PreferenceApiClient.updatePreferences(data, config);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
88
101
|
}
|