@selfcommunity/api-services 0.1.28-alpha.3 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/lib/cjs/services/category/index.d.ts +76 -49
  2. package/lib/cjs/services/category/index.d.ts.map +1 -1
  3. package/lib/cjs/services/category/index.js +91 -65
  4. package/lib/cjs/services/category/index.js.map +1 -1
  5. package/lib/cjs/services/comment/index.d.ts +55 -34
  6. package/lib/cjs/services/comment/index.d.ts.map +1 -1
  7. package/lib/cjs/services/comment/index.js +65 -45
  8. package/lib/cjs/services/comment/index.js.map +1 -1
  9. package/lib/cjs/services/custom_adv/index.d.ts +23 -10
  10. package/lib/cjs/services/custom_adv/index.d.ts.map +1 -1
  11. package/lib/cjs/services/custom_adv/index.js +25 -13
  12. package/lib/cjs/services/custom_adv/index.js.map +1 -1
  13. package/lib/cjs/services/custom_page/index.d.ts +23 -10
  14. package/lib/cjs/services/custom_page/index.d.ts.map +1 -1
  15. package/lib/cjs/services/custom_page/index.js +25 -13
  16. package/lib/cjs/services/custom_page/index.js.map +1 -1
  17. package/lib/cjs/services/data_portability/index.d.ts +22 -9
  18. package/lib/cjs/services/data_portability/index.d.ts.map +1 -1
  19. package/lib/cjs/services/data_portability/index.js +24 -12
  20. package/lib/cjs/services/data_portability/index.js.map +1 -1
  21. package/lib/cjs/services/embed/index.d.ts +43 -25
  22. package/lib/cjs/services/embed/index.d.ts.map +1 -1
  23. package/lib/cjs/services/embed/index.js +50 -33
  24. package/lib/cjs/services/embed/index.js.map +1 -1
  25. package/lib/cjs/services/feature/index.d.ts +14 -3
  26. package/lib/cjs/services/feature/index.d.ts.map +1 -1
  27. package/lib/cjs/services/feature/index.js +14 -4
  28. package/lib/cjs/services/feature/index.js.map +1 -1
  29. package/lib/cjs/services/feed/index.d.ts +32 -17
  30. package/lib/cjs/services/feed/index.d.ts.map +1 -1
  31. package/lib/cjs/services/feed/index.js +36 -22
  32. package/lib/cjs/services/feed/index.js.map +1 -1
  33. package/lib/cjs/services/feed_object/index.d.ts +118 -81
  34. package/lib/cjs/services/feed_object/index.d.ts.map +1 -1
  35. package/lib/cjs/services/feed_object/index.js +143 -107
  36. package/lib/cjs/services/feed_object/index.js.map +1 -1
  37. package/lib/cjs/services/incubator/index.d.ts +39 -22
  38. package/lib/cjs/services/incubator/index.d.ts.map +1 -1
  39. package/lib/cjs/services/incubator/index.js +45 -29
  40. package/lib/cjs/services/incubator/index.js.map +1 -1
  41. package/lib/cjs/services/insight/index.d.ts +35 -19
  42. package/lib/cjs/services/insight/index.d.ts.map +1 -1
  43. package/lib/cjs/services/insight/index.js +40 -25
  44. package/lib/cjs/services/insight/index.js.map +1 -1
  45. package/lib/cjs/services/legal_page/index.d.ts +35 -19
  46. package/lib/cjs/services/legal_page/index.d.ts.map +1 -1
  47. package/lib/cjs/services/legal_page/index.js +40 -25
  48. package/lib/cjs/services/legal_page/index.js.map +1 -1
  49. package/lib/cjs/services/locality/index.d.ts +18 -6
  50. package/lib/cjs/services/locality/index.d.ts.map +1 -1
  51. package/lib/cjs/services/locality/index.js +19 -8
  52. package/lib/cjs/services/locality/index.js.map +1 -1
  53. package/lib/cjs/services/loyalty/index.d.ts +48 -29
  54. package/lib/cjs/services/loyalty/index.d.ts.map +1 -1
  55. package/lib/cjs/services/loyalty/index.js +56 -38
  56. package/lib/cjs/services/loyalty/index.js.map +1 -1
  57. package/lib/cjs/services/media/index.d.ts +42 -22
  58. package/lib/cjs/services/media/index.d.ts.map +1 -1
  59. package/lib/cjs/services/media/index.js +48 -29
  60. package/lib/cjs/services/media/index.js.map +1 -1
  61. package/lib/cjs/services/moderation/index.d.ts +33 -19
  62. package/lib/cjs/services/moderation/index.d.ts.map +1 -1
  63. package/lib/cjs/services/moderation/index.js +40 -27
  64. package/lib/cjs/services/moderation/index.js.map +1 -1
  65. package/lib/cjs/services/notification/index.d.ts +47 -28
  66. package/lib/cjs/services/notification/index.d.ts.map +1 -1
  67. package/lib/cjs/services/notification/index.js +55 -37
  68. package/lib/cjs/services/notification/index.js.map +1 -1
  69. package/lib/cjs/services/preference/index.d.ts +23 -10
  70. package/lib/cjs/services/preference/index.d.ts.map +1 -1
  71. package/lib/cjs/services/preference/index.js +25 -13
  72. package/lib/cjs/services/preference/index.js.map +1 -1
  73. package/lib/cjs/services/private_message/index.d.ts +51 -31
  74. package/lib/cjs/services/private_message/index.d.ts.map +1 -1
  75. package/lib/cjs/services/private_message/index.js +60 -41
  76. package/lib/cjs/services/private_message/index.js.map +1 -1
  77. package/lib/cjs/services/score/index.d.ts +22 -9
  78. package/lib/cjs/services/score/index.d.ts.map +1 -1
  79. package/lib/cjs/services/score/index.js +24 -12
  80. package/lib/cjs/services/score/index.js.map +1 -1
  81. package/lib/cjs/services/sso/index.d.ts +18 -6
  82. package/lib/cjs/services/sso/index.d.ts.map +1 -1
  83. package/lib/cjs/services/sso/index.js +19 -8
  84. package/lib/cjs/services/sso/index.js.map +1 -1
  85. package/lib/cjs/services/suggestion/index.d.ts +26 -12
  86. package/lib/cjs/services/suggestion/index.d.ts.map +1 -1
  87. package/lib/cjs/services/suggestion/index.js +29 -16
  88. package/lib/cjs/services/suggestion/index.js.map +1 -1
  89. package/lib/cjs/services/tag/index.d.ts +39 -22
  90. package/lib/cjs/services/tag/index.d.ts.map +1 -1
  91. package/lib/cjs/services/tag/index.js +45 -29
  92. package/lib/cjs/services/tag/index.js.map +1 -1
  93. package/lib/cjs/services/user/index.d.ts +204 -145
  94. package/lib/cjs/services/user/index.d.ts.map +1 -1
  95. package/lib/cjs/services/user/index.js +259 -201
  96. package/lib/cjs/services/user/index.js.map +1 -1
  97. package/lib/cjs/services/webhook/index.d.ts +59 -37
  98. package/lib/cjs/services/webhook/index.d.ts.map +1 -1
  99. package/lib/cjs/services/webhook/index.js +70 -49
  100. package/lib/cjs/services/webhook/index.js.map +1 -1
  101. package/lib/cjs/utils/apiRequest.d.ts +2 -1
  102. package/lib/cjs/utils/apiRequest.d.ts.map +1 -1
  103. package/lib/cjs/utils/apiRequest.js +4 -8
  104. package/lib/cjs/utils/apiRequest.js.map +1 -1
  105. package/lib/esm/services/category/index.d.ts +76 -49
  106. package/lib/esm/services/category/index.d.ts.map +1 -1
  107. package/lib/esm/services/category/index.js +91 -65
  108. package/lib/esm/services/category/index.js.map +1 -1
  109. package/lib/esm/services/comment/index.d.ts +55 -34
  110. package/lib/esm/services/comment/index.d.ts.map +1 -1
  111. package/lib/esm/services/comment/index.js +65 -45
  112. package/lib/esm/services/comment/index.js.map +1 -1
  113. package/lib/esm/services/custom_adv/index.d.ts +23 -10
  114. package/lib/esm/services/custom_adv/index.d.ts.map +1 -1
  115. package/lib/esm/services/custom_adv/index.js +25 -13
  116. package/lib/esm/services/custom_adv/index.js.map +1 -1
  117. package/lib/esm/services/custom_page/index.d.ts +23 -10
  118. package/lib/esm/services/custom_page/index.d.ts.map +1 -1
  119. package/lib/esm/services/custom_page/index.js +25 -13
  120. package/lib/esm/services/custom_page/index.js.map +1 -1
  121. package/lib/esm/services/data_portability/index.d.ts +22 -9
  122. package/lib/esm/services/data_portability/index.d.ts.map +1 -1
  123. package/lib/esm/services/data_portability/index.js +24 -12
  124. package/lib/esm/services/data_portability/index.js.map +1 -1
  125. package/lib/esm/services/embed/index.d.ts +43 -25
  126. package/lib/esm/services/embed/index.d.ts.map +1 -1
  127. package/lib/esm/services/embed/index.js +50 -33
  128. package/lib/esm/services/embed/index.js.map +1 -1
  129. package/lib/esm/services/feature/index.d.ts +14 -3
  130. package/lib/esm/services/feature/index.d.ts.map +1 -1
  131. package/lib/esm/services/feature/index.js +14 -4
  132. package/lib/esm/services/feature/index.js.map +1 -1
  133. package/lib/esm/services/feed/index.d.ts +32 -17
  134. package/lib/esm/services/feed/index.d.ts.map +1 -1
  135. package/lib/esm/services/feed/index.js +36 -22
  136. package/lib/esm/services/feed/index.js.map +1 -1
  137. package/lib/esm/services/feed_object/index.d.ts +118 -81
  138. package/lib/esm/services/feed_object/index.d.ts.map +1 -1
  139. package/lib/esm/services/feed_object/index.js +143 -107
  140. package/lib/esm/services/feed_object/index.js.map +1 -1
  141. package/lib/esm/services/incubator/index.d.ts +39 -22
  142. package/lib/esm/services/incubator/index.d.ts.map +1 -1
  143. package/lib/esm/services/incubator/index.js +45 -29
  144. package/lib/esm/services/incubator/index.js.map +1 -1
  145. package/lib/esm/services/insight/index.d.ts +35 -19
  146. package/lib/esm/services/insight/index.d.ts.map +1 -1
  147. package/lib/esm/services/insight/index.js +40 -25
  148. package/lib/esm/services/insight/index.js.map +1 -1
  149. package/lib/esm/services/legal_page/index.d.ts +35 -19
  150. package/lib/esm/services/legal_page/index.d.ts.map +1 -1
  151. package/lib/esm/services/legal_page/index.js +40 -25
  152. package/lib/esm/services/legal_page/index.js.map +1 -1
  153. package/lib/esm/services/locality/index.d.ts +18 -6
  154. package/lib/esm/services/locality/index.d.ts.map +1 -1
  155. package/lib/esm/services/locality/index.js +19 -8
  156. package/lib/esm/services/locality/index.js.map +1 -1
  157. package/lib/esm/services/loyalty/index.d.ts +48 -29
  158. package/lib/esm/services/loyalty/index.d.ts.map +1 -1
  159. package/lib/esm/services/loyalty/index.js +56 -38
  160. package/lib/esm/services/loyalty/index.js.map +1 -1
  161. package/lib/esm/services/media/index.d.ts +42 -22
  162. package/lib/esm/services/media/index.d.ts.map +1 -1
  163. package/lib/esm/services/media/index.js +48 -29
  164. package/lib/esm/services/media/index.js.map +1 -1
  165. package/lib/esm/services/moderation/index.d.ts +33 -19
  166. package/lib/esm/services/moderation/index.d.ts.map +1 -1
  167. package/lib/esm/services/moderation/index.js +40 -27
  168. package/lib/esm/services/moderation/index.js.map +1 -1
  169. package/lib/esm/services/notification/index.d.ts +47 -28
  170. package/lib/esm/services/notification/index.d.ts.map +1 -1
  171. package/lib/esm/services/notification/index.js +55 -37
  172. package/lib/esm/services/notification/index.js.map +1 -1
  173. package/lib/esm/services/preference/index.d.ts +23 -10
  174. package/lib/esm/services/preference/index.d.ts.map +1 -1
  175. package/lib/esm/services/preference/index.js +25 -13
  176. package/lib/esm/services/preference/index.js.map +1 -1
  177. package/lib/esm/services/private_message/index.d.ts +51 -31
  178. package/lib/esm/services/private_message/index.d.ts.map +1 -1
  179. package/lib/esm/services/private_message/index.js +60 -41
  180. package/lib/esm/services/private_message/index.js.map +1 -1
  181. package/lib/esm/services/score/index.d.ts +22 -9
  182. package/lib/esm/services/score/index.d.ts.map +1 -1
  183. package/lib/esm/services/score/index.js +24 -12
  184. package/lib/esm/services/score/index.js.map +1 -1
  185. package/lib/esm/services/sso/index.d.ts +18 -6
  186. package/lib/esm/services/sso/index.d.ts.map +1 -1
  187. package/lib/esm/services/sso/index.js +19 -8
  188. package/lib/esm/services/sso/index.js.map +1 -1
  189. package/lib/esm/services/suggestion/index.d.ts +26 -12
  190. package/lib/esm/services/suggestion/index.d.ts.map +1 -1
  191. package/lib/esm/services/suggestion/index.js +29 -16
  192. package/lib/esm/services/suggestion/index.js.map +1 -1
  193. package/lib/esm/services/tag/index.d.ts +39 -22
  194. package/lib/esm/services/tag/index.d.ts.map +1 -1
  195. package/lib/esm/services/tag/index.js +45 -29
  196. package/lib/esm/services/tag/index.js.map +1 -1
  197. package/lib/esm/services/user/index.d.ts +204 -145
  198. package/lib/esm/services/user/index.d.ts.map +1 -1
  199. package/lib/esm/services/user/index.js +259 -201
  200. package/lib/esm/services/user/index.js.map +1 -1
  201. package/lib/esm/services/webhook/index.d.ts +59 -37
  202. package/lib/esm/services/webhook/index.d.ts.map +1 -1
  203. package/lib/esm/services/webhook/index.js +70 -49
  204. package/lib/esm/services/webhook/index.js.map +1 -1
  205. package/lib/esm/utils/apiRequest.d.ts +2 -1
  206. package/lib/esm/utils/apiRequest.d.ts.map +1 -1
  207. package/lib/esm/utils/apiRequest.js +4 -8
  208. package/lib/esm/utils/apiRequest.js.map +1 -1
  209. package/lib/umd/api-services.js +1 -1
  210. package/lib/umd/api-services.js.map +1 -1
  211. package/package.json +4 -4
