From 667f7b791e746473987fe20de5817fb6ea39ddcc Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Mon, 28 Oct 2024 16:13:29 -0400 Subject: [PATCH] Add media segments api --- src/utils/api/__tests__/api.test.ts | 5 +++-- src/utils/api/index.ts | 1 + src/utils/api/media-segments-api.ts | 13 +++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/utils/api/media-segments-api.ts diff --git a/src/utils/api/__tests__/api.test.ts b/src/utils/api/__tests__/api.test.ts index c548d2226..1909e1bb0 100644 --- a/src/utils/api/__tests__/api.test.ts +++ b/src/utils/api/__tests__/api.test.ts @@ -5,12 +5,12 @@ */ import { describe, it, expect } from 'vitest'; -import { getActivityLogApi, getApiKeyApi, getArtistsApi, getAudioApi, getBrandingApi, getChannelsApi, getClientLogApi, getCollectionApi, getConfigurationApi, getDashboardApi, getDevicesApi, getDisplayPreferencesApi, getDynamicHlsApi, getEnvironmentApi, getFilterApi, getGenresApi, getHlsSegmentApi, getImageApi, getInstantMixApi, getItemLookupApi, getItemRefreshApi, getItemUpdateApi, getItemsApi, getLibraryApi, getLibraryStructureApi, getLiveTvApi, getLocalizationApi, getLyricsApi, getMediaInfoApi, getMoviesApi, getMusicGenresApi, getPackageApi, getPersonsApi, getPlaylistsApi, getPlaystateApi, getPluginsApi, getQuickConnectApi, getRemoteImageApi, getScheduledTasksApi, getSearchApi, getSessionApi, getStartupApi, getStudiosApi, getSubtitleApi, getSuggestionsApi, getSyncPlayApi, getSystemApi, getTimeSyncApi, getTmdbApi, getTrailersApi, getTrickplayApi, getTvShowsApi, getUniversalAudioApi, getUserApi, getUserLibraryApi, getUserViewsApi, getVideoAttachmentsApi, getVideosApi, getYearsApi } from '..'; +import { getActivityLogApi, getApiKeyApi, getArtistsApi, getAudioApi, getBrandingApi, getChannelsApi, getClientLogApi, getCollectionApi, getConfigurationApi, getDashboardApi, getDevicesApi, getDisplayPreferencesApi, getDynamicHlsApi, getEnvironmentApi, getFilterApi, getGenresApi, getHlsSegmentApi, getImageApi, getInstantMixApi, getItemLookupApi, getItemRefreshApi, getItemUpdateApi, getItemsApi, getLibraryApi, getLibraryStructureApi, getLiveTvApi, getLocalizationApi, getLyricsApi, getMediaInfoApi, getMediaSegmentsApi, getMoviesApi, getMusicGenresApi, getPackageApi, getPersonsApi, getPlaylistsApi, getPlaystateApi, getPluginsApi, getQuickConnectApi, getRemoteImageApi, getScheduledTasksApi, getSearchApi, getSessionApi, getStartupApi, getStudiosApi, getSubtitleApi, getSuggestionsApi, getSyncPlayApi, getSystemApi, getTimeSyncApi, getTmdbApi, getTrailersApi, getTrickplayApi, getTvShowsApi, getUniversalAudioApi, getUserApi, getUserLibraryApi, getUserViewsApi, getVideoAttachmentsApi, getVideosApi, getYearsApi } from '..'; import { SERVER_URL, TEST_CLIENT, TEST_DEVICE } from '../../../__helpers__/common'; import { Api } from '../../../api'; -import { ActivityLogApi, ApiKeyApi, ArtistsApi, AudioApi, BrandingApi, ChannelsApi, ClientLogApi, CollectionApi, ConfigurationApi, DashboardApi, DevicesApi, DisplayPreferencesApi, DynamicHlsApi, EnvironmentApi, FilterApi, GenresApi, HlsSegmentApi, ImageApi, InstantMixApi, ItemLookupApi, ItemRefreshApi, ItemsApi, ItemUpdateApi, LibraryApi, LibraryStructureApi, LiveTvApi, LocalizationApi, LyricsApi, MediaInfoApi, MoviesApi, MusicGenresApi, PackageApi, PersonsApi, PlaylistsApi, PlaystateApi, PluginsApi, QuickConnectApi, RemoteImageApi, ScheduledTasksApi, SearchApi, SessionApi, StartupApi, StudiosApi, SubtitleApi, SuggestionsApi, SyncPlayApi, SystemApi, TimeSyncApi, TmdbApi, TrailersApi, TrickplayApi, TvShowsApi, UniversalAudioApi, UserApi, UserLibraryApi, UserViewsApi, VideoAttachmentsApi, VideosApi, YearsApi } from '../../../generated-client/api'; +import { ActivityLogApi, ApiKeyApi, ArtistsApi, AudioApi, BrandingApi, ChannelsApi, ClientLogApi, CollectionApi, ConfigurationApi, DashboardApi, DevicesApi, DisplayPreferencesApi, DynamicHlsApi, EnvironmentApi, FilterApi, GenresApi, HlsSegmentApi, ImageApi, InstantMixApi, ItemLookupApi, ItemRefreshApi, ItemsApi, ItemUpdateApi, LibraryApi, LibraryStructureApi, LiveTvApi, LocalizationApi, LyricsApi, MediaInfoApi, MediaSegmentsApi, MoviesApi, MusicGenresApi, PackageApi, PersonsApi, PlaylistsApi, PlaystateApi, PluginsApi, QuickConnectApi, RemoteImageApi, ScheduledTasksApi, SearchApi, SessionApi, StartupApi, StudiosApi, SubtitleApi, SuggestionsApi, SyncPlayApi, SystemApi, TimeSyncApi, TmdbApi, TrailersApi, TrickplayApi, TvShowsApi, UniversalAudioApi, UserApi, UserLibraryApi, UserViewsApi, VideoAttachmentsApi, VideosApi, YearsApi } from '../../../generated-client/api'; /** * Api helper function tests. @@ -50,6 +50,7 @@ describe('Api Utilities', () => { expect(getLocalizationApi(api)).toBeInstanceOf(LocalizationApi); expect(getLyricsApi(api)).toBeInstanceOf(LyricsApi); expect(getMediaInfoApi(api)).toBeInstanceOf(MediaInfoApi); + expect(getMediaSegmentsApi(api)).toBeInstanceOf(MediaSegmentsApi); expect(getMoviesApi(api)).toBeInstanceOf(MoviesApi); expect(getMusicGenresApi(api)).toBeInstanceOf(MusicGenresApi); expect(getPackageApi(api)).toBeInstanceOf(PackageApi); diff --git a/src/utils/api/index.ts b/src/utils/api/index.ts index 9fb783c75..fce5e11d3 100644 --- a/src/utils/api/index.ts +++ b/src/utils/api/index.ts @@ -33,6 +33,7 @@ export * from './live-tv-api'; export * from './localization-api'; export * from './lyrics-api'; export * from './media-info-api'; +export * from './media-segments-api'; export * from './movies-api'; export * from './music-genres-api'; export * from './package-api'; diff --git a/src/utils/api/media-segments-api.ts b/src/utils/api/media-segments-api.ts new file mode 100644 index 000000000..fe96a7448 --- /dev/null +++ b/src/utils/api/media-segments-api.ts @@ -0,0 +1,13 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import type { Api } from '../../api'; + +import { MediaSegmentsApi } from '../../generated-client/api/media-segments-api'; + +export function getMediaSegmentsApi(api: Api): MediaSegmentsApi { + return new MediaSegmentsApi(api.configuration, undefined, api.axiosInstance); +}