Replace querystring with URLSearchParams

URLSearchParams has greater compatibility with browser code

Created new PageOptions and LocaleOptions for easier use
with URLSearchParams
This commit is contained in:
Tobias Karlsson
2023-03-08 14:00:04 +01:00
parent fe86aed01f
commit f8b5564d22
11 changed files with 113 additions and 68 deletions

View File

@@ -1,5 +1,3 @@
import { ParsedUrlQueryInput } from 'querystring';
export interface Change {
id: number;
adult: boolean | undefined;
@@ -12,7 +10,7 @@ export interface Changes{
total_results: number;
}
export interface ChangeOptions extends ParsedUrlQueryInput {
export interface ChangeOptions {
end_date?: string;
start_date?: string;
page?: number;

View File

@@ -1,4 +1,3 @@
import { ParsedUrlQueryInput } from 'querystring';
import { Episode, Media, MediaType, Movie, Person, Season, TV } from '.';
export type ExternalSource =
@@ -11,7 +10,7 @@ export type ExternalSource =
| 'twitter_id'
| 'instagram_id';
export interface ExternalIdOptions extends ParsedUrlQueryInput {
export interface ExternalIdOptions {
external_source: ExternalSource;
language?: string;
}

View File

@@ -6,6 +6,7 @@ export * from './movies';
export * from './search';
export * from './tv-shows';
export * from './watch-providers';
export * from './page';
export * from './people';
export * from './discover';
export * from './review';

8
src/types/page.ts Normal file
View File

@@ -0,0 +1,8 @@
export interface PageOptions {
page?: number;
}
export interface LocaleOptions extends PageOptions {
region?: string;
language?: string;
}