|
1 |
| -import { |
2 |
| - discussionsApiRequest, |
3 |
| - discussionsApiRequestV2, |
| 1 | +export { |
| 2 | + searchChannels, |
| 3 | + searchChannelsV2, |
| 4 | + createChannel, |
| 5 | + fetchChannel, |
| 6 | + updateChannel, |
| 7 | + removeChannel, |
| 8 | + fetchChannelNotifcationOptOut, |
| 9 | + createChannelNotificationOptOut, |
| 10 | + removeChannelNotificationOptOut, |
| 11 | + removeChannelActivity, |
| 12 | + createChannelV2, |
| 13 | + fetchChannelV2, |
| 14 | + updateChannelV2, |
| 15 | + removeChannelV2, |
| 16 | + fetchChannelNotifcationOptOutV2, |
| 17 | + createChannelNotificationOptOutV2, |
| 18 | + removeChannelNotificationOptOutV2, |
| 19 | + removeChannelActivityV2, |
4 | 20 | } from "@esri/hub-common";
|
5 |
| -import { |
6 |
| - ICreateChannelParams, |
7 |
| - ICreateChannelParamsV2, |
8 |
| - IFetchChannelParams, |
9 |
| - IUpdateChannelParams, |
10 |
| - IUpdateChannelParamsV2, |
11 |
| - IRemoveChannelParams, |
12 |
| - IChannel, |
13 |
| - IRemoveChannelResponse, |
14 |
| - IFetchChannelNotificationOptOutParams, |
15 |
| - ICreateChannelNotificationOptOutParams, |
16 |
| - IRemoveChannelNotificationOptOutParams, |
17 |
| - IRemoveChannelActivityParams, |
18 |
| - IRemoveChannelNotificationOptOutResult, |
19 |
| - IRemoveChannelActivityResult, |
20 |
| - IChannelNotificationOptOut, |
21 |
| -} from "../types"; |
22 |
| - |
23 |
| -export { searchChannels, searchChannelsV2 } from "@esri/hub-common"; |
24 |
| - |
25 |
| -/** |
26 |
| - * create channel |
27 |
| - * |
28 |
| - * @deprecated replace with createChannelV2 for v2 discussions |
29 |
| - * @export |
30 |
| - * @param {ICreateChannelParams} options |
31 |
| - * @return {*} {Promise<IChannel>} |
32 |
| - */ |
33 |
| -export function createChannel( |
34 |
| - options: ICreateChannelParams |
35 |
| -): Promise<IChannel> { |
36 |
| - options.httpMethod = "POST"; |
37 |
| - return discussionsApiRequest(`/channels`, options); |
38 |
| -} |
39 |
| - |
40 |
| -/** |
41 |
| - * fetch channel |
42 |
| - * |
43 |
| - * @deprecated replace with fetchChannelV2 for v2 discussions |
44 |
| - * @export |
45 |
| - * @param {IFetchChannelParams} options |
46 |
| - * @return {*} {Promise<IChannel>} |
47 |
| - */ |
48 |
| -export function fetchChannel(options: IFetchChannelParams): Promise<IChannel> { |
49 |
| - options.httpMethod = "GET"; |
50 |
| - return discussionsApiRequest(`/channels/${options.channelId}`, options); |
51 |
| -} |
52 |
| - |
53 |
| -/** |
54 |
| - * update channel |
55 |
| - * |
56 |
| - * @deprecated replace with updateChannelV2 for v2 discussions |
57 |
| - * @export |
58 |
| - * @param {IUpdateChannelParams} options |
59 |
| - * @return {*} {Promise<IChannel>} |
60 |
| - */ |
61 |
| -export function updateChannel( |
62 |
| - options: IUpdateChannelParams |
63 |
| -): Promise<IChannel> { |
64 |
| - options.httpMethod = "PATCH"; |
65 |
| - return discussionsApiRequest(`/channels/${options.channelId}`, options); |
66 |
| -} |
67 |
| - |
68 |
| -/** |
69 |
| - * remove channel |
70 |
| - * |
71 |
| - * @deprecated replace with removeChannelV2 for v2 discussions |
72 |
| - * @export |
73 |
| - * @param {IRemoveChannelParams} options |
74 |
| - * @return {*} |
75 |
| - */ |
76 |
| -export function removeChannel( |
77 |
| - options: IRemoveChannelParams |
78 |
| -): Promise<IRemoveChannelResponse> { |
79 |
| - options.httpMethod = "DELETE"; |
80 |
| - return discussionsApiRequest(`/channels/${options.channelId}`, options); |
81 |
| -} |
82 |
| - |
83 |
| -/** |
84 |
| - * get channel opt out status |
85 |
| - * |
86 |
| - * @deprecated replace with fetchChannelNotifcationOptOutV2 for v2 discussions |
87 |
| - * @export |
88 |
| - * @param {IFetchChannelNotificationOptOutParams} options |
89 |
| - * @return {*} |
90 |
| - */ |
91 |
| -export function fetchChannelNotifcationOptOut( |
92 |
| - options: IFetchChannelNotificationOptOutParams |
93 |
| -): Promise<IChannelNotificationOptOut> { |
94 |
| - options.httpMethod = "GET"; |
95 |
| - return discussionsApiRequest( |
96 |
| - `/channels/${options.channelId}/notifications/opt-out`, |
97 |
| - options |
98 |
| - ); |
99 |
| -} |
100 |
| - |
101 |
| -/** |
102 |
| - * opt out of channel notifs |
103 |
| - * |
104 |
| - * @deprecated replace with createChannelNotificationOptOutV2 for v2 discussions |
105 |
| - * @export |
106 |
| - * @param {ICreateChannelNotificationOptOutParams} options |
107 |
| - * @return {*} |
108 |
| - */ |
109 |
| -export function createChannelNotificationOptOut( |
110 |
| - options: ICreateChannelNotificationOptOutParams |
111 |
| -): Promise<IChannelNotificationOptOut> { |
112 |
| - options.httpMethod = "POST"; |
113 |
| - return discussionsApiRequest( |
114 |
| - `/channels/${options.channelId}/notifications/opt-out`, |
115 |
| - options |
116 |
| - ); |
117 |
| -} |
118 |
| - |
119 |
| -/** |
120 |
| - * remove channel notifs |
121 |
| - * |
122 |
| - * @deprecated replace with removeChannelNotificationOptOutV2 for v2 discussions |
123 |
| - * @export |
124 |
| - * @param {IRemoveChannelNotificationOptOutParams} options |
125 |
| - * @return {*} |
126 |
| - */ |
127 |
| -export function removeChannelNotificationOptOut( |
128 |
| - options: IRemoveChannelNotificationOptOutParams |
129 |
| -): Promise<IRemoveChannelNotificationOptOutResult> { |
130 |
| - options.httpMethod = "DELETE"; |
131 |
| - return discussionsApiRequest( |
132 |
| - `/channels/${options.channelId}/notifications/opt-out`, |
133 |
| - options |
134 |
| - ); |
135 |
| -} |
136 |
| - |
137 |
| -/** |
138 |
| - * remove all posts in a channel |
139 |
| - * |
140 |
| - * @deprecated replace with removeChannelActivityV2 for v2 discussions |
141 |
| - * @export |
142 |
| - * @param {IRemoveChannelActivityParams} options |
143 |
| - * @return {*} |
144 |
| - */ |
145 |
| -export function removeChannelActivity( |
146 |
| - options: IRemoveChannelActivityParams |
147 |
| -): Promise<IRemoveChannelActivityResult> { |
148 |
| - options.httpMethod = "DELETE"; |
149 |
| - return discussionsApiRequest( |
150 |
| - `/channels/${options.channelId}/activity`, |
151 |
| - options |
152 |
| - ); |
153 |
| -} |
154 |
| - |
155 |
| -/******************************* |
156 |
| - * V2 |
157 |
| - *******************************/ |
158 |
| - |
159 |
| -/** |
160 |
| - * create channel v2 |
161 |
| - * |
162 |
| - * @export |
163 |
| - * @param {ICreateChannelParamsV2} options |
164 |
| - * @return {*} {Promise<IChannel>} |
165 |
| - */ |
166 |
| -export function createChannelV2( |
167 |
| - options: ICreateChannelParamsV2 |
168 |
| -): Promise<IChannel> { |
169 |
| - options.httpMethod = "POST"; |
170 |
| - return discussionsApiRequestV2(`/channels`, options); |
171 |
| -} |
172 |
| - |
173 |
| -/** |
174 |
| - * fetch channel V2 |
175 |
| - * |
176 |
| - * @export |
177 |
| - * @param {IFetchChannelParams} options |
178 |
| - * @return {*} {Promise<IChannel>} |
179 |
| - */ |
180 |
| -export function fetchChannelV2( |
181 |
| - options: IFetchChannelParams |
182 |
| -): Promise<IChannel> { |
183 |
| - options.httpMethod = "GET"; |
184 |
| - return discussionsApiRequestV2(`/channels/${options.channelId}`, options); |
185 |
| -} |
186 |
| - |
187 |
| -/** |
188 |
| - * update channel V2 |
189 |
| - * |
190 |
| - * @export |
191 |
| - * @param {IUpdateChannelParamsV2} options |
192 |
| - * @return {*} {Promise<IChannel>} |
193 |
| - */ |
194 |
| -export function updateChannelV2( |
195 |
| - options: IUpdateChannelParamsV2 |
196 |
| -): Promise<IChannel> { |
197 |
| - options.httpMethod = "PATCH"; |
198 |
| - return discussionsApiRequestV2(`/channels/${options.channelId}`, options); |
199 |
| -} |
200 |
| - |
201 |
| -/** |
202 |
| - * remove channel V2 |
203 |
| - * |
204 |
| - * @export |
205 |
| - * @param {IRemoveChannelParams} options |
206 |
| - * @return {*} |
207 |
| - */ |
208 |
| -export function removeChannelV2( |
209 |
| - options: IRemoveChannelParams |
210 |
| -): Promise<IRemoveChannelResponse> { |
211 |
| - options.httpMethod = "DELETE"; |
212 |
| - return discussionsApiRequestV2(`/channels/${options.channelId}`, options); |
213 |
| -} |
214 |
| - |
215 |
| -/** |
216 |
| - * get channel opt out status V2 |
217 |
| - * |
218 |
| - * @export |
219 |
| - * @param {IFetchChannelNotificationOptOutParams} options |
220 |
| - * @return {*} |
221 |
| - */ |
222 |
| -export function fetchChannelNotifcationOptOutV2( |
223 |
| - options: IFetchChannelNotificationOptOutParams |
224 |
| -): Promise<IChannelNotificationOptOut> { |
225 |
| - options.httpMethod = "GET"; |
226 |
| - return discussionsApiRequestV2( |
227 |
| - `/channels/${options.channelId}/notifications/opt-out`, |
228 |
| - options |
229 |
| - ); |
230 |
| -} |
231 |
| - |
232 |
| -/** |
233 |
| - * opt out of channel notifs V2 |
234 |
| - * |
235 |
| - * @export |
236 |
| - * @param {ICreateChannelNotificationOptOutParams} options |
237 |
| - * @return {*} |
238 |
| - */ |
239 |
| -export function createChannelNotificationOptOutV2( |
240 |
| - options: ICreateChannelNotificationOptOutParams |
241 |
| -): Promise<IChannelNotificationOptOut> { |
242 |
| - options.httpMethod = "POST"; |
243 |
| - return discussionsApiRequestV2( |
244 |
| - `/channels/${options.channelId}/notifications/opt-out`, |
245 |
| - options |
246 |
| - ); |
247 |
| -} |
248 |
| - |
249 |
| -/** |
250 |
| - * remove channel notifs V2 |
251 |
| - * |
252 |
| - * @export |
253 |
| - * @param {IRemoveChannelNotificationOptOutParams} options |
254 |
| - * @return {*} |
255 |
| - */ |
256 |
| -export function removeChannelNotificationOptOutV2( |
257 |
| - options: IRemoveChannelNotificationOptOutParams |
258 |
| -): Promise<IRemoveChannelNotificationOptOutResult> { |
259 |
| - options.httpMethod = "DELETE"; |
260 |
| - return discussionsApiRequestV2( |
261 |
| - `/channels/${options.channelId}/notifications/opt-out`, |
262 |
| - options |
263 |
| - ); |
264 |
| -} |
265 |
| - |
266 |
| -/** |
267 |
| - * remove all posts in a channel V2 |
268 |
| - * |
269 |
| - * @export |
270 |
| - * @param {IRemoveChannelActivityParams} options |
271 |
| - * @return {*} |
272 |
| - */ |
273 |
| -export function removeChannelActivityV2( |
274 |
| - options: IRemoveChannelActivityParams |
275 |
| -): Promise<IRemoveChannelActivityResult> { |
276 |
| - options.httpMethod = "DELETE"; |
277 |
| - return discussionsApiRequestV2( |
278 |
| - `/channels/${options.channelId}/activity`, |
279 |
| - options |
280 |
| - ); |
281 |
| -} |
0 commit comments