mirror of
https://github.com/jellyfin/jellyfin-sdk-typescript.git
synced 2024-11-23 05:59:44 +00:00
Remove deprecated image url function
This commit is contained in:
parent
9f9ab70444
commit
cb5ec89d9a
@ -9,7 +9,6 @@ import { vi, describe, expect, it, afterEach } from 'vitest';
|
||||
|
||||
import { Api, AUTHORIZATION_HEADER } from '..';
|
||||
import { SERVER_URL, TEST_CLIENT, TEST_DEVICE } from '../__helpers__/common';
|
||||
import { ImageType } from '../generated-client/models';
|
||||
import { getAuthorizationHeader } from '../utils';
|
||||
|
||||
vi.mock('axios', async () => {
|
||||
@ -80,11 +79,4 @@ describe('Api', () => {
|
||||
const api = new Api(SERVER_URL, TEST_CLIENT, TEST_DEVICE);
|
||||
expect(api.basePath).toBe(SERVER_URL);
|
||||
});
|
||||
|
||||
it('should return an item image url', () => {
|
||||
const api = new Api(SERVER_URL, TEST_CLIENT, TEST_DEVICE);
|
||||
expect(api.getItemImageUrl('TEST')).toBe('https://example.com/Items/TEST/Images/Primary');
|
||||
expect(api.getItemImageUrl('TEST', ImageType.Backdrop, { fillWidth: 100, fillHeight: 100 }))
|
||||
.toBe('https://example.com/Items/TEST/Images/Backdrop?fillWidth=100&fillHeight=100');
|
||||
});
|
||||
});
|
||||
|
27
src/api.ts
27
src/api.ts
@ -8,14 +8,8 @@ import globalInstance from 'axios';
|
||||
|
||||
import { Configuration } from './generated-client/configuration';
|
||||
import type { AuthenticationResult } from './generated-client/models/authentication-result';
|
||||
import { ImageType } from './generated-client/models/image-type';
|
||||
import type { ClientInfo, DeviceInfo } from './models';
|
||||
import type { ImageRequestParameters } from './models/api/image-request-parameters';
|
||||
import { getAuthorizationHeader } from './utils';
|
||||
import { getImageApi } from './utils/api/image-api';
|
||||
// NOTE: This import is used for TSDoc
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import type { ImageUrlsApi } from './utils/api/image-urls-api';
|
||||
import { getSessionApi } from './utils/api/session-api';
|
||||
import { getUserApi } from './utils/api/user-api';
|
||||
|
||||
@ -80,27 +74,6 @@ export class Api {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item image URL.
|
||||
* @deprecated Use {@link ImageUrlsApi.getItemImageUrlById} instead.
|
||||
* @param itemId The Item ID.
|
||||
* @param imageType An optional Image Type (Primary by default).
|
||||
* @param params Additional request parameters.
|
||||
* @returns The image URL.
|
||||
*/
|
||||
getItemImageUrl(
|
||||
itemId: string,
|
||||
imageType: ImageType = ImageType.Primary,
|
||||
params: ImageRequestParameters = {}
|
||||
): string | undefined {
|
||||
return getImageApi(this)
|
||||
.getItemImageUrlById(
|
||||
itemId,
|
||||
imageType,
|
||||
params
|
||||
);
|
||||
}
|
||||
|
||||
get authorizationHeader(): string {
|
||||
return getAuthorizationHeader(this.clientInfo, this.deviceInfo, this.accessToken);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user