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