@@ -15,73 +15,82 @@ import Endpoints from '../../constants/Endpoints';
15
15
  export class LoyaltyApiClient {
16
16
  /**
17
17
  * This endpoint retrieves all prizes.
18
+ * @param config
18
19
  */
19
- static getPrizes() {
20
- return apiRequest(Endpoints.GetPrizes.url({}), Endpoints.GetPrizes.method);
20
+ static getPrizes(config) {
21
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetPrizes.url({}), method: Endpoints.GetPrizes.method }));
21
22
  }
22
23
  /**
23
24
  * This endpoint creates a prize.
24
25
  * @param data
26
+ * @param config
25
27
  */
26
- static createPrize(data) {
27
- return apiRequest(Endpoints.CreatePrize.url({}), Endpoints.CreatePrize.method, data);
28
+ static createPrize(data, config) {
29
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreatePrize.url({}), method: Endpoints.CreatePrize.method, data: data }));
28
30
  }
29
31
  /**
30
32
  * This endpoint retrieves a specific prize
31
33
  * @param id
34
+ * @param config
32
35
  */
33
- static getSpecificPrize(id) {
34
- return apiRequest(Endpoints.GetSpecificPrize.url({ id }), Endpoints.GetSpecificPrize.method);
36
+ static getSpecificPrize(id, config) {
37
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetSpecificPrize.url({ id }), method: Endpoints.GetSpecificPrize.method }));
35
38
  }
