From 06c4f0f258cfb444775442cea69f6c9de63649c0 Mon Sep 17 00:00:00 2001 From: Merlin Danner Date: Wed, 29 Mar 2023 07:44:21 +0200 Subject: [PATCH] Add JSDoc comment to getItems helper In return the comments at each usage are removed. --- src/components/notifications/notifications.js | 2 -- src/components/playback/playbackmanager.js | 2 -- src/plugins/chromecastPlayer/plugin.js | 2 -- src/plugins/syncPlay/core/Helper.js | 2 -- src/utils/jellyfin-apiclient/getItems.ts | 8 ++++++++ 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index 13c4ffd8d..2d11691e9 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -131,8 +131,6 @@ function onLibraryChanged(data, apiClient) { newItems.length = 12; } - // call getItems from jellyfin-apiclient/getItems.ts instead of apiClient.getItems() - // to split up into multiple requests if necessary (URL might get too long) getItems(apiClient, apiClient.getCurrentUserId(), { Recursive: true, diff --git a/src/components/playback/playbackmanager.js b/src/components/playback/playbackmanager.js index 0d0434c97..14c841bea 100644 --- a/src/components/playback/playbackmanager.js +++ b/src/components/playback/playbackmanager.js @@ -128,8 +128,6 @@ function getItemsForPlayback(serverId, query) { query.EnableTotalRecordCount = false; query.CollapseBoxSetItems = false; - // call getItems from jellyfin-apiclient/getItems.ts instead of apiClient.getItems() - // to split up into multiple requests if necessary (URL might get too long) return getItems(apiClient, apiClient.getCurrentUserId(), query); } } diff --git a/src/plugins/chromecastPlayer/plugin.js b/src/plugins/chromecastPlayer/plugin.js index d4aca76a3..a656337d6 100644 --- a/src/plugins/chromecastPlayer/plugin.js +++ b/src/plugins/chromecastPlayer/plugin.js @@ -483,8 +483,6 @@ function getItemsForPlayback(apiClient, query) { query.ExcludeLocationTypes = 'Virtual'; query.EnableTotalRecordCount = false; - // call getItems from jellyfin-apiclient/getItems.ts instead of apiClient.getItems() - // to split up into multiple requests if necessary (URL might get too long) return getItems(apiClient, userId, query); } } diff --git a/src/plugins/syncPlay/core/Helper.js b/src/plugins/syncPlay/core/Helper.js index 364217e98..47f25578a 100644 --- a/src/plugins/syncPlay/core/Helper.js +++ b/src/plugins/syncPlay/core/Helper.js @@ -89,8 +89,6 @@ export function getItemsForPlayback(apiClient, query) { query.EnableTotalRecordCount = false; query.CollapseBoxSetItems = false; - // call getItems from jellyfin-apiclient/getItems.ts instead of apiClient.getItems() - // to split up into multiple requests if necessary (URL might get too long) return getItems(apiClient, apiClient.getCurrentUserId(), query); } } diff --git a/src/utils/jellyfin-apiclient/getItems.ts b/src/utils/jellyfin-apiclient/getItems.ts index c47e707cc..03f242ac0 100644 --- a/src/utils/jellyfin-apiclient/getItems.ts +++ b/src/utils/jellyfin-apiclient/getItems.ts @@ -49,6 +49,14 @@ function mergeResults(results: BaseItemDtoQueryResult[]) { return merged; } +/** + * Transparently handles the call to apiClient.getItems splitting the + * call into multiple ones if the URL might get too long. + * @param apiClient The ApiClient to use + * @param userId User id to pass to actual getItems call + * @param options Options object to specify getItems option. This includes a possibly long Items list that will be split up. + * @returns A promise that resolves to the merged result of all getItems calls + */ export function getItems(apiClient: ApiClient, userId: string, options?: any) { if (options.Ids?.split(',').length <= ITEMS_PER_REQUEST_LIMIT) { return apiClient.getItems(apiClient.getCurrentUserId(), options);