Move api helpers to separate functions and use direct file imports

This commit is contained in:
Bill Thornton 2022-03-16 11:22:31 -04:00
parent 1a694097e0
commit 4f52d15dd9
66 changed files with 736 additions and 250 deletions

View File

@ -5,10 +5,14 @@
*/
import globalInstance, { AxiosInstance, AxiosResponse } from 'axios';
import { ActivityLogApi, ApiKeyApi, ArtistsApi, AudioApi, AuthenticationResult, BrandingApi, ChannelsApi, CollectionApi, Configuration, ConfigurationApi, DashboardApi, DevicesApi, DisplayPreferencesApi, DlnaApi, DlnaServerApi, DynamicHlsApi, EnvironmentApi, FilterApi, GenresApi, HlsSegmentApi, ImageApi, ImageByNameApi, ImageType, InstantMixApi, ItemLookupApi, ItemRefreshApi, ItemsApi, ItemUpdateApi, LibraryApi, LibraryStructureApi, LiveTvApi, LocalizationApi, MediaInfoApi, MoviesApi, MusicGenresApi, NotificationsApi, PackageApi, PersonsApi, PlaylistsApi, PlaystateApi, PluginsApi, QuickConnectApi, RemoteImageApi, ScheduledTasksApi, SearchApi, SessionApi, StartupApi, StudiosApi, SubtitleApi, SuggestionsApi, SyncPlayApi, SystemApi, TimeSyncApi, TrailersApi, TvShowsApi, UniversalAudioApi, UserApi, UserLibraryApi, UserViewsApi, VideoAttachmentsApi, VideoHlsApi, VideosApi, YearsApi } from './generated-client';
import { Configuration } from './generated-client/configuration';
import { AuthenticationResult } from './generated-client/models/authentication-result';
import { ImageType } from './generated-client/models/image-type';
import { ClientInfo, DeviceInfo } from './models';
import { ImageRequestParameters } from './models/api/image-request-parameters';
import { getAuthorizationHeader } from './utils';
import { getSessionApi } from './utils/api/session-api';
import { getUserApi } from './utils/api/user-api';
// HACK: Axios does not export types for axios/lib. This is a workaround.
type BuildFullPathFunction = (baseURL?: string, requestedURL?: string) => string;
@ -40,7 +44,7 @@ export class Api {
this.axiosInstance = axiosInstance;
}
private get configuration(): Configuration {
get configuration(): Configuration {
return new Configuration({
basePath: this.basePath,
apiKey: this.authorizationHeader
@ -53,7 +57,7 @@ export class Api {
* @param password The user password if required.
*/
authenticateUserByName(username: string, password?: string): Promise<AxiosResponse<AuthenticationResult>> {
return this.userApi.authenticateUserByName(
return getUserApi(this).authenticateUserByName(
// The axios client does some strange wrapping of the param object
{ authenticateUserByName: { Username: username, Pw: password } },
// The authorization header is required for the request to succeed
@ -69,7 +73,7 @@ export class Api {
* Convenience method for logging out and updating the internal state.
*/
logout(): Promise<AxiosResponse<never> | AxiosResponse<void>> {
return this.sessionApi.reportSessionEnded().then(response => {
return getSessionApi(this).reportSessionEnded().then(response => {
this.accessToken = '';
return response;
});
@ -96,244 +100,4 @@ export class Api {
get authorizationHeader(): string {
return getAuthorizationHeader(this.clientInfo, this.deviceInfo, this.accessToken);
}
get activityLogApi(): ActivityLogApi {
return new ActivityLogApi(this.configuration, undefined, this.axiosInstance);
}
get apiKeyApi(): ApiKeyApi {
return new ApiKeyApi(this.configuration, undefined, this.axiosInstance);
}
get artistsApi(): ArtistsApi {
return new ArtistsApi(this.configuration, undefined, this.axiosInstance);
}
get audioApi(): AudioApi {
return new AudioApi(this.configuration, undefined, this.axiosInstance);
}
get brandingApi(): BrandingApi {
return new BrandingApi(this.configuration, undefined, this.axiosInstance);
}
get channelsApi(): ChannelsApi {
return new ChannelsApi(this.configuration, undefined, this.axiosInstance);
}
get collectionApi(): CollectionApi {
return new CollectionApi(this.configuration, undefined, this.axiosInstance);
}
get configurationApi(): ConfigurationApi {
return new ConfigurationApi(this.configuration, undefined, this.axiosInstance);
}
get dashboardApi(): DashboardApi {
return new DashboardApi(this.configuration, undefined, this.axiosInstance);
}
get devicesApi(): DevicesApi {
return new DevicesApi(this.configuration, undefined, this.axiosInstance);
}
get displayPreferencesApi(): DisplayPreferencesApi {
return new DisplayPreferencesApi(this.configuration, undefined, this.axiosInstance);
}
get dlnaApi(): DlnaApi {
return new DlnaApi(this.configuration, undefined, this.axiosInstance);
}
get dlnaServerApi(): DlnaServerApi {
return new DlnaServerApi(this.configuration, undefined, this.axiosInstance);
}
get dynamicHlsApi(): DynamicHlsApi {
return new DynamicHlsApi(this.configuration, undefined, this.axiosInstance);
}
get environmentApi(): EnvironmentApi {
return new EnvironmentApi(this.configuration, undefined, this.axiosInstance);
}
get filterApi(): FilterApi {
return new FilterApi(this.configuration, undefined, this.axiosInstance);
}
get genresApi(): GenresApi {
return new GenresApi(this.configuration, undefined, this.axiosInstance);
}
get hlsSegmentApi(): HlsSegmentApi {
return new HlsSegmentApi(this.configuration, undefined, this.axiosInstance);
}
get imageApi(): ImageApi {
return new ImageApi(this.configuration, undefined, this.axiosInstance);
}
get imageByNameApi(): ImageByNameApi {
return new ImageByNameApi(this.configuration, undefined, this.axiosInstance);
}
get instantMixApi(): InstantMixApi {
return new InstantMixApi(this.configuration, undefined, this.axiosInstance);
}
get itemLookupApi(): ItemLookupApi {
return new ItemLookupApi(this.configuration, undefined, this.axiosInstance);
}
get itemRefreshApi(): ItemRefreshApi {
return new ItemRefreshApi(this.configuration, undefined, this.axiosInstance);
}
get itemUpdateApi(): ItemUpdateApi {
return new ItemUpdateApi(this.configuration, undefined, this.axiosInstance);
}
get itemsApi(): ItemsApi {
return new ItemsApi(this.configuration, undefined, this.axiosInstance);
}
get libraryApi(): LibraryApi {
return new LibraryApi(this.configuration, undefined, this.axiosInstance);
}
get libraryStructureApi(): LibraryStructureApi {
return new LibraryStructureApi(this.configuration, undefined, this.axiosInstance);
}
get liveTvApi(): LiveTvApi {
return new LiveTvApi(this.configuration, undefined, this.axiosInstance);
}
get localizationApi(): LocalizationApi {
return new LocalizationApi(this.configuration, undefined, this.axiosInstance);
}
get mediaInfoApi(): MediaInfoApi {
return new MediaInfoApi(this.configuration, undefined, this.axiosInstance);
}
get moviesApi(): MoviesApi {
return new MoviesApi(this.configuration, undefined, this.axiosInstance);
}
get musicGenresApi(): MusicGenresApi {
return new MusicGenresApi(this.configuration, undefined, this.axiosInstance);
}
get notificationsApi(): NotificationsApi {
return new NotificationsApi(this.configuration, undefined, this.axiosInstance);
}
get packageApi(): PackageApi {
return new PackageApi(this.configuration, undefined, this.axiosInstance);
}
get personsApi(): PersonsApi {
return new PersonsApi(this.configuration, undefined, this.axiosInstance);
}
get playlistsApi(): PlaylistsApi {
return new PlaylistsApi(this.configuration, undefined, this.axiosInstance);
}
get playstateApi(): PlaystateApi {
return new PlaystateApi(this.configuration, undefined, this.axiosInstance);
}
get pluginsApi(): PluginsApi {
return new PluginsApi(this.configuration, undefined, this.axiosInstance);
}
get quickConnectApi(): QuickConnectApi {
return new QuickConnectApi(this.configuration, undefined, this.axiosInstance);
}
get remoteImageApi(): RemoteImageApi {
return new RemoteImageApi(this.configuration, undefined, this.axiosInstance);
}
get scheduledTasksApi(): ScheduledTasksApi {
return new ScheduledTasksApi(this.configuration, undefined, this.axiosInstance);
}
get searchApi(): SearchApi {
return new SearchApi(this.configuration, undefined, this.axiosInstance);
}
get sessionApi(): SessionApi {
return new SessionApi(this.configuration, undefined, this.axiosInstance);
}
get startupApi(): StartupApi {
return new StartupApi(this.configuration, undefined, this.axiosInstance);
}
get studiosApi(): StudiosApi {
return new StudiosApi(this.configuration, undefined, this.axiosInstance);
}
get subtitleApi(): SubtitleApi {
return new SubtitleApi(this.configuration, undefined, this.axiosInstance);
}
get suggestionsApi(): SuggestionsApi {
return new SuggestionsApi(this.configuration, undefined, this.axiosInstance);
}
get syncPlayApi(): SyncPlayApi {
return new SyncPlayApi(this.configuration, undefined, this.axiosInstance);
}
get systemApi(): SystemApi {
return new SystemApi(this.configuration, undefined, this.axiosInstance);
}
get timeSyncApi(): TimeSyncApi {
return new TimeSyncApi(this.configuration, undefined, this.axiosInstance);
}
get trailersApi(): TrailersApi {
return new TrailersApi(this.configuration, undefined, this.axiosInstance);
}
get tvShowsApi(): TvShowsApi {
return new TvShowsApi(this.configuration, undefined, this.axiosInstance);
}
get universalAudioApi(): UniversalAudioApi {
return new UniversalAudioApi(this.configuration, undefined, this.axiosInstance);
}
get userApi(): UserApi {
return new UserApi(this.configuration, undefined, this.axiosInstance);
}
get userLibraryApi(): UserLibraryApi {
return new UserLibraryApi(this.configuration, undefined, this.axiosInstance);
}
get userViewsApi(): UserViewsApi {
return new UserViewsApi(this.configuration, undefined, this.axiosInstance);
}
get videoAttachmentsApi(): VideoAttachmentsApi {
return new VideoAttachmentsApi(this.configuration, undefined, this.axiosInstance);
}
get videoHlsApi(): VideoHlsApi {
return new VideoHlsApi(this.configuration, undefined, this.axiosInstance);
}
get videosApi(): VideosApi {
return new VideosApi(this.configuration, undefined, this.axiosInstance);
}
get yearsApi(): YearsApi {
return new YearsApi(this.configuration, undefined, this.axiosInstance);
}
}

View File

@ -8,7 +8,8 @@ import { AxiosError, AxiosResponse } from 'axios';
import { compare } from 'compare-versions';
import { API_VERSION, Jellyfin, MINIMUM_VERSION, ProductNameIssue, RecommendedServerInfo, RecommendedServerInfoScore, RecommendedServerIssue, SlowResponseIssue, SystemInfoIssue, VersionMissingIssue, VersionOutdatedIssue, VersionUnsupportedIssue } from '..';
import { PublicSystemInfo } from '../generated-client';
import { PublicSystemInfo } from '../generated-client/models/public-system-info';
import { getSystemApi } from '../utils/api/system-api';
/** The result of a SystemInfo request. */
interface SystemInfoResult {
@ -92,7 +93,7 @@ export class RecommendedServerDiscovery {
const api = this.jellyfin.createApi(address);
const startTime = Date.now();
return api.systemApi.getPublicSystemInfo({ timeout: HTTP_TIMEOUT })
return getSystemApi(api).getPublicSystemInfo({ timeout: HTTP_TIMEOUT })
.then(response => ({
address,
response,

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// TODO: Should the generated client be exported?
export * as discovery from './discovery';
export * as utils from './utils';

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { ImageFormat } from '../../generated-client';
import { ImageFormat } from '../../generated-client/models/image-format';
/**
* Interface representing supported request parameters for the getItemImage API.

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { PublicSystemInfo } from '../generated-client';
import { PublicSystemInfo } from '../generated-client/models/public-system-info';
import { RecommendedServerIssue } from './recommended-server-issue';

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ActivityLogApi } from '../../generated-client/api/activity-log-api';
export function getActivityLogApi(api: Api): ActivityLogApi {
return new ActivityLogApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ApiKeyApi } from '../../generated-client/api/api-key-api';
export function getApiKeyApi(api: Api): ApiKeyApi {
return new ApiKeyApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ArtistsApi } from '../../generated-client/api/artists-api';
export function getArtistsApi(api: Api): ArtistsApi {
return new ArtistsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { AudioApi } from '../../generated-client/api/audio-api';
export function getAudioApi(api: Api): AudioApi {
return new AudioApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { BrandingApi } from '../../generated-client/api/branding-api';
export function getBrandingApi(api: Api): BrandingApi {
return new BrandingApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ChannelsApi } from '../../generated-client/api/channels-api';
export function getChannelsApi(api: Api): ChannelsApi {
return new ChannelsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { CollectionApi } from '../../generated-client/api/collection-api';
export function getCollectionApi(api: Api): CollectionApi {
return new CollectionApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ConfigurationApi } from '../../generated-client/api/configuration-api';
export function getConfigurationApi(api: Api): ConfigurationApi {
return new ConfigurationApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { DashboardApi } from '../../generated-client/api/dashboard-api';
export function getDashboardApi(api: Api): DashboardApi {
return new DashboardApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { DevicesApi } from '../../generated-client/api/devices-api';
export function getDevicesApi(api: Api): DevicesApi {
return new DevicesApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { DisplayPreferencesApi } from '../../generated-client/api/display-preferences-api';
export function getDisplayPreferencesApi(api: Api): DisplayPreferencesApi {
return new DisplayPreferencesApi(api.configuration, undefined, api.axiosInstance);
}

12
src/utils/api/dlna-api.ts Normal file
View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { DlnaApi } from '../../generated-client/api/dlna-api';
export function getDlnaApi(api: Api): DlnaApi {
return new DlnaApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { DlnaServerApi } from '../../generated-client/api/dlna-server-api';
export function getDlnaServerApi(api: Api): DlnaServerApi {
return new DlnaServerApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { DynamicHlsApi } from '../../generated-client/api/dynamic-hls-api';
export function getDynamicHlsApi(api: Api): DynamicHlsApi {
return new DynamicHlsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { EnvironmentApi } from '../../generated-client/api/environment-api';
export function getEnvironmentApi(api: Api): EnvironmentApi {
return new EnvironmentApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { FilterApi } from '../../generated-client/api/filter-api';
export function getFilterApi(api: Api): FilterApi {
return new FilterApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { GenresApi } from '../../generated-client/api/genres-api';
export function getGenresApi(api: Api): GenresApi {
return new GenresApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { HlsSegmentApi } from '../../generated-client/api/hls-segment-api';
export function getHlsSegmentApi(api: Api): HlsSegmentApi {
return new HlsSegmentApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ImageApi } from '../../generated-client/api/image-api';
export function getImageApi(api: Api): ImageApi {
return new ImageApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ImageByNameApi } from '../../generated-client/api/image-by-name-api';
export function getImageByNameApi(api: Api): ImageByNameApi {
return new ImageByNameApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { InstantMixApi } from '../../generated-client/api/instant-mix-api';
export function getInstantMixApi(api: Api): InstantMixApi {
return new InstantMixApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ItemLookupApi } from '../../generated-client/api/item-lookup-api';
export function getItemLookupApi(api: Api): ItemLookupApi {
return new ItemLookupApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ItemRefreshApi } from '../../generated-client/api/item-refresh-api';
export function getItemRefreshApi(api: Api): ItemRefreshApi {
return new ItemRefreshApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ItemUpdateApi } from '../../generated-client/api/item-update-api';
export function getItemUpdateApi(api: Api): ItemUpdateApi {
return new ItemUpdateApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ItemsApi } from '../../generated-client/api/items-api';
export function getItemsApi(api: Api): ItemsApi {
return new ItemsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { LibraryApi } from '../../generated-client/api/library-api';
export function getLibraryApi(api: Api): LibraryApi {
return new LibraryApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { LibraryStructureApi } from '../../generated-client/api/library-structure-api';
export function getLibraryStructureApi(api: Api): LibraryStructureApi {
return new LibraryStructureApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { LiveTvApi } from '../../generated-client/api/live-tv-api';
export function getLiveTvApi(api: Api): LiveTvApi {
return new LiveTvApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { LocalizationApi } from '../../generated-client/api/localization-api';
export function getLocalizationApi(api: Api): LocalizationApi {
return new LocalizationApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { MediaInfoApi } from '../../generated-client/api/media-info-api';
export function getMediaInfoApi(api: Api): MediaInfoApi {
return new MediaInfoApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { MoviesApi } from '../../generated-client/api/movies-api';
export function getMoviesApi(api: Api): MoviesApi {
return new MoviesApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { MusicGenresApi } from '../../generated-client/api/music-genres-api';
export function getMusicGenresApi(api: Api): MusicGenresApi {
return new MusicGenresApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { NotificationsApi } from '../../generated-client/api/notifications-api';
export function getNotificationsApi(api: Api): NotificationsApi {
return new NotificationsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { PackageApi } from '../../generated-client/api/package-api';
export function getPackageApi(api: Api): PackageApi {
return new PackageApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { PersonsApi } from '../../generated-client/api/persons-api';
export function getPersonsApi(api: Api): PersonsApi {
return new PersonsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { PlaylistsApi } from '../../generated-client/api/playlists-api';
export function getPlaylistsApi(api: Api): PlaylistsApi {
return new PlaylistsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { PlaystateApi } from '../../generated-client/api/playstate-api';
export function getPlaystateApi(api: Api): PlaystateApi {
return new PlaystateApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { PluginsApi } from '../../generated-client/api/plugins-api';
export function getPluginsApi(api: Api): PluginsApi {
return new PluginsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { QuickConnectApi } from '../../generated-client/api/quick-connect-api';
export function getQuickConnectApi(api: Api): QuickConnectApi {
return new QuickConnectApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { RemoteImageApi } from '../../generated-client/api/remote-image-api';
export function getRemoteImageApi(api: Api): RemoteImageApi {
return new RemoteImageApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { ScheduledTasksApi } from '../../generated-client/api/scheduled-tasks-api';
export function getScheduledTasksApi(api: Api): ScheduledTasksApi {
return new ScheduledTasksApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { SearchApi } from '../../generated-client/api/search-api';
export function getSearchApi(api: Api): SearchApi {
return new SearchApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { SessionApi } from '../../generated-client/api/session-api';
export function getSessionApi(api: Api): SessionApi {
return new SessionApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { StartupApi } from '../../generated-client/api/startup-api';
export function getStartupApi(api: Api): StartupApi {
return new StartupApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { StudiosApi } from '../../generated-client/api/studios-api';
export function getStudiosApi(api: Api): StudiosApi {
return new StudiosApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { SubtitleApi } from '../../generated-client/api/subtitle-api';
export function getSubtitleApi(api: Api): SubtitleApi {
return new SubtitleApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { SuggestionsApi } from '../../generated-client/api/suggestions-api';
export function getSuggestionsApi(api: Api): SuggestionsApi {
return new SuggestionsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { SyncPlayApi } from '../../generated-client/api/sync-play-api';
export function getSyncPlayApi(api: Api): SyncPlayApi {
return new SyncPlayApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { SystemApi } from '../../generated-client/api/system-api';
export function getSystemApi(api: Api): SystemApi {
return new SystemApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { TimeSyncApi } from '../../generated-client/api/time-sync-api';
export function getTimeSyncApi(api: Api): TimeSyncApi {
return new TimeSyncApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { TrailersApi } from '../../generated-client/api/trailers-api';
export function getTrailersApi(api: Api): TrailersApi {
return new TrailersApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { TvShowsApi } from '../../generated-client/api/tv-shows-api';
export function getTvShowsApi(api: Api): TvShowsApi {
return new TvShowsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { UniversalAudioApi } from '../../generated-client/api/universal-audio-api';
export function getUniversalAudioApi(api: Api): UniversalAudioApi {
return new UniversalAudioApi(api.configuration, undefined, api.axiosInstance);
}

12
src/utils/api/user-api.ts Normal file
View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { UserApi } from '../../generated-client/api/user-api';
export function getUserApi(api: Api): UserApi {
return new UserApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { UserLibraryApi } from '../../generated-client/api/user-library-api';
export function getUserLibraryApi(api: Api): UserLibraryApi {
return new UserLibraryApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { UserViewsApi } from '../../generated-client/api/user-views-api';
export function getUserViewsApi(api: Api): UserViewsApi {
return new UserViewsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { VideoAttachmentsApi } from '../../generated-client/api/video-attachments-api';
export function getVideoAttachmentsApi(api: Api): VideoAttachmentsApi {
return new VideoAttachmentsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { VideoHlsApi } from '../../generated-client/api/video-hls-api';
export function getVideoHlsApi(api: Api): VideoHlsApi {
return new VideoHlsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { VideosApi } from '../../generated-client/api/videos-api';
export function getVideosApi(api: Api): VideosApi {
return new VideosApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -0,0 +1,12 @@
/**
* 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 { Api } from '../../api';
import { YearsApi } from '../../generated-client/api/years-api';
export function getYearsApi(api: Api): YearsApi {
return new YearsApi(api.configuration, undefined, api.axiosInstance);
}

View File

@ -4,7 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { DeviceProfile, SubtitleDeliveryMethod, SubtitleProfile } from '../generated-client';
import { DeviceProfile } from '../generated-client/models/device-profile';
import { SubtitleDeliveryMethod } from '../generated-client/models/subtitle-delivery-method';
import { SubtitleProfile } from '../generated-client/models/subtitle-profile';
/**
* Options parameters to build profiles