36
39
  /**
37
40
  * This endpoint updates a specific prize.
38
41
  * @param id
39
42
  * @param data
43
+ * @param config
40
44
  */
41
- static updatePrize(id, data) {
42
- return apiRequest(Endpoints.UpdatePrize.url({ id }), Endpoints.UpdatePrize.method, data);
45
+ static updatePrize(id, data, config) {
46
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.UpdatePrize.url({ id }), method: Endpoints.UpdatePrize.method, data: data }));
43
47
  }
44
48
  /**
45
49
  * This endpoint patches a specific prize.
46
50
  * @param id
47
51
  * @param data
52
+ * @param config
48
53
  */
49
- static patchPrize(id, data) {
50
- return apiRequest(Endpoints.PatchPrize.url({ id }), Endpoints.PatchPrize.method, data);
54
+ static patchPrize(id, data, config) {
55
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.PatchPrize.url({ id }), method: Endpoints.PatchPrize.method, data: data }));
51
56
  }
52
57
  /**
53
58
  * This endpoint retrieves all requests of loyalty prizes.
59
+ * @param config
54
60
  */
55
- static getAllPrizeRequests() {
56
- return apiRequest(Endpoints.GetPrizeRequests.url({}), Endpoints.GetPrizeRequests.method);
61
+ static getAllPrizeRequests(config) {
62
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetPrizeRequests.url({}), method: Endpoints.GetPrizeRequests.method }));
57
63
  }
