* Retrieve channels matching the provided query params, paging until complete. * Does NOT touch any table/store state; returns a plain array.
(params)
| 390 | * Does NOT touch any table/store state; returns a plain array. |
| 391 | */ |
| 392 | static async getChannelsForParams(params) { |
| 393 | try { |
| 394 | const pageSize = 200; |
| 395 | const query = new URLSearchParams(params); |
| 396 | let page = 1; |
| 397 | let all = []; |
| 398 | |
| 399 | while (true) { |
| 400 | query.set('page', String(page)); |
| 401 | query.set('page_size', String(pageSize)); |
| 402 | const url = `${host}/api/channels/channels/?${query.toString()}`; |
| 403 | const data = await request(url); |
| 404 | |
| 405 | if (Array.isArray(data)) { |
| 406 | // Legacy array response |
| 407 | all = data; |
| 408 | break; |
| 409 | } |
| 410 | |
| 411 | const results = Array.isArray(data?.results) ? data.results : []; |
| 412 | all = all.concat(results); |
| 413 | |
| 414 | const hasMore = Boolean(data?.next); |
| 415 | if (!hasMore || results.length === 0) break; |
| 416 | page += 1; |
| 417 | } |
| 418 | |
| 419 | return all; |
| 420 | } catch (e) { |
| 421 | errorNotification('Failed to retrieve channels for query', e); |
| 422 | throw e; |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | static async requeryChannels() { |
| 427 | try { |
nothing calls this directly
no test coverage detected