streaming-availability
Version:
Streaming Availability API allows getting streaming availability information of movies and series; and querying the list of available shows on streaming services such as Netflix, Disney+, Apple TV, Max and Hulu across 60 countries!
151 lines (126 loc) • 5.93 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* Streaming Availability API
* Streaming Availability API allows getting streaming availability information of movies and series; and querying the list of available shows on streaming services such as Netflix, Disney+, Apple TV, Max and Hulu across 60 countries!
*
* The version of the OpenAPI document: 4.1.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
Country,
ModelError,
} from '../models/index';
import {
CountryFromJSON,
CountryToJSON,
ModelErrorFromJSON,
ModelErrorToJSON,
} from '../models/index';
export interface GetCountriesRequest {
outputLanguage?: GetCountriesOutputLanguageEnum;
}
export interface GetCountryRequest {
countryCode: string;
outputLanguage?: GetCountryOutputLanguageEnum;
}
/**
*
*/
export class CountriesApi extends runtime.BaseAPI {
/**
* Get all the supported countries and the list of the supported services and their details for each country. Details of services include names, logos, supported streaming types (subscription, rent, buy, free etc.) and list of available addons/channels.
* Get all Countries
*/
async getCountriesRaw(requestParameters: GetCountriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: Country; }>> {
const queryParameters: any = {};
if (requestParameters['outputLanguage'] != null) {
queryParameters['output_language'] = requestParameters['outputLanguage'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // X-API-Key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-RapidAPI-Key"] = await this.configuration.apiKey("X-RapidAPI-Key"); // X-RapidAPI-Key authentication
}
const response = await this.request({
path: `/countries`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => runtime.mapValues(jsonValue, CountryFromJSON));
}
/**
* Get all the supported countries and the list of the supported services and their details for each country. Details of services include names, logos, supported streaming types (subscription, rent, buy, free etc.) and list of available addons/channels.
* Get all Countries
*/
async getCountries(requestParameters: GetCountriesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: Country; }> {
const response = await this.getCountriesRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get a country and the list of the supported services and their details. Details of services include names, logos, supported streaming types (subscription, rent, buy, free etc.) and list of available addons/channels.
* Get a Country
*/
async getCountryRaw(requestParameters: GetCountryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Country>> {
if (requestParameters['countryCode'] == null) {
throw new runtime.RequiredError(
'countryCode',
'Required parameter "countryCode" was null or undefined when calling getCountry().'
);
}
const queryParameters: any = {};
if (requestParameters['outputLanguage'] != null) {
queryParameters['output_language'] = requestParameters['outputLanguage'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // X-API-Key authentication
}
if (this.configuration && this.configuration.apiKey) {
headerParameters["X-RapidAPI-Key"] = await this.configuration.apiKey("X-RapidAPI-Key"); // X-RapidAPI-Key authentication
}
const response = await this.request({
path: `/countries/{country-code}`.replace(`{${"country-code"}}`, encodeURIComponent(String(requestParameters['countryCode']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => CountryFromJSON(jsonValue));
}
/**
* Get a country and the list of the supported services and their details. Details of services include names, logos, supported streaming types (subscription, rent, buy, free etc.) and list of available addons/channels.
* Get a Country
*/
async getCountry(requestParameters: GetCountryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Country> {
const response = await this.getCountryRaw(requestParameters, initOverrides);
return await response.value();
}
}
/**
* @export
*/
export const GetCountriesOutputLanguageEnum = {
En: 'en',
Es: 'es',
Tr: 'tr',
Fr: 'fr'
} as const;
export type GetCountriesOutputLanguageEnum = typeof GetCountriesOutputLanguageEnum[keyof typeof GetCountriesOutputLanguageEnum];
/**
* @export
*/
export const GetCountryOutputLanguageEnum = {
En: 'en',
Es: 'es',
Tr: 'tr',
Fr: 'fr'
} as const;
export type GetCountryOutputLanguageEnum = typeof GetCountryOutputLanguageEnum[keyof typeof GetCountryOutputLanguageEnum];