@selfcommunity/api-services 0.4.9-alpha.8 → 0.4.9

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.
@@ -1192,6 +1192,10 @@ const Endpoints = {
1192
1192
  RemoveUserFromGroup: {
1193
1193
  url: (0, utils_1.urlReplacer)('/api/v2/group/$(id)/subscribe/?user=$(user)'),
1194
1194
  method: 'DELETE'
1195
+ },
1196
+ GetUserSubscribedGroups: {
1197
+ url: (0, utils_1.urlReplacer)('/api/v2/user/$(id)/groups/'),
1198
+ method: 'GET'
1195
1199
  }
1196
1200
  };
1197
1201
  exports.default = Endpoints;
@@ -76,12 +76,14 @@ export declare class CategoryApiClient {
76
76
  /**
77
77
  * This endpoint returns all followers of a specific category.
78
78
  * @param id
79
+ * @param params
79
80
  * @param config
80
81
  */
81
82
  static getCategoryFollowers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
82
83
  /**
83
84
  * This endpoint retrieves the category feed.
84
85
  * @param id
86
+ * @param params
85
87
  * @param config
86
88
  */
87
89
  static getCategoryFeed(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedUnitType>>;
@@ -95,6 +97,7 @@ export declare class CategoryApiClient {
95
97
  /**
96
98
  * This endpoint returns all trending followers of a specific category during last n days (default 90) .
97
99
  * @param id
100
+ * @param params
98
101
  * @param config
99
102
  */
100
103
  static getCategoryTrendingFollowers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
@@ -4,7 +4,6 @@ exports.CategoryApiClient = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Endpoints_1 = tslib_1.__importDefault(require("../../constants/Endpoints"));
6
6
  const apiRequest_1 = require("../../utils/apiRequest");
7
- const url_1 = require("../../utils/url");
8
7
  /**
9
8
  * Contains all the endpoints needed to manage categories.
10
9
  */
@@ -15,8 +14,7 @@ class CategoryApiClient {
15
14
  * @param config
16
15
  */
17
16
  static getAllCategories(params, config) {
18
- const p = (0, url_1.urlParams)(params);
19
- return (0, apiRequest_1.apiRequest)(Object.assign({ url: `${Endpoints_1.default.CategoryList.url({})}?${p.toString()}`, method: Endpoints_1.default.CategoryList.method }, config));
17
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.CategoryList.url({}), method: Endpoints_1.default.CategoryList.method }));
20
18
  }
21
19
  /**
22
20
  * This endpoint performs category search.
@@ -24,8 +22,7 @@ class CategoryApiClient {
24
22
  * @param config
25
23
  */
26
24
  static searchCategory(params, config) {
27
- const p = (0, url_1.urlParams)(params);
28
- return (0, apiRequest_1.apiRequest)(Object.assign({ url: `${Endpoints_1.default.SearchCategory.url({})}?${p.toString()}`, method: Endpoints_1.default.SearchCategory.method }, config));
25
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.SearchCategory.url({}), method: Endpoints_1.default.SearchCategory.method }));
29
26
  }
30
27
  /**
31
28
  * This endpoint creates a category.
@@ -80,6 +77,7 @@ class CategoryApiClient {
80
77
  /**
81
78
  * This endpoint returns all followers of a specific category.
82
79
  * @param id
80
+ * @param params
83
81
  * @param config
84
82
  */
85
83
  static getCategoryFollowers(id, params, config) {
@@ -88,6 +86,7 @@ class CategoryApiClient {
88
86
  /**
89
87
  * This endpoint retrieves the category feed.
90
88
  * @param id
89
+ * @param params
91
90
  * @param config
92
91
  */
93
92
  static getCategoryFeed(id, params, config) {
@@ -100,12 +99,12 @@ class CategoryApiClient {
100
99
  * @param config
101
100
  */
102
101
  static getCategoryTrendingFeed(id, params, config) {
103
- const p = (0, url_1.urlParams)(params);
104
- return (0, apiRequest_1.apiRequest)(Object.assign({ url: `${Endpoints_1.default.CategoryTrendingFeed.url({ id })}?${p.toString()}`, method: Endpoints_1.default.CategoryTrendingFeed.method }, config));
102
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.CategoryTrendingFeed.url({ id }), method: Endpoints_1.default.CategoryTrendingFeed.method }));
105
103
  }
106
104
  /**
107
105
  * This endpoint returns all trending followers of a specific category during last n days (default 90) .
108
106
  * @param id
107
+ * @param params
109
108
  * @param config
110
109
  */
111
110
  static getCategoryTrendingFollowers(id, params, config) {
@@ -133,8 +132,7 @@ class CategoryApiClient {
133
132
  * @param config
134
133
  */
135
134
  static getFollowedCategories(params, config) {
136
- const p = (0, url_1.urlParams)(params);
137
- return (0, apiRequest_1.apiRequest)(Object.assign({ url: `${Endpoints_1.default.CategoriesFollowed.url({})}?${p.toString()}`, method: Endpoints_1.default.CategoriesFollowed.method }, config));
135
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.CategoriesFollowed.url({}), method: Endpoints_1.default.CategoriesFollowed.method }));
138
136
  }