58
64
  /**
59
65
  * This endpoint creates a request for a loyalty prize
60
66
  * @param prize
67
+ * @param config
61
68
  */
62
- static createPrizeRequest(prize) {
63
- return apiRequest(Endpoints.CreatePrizeRequest.url({}), Endpoints.CreatePrizeRequest.method, { prize: prize });
69
+ static createPrizeRequest(prize, config) {
70
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.CreatePrizeRequest.url({}), method: Endpoints.CreatePrizeRequest.method, data: { prize: prize } }));
64
71
  }
65
72
  /**
66
73
  * This endpoint retrieves a specific request for a loyalty prize.
67
74
  * @param id
75
+ * @param config
68
76
  */
69
- static getSpecificPrizeRequest(id) {
70
- return apiRequest(Endpoints.GetSpecificPrizeRequest.url({ id }), Endpoints.GetSpecificPrizeRequest.method);
77
+ static getSpecificPrizeRequest(id, config) {
78
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetSpecificPrizeRequest.url({ id }), method: Endpoints.GetSpecificPrizeRequest.method }));
71
79
  }
72
80
  /**
73
81
  * This endpoint patches a specific request for a loyalty prize.
74
- * You can use this endpoint to to change status in an admin list/table interface.
82
+ * You can use this endpoint to change status in an admin list/table interface.
75
83
  * @param id
76
84
  * @param status
85
+ * @param config
77
86
  */
78
- static patchPrizeRequest(id, status) {
79
- return apiRequest(Endpoints.PatchPrizeRequest.url({ id }), Endpoints.PatchPrizeRequest.method, { status: status });
87
+ static patchPrizeRequest(id, status, config) {
88
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.PatchPrizeRequest.url({ id }), method: Endpoints.PatchPrizeRequest.method, data: { status: status } }));
80
89
  }
81
90
  }
82
91
  /**
83
92
  *
84
- :::tipLoyalty service can be used in the following ways:
93
+ :::tipLoyalty service can be used in the following way:
85
94
 
86
95
  ```jsx
87
96
  1. Import the service from our library:
@@ -103,52 +112,61 @@ export class LoyaltyApiClient {
103
112
  return await LoyaltyService.getSpecificPrize(prizeId);
104
113
  }
105
114
  ```
115
+ ```jsx
116
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
117
+
118
+ 1. Declare it(or declare them, it is possible to add multiple params)
119
+
120
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
121
+
122
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
123
+ ```
106
124
  :::
107
125
  */
