Restructure project root

This commit is contained in:
Bill Thornton 2021-09-16 11:32:01 -04:00
parent 22b9bf97f7
commit 350a9a589f
3 changed files with 34 additions and 27 deletions

View File

@ -1,5 +1,4 @@
import { Jellyfin } from '..';
import { Configuration } from '../generated-client';
import { Configuration, Jellyfin } from '..';
// FIXME: These tests should be mocked and not calling an actual server
const SERVER_URL = 'https://demo.jellyfin.org/stable';

View File

@ -3,30 +3,10 @@
* 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 globalInstance from 'axios';
import { Api } from './api';
import { Configuration } from './generated-client';
import { ClientInfo } from './models/client-info';
import { DeviceInfo } from './models/device-info';
export * from './api';
// Should the full generated client be exported?
export * from './generated-client/configuration';
export * from './jellyfin';
export * from './models';
export * from './utils';
export class Jellyfin {
clientInfo;
deviceInfo;
constructor(
clientInfo: ClientInfo = { Name: 'jellyfin-sdk-typescript', Version: 'v0.1.0' },
// FIXME: The device info should always be required.
deviceInfo: DeviceInfo = { Name: 'device-name', Id: 'device-id' }
) {
this.clientInfo = clientInfo;
this.deviceInfo = deviceInfo;
}
createApi(configuration: Configuration, axiosInstance = globalInstance): Api {
return new Api(this.clientInfo, this.deviceInfo, configuration, axiosInstance);
}
}

28
src/jellyfin.ts Normal file
View File

@ -0,0 +1,28 @@
/**
* 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 globalInstance from 'axios';
import { Api } from './api';
import { Configuration } from './generated-client';
import { ClientInfo, DeviceInfo } from './models';
export class Jellyfin {
clientInfo;
deviceInfo;
constructor(
clientInfo: ClientInfo = { Name: 'jellyfin-sdk-typescript', Version: 'v0.1.0' },
// FIXME: The device info should always be required.
deviceInfo: DeviceInfo = { Name: 'device-name', Id: 'device-id' }
) {
this.clientInfo = clientInfo;
this.deviceInfo = deviceInfo;
}
createApi(configuration: Configuration, axiosInstance = globalInstance): Api {
return new Api(this.clientInfo, this.deviceInfo, configuration, axiosInstance);
}
}