139
137
  /**
140
138
  * This endpoint retrieves all categories ordered by the number of followers (in descending order).
@@ -142,8 +140,7 @@ class CategoryApiClient {
142
140
  * @param config
143
141
  */
144
142
  static getPopularCategories(params, config) {
145
- const p = (0, url_1.urlParams)(params);
146
- return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.PopularCategories.url({})}?${p.toString()}`, method: Endpoints_1.default.PopularCategories.method }));
143
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { params, url: Endpoints_1.default.PopularCategories.url({}), method: Endpoints_1.default.PopularCategories.method }));
147
144
  }
148
145
  }
149
146
  exports.CategoryApiClient = CategoryApiClient;
@@ -3,7 +3,8 @@ import { SCGroupType, SCUserType } from '@selfcommunity/types';
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
  import { GroupCreateParams } from '../../types';
5
5
  export interface GroupApiClientInterface {
6
- getUserGroups(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
6
+ getUserGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
7
+ getUserSubscribedGroups(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
7
8
  searchGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
8
9
  getSpecificGroupInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCGroupType>;
9
10
  getGroupFeed(id: number | string, params?: GroupFeedParams, config?: AxiosRequestConfig): Promise<any>;
@@ -15,7 +16,7 @@ export interface GroupApiClientInterface {
15
16
  getGroupSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
16
17
  getGroupsSuggestedUsers(search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
17
18
  removeUserFromGroup(id: number | string, user: number | string, config?: AxiosRequestConfig): Promise<any>;
18
- getGroupInvitedUsers(id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
19
+ getGroupInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
19
20
  subscribeToGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
20
21
  unsubscribeFromGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
21
22
  inviteOrAcceptGroupRequest(id: number | string, data: {
@@ -33,7 +34,14 @@ export declare class GroupApiClient {
33
34
  * @param params
34
35
  * @param config
35
36
  */
36
- static getUserGroups(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
37
+ static getUserGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
38
+ /**
39
+ * This endpoint retrieves a specific user groups.
40
+ * @param id
41
+ * @param params
42
+ * @param config
43
+ */
44
+ static getUserSubscribedGroups(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
37
45
  /**
38
46
  * This endpoint performs groups search
39
47
  * @param params
@@ -110,9 +118,10 @@ export declare class GroupApiClient {
110
118
  /**
111
119
  * This endpoint returns a list of invited users.
112
120
  * @param id
121
+ * @param params
113
122
  * @param config
114
123
  */
115
- static getGroupInvitedUsers(id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
124
+ static getGroupInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
116
125
  /**
117
126
  * This endpoint subscribes to a group.
118
127
  * @param id
@@ -184,7 +193,8 @@ export declare class GroupApiClient {
184
193
  :::
185
194
  */
186
195
  export default class GroupService {
187
- static getUserGroups(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
196
+ static getUserGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
197
+ static getUserSubscribedGroups(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
188
198
  static searchGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
189
199
  static getSpecificGroupInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCGroupType>;
190
200
  static getGroupFeed(id: number | string, params?: GroupFeedParams, config?: AxiosRequestConfig): Promise<any>;
@@ -196,7 +206,7 @@ export default class GroupService {
196
206
  static getGroupSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
197
207
  static getGroupsSuggestedUsers(search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
198
208
  static removeUserFromGroup(id: number | string, user: number | string, config?: AxiosRequestConfig): Promise<any>;
199
- static getGroupInvitedUsers(id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
209
+ static getGroupInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
200
210
  static subscribeToGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
201
211
  static unsubscribeFromGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
202
212
  static inviteOrAcceptGroupRequest(id: number | string, data: {
@@ -18,6 +18,16 @@ class GroupApiClient {
18
18
  const p = (0, url_1.urlParams)(params);
19
19
  return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetUserGroups.url({})}?${p.toString()}`, method: Endpoints_1.default.GetUserGroups.method }));