108
126
  export default class LoyaltyService {
109
- static getPrizes() {
127
+ static getPrizes(config) {
110
128
  return __awaiter(this, void 0, void 0, function* () {
111
- return LoyaltyApiClient.getPrizes();
129
+ return LoyaltyApiClient.getPrizes(config);
112
130
  });
113
131
  }
114
- static createPrize(data) {
132
+ static createPrize(data, config) {
115
133
  return __awaiter(this, void 0, void 0, function* () {
116
- return LoyaltyApiClient.createPrize(data);
134
+ return LoyaltyApiClient.createPrize(data, config);
117
135
  });
118
136
  }
119
- static getSpecificPrize(id) {
137
+ static getSpecificPrize(id, config) {
120
138
  return __awaiter(this, void 0, void 0, function* () {
121
- return LoyaltyApiClient.getSpecificPrize(id);
139
+ return LoyaltyApiClient.getSpecificPrize(id, config);
122
140
  });
123
141
  }
124
- static updatePrize(id, data) {
142
+ static updatePrize(id, data, config) {
125
143
  return __awaiter(this, void 0, void 0, function* () {
126
- return LoyaltyApiClient.updatePrize(id, data);
144
+ return LoyaltyApiClient.updatePrize(id, data, config);
127
145
  });
128
146
  }
129
- static patchPrize(id, data) {
147
+ static patchPrize(id, data, config) {
130
148
  return __awaiter(this, void 0, void 0, function* () {
131
- return LoyaltyApiClient.patchPrize(id, data);
149
+ return LoyaltyApiClient.patchPrize(id, data, config);
132
150
  });
133
151
  }
134
- static getAllPrizeRequests() {
152
+ static getAllPrizeRequests(config) {
135
153
  return __awaiter(this, void 0, void 0, function* () {
136
- return LoyaltyApiClient.getAllPrizeRequests();
154
+ return LoyaltyApiClient.getAllPrizeRequests(config);
137
155
  });
138
156
  }
139
- static createPrizeRequest(prize) {
157
+ static createPrizeRequest(prize, config) {
140
158
  return __awaiter(this, void 0, void 0, function* () {
141
- return LoyaltyApiClient.createPrizeRequest(prize);
159
+ return LoyaltyApiClient.createPrizeRequest(prize, config);
142
160
  });
143
161
  }
144
- static getSpecificPrizeRequest(id) {
162
+ static getSpecificPrizeRequest(id, config) {
145
163
  return __awaiter(this, void 0, void 0, function* () {
146
- return LoyaltyApiClient.getSpecificPrizeRequest(id);
164
+ return LoyaltyApiClient.getSpecificPrizeRequest(id, config);
147
165
  });
148
166
  }
149
- static patchPrizeRequest(id, status) {
167
+ static patchPrizeRequest(id, status, config) {
150
168
  return __awaiter(this, void 0, void 0, function* () {
151
- return LoyaltyApiClient.patchPrizeRequest(id, status);
169
+ return LoyaltyApiClient.patchPrizeRequest(id, status, config);
152
170
  });
153
171
  }
154
172
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/loyalty/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAelD;;GAEG;AAEH,MAAM,OAAO,gBAAgB;IAC3B;;OAEG;IACH,MAAM,CAAC,SAAS;QACd,OAAO,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7E,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,IAAwB;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AAC,CAAC;QACvD,CAAC;KAAA;IAED,MAAM,CAAO,mBAAmB,CAAC,MAA2B;;YAC1D,OAAO,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACtD,CAAC;KAAA;IAED,MAAM,CAAO,kBAAkB,CAAC,KAAa,EAAE,MAA2B;;YACxE,OAAO,gBAAgB,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC5D,CAAC;KAAA;IAED,MAAM,CAAO,uBAAuB,CAAC,EAAU,EAAE,MAA2B;;YAC1E,OAAO,gBAAgB,CAAC,uBAAuB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAC9D,CAAC;KAAA;IACD,MAAM,CAAO,iBAAiB,CAAC,EAAU,EAAE,MAA8B,EAAE,MAA2B;;YACpG,OAAO,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAChE,CAAC;KAAA;CACF"}
@@ -1,13 +1,14 @@
1
1
  import { SCChunkMediaType, SCMediaType } from '@selfcommunity/types';
2
2
  import { ChunkUploadCompleteParams, ChunkUploadParams, MediaCreateParams } from '../../types';
3
+ import { AxiosRequestConfig } from 'axios';
3
4
  export interface MediaApiClientInterface {
4
- chunkUploadMedia(data: ChunkUploadParams): Promise<SCChunkMediaType>;
5
- chunkUploadMediaComplete(data: ChunkUploadCompleteParams): Promise<SCMediaType>;
6
- createMedia(data: MediaCreateParams): Promise<SCMediaType>;
7
- clickMedia(id: number, ip?: string): Promise<any>;
8
- getSpecificMedia(id: number): Promise<SCMediaType>;
9
- updateMedia(id: number, image: string): Promise<SCMediaType>;
10
- deleteMedia(id: number): Promise<any>;
5
+ chunkUploadMedia(data: ChunkUploadParams, bytesStart: number, bytesEnd: number, bytesTotal: number, config?: AxiosRequestConfig): Promise<SCChunkMediaType>;
6
+ chunkUploadMediaComplete(data: ChunkUploadCompleteParams, config?: AxiosRequestConfig): Promise<SCMediaType>;
7
+ createMedia(data: MediaCreateParams, config?: AxiosRequestConfig): Promise<SCMediaType>;
8
+ clickMedia(id: number, ip?: string, config?: AxiosRequestConfig): Promise<any>;
9
+ getSpecificMedia(id: number, config?: AxiosRequestConfig): Promise<SCMediaType>;
10
+ updateMedia(id: number, image: string, config?: AxiosRequestConfig): Promise<SCMediaType>;
11
+ deleteMedia(id: number, config?: AxiosRequestConfig): Promise<any>;
11
12
  }
12
13
  /**
13
14
  * Contains all the endpoints needed to manage medias.
@@ -16,42 +17,52 @@ export declare class MediaApiClient {
16
17
  /**
17
18
  * This endpoint performs the chunk upload of a media with type image or document.
18
19
  * The client must split the file into chunks and send to the server in series. After all the chunks have been uploaded the client must call the Chunk Upload Complete endpoint with the given upload_id parameter to finalize the upload and retrieve the Media.
19
- * To perform chunk upload the request must contain Content-Range header with the information about the chunk.
20
+ * To perform chunk upload the request must contain Content-Range header with the information about the chunk(range of the chunk upload in the format bytes start-end/total)
20
21
  * @param data
22
+ * @param bytesStart
23
+ * @param bytesEnd
24
+ * @param bytesTotal
25
+ * @param config
21
26
  */
22
- static chunkUploadMedia(data: ChunkUploadParams): Promise<SCChunkMediaType>;
27
+ static chunkUploadMedia(data: ChunkUploadParams, bytesStart: number, bytesEnd: number, bytesTotal: number, config?: AxiosRequestConfig): Promise<SCChunkMediaType>;
23
28
  /**
24
29
  * This endpoint completes the chunk upload and create the media.
25
30
  * @param data
31
+ * @param config
26
32
  */
27
- static chunkUploadMediaComplete(data: ChunkUploadCompleteParams): Promise<SCMediaType>;
33
+ static chunkUploadMediaComplete(data: ChunkUploadCompleteParams, config?: AxiosRequestConfig): Promise<SCMediaType>;
28
34
  /**
29
35
  * This endpoint creates a media.
30
36
  * @param data
37
+ * @param config
31
38
  */
32
- static createMedia(data: MediaCreateParams): Promise<SCMediaType>;
39
+ static createMedia(data: MediaCreateParams, config?: AxiosRequestConfig): Promise<SCMediaType>;
33
40
  /**
34
41
  * This endpoint saves a click on a specific media using ID.
35
42
  * @param id
36
43
  * @param ip
44
+ * @param config
37
45
  */
38
- static clickMedia(id: number, ip?: string): Promise<any>;
46
+ static clickMedia(id: number, ip?: string, config?: AxiosRequestConfig): Promise<any>;
39
47
  /**
40
48
  * This endpoint retrieves a specific media using ID.
41
49
  * @param id
50
+ * @param config
42
51
  */
43
- static getSpecificMedia(id: number): Promise<SCMediaType>;
52
+ static getSpecificMedia(id: number, config?: AxiosRequestConfig): Promise<SCMediaType>;
44
53
  /**
45
54
  * This endpoint updates a media.
46
55
  * @param id
47
56
  * @param image
57
+ * @param config
48
58
  */
49
- static updateMedia(id: number, image: string): Promise<SCMediaType>;
59
+ static updateMedia(id: number, image: string, config?: AxiosRequestConfig): Promise<SCMediaType>;
50
60
  /**
51
61
  * This endpoint deletes a media.
52
62
  * @param id
63
+ * @param config
53
64
  */
54
- static deleteMedia(id: number): Promise<any>;
65
+ static deleteMedia(id: number, config?: AxiosRequestConfig): Promise<any>;
55
66
  }
56
67
  /**
57
68
  *
@@ -71,15 +82,24 @@ export declare class MediaApiClient {
71
82
  return await MediaService.createMedia(body);
72
83
  }
73
84
  ```
85
+ ```jsx
86
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
87
+
88
+ 1. Declare it(or declare them, it is possible to add multiple params)
89
+
90
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
91
+
92
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
93
+ ```
74
94
  :::
75
95
  */
76
96
  export default class MediaService {
77
- static chunkUploadMedia(data: ChunkUploadParams): Promise<SCChunkMediaType>;
78
- static chunkUploadMediaComplete(data: ChunkUploadCompleteParams): Promise<SCMediaType>;
79
- static createMedia(data: MediaCreateParams): Promise<SCMediaType>;
80
- static clickMedia(id: number, ip?: string): Promise<any>;
81
- static getSpecificMedia(id: number): Promise<SCMediaType>;
82
- static updateMedia(id: number, image: string): Promise<SCMediaType>;
83
- static deleteMedia(id: number): Promise<any>;
97
+ static chunkUploadMedia(data: ChunkUploadParams, bytesStart: number, bytesEnd: number, bytesTotal: number, config?: AxiosRequestConfig): Promise<SCChunkMediaType>;
98
+ static chunkUploadMediaComplete(data: ChunkUploadCompleteParams, config?: AxiosRequestConfig): Promise<SCMediaType>;
99
+ static createMedia(data: MediaCreateParams, config?: AxiosRequestConfig): Promise<SCMediaType>;
100
+ static clickMedia(id: number, ip?: string, config?: AxiosRequestConfig): Promise<any>;
101
+ static getSpecificMedia(id: number, config?: AxiosRequestConfig): Promise<SCMediaType>;
102
+ static updateMedia(id: number, image: string, config?: AxiosRequestConfig): Promise<SCMediaType>;
103
+ static deleteMedia(id: number, config?: AxiosRequestConfig): Promise<any>;
84
104
  }
85
105
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/media/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAE5F,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrE,wBAAwB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChF,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC3D,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAClD,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7D,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OA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;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;WAClB,gBAAgB,CAC3B,IAAI,EAAE,iBAAiB,EACvB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;WAIf,wBAAwB,CAAC,IAAI,EAAE,yBAAyB,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;WAI5G,WAAW,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;WAIvF,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;WAI9E,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;WAI/E,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;WAIzF,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;CAGhF"}
@@ -16,56 +16,66 @@ export class MediaApiClient {
16
16
  /**
17
17
  * This endpoint performs the chunk upload of a media with type image or document.
18
18
  * The client must split the file into chunks and send to the server in series. After all the chunks have been uploaded the client must call the Chunk Upload Complete endpoint with the given upload_id parameter to finalize the upload and retrieve the Media.
19
- * To perform chunk upload the request must contain Content-Range header with the information about the chunk.
19
+ * To perform chunk upload the request must contain Content-Range header with the information about the chunk(range of the chunk upload in the format bytes start-end/total)
20
20
  * @param data
21
+ * @param bytesStart
22
+ * @param bytesEnd
23
+ * @param bytesTotal
24
+ * @param config
21
25
  */
22
- static chunkUploadMedia(data) {
23
- return apiRequest(Endpoints.ComposerChunkUploadMedia.url({}), Endpoints.ComposerChunkUploadMedia.method, data);
26
+ static chunkUploadMedia(data, bytesStart, bytesEnd, bytesTotal, config) {
27
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.ComposerChunkUploadMedia.url({}), method: Endpoints.ComposerChunkUploadMedia.method, data: data, headers: { 'Content-Range': `bytes ${bytesStart}-${bytesEnd}/${bytesTotal}` } }));
24
28
  }
25
29
  /**
26
30
  * This endpoint completes the chunk upload and create the media.
27
31
  * @param data
32
+ * @param config
28
33
  */
29
- static chunkUploadMediaComplete(data) {
30
- return apiRequest(Endpoints.ComposerChunkUploadMediaComplete.url({}), Endpoints.ComposerChunkUploadMediaComplete.method, data);
34
+ static chunkUploadMediaComplete(data, config) {
35
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.ComposerChunkUploadMediaComplete.url({}), method: Endpoints.ComposerChunkUploadMediaComplete.method, data: data }));
31
36
  }
32
37
  /**
33
38
  * This endpoint creates a media.
34
39
  * @param data
40
+ * @param config
35
41
  */
36
- static createMedia(data) {
37
- return apiRequest(Endpoints.ComposerMediaCreate.url({}), Endpoints.ComposerMediaCreate.method, data);
42
+ static createMedia(data, config) {
43
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.ComposerMediaCreate.url({}), method: Endpoints.ComposerMediaCreate.method, data: data }));
38
44
  }
39
45
  /**
40
46
  * This endpoint saves a click on a specific media using ID.
41
47
  * @param id
42
48
  * @param ip
49
+ * @param config
43
50
  */
44
- static clickMedia(id, ip) {
51
+ static clickMedia(id, ip, config) {
45
52
  var _a;
46
- return apiRequest(Endpoints.MediaClickTracker.url({ id }), Endpoints.MediaClickTracker.method, (_a = { ip: ip }) !== null && _a !== void 0 ? _a : null);
53
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.MediaClickTracker.url({ id }), method: Endpoints.MediaClickTracker.method, data: (_a = { ip: ip }) !== null && _a !== void 0 ? _a : null }));
47
54
  }
48
55
  /**
49
56
  * This endpoint retrieves a specific media using ID.
50
57
  * @param id
58
+ * @param config
51
59
  */
52
- static getSpecificMedia(id) {
53
- return apiRequest(Endpoints.GetMedia.url({ id }), Endpoints.GetMedia.method);
60
+ static getSpecificMedia(id, config) {
61
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.GetMedia.url({ id }), method: Endpoints.GetMedia.method }));
54
62
  }