20
20
  }
21
+ /**
22
+ * This endpoint retrieves a specific user groups.
23
+ * @param id
24
+ * @param params
25
+ * @param config
26
+ */
27
+ static getUserSubscribedGroups(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.GetUserSubscribedGroups.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetUserSubscribedGroups.method }));
30
+ }
21
31
  /**
22
32
  * This endpoint performs groups search
23
33
  * @param params
@@ -119,10 +129,12 @@ class GroupApiClient {
119
129
  /**
120
130
  * This endpoint returns a list of invited users.
121
131
  * @param id
132
+ * @param params
122
133
  * @param config
123
134
  */
124
- static getGroupInvitedUsers(id, config) {
125
- return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.GetGroupInvitedUsers.url({ id }), method: Endpoints_1.default.GetGroupInvitedUsers.method }));
135
+ static getGroupInvitedUsers(id, params, config) {
136
+ const p = (0, url_1.urlParams)(params);
137
+ return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: `${Endpoints_1.default.GetGroupInvitedUsers.url({ id })}?${p.toString()}`, method: Endpoints_1.default.GetGroupInvitedUsers.method }));
126
138
  }
127
139
  /**
128
140
  * This endpoint subscribes to a group.
@@ -210,6 +222,11 @@ class GroupService {
210
222
  return GroupApiClient.getUserGroups(params, config);
211
223
  });
212
224
  }
225
+ static getUserSubscribedGroups(id, params, config) {
226
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
227
+ return GroupApiClient.getUserSubscribedGroups(id, params, config);
228
+ });
229
+ }
213
230
  static searchGroups(params, config) {
214
231
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
215
232
  return GroupApiClient.searchGroups(params, config);
@@ -265,9 +282,9 @@ class GroupService {
265
282
  return GroupApiClient.removeUserFromGroup(id, user, config);
266
283
  });
267
284
  }
268
- static getGroupInvitedUsers(id, config) {
285
+ static getGroupInvitedUsers(id, params, config) {
269
286
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
270
- return GroupApiClient.getGroupInvitedUsers(id, config);
287
+ return GroupApiClient.getGroupInvitedUsers(id, params, config);
271
288
  });
272
289
  }
273
290
  static subscribeToGroup(id, config) {
@@ -29,7 +29,7 @@ export declare class LegalPageApiClient {
29
29
  static getSpecificLegalPage(id: number | string, config?: AxiosRequestConfig): Promise<SCLegalPageType>;
30
30
  /**
31
31
  * This endpoint retrieves all revisions of a legal page.
32
- * @param id
32
+ * @param policy
33
33
  * @param config
34
34
  */