55
63
  /**
56
64
  * This endpoint updates a media.
57
65
  * @param id
58
66
  * @param image
67
+ * @param config
59
68
  */
60
- static updateMedia(id, image) {
61
- return apiRequest(Endpoints.UpdateMedia.url({ id }), Endpoints.UpdateMedia.method, { image: image });
69
+ static updateMedia(id, image, config) {
70
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.UpdateMedia.url({ id }), method: Endpoints.UpdateMedia.method, data: { image: image } }));
62
71
  }
63
72
  /**
64
73
  * This endpoint deletes a media.
65
74
  * @param id
75
+ * @param config
66
76
  */
67
- static deleteMedia(id) {
68
- return apiRequest(Endpoints.DeleteMedia.url({ id }), Endpoints.DeleteMedia.method);
77
+ static deleteMedia(id, config) {
78
+ return apiRequest(Object.assign(Object.assign({}, config), { url: Endpoints.DeleteMedia.url({ id }), method: Endpoints.DeleteMedia.method }));
69
79
  }
70
80
  }
71
81
  /**
@@ -86,42 +96,51 @@ export class MediaApiClient {
86
96
  return await MediaService.createMedia(body);
87
97
  }
88
98
  ```
99
+ ```jsx
100
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
101
+
102
+ 1. Declare it(or declare them, it is possible to add multiple params)
103
+
104
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
105
+
106
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
107
+ ```
89
108
  :::
90
109
  */