35
35
  static getAllRevisionsOfLegalPage(policy: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLegalPageType>>;
@@ -39,7 +39,7 @@ export declare class LegalPageApiClient {
39
39
  static getAllLastRevisionsOfLegalPages(config?: AxiosRequestConfig): Promise<SCLegalPageType[]>;
40
40
  /**
41
41
  * This endpoint retrieves last revision of a legal page.
42
- * @param id
42
+ * @param policy
43
43
  * @param config
44
44
  */
45
45
  static getLastRevisionOfLegalPage(policy: string, config?: AxiosRequestConfig): Promise<SCLegalPageType>;
@@ -28,7 +28,7 @@ class LegalPageApiClient {
28
28
  }
29
29
  /**
30
30
  * This endpoint retrieves all revisions of a legal page.
31
- * @param id
31
+ * @param policy
32
32
  * @param config
33
33
  */
34
34
  static getAllRevisionsOfLegalPage(policy, config) {
@@ -42,7 +42,7 @@ class LegalPageApiClient {
42
42
  }
43
43
  /**
44
44
  * This endpoint retrieves last revision of a legal page.
45
- * @param id
45
+ * @param policy
46
46
  * @param config
47
47
  */
48
48
  static getLastRevisionOfLegalPage(policy, config) {
@@ -129,6 +129,7 @@ export declare class UserApiClient {
129
129
  * @param id
130
130
  * @param new_email
131
131
  * @param confirm
132
+ * @param send_email
132
133
  * @param config
133
134
  */
134
135
  static changeUserMail(id: number | string, new_email: string, confirm?: boolean, send_email?: boolean, config?: AxiosRequestConfig): Promise<any | SCUserChangeEmailType>;
@@ -192,20 +193,21 @@ export declare class UserApiClient {
192
193
  /**
193
194
  * This endpoint retrieves the list of posts of the user identified by ID.
194
195
  * @param id
196
+ * @param params
195
197
  * @param config
196
198
  */
197
199
  static getUserFeed(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedUnitType>>;
198
200
  /**
199
201
  * This endpoint retrieves the list of followers of a specific user identified by ID.
200
202
  * @param id
201
- * @param mutual
203
+ * @param params
202
204
  * @param config
203
205
  */
204
206
  static getUserFollowers(id: number | string, params?: UserGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
205
207
  /**
206
- * This endpoint retrieves the list of following of a specific user identified by ID..
208
+ * This endpoint retrieves the list of following of a specific user identified by ID.
207
209
  * @param id
208
- * @param mutual
210
+ * @param params
209
211
  * @param config
210
212
  */
211
213
  static getUserFollowings(id: number | string, params?: UserGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
@@ -230,7 +232,7 @@ export declare class UserApiClient {
230
232
  /**
231
233
  * This endpoint retrieves the list of connections of a specific user identified by ID.
232
234
  * @param id
233
- * @param mutual
235
+ * @param params
234
236
  * @param config
235
237
  */
236
238
  static getUserConnections(id: number | string, params?: UserGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
@@ -242,13 +244,13 @@ export declare class UserApiClient {
242
244
  static checkUserConnections(id: number | string, config?: AxiosRequestConfig): Promise<SCUserConnectionStatusType>;
243
245
  /**
244
246
  * This endpoint retrieves the list of connection requests received by a specific user identified by ID.
245
- * @param id
247
+ * @param params
246
248
  * @param config
247
249
  */
248
250
  static getUserConnectionRequests(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserConnectionRequestType>>;
249
251
  /**
250
252
  * This endpoint retrieves a specific user's list of connection requests sent by user.
251
- * @param id
253
+ * @param params
252
254
  * @param config
253
255
  */
254
256
  static getUserRequestConnectionsSent(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserConnectionRequestType>>;
@@ -105,6 +105,7 @@ class UserApiClient {
105
105
  * @param id
106
106
  * @param new_email
107
107
  * @param confirm
108
+ * @param send_email
108
109
  * @param config
109
110
  */
110
111
  static changeUserMail(id, new_email, confirm, send_email, config) {
@@ -196,6 +197,7 @@ class UserApiClient {
196
197
  /**
197
198
  * This endpoint retrieves the list of posts of the user identified by ID.
198
199
  * @param id
200
+ * @param params
199
201
  * @param config
200
202
  */
201
203
  static getUserFeed(id, params, config) {
@@ -204,16 +206,16 @@ class UserApiClient {
204
206
  /**
205
207
  * This endpoint retrieves the list of followers of a specific user identified by ID.
206
208
  * @param id
207
- * @param mutual
209
+ * @param params
208
210
  * @param config
209
211
  */
210
212
  static getUserFollowers(id, params, config) {
211
213
  return (0, apiRequest_1.apiRequest)(Object.assign(Object.assign({}, config), { url: Endpoints_1.default.UserFollowers.url({ id }), method: Endpoints_1.default.UserFollowers.method, params }));
212
214
  }
213
215
  /**
214
- * This endpoint retrieves the list of following of a specific user identified by ID..
216
+ * This endpoint retrieves the list of following of a specific user identified by ID.
215
217
  * @param id
216
- * @param mutual
218
+ * @param params
217
219
  * @param config
218
220
  */
219
221
  static getUserFollowings(id, params, config) {
@@ -246,7 +248,7 @@ class UserApiClient {
246
248
  /**
247
249
  * This endpoint retrieves the list of connections of a specific user identified by ID.
248
250
  * @param id
249
- * @param mutual
251
+ * @param params
250
252
  * @param config
251
253
  */
252
254
  static getUserConnections(id, params, config) {
@@ -262,7 +264,7 @@ class UserApiClient {
262
264
  }
263
265
  /**
264
266
  * This endpoint retrieves the list of connection requests received by a specific user identified by ID.
265
- * @param id
267
+ * @param params
266
268
  * @param config
267
269
  */
268
270
  static getUserConnectionRequests(params, config) {
@@ -270,7 +272,7 @@ class UserApiClient {
270
272
  }
271
273
  /**
272
274
  * This endpoint retrieves a specific user's list of connection requests sent by user.
273
- * @param id
275
+ * @param params
274
276
  * @param config
275
277
  */
276
278
  static getUserRequestConnectionsSent(params, config) {
@@ -1190,6 +1190,10 @@ const Endpoints = {
1190
1190
  RemoveUserFromGroup: {
1191
1191
  url: urlReplacer('/api/v2/group/$(id)/subscribe/?user=$(user)'),
1192
1192
  method: 'DELETE'
1193
+ },
1194
+ GetUserSubscribedGroups: {
1195
+ url: urlReplacer('/api/v2/user/$(id)/groups/'),
1196
+ method: 'GET'
1193
1197
  }
1194
1198
  };
1195
1199
  export default Endpoints;
@@ -76,12 +76,14 @@ export declare class CategoryApiClient {
76
76
  /**
77
77
  * This endpoint returns all followers of a specific category.
78
78
  * @param id
79
+ * @param params
79
80
  * @param config
80
81
  */
81
82
  static getCategoryFollowers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
82
83
  /**
83
84
  * This endpoint retrieves the category feed.
84
85
  * @param id
86
+ * @param params
85
87
  * @param config
86
88
  */
87
89
  static getCategoryFeed(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFeedUnitType>>;
@@ -95,6 +97,7 @@ export declare class CategoryApiClient {
95
97
  /**
96
98
  * This endpoint returns all trending followers of a specific category during last n days (default 90) .
97
99
  * @param id
100
+ * @param params
98
101
  * @param config
99
102
  */
100
103
  static getCategoryTrendingFollowers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
@@ -1,7 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import Endpoints from '../../constants/Endpoints';
3
3
  import { apiRequest } from '../../utils/apiRequest';
4
- import { urlParams } from '../../utils/url';
5
4
  /**
6
5
  * Contains all the endpoints needed to manage categories.
7
6
  */
@@ -12,8 +11,7 @@ export class CategoryApiClient {
12
11
  * @param config
13
12
  */
14
13
  static getAllCategories(params, config) {
15
- const p = urlParams(params);
16
- return apiRequest(Object.assign({ url: `${Endpoints.CategoryList.url({})}?${p.toString()}`, method: Endpoints.CategoryList.method }, config));
14
+ return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.CategoryList.url({}), method: Endpoints.CategoryList.method }));
17
15
  }
18
16
  /**
19
17
  * This endpoint performs category search.
@@ -21,8 +19,7 @@ export class CategoryApiClient {
21
19
  * @param config
22
20
  */
23
21
  static searchCategory(params, config) {
24
- const p = urlParams(params);
25
- return apiRequest(Object.assign({ url: `${Endpoints.SearchCategory.url({})}?${p.toString()}`, method: Endpoints.SearchCategory.method }, config));
22
+ return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.SearchCategory.url({}), method: Endpoints.SearchCategory.method }));
26
23
  }
27
24
  /**
28
25
  * This endpoint creates a category.
@@ -77,6 +74,7 @@ export class CategoryApiClient {
77
74
  /**
78
75
  * This endpoint returns all followers of a specific category.
79
76
  * @param id
77
+ * @param params
80
78
  * @param config
81
79
  */
82
80
  static getCategoryFollowers(id, params, config) {
@@ -85,6 +83,7 @@ export class CategoryApiClient {
85
83
  /**
86
84
  * This endpoint retrieves the category feed.
87
85
  * @param id
86
+ * @param params
88
87
  * @param config
89
88
  */
90
89
  static getCategoryFeed(id, params, config) {
@@ -97,12 +96,12 @@ export class CategoryApiClient {
97
96
  * @param config
98
97
  */
99
98
  static getCategoryTrendingFeed(id, params, config) {
100
- const p = urlParams(params);
101
- return apiRequest(Object.assign({ url: `${Endpoints.CategoryTrendingFeed.url({ id })}?${p.toString()}`, method: Endpoints.CategoryTrendingFeed.method }, config));
99
+ return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.CategoryTrendingFeed.url({ id }), method: Endpoints.CategoryTrendingFeed.method }));
102
100
  }
103
101
  /**
104
102
  * This endpoint returns all trending followers of a specific category during last n days (default 90) .
105
103
  * @param id
104
+ * @param params
106
105
  * @param config
107
106
  */
108
107
  static getCategoryTrendingFollowers(id, params, config) {
@@ -130,8 +129,7 @@ export class CategoryApiClient {
130
129
  * @param config
131
130
  */
132
131
  static getFollowedCategories(params, config) {
133
- const p = urlParams(params);
134
- return apiRequest(Object.assign({ url: `${Endpoints.CategoriesFollowed.url({})}?${p.toString()}`, method: Endpoints.CategoriesFollowed.method }, config));
132
+ return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.CategoriesFollowed.url({}), method: Endpoints.CategoriesFollowed.method }));
135
133
  }
136
134
  /**
137
135
  * This endpoint retrieves all categories ordered by the number of followers (in descending order).
@@ -139,8 +137,7 @@ export class CategoryApiClient {
139
137
  * @param config
140
138
  */
141
139
  static getPopularCategories(params, config) {
142
- const p = urlParams(params);
143
- return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.PopularCategories.url({})}?${p.toString()}`, method: Endpoints.PopularCategories.method }));
140
+ return apiRequest(Object.assign(Object.assign({}, config), { params, url: Endpoints.PopularCategories.url({}), method: Endpoints.PopularCategories.method }));
144
141
  }
145
142
  }
146
143
  /**
@@ -3,7 +3,8 @@ import { SCGroupType, SCUserType } from '@selfcommunity/types';
3
3
  import { AxiosRequestConfig } from 'axios';
4
4
  import { GroupCreateParams } from '../../types';
5
5
  export interface GroupApiClientInterface {
6
- getUserGroups(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
6
+ getUserGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
7
+ getUserSubscribedGroups(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
7
8
  searchGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
8
9
  getSpecificGroupInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCGroupType>;
9
10
  getGroupFeed(id: number | string, params?: GroupFeedParams, config?: AxiosRequestConfig): Promise<any>;
@@ -15,7 +16,7 @@ export interface GroupApiClientInterface {
15
16
  getGroupSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
16
17
  getGroupsSuggestedUsers(search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
17
18
  removeUserFromGroup(id: number | string, user: number | string, config?: AxiosRequestConfig): Promise<any>;
18
- getGroupInvitedUsers(id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
19
+ getGroupInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
19
20
  subscribeToGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
20
21
  unsubscribeFromGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
21
22
  inviteOrAcceptGroupRequest(id: number | string, data: {
@@ -33,7 +34,14 @@ export declare class GroupApiClient {
33
34
  * @param params
34
35
  * @param config
35
36
  */
36
- static getUserGroups(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
37
+ static getUserGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
38
+ /**
39
+ * This endpoint retrieves a specific user groups.
40
+ * @param id
41
+ * @param params
42
+ * @param config
43
+ */
44
+ static getUserSubscribedGroups(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
37
45
  /**
38
46
  * This endpoint performs groups search
39
47
  * @param params
@@ -110,9 +118,10 @@ export declare class GroupApiClient {
110
118
  /**
111
119
  * This endpoint returns a list of invited users.
112
120
  * @param id
121
+ * @param params
113
122
  * @param config
114
123
  */
115
- static getGroupInvitedUsers(id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
124
+ static getGroupInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
116
125
  /**
117
126
  * This endpoint subscribes to a group.
118
127
  * @param id
@@ -184,7 +193,8 @@ export declare class GroupApiClient {
184
193
  :::
185
194
  */
186
195
  export default class GroupService {
187
- static getUserGroups(params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
196
+ static getUserGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
197
+ static getUserSubscribedGroups(id: number | string, params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
188
198
  static searchGroups(params?: BaseSearchParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCGroupType>>;
189
199
  static getSpecificGroupInfo(id: number | string, config?: AxiosRequestConfig): Promise<SCGroupType>;
190
200
  static getGroupFeed(id: number | string, params?: GroupFeedParams, config?: AxiosRequestConfig): Promise<any>;
@@ -196,7 +206,7 @@ export default class GroupService {
196
206
  static getGroupSuggestedUsers(id: number | string, search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
197
207
  static getGroupsSuggestedUsers(search: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
198
208
  static removeUserFromGroup(id: number | string, user: number | string, config?: AxiosRequestConfig): Promise<any>;
199
- static getGroupInvitedUsers(id: number | string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
209
+ static getGroupInvitedUsers(id: number | string, params?: BaseGetParams, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserType>>;
200
210
  static subscribeToGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
201
211
  static unsubscribeFromGroup(id: number | string, config?: AxiosRequestConfig): Promise<any>;
202
212
  static inviteOrAcceptGroupRequest(id: number | string, data: {
@@ -15,6 +15,16 @@ export class GroupApiClient {
15
15
  const p = urlParams(params);
16
16
  return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUserGroups.url({})}?${p.toString()}`, method: Endpoints.GetUserGroups.method }));
17
17
  }
18
+ /**
19
+ * This endpoint retrieves a specific user groups.
20
+ * @param id
21
+ * @param params
22
+ * @param config
23
+ */
24
+ static getUserSubscribedGroups(id, params, config) {
25
+ const p = urlParams(params);
26
+ return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetUserSubscribedGroups.url({ id })}?${p.toString()}`, method: Endpoints.GetUserSubscribedGroups.method }));
27
+ }
18
28
  /**
19
29
  * This endpoint performs groups search
20
30
  * @param params
@@ -116,10 +126,12 @@ export class GroupApiClient {
116
126
  /**
117
127
  * This endpoint returns a list of invited users.
118
128
  * @param id
129
+ * @param params
119
130
  * @param config
120
131
  */
121
- static getGroupInvitedUsers(id, config) {
122
- return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetGroupInvitedUsers.url({ id }), method: Endpoints.GetGroupInvitedUsers.method }));
132
+ static getGroupInvitedUsers(id, params, config) {
133
+ const p = urlParams(params);
134
+ return apiRequest(Object.assign(Object.assign({}, config), { url: `${Endpoints.GetGroupInvitedUsers.url({ id })}?${p.toString()}`, method: Endpoints.GetGroupInvitedUsers.method }));
123
135
  }
124
136
  /**
125
137
  * This endpoint subscribes to a group.
@@ -206,6 +218,11 @@ export default class GroupService {
206
218
  return GroupApiClient.getUserGroups(params, config);
207
219
  });
208
220
  }
221
+ static getUserSubscribedGroups(id, params, config) {
222
+ return __awaiter(this, void 0, void 0, function* () {
223
+ return GroupApiClient.getUserSubscribedGroups(id, params, config);
224
+ });
225
+ }
209
226
  static searchGroups(params, config) {
210
227
  return __awaiter(this, void 0, void 0, function* () {
211
228
  return GroupApiClient.searchGroups(params, config);
@@ -261,9 +278,9 @@ export default class GroupService {
261
278
  return GroupApiClient.removeUserFromGroup(id, user, config);
262
279
  });
263
280
  }
264
- static getGroupInvitedUsers(id, config) {
281
+ static getGroupInvitedUsers(id, params, config) {
265
282
  return __awaiter(this, void 0, void 0, function* () {
266
- return GroupApiClient.getGroupInvitedUsers(id, config);
283
+ return GroupApiClient.getGroupInvitedUsers(id, params, config);
267
284
  });
268
285
  }
269
286
  static subscribeToGroup(id, config) {
@@ -29,7 +29,7 @@ export declare class LegalPageApiClient {
29
29
  static getSpecificLegalPage(id: number | string, config?: AxiosRequestConfig): Promise<SCLegalPageType>;
30
30
  /**
31
31
  * This endpoint retrieves all revisions of a legal page.
32
- * @param id
32
+ * @param policy
33
33
  * @param config
34
34
  */
35
35
  static getAllRevisionsOfLegalPage(policy: string, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCLegalPageType>>;
@@ -39,7 +39,7 @@ export declare class LegalPageApiClient {
39
39
  static getAllLastRevisionsOfLegalPages(config?: AxiosRequestConfig): Promise<SCLegalPageType[]>;
40
40
  /**
41
41
  * This endpoint retrieves last revision of a legal page.
42
- * @param id
42
+ * @param policy
43
43
  * @param config
44
44
  */
45
45
  static getLastRevisionOfLegalPage(policy: string, config?: AxiosRequestConfig): Promise<SCLegalPageType>;