91
110
  export default class MediaService {
92
- static chunkUploadMedia(data) {
111
+ static chunkUploadMedia(data, bytesStart, bytesEnd, bytesTotal, config) {
93
112
  return __awaiter(this, void 0, void 0, function* () {
94
- return MediaApiClient.chunkUploadMedia(data);
113
+ return MediaApiClient.chunkUploadMedia(data, bytesStart, bytesEnd, bytesTotal, config);
95
114
  });
96
115
  }
97
- static chunkUploadMediaComplete(data) {
116
+ static chunkUploadMediaComplete(data, config) {
98
117
  return __awaiter(this, void 0, void 0, function* () {
99
- return MediaApiClient.chunkUploadMediaComplete(data);
118
+ return MediaApiClient.chunkUploadMediaComplete(data, config);
100
119
  });
101
120
  }
102
- static createMedia(data) {
121
+ static createMedia(data, config) {
103
122
  return __awaiter(this, void 0, void 0, function* () {
104
- return MediaApiClient.createMedia(data);
123
+ return MediaApiClient.createMedia(data, config);
105
124
  });
106
125
  }
107
- static clickMedia(id, ip) {
126
+ static clickMedia(id, ip, config) {
108
127
  return __awaiter(this, void 0, void 0, function* () {
109
- return MediaApiClient.clickMedia(id, ip);
128
+ return MediaApiClient.clickMedia(id, ip, config);
110
129
  });
111
130
  }
112
- static getSpecificMedia(id) {
131
+ static getSpecificMedia(id, config) {
113
132
  return __awaiter(this, void 0, void 0, function* () {
114
- return MediaApiClient.getSpecificMedia(id);
133
+ return MediaApiClient.getSpecificMedia(id, config);
115
134
  });
116
135
  }
117
- static updateMedia(id, image) {
136
+ static updateMedia(id, image, config) {
118
137
  return __awaiter(this, void 0, void 0, function* () {
119
- return MediaApiClient.updateMedia(id, image);
138
+ return MediaApiClient.updateMedia(id, image, config);
120
139
  });
121
140
  }
122
- static deleteMedia(id) {
141
+ static deleteMedia(id, config) {
123
142
  return __awaiter(this, void 0, void 0, function* () {
124
- return MediaApiClient.deleteMedia(id);
143
+ return MediaApiClient.deleteMedia(id, config);
125
144
  });
126
145
  }
127
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/media/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,SAAS,MAA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AO,cAAc,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACzF,CAAC;KAAA;IAED,MAAM,CAAO,wBAAwB,CAAC,IAA+B,EAAE,MAA2B;;YAChG,OAAO,cAAc,CAAC,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC;KAAA;IAED,MAAM,CAAO,WAAW,CAAC,IAAuB,EAAE,MAA2B;;YAC3E,OAAO,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;KAAA;IAED,MAAM,CAAO,UAAU,CAAC,EAAU,EAAE,EAAW,EAAE,MAA2B;;YAC1E,OAAO,cAAc,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QACnD,CAAC;KAAA;IAED,MAAM,CAAO,gBAAgB,CAAC,EAAU,EAAE,MAA2B;;YACnE,OAAO,cAAc,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QACrD,CAAC;KAAA;IAED,MAAM,CAAO,WAAW,CAAC,EAAU,EAAE,KAAa,EAAE,MAA2B;;YAC7E,OAAO,cAAc,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACvD,CAAC;KAAA;IAED,MAAM,CAAO,WAAW,CAAC,EAAU,EAAE,MAA2B;;YAC9D,OAAO,cAAc,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAChD,CAAC;KAAA;CACF"}
@@ -1,13 +1,14 @@
1
1
  import { SCUserModerationType, SCUserStatus, SCFlaggedContributionType, SCFlagType, SCFlagTypeEnum, SCContributionType } from '@selfcommunity/types';
2
2
  import { ModerateContributionParams, SCPaginatedResponse } from '../../types';
3
3
  import { SCContributionStatus } from '@selfcommunity/types';
4
+ import { AxiosRequestConfig } from 'axios';
4
5
  export interface ModerationApiClientInterface {
5
- getUsersForModeration(): Promise<SCPaginatedResponse<SCUserModerationType>>;
6
- moderateASpecificUser(id: number, status: SCUserStatus): Promise<any>;
7
- getAllFlaggedContributions(): Promise<SCPaginatedResponse<SCFlaggedContributionType>>;
8
- getAllFlagsForSpecificContribution(id: number, contribution_type: SCContributionType, flag_type?: SCFlagTypeEnum): Promise<SCPaginatedResponse<SCFlagType>>;
9
- moderateAContribution(id: number, data: ModerateContributionParams): Promise<any>;
10
- getContributionModerationStatus(id: number, contribution_type: SCContributionType): Promise<SCContributionStatus>;
6
+ getUsersForModeration(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserModerationType>>;
7
+ moderateASpecificUser(id: number, status: SCUserStatus, config?: AxiosRequestConfig): Promise<any>;
8
+ getAllFlaggedContributions(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlaggedContributionType>>;
9
+ getAllFlagsForSpecificContribution(id: number, contribution_type: SCContributionType, flag_type?: SCFlagTypeEnum, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
10
+ moderateAContribution(id: number, data: ModerateContributionParams, config?: AxiosRequestConfig): Promise<any>;
11
+ getContributionModerationStatus(id: number, contribution_type: SCContributionType, config?: AxiosRequestConfig): Promise<SCContributionStatus>;
11
12
  }
12
13
  /**
13
14
  * Contains all the endpoints needed to manage moderation.
@@ -16,40 +17,44 @@ export declare class ModerationApiClient {
16
17
  /**
17
18
  * This endpoint retrieves all users for moderation purpose.
18
19
  */
19
- static getUsersForModeration(): Promise<SCPaginatedResponse<SCUserModerationType>>;
20
+ static getUsersForModeration(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserModerationType>>;
20
21
  /**
21
22
  * This endpoint performs users moderation.
22
23
  * @param id
23
24
  * @param status
25
+ * @param config
24
26
  */
25
- static moderateASpecificUser(id: number, status: SCUserStatus): Promise<any>;
27
+ static moderateASpecificUser(id: number, status: SCUserStatus, config?: AxiosRequestConfig): Promise<any>;
26
28
  /**
27
29
  * This endpoint retrieves all flagged contributions.
28
30
  */
29
- static getAllFlaggedContributions(): Promise<SCPaginatedResponse<SCFlaggedContributionType>>;
31
+ static getAllFlaggedContributions(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlaggedContributionType>>;
30
32
  /**
31
33
  * This endpoint retrieves all flags for a specific contribution.
32
34
  * @param id
33
35
  * @param contribution_type
34
36
  * @param flag_type
37
+ * @param config
35
38
  */
36
- static getAllFlagsForSpecificContribution(id: number, contribution_type: SCContributionType, flag_type?: SCFlagTypeEnum): Promise<SCPaginatedResponse<SCFlagType>>;
39
+ static getAllFlagsForSpecificContribution(id: number, contribution_type: SCContributionType, flag_type?: SCFlagTypeEnum, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
37
40
  /**
38
41
  * This endpoint provides actions for flagged contributions moderation.
39
42
  * @param id
40
43
  * @param data
44
+ * @param config
41
45
  */
42
- static moderateAContribution(id: number, data: ModerateContributionParams): Promise<any>;
46
+ static moderateAContribution(id: number, data: ModerateContributionParams, config?: AxiosRequestConfig): Promise<any>;
43
47
  /**
44
48
  * This endpoint retrieves moderation status for a specific contribution.
45
49
  * @param id
46
50
  * @param contribution_type
51
+ * @param config
47
52
  */
48
- static getContributionModerationStatus(id: number, contribution_type: SCContributionType): Promise<SCContributionStatus>;
53
+ static getContributionModerationStatus(id: number, contribution_type: SCContributionType, config?: AxiosRequestConfig): Promise<SCContributionStatus>;
49
54
  }
50
55
  /**
51
56
  *
52
- :::tipModeration service can be used in the following ways:
57
+ :::tipModeration service can be used in the following way:
53
58
 
54
59
  ```jsx
55
60
  1. Import the service from our library:
@@ -71,14 +76,23 @@ export declare class ModerationApiClient {
71
76
  return await ModerationService.moderateASpecificUser(userId, userStatus);
72
77
  }
73
78
  ```
79
+ ```jsx
80
+ If you need to customize the request, you can add optional config params (`AxiosRequestConfig` type).
81
+
82
+ 1. Declare it(or declare them, it is possible to add multiple params)
83
+
84
+ const headers = headers: {Authorization: `Bearer ${yourToken}`}
85
+
86
+ 2. Add it inside the brackets and pass it to the function, as shown in the previous example!
87
+ ```
74
88
  :::
75
89
  */
76
90
  export default class ModerationService {
77
- static getUsersForModeration(): Promise<SCPaginatedResponse<SCUserModerationType>>;
78
- static moderateASpecificUser(id: number, status: SCUserStatus): Promise<any>;
79
- static getAllFlaggedContributions(): Promise<SCPaginatedResponse<SCFlaggedContributionType>>;
80
- static getAllFlagsForSpecificContribution(id: number, contribution_type: SCContributionType, flag_type?: SCFlagTypeEnum): Promise<SCPaginatedResponse<SCFlagType>>;
81
- static moderateAContribution(id: number, data: ModerateContributionParams): Promise<any>;
82
- static getContributionModerationStatus(id: number, contribution_type: SCContributionType): Promise<SCContributionStatus>;
91
+ static getUsersForModeration(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCUserModerationType>>;
92
+ static moderateASpecificUser(id: number, status: SCUserStatus, config?: AxiosRequestConfig): Promise<any>;
93
+ static getAllFlaggedContributions(config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlaggedContributionType>>;
94
+ static getAllFlagsForSpecificContribution(id: number, contribution_type: SCContributionType, flag_type?: SCFlagTypeEnum, config?: AxiosRequestConfig): Promise<SCPaginatedResponse<SCFlagType>>;
95
+ static moderateAContribution(id: number, data: ModerateContributionParams, config?: AxiosRequestConfig): Promise<any>;
96
+ static getContributionModerationStatus(id: number, contribution_type: SCContributionType, config?: AxiosRequestConfig): Promise<SCContributionStatus>;
83
97
  }
84
98
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/moderation/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,oBAAoB,EAAE,YAAY,EAAE,yBAAyB,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACnJ,OAAO,EAAC,0BAA0B,EAAE,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAC,oBAAoB,EAAC,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