@saeris/tmdbkit 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE.md +21 -0
- package/README.md +385 -4
- package/dist/certification/getMovieCertifications.d.mts +9 -0
- package/dist/certification/getMovieCertifications.d.mts.map +1 -0
- package/dist/certification/getMovieCertifications.mjs +11 -0
- package/dist/certification/getMovieCertifications.mjs.map +1 -0
- package/dist/certification/getTvCertifications.d.mts +9 -0
- package/dist/certification/getTvCertifications.d.mts.map +1 -0
- package/dist/certification/getTvCertifications.mjs +11 -0
- package/dist/certification/getTvCertifications.mjs.map +1 -0
- package/dist/certification/index.d.mts +5 -0
- package/dist/certification/index.mjs +4 -0
- package/dist/certification/types/Certifications.d.mts +23 -0
- package/dist/certification/types/Certifications.d.mts.map +1 -0
- package/dist/certification/types/Certifications.mjs +24 -0
- package/dist/certification/types/Certifications.mjs.map +1 -0
- package/dist/certification/types/index.d.mts +2 -0
- package/dist/certification/types/index.mjs +1 -0
- package/dist/collection/getCollection.d.mts +37 -0
- package/dist/collection/getCollection.d.mts.map +1 -0
- package/dist/collection/getCollection.mjs +17 -0
- package/dist/collection/getCollection.mjs.map +1 -0
- package/dist/collection/getCollectionImages.d.mts +45 -0
- package/dist/collection/getCollectionImages.d.mts.map +1 -0
- package/dist/collection/getCollectionImages.mjs +21 -0
- package/dist/collection/getCollectionImages.mjs.map +1 -0
- package/dist/collection/getCollectionTranslations.d.mts +13 -0
- package/dist/collection/getCollectionTranslations.d.mts.map +1 -0
- package/dist/collection/getCollectionTranslations.mjs +14 -0
- package/dist/collection/getCollectionTranslations.mjs.map +1 -0
- package/dist/collection/index.d.mts +8 -0
- package/dist/collection/index.mjs +7 -0
- package/dist/collection/types/CollectionDetails.d.mts +23 -0
- package/dist/collection/types/CollectionDetails.d.mts.map +1 -0
- package/dist/collection/types/CollectionDetails.mjs +25 -0
- package/dist/collection/types/CollectionDetails.mjs.map +1 -0
- package/dist/collection/types/CollectionListItem.d.mts +24 -0
- package/dist/collection/types/CollectionListItem.d.mts.map +1 -0
- package/dist/collection/types/CollectionListItem.mjs +26 -0
- package/dist/collection/types/CollectionListItem.mjs.map +1 -0
- package/dist/collection/types/CollectionTranslations.d.mts +17 -0
- package/dist/collection/types/CollectionTranslations.d.mts.map +1 -0
- package/dist/collection/types/CollectionTranslations.mjs +18 -0
- package/dist/collection/types/CollectionTranslations.mjs.map +1 -0
- package/dist/collection/types/index.d.mts +4 -0
- package/dist/collection/types/index.mjs +4 -0
- package/dist/company/getCompany.d.mts +13 -0
- package/dist/company/getCompany.d.mts.map +1 -0
- package/dist/company/getCompany.mjs +14 -0
- package/dist/company/getCompany.mjs.map +1 -0
- package/dist/company/getCompanyAlternativeNames.d.mts +13 -0
- package/dist/company/getCompanyAlternativeNames.d.mts.map +1 -0
- package/dist/company/getCompanyAlternativeNames.mjs +14 -0
- package/dist/company/getCompanyAlternativeNames.mjs.map +1 -0
- package/dist/company/getCompanyImages.d.mts +13 -0
- package/dist/company/getCompanyImages.d.mts.map +1 -0
- package/dist/company/getCompanyImages.mjs +14 -0
- package/dist/company/getCompanyImages.mjs.map +1 -0
- package/dist/company/index.d.mts +7 -0
- package/dist/company/index.mjs +6 -0
- package/dist/company/types/CompanyDetails.d.mts +23 -0
- package/dist/company/types/CompanyDetails.d.mts.map +1 -0
- package/dist/company/types/CompanyDetails.mjs +26 -0
- package/dist/company/types/CompanyDetails.mjs.map +1 -0
- package/dist/company/types/CompanyListItem.d.mts +10 -0
- package/dist/company/types/CompanyListItem.d.mts.map +1 -0
- package/dist/company/types/CompanyListItem.mjs +13 -0
- package/dist/company/types/CompanyListItem.mjs.map +1 -0
- package/dist/company/types/index.d.mts +3 -0
- package/dist/company/types/index.mjs +3 -0
- package/dist/configuration/getConfiguration.d.mts +9 -0
- package/dist/configuration/getConfiguration.d.mts.map +1 -0
- package/dist/configuration/getConfiguration.mjs +11 -0
- package/dist/configuration/getConfiguration.mjs.map +1 -0
- package/dist/configuration/getCountries.d.mts +36 -0
- package/dist/configuration/getCountries.d.mts.map +1 -0
- package/dist/configuration/getCountries.mjs +13 -0
- package/dist/configuration/getCountries.mjs.map +1 -0
- package/dist/configuration/getJobs.d.mts +9 -0
- package/dist/configuration/getJobs.d.mts.map +1 -0
- package/dist/configuration/getJobs.mjs +11 -0
- package/dist/configuration/getJobs.mjs.map +1 -0
- package/dist/configuration/getLanguages.d.mts +9 -0
- package/dist/configuration/getLanguages.d.mts.map +1 -0
- package/dist/configuration/getLanguages.mjs +11 -0
- package/dist/configuration/getLanguages.mjs.map +1 -0
- package/dist/configuration/getPrimaryTranslations.d.mts +9 -0
- package/dist/configuration/getPrimaryTranslations.d.mts.map +1 -0
- package/dist/configuration/getPrimaryTranslations.mjs +11 -0
- package/dist/configuration/getPrimaryTranslations.mjs.map +1 -0
- package/dist/configuration/getTimezones.d.mts +9 -0
- package/dist/configuration/getTimezones.d.mts.map +1 -0
- package/dist/configuration/getTimezones.mjs +11 -0
- package/dist/configuration/getTimezones.mjs.map +1 -0
- package/dist/configuration/imageUrl.d.mts +26 -0
- package/dist/configuration/imageUrl.d.mts.map +1 -0
- package/dist/configuration/imageUrl.mjs +50 -0
- package/dist/configuration/imageUrl.mjs.map +1 -0
- package/dist/configuration/index.d.mts +15 -0
- package/dist/configuration/index.mjs +14 -0
- package/dist/configuration/types/ConfigurationDetails.d.mts +26 -0
- package/dist/configuration/types/ConfigurationDetails.d.mts.map +1 -0
- package/dist/configuration/types/ConfigurationDetails.mjs +28 -0
- package/dist/configuration/types/ConfigurationDetails.mjs.map +1 -0
- package/dist/configuration/types/Country.d.mts +27 -0
- package/dist/configuration/types/Country.d.mts.map +1 -0
- package/dist/configuration/types/Country.mjs +22 -0
- package/dist/configuration/types/Country.mjs.map +1 -0
- package/dist/configuration/types/DepartmentJobs.d.mts +15 -0
- package/dist/configuration/types/DepartmentJobs.d.mts.map +1 -0
- package/dist/configuration/types/DepartmentJobs.mjs +16 -0
- package/dist/configuration/types/DepartmentJobs.mjs.map +1 -0
- package/dist/configuration/types/Language.d.mts +10 -0
- package/dist/configuration/types/Language.d.mts.map +1 -0
- package/dist/configuration/types/Language.mjs +13 -0
- package/dist/configuration/types/Language.mjs.map +1 -0
- package/dist/configuration/types/PrimaryTranslations.d.mts +9 -0
- package/dist/configuration/types/PrimaryTranslations.d.mts.map +1 -0
- package/dist/configuration/types/PrimaryTranslations.mjs +12 -0
- package/dist/configuration/types/PrimaryTranslations.mjs.map +1 -0
- package/dist/configuration/types/Timezone.d.mts +17 -0
- package/dist/configuration/types/Timezone.d.mts.map +1 -0
- package/dist/configuration/types/Timezone.mjs +18 -0
- package/dist/configuration/types/Timezone.mjs.map +1 -0
- package/dist/configuration/types/index.d.mts +7 -0
- package/dist/configuration/types/index.mjs +7 -0
- package/dist/credit/getCredit.d.mts +37 -0
- package/dist/credit/getCredit.d.mts.map +1 -0
- package/dist/credit/getCredit.mjs +16 -0
- package/dist/credit/getCredit.mjs.map +1 -0
- package/dist/credit/index.d.mts +4 -0
- package/dist/credit/index.mjs +3 -0
- package/dist/credit/types/CreditDetails.d.mts +62 -0
- package/dist/credit/types/CreditDetails.d.mts.map +1 -0
- package/dist/credit/types/CreditDetails.mjs +35 -0
- package/dist/credit/types/CreditDetails.mjs.map +1 -0
- package/dist/credit/types/index.d.mts +2 -0
- package/dist/credit/types/index.mjs +1 -0
- package/dist/discover/discoverMovies.d.mts +708 -0
- package/dist/discover/discoverMovies.d.mts.map +1 -0
- package/dist/discover/discoverMovies.mjs +93 -0
- package/dist/discover/discoverMovies.mjs.map +1 -0
- package/dist/discover/discoverTvSeries.d.mts +608 -0
- package/dist/discover/discoverTvSeries.d.mts.map +1 -0
- package/dist/discover/discoverTvSeries.mjs +80 -0
- package/dist/discover/discoverTvSeries.mjs.map +1 -0
- package/dist/discover/index.d.mts +3 -0
- package/dist/discover/index.mjs +3 -0
- package/dist/find/findByExternalId.d.mts +38 -0
- package/dist/find/findByExternalId.d.mts.map +1 -0
- package/dist/find/findByExternalId.mjs +29 -0
- package/dist/find/findByExternalId.mjs.map +1 -0
- package/dist/find/index.d.mts +4 -0
- package/dist/find/index.mjs +3 -0
- package/dist/find/types/FindResults.d.mts +47 -0
- package/dist/find/types/FindResults.d.mts.map +1 -0
- package/dist/find/types/FindResults.mjs +39 -0
- package/dist/find/types/FindResults.mjs.map +1 -0
- package/dist/find/types/index.d.mts +2 -0
- package/dist/find/types/index.mjs +1 -0
- package/dist/genre/getMovieGenres.d.mts +36 -0
- package/dist/genre/getMovieGenres.d.mts.map +1 -0
- package/dist/genre/getMovieGenres.mjs +13 -0
- package/dist/genre/getMovieGenres.mjs.map +1 -0
- package/dist/genre/getTvGenres.d.mts +36 -0
- package/dist/genre/getTvGenres.d.mts.map +1 -0
- package/dist/genre/getTvGenres.mjs +13 -0
- package/dist/genre/getTvGenres.mjs.map +1 -0
- package/dist/genre/index.d.mts +5 -0
- package/dist/genre/index.mjs +4 -0
- package/dist/genre/types/GenreList.d.mts +15 -0
- package/dist/genre/types/GenreList.d.mts.map +1 -0
- package/dist/genre/types/GenreList.mjs +14 -0
- package/dist/genre/types/GenreList.mjs.map +1 -0
- package/dist/genre/types/index.d.mts +2 -0
- package/dist/genre/types/index.mjs +1 -0
- package/dist/index.d.mts +213 -0
- package/dist/index.mjs +192 -0
- package/dist/keyword/getKeyword.d.mts +13 -0
- package/dist/keyword/getKeyword.d.mts.map +1 -0
- package/dist/keyword/getKeyword.mjs +14 -0
- package/dist/keyword/getKeyword.mjs.map +1 -0
- package/dist/keyword/getKeywordMovies.d.mts +51 -0
- package/dist/keyword/getKeywordMovies.d.mts.map +1 -0
- package/dist/keyword/getKeywordMovies.mjs +21 -0
- package/dist/keyword/getKeywordMovies.mjs.map +1 -0
- package/dist/keyword/index.d.mts +3 -0
- package/dist/keyword/index.mjs +3 -0
- package/dist/list/getList.d.mts +44 -0
- package/dist/list/getList.d.mts.map +1 -0
- package/dist/list/getList.mjs +20 -0
- package/dist/list/getList.mjs.map +1 -0
- package/dist/list/getListItemStatus.d.mts +44 -0
- package/dist/list/getListItemStatus.d.mts.map +1 -0
- package/dist/list/getListItemStatus.mjs +20 -0
- package/dist/list/getListItemStatus.mjs.map +1 -0
- package/dist/list/index.d.mts +7 -0
- package/dist/list/index.mjs +6 -0
- package/dist/list/types/ListDetails.d.mts +29 -0
- package/dist/list/types/ListDetails.d.mts.map +1 -0
- package/dist/list/types/ListDetails.mjs +31 -0
- package/dist/list/types/ListDetails.mjs.map +1 -0
- package/dist/list/types/ListItemStatus.d.mts +15 -0
- package/dist/list/types/ListItemStatus.d.mts.map +1 -0
- package/dist/list/types/ListItemStatus.mjs +18 -0
- package/dist/list/types/ListItemStatus.mjs.map +1 -0
- package/dist/list/types/ListsContaining.d.mts +31 -0
- package/dist/list/types/ListsContaining.d.mts.map +1 -0
- package/dist/list/types/ListsContaining.mjs +32 -0
- package/dist/list/types/ListsContaining.mjs.map +1 -0
- package/dist/list/types/index.d.mts +4 -0
- package/dist/list/types/index.mjs +4 -0
- package/dist/movie/getLatestMovie.d.mts +9 -0
- package/dist/movie/getLatestMovie.d.mts.map +1 -0
- package/dist/movie/getLatestMovie.mjs +11 -0
- package/dist/movie/getLatestMovie.mjs.map +1 -0
- package/dist/movie/getMovie.d.mts +45 -0
- package/dist/movie/getMovie.d.mts.map +1 -0
- package/dist/movie/getMovie.mjs +36 -0
- package/dist/movie/getMovie.mjs.map +1 -0
- package/dist/movie/getMovieAlternativeTitles.d.mts +38 -0
- package/dist/movie/getMovieAlternativeTitles.d.mts.map +1 -0
- package/dist/movie/getMovieAlternativeTitles.mjs +19 -0
- package/dist/movie/getMovieAlternativeTitles.mjs.map +1 -0
- package/dist/movie/getMovieChangeList.d.mts +50 -0
- package/dist/movie/getMovieChangeList.d.mts.map +1 -0
- package/dist/movie/getMovieChangeList.mjs +19 -0
- package/dist/movie/getMovieChangeList.mjs.map +1 -0
- package/dist/movie/getMovieChanges.d.mts +51 -0
- package/dist/movie/getMovieChanges.d.mts.map +1 -0
- package/dist/movie/getMovieChanges.mjs +22 -0
- package/dist/movie/getMovieChanges.mjs.map +1 -0
- package/dist/movie/getMovieCredits.d.mts +37 -0
- package/dist/movie/getMovieCredits.d.mts.map +1 -0
- package/dist/movie/getMovieCredits.mjs +17 -0
- package/dist/movie/getMovieCredits.mjs.map +1 -0
- package/dist/movie/getMovieExternalIds.d.mts +13 -0
- package/dist/movie/getMovieExternalIds.d.mts.map +1 -0
- package/dist/movie/getMovieExternalIds.mjs +14 -0
- package/dist/movie/getMovieExternalIds.mjs.map +1 -0
- package/dist/movie/getMovieImages.d.mts +45 -0
- package/dist/movie/getMovieImages.d.mts.map +1 -0
- package/dist/movie/getMovieImages.mjs +21 -0
- package/dist/movie/getMovieImages.mjs.map +1 -0
- package/dist/movie/getMovieKeywords.d.mts +13 -0
- package/dist/movie/getMovieKeywords.d.mts.map +1 -0
- package/dist/movie/getMovieKeywords.mjs +13 -0
- package/dist/movie/getMovieKeywords.mjs.map +1 -0
- package/dist/movie/getMovieLists.d.mts +44 -0
- package/dist/movie/getMovieLists.d.mts.map +1 -0
- package/dist/movie/getMovieLists.mjs +20 -0
- package/dist/movie/getMovieLists.mjs.map +1 -0
- package/dist/movie/getMovieRecommendations.d.mts +44 -0
- package/dist/movie/getMovieRecommendations.d.mts.map +1 -0
- package/dist/movie/getMovieRecommendations.mjs +20 -0
- package/dist/movie/getMovieRecommendations.mjs.map +1 -0
- package/dist/movie/getMovieReleaseDates.d.mts +13 -0
- package/dist/movie/getMovieReleaseDates.d.mts.map +1 -0
- package/dist/movie/getMovieReleaseDates.mjs +14 -0
- package/dist/movie/getMovieReleaseDates.mjs.map +1 -0
- package/dist/movie/getMovieReviews.d.mts +44 -0
- package/dist/movie/getMovieReviews.d.mts.map +1 -0
- package/dist/movie/getMovieReviews.mjs +20 -0
- package/dist/movie/getMovieReviews.mjs.map +1 -0
- package/dist/movie/getMovieTranslations.d.mts +13 -0
- package/dist/movie/getMovieTranslations.d.mts.map +1 -0
- package/dist/movie/getMovieTranslations.mjs +14 -0
- package/dist/movie/getMovieTranslations.mjs.map +1 -0
- package/dist/movie/getMovieVideos.d.mts +37 -0
- package/dist/movie/getMovieVideos.d.mts.map +1 -0
- package/dist/movie/getMovieVideos.mjs +17 -0
- package/dist/movie/getMovieVideos.mjs.map +1 -0
- package/dist/movie/getMovieWatchProviders.d.mts +13 -0
- package/dist/movie/getMovieWatchProviders.d.mts.map +1 -0
- package/dist/movie/getMovieWatchProviders.mjs +14 -0
- package/dist/movie/getMovieWatchProviders.mjs.map +1 -0
- package/dist/movie/getNowPlayingMovies.d.mts +51 -0
- package/dist/movie/getNowPlayingMovies.d.mts.map +1 -0
- package/dist/movie/getNowPlayingMovies.mjs +19 -0
- package/dist/movie/getNowPlayingMovies.mjs.map +1 -0
- package/dist/movie/getPopularMovies.d.mts +51 -0
- package/dist/movie/getPopularMovies.d.mts.map +1 -0
- package/dist/movie/getPopularMovies.mjs +19 -0
- package/dist/movie/getPopularMovies.mjs.map +1 -0
- package/dist/movie/getSimilarMovies.d.mts +44 -0
- package/dist/movie/getSimilarMovies.d.mts.map +1 -0
- package/dist/movie/getSimilarMovies.mjs +20 -0
- package/dist/movie/getSimilarMovies.mjs.map +1 -0
- package/dist/movie/getTopRatedMovies.d.mts +51 -0
- package/dist/movie/getTopRatedMovies.d.mts.map +1 -0
- package/dist/movie/getTopRatedMovies.mjs +19 -0
- package/dist/movie/getTopRatedMovies.mjs.map +1 -0
- package/dist/movie/getUpcomingMovies.d.mts +51 -0
- package/dist/movie/getUpcomingMovies.d.mts.map +1 -0
- package/dist/movie/getUpcomingMovies.mjs +19 -0
- package/dist/movie/getUpcomingMovies.mjs.map +1 -0
- package/dist/movie/index.d.mts +31 -0
- package/dist/movie/index.mjs +30 -0
- package/dist/movie/types/MovieAlternativeTitles.d.mts +20 -0
- package/dist/movie/types/MovieAlternativeTitles.d.mts.map +1 -0
- package/dist/movie/types/MovieAlternativeTitles.mjs +23 -0
- package/dist/movie/types/MovieAlternativeTitles.mjs.map +1 -0
- package/dist/movie/types/MovieCredits.d.mts +39 -0
- package/dist/movie/types/MovieCredits.d.mts.map +1 -0
- package/dist/movie/types/MovieCredits.mjs +30 -0
- package/dist/movie/types/MovieCredits.mjs.map +1 -0
- package/dist/movie/types/MovieDetails.d.mts +145 -0
- package/dist/movie/types/MovieDetails.d.mts.map +1 -0
- package/dist/movie/types/MovieDetails.mjs +94 -0
- package/dist/movie/types/MovieDetails.mjs.map +1 -0
- package/dist/movie/types/MovieExternalIds.d.mts +19 -0
- package/dist/movie/types/MovieExternalIds.d.mts.map +1 -0
- package/dist/movie/types/MovieExternalIds.mjs +22 -0
- package/dist/movie/types/MovieExternalIds.mjs.map +1 -0
- package/dist/movie/types/MovieKeywords.d.mts +16 -0
- package/dist/movie/types/MovieKeywords.d.mts.map +1 -0
- package/dist/movie/types/MovieKeywords.mjs +18 -0
- package/dist/movie/types/MovieKeywords.mjs.map +1 -0
- package/dist/movie/types/MovieListItem.d.mts +116 -0
- package/dist/movie/types/MovieListItem.d.mts.map +1 -0
- package/dist/movie/types/MovieListItem.mjs +57 -0
- package/dist/movie/types/MovieListItem.mjs.map +1 -0
- package/dist/movie/types/MovieReleaseDates.d.mts +36 -0
- package/dist/movie/types/MovieReleaseDates.d.mts.map +1 -0
- package/dist/movie/types/MovieReleaseDates.mjs +45 -0
- package/dist/movie/types/MovieReleaseDates.mjs.map +1 -0
- package/dist/movie/types/MovieTranslations.d.mts +20 -0
- package/dist/movie/types/MovieTranslations.d.mts.map +1 -0
- package/dist/movie/types/MovieTranslations.mjs +22 -0
- package/dist/movie/types/MovieTranslations.mjs.map +1 -0
- package/dist/movie/types/index.d.mts +9 -0
- package/dist/movie/types/index.mjs +9 -0
- package/dist/network/getNetwork.d.mts +13 -0
- package/dist/network/getNetwork.d.mts.map +1 -0
- package/dist/network/getNetwork.mjs +14 -0
- package/dist/network/getNetwork.mjs.map +1 -0
- package/dist/network/getNetworkAlternativeNames.d.mts +13 -0
- package/dist/network/getNetworkAlternativeNames.d.mts.map +1 -0
- package/dist/network/getNetworkAlternativeNames.mjs +14 -0
- package/dist/network/getNetworkAlternativeNames.mjs.map +1 -0
- package/dist/network/getNetworkImages.d.mts +13 -0
- package/dist/network/getNetworkImages.d.mts.map +1 -0
- package/dist/network/getNetworkImages.mjs +14 -0
- package/dist/network/getNetworkImages.mjs.map +1 -0
- package/dist/network/index.d.mts +6 -0
- package/dist/network/index.mjs +5 -0
- package/dist/network/types/NetworkDetails.d.mts +19 -0
- package/dist/network/types/NetworkDetails.d.mts.map +1 -0
- package/dist/network/types/NetworkDetails.mjs +22 -0
- package/dist/network/types/NetworkDetails.mjs.map +1 -0
- package/dist/network/types/index.d.mts +2 -0
- package/dist/network/types/index.mjs +1 -0
- package/dist/person/getLatestPerson.d.mts +9 -0
- package/dist/person/getLatestPerson.d.mts.map +1 -0
- package/dist/person/getLatestPerson.mjs +11 -0
- package/dist/person/getLatestPerson.mjs.map +1 -0
- package/dist/person/getPerson.d.mts +45 -0
- package/dist/person/getPerson.d.mts.map +1 -0
- package/dist/person/getPerson.mjs +30 -0
- package/dist/person/getPerson.mjs.map +1 -0
- package/dist/person/getPersonChangeList.d.mts +50 -0
- package/dist/person/getPersonChangeList.d.mts.map +1 -0
- package/dist/person/getPersonChangeList.mjs +19 -0
- package/dist/person/getPersonChangeList.mjs.map +1 -0
- package/dist/person/getPersonChanges.d.mts +51 -0
- package/dist/person/getPersonChanges.d.mts.map +1 -0
- package/dist/person/getPersonChanges.mjs +22 -0
- package/dist/person/getPersonChanges.mjs.map +1 -0
- package/dist/person/getPersonCombinedCredits.d.mts +37 -0
- package/dist/person/getPersonCombinedCredits.d.mts.map +1 -0
- package/dist/person/getPersonCombinedCredits.mjs +16 -0
- package/dist/person/getPersonCombinedCredits.mjs.map +1 -0
- package/dist/person/getPersonExternalIds.d.mts +13 -0
- package/dist/person/getPersonExternalIds.d.mts.map +1 -0
- package/dist/person/getPersonExternalIds.mjs +14 -0
- package/dist/person/getPersonExternalIds.mjs.map +1 -0
- package/dist/person/getPersonImages.d.mts +13 -0
- package/dist/person/getPersonImages.d.mts.map +1 -0
- package/dist/person/getPersonImages.mjs +14 -0
- package/dist/person/getPersonImages.mjs.map +1 -0
- package/dist/person/getPersonMovieCredits.d.mts +37 -0
- package/dist/person/getPersonMovieCredits.d.mts.map +1 -0
- package/dist/person/getPersonMovieCredits.mjs +17 -0
- package/dist/person/getPersonMovieCredits.mjs.map +1 -0
- package/dist/person/getPersonTaggedImages.d.mts +37 -0
- package/dist/person/getPersonTaggedImages.d.mts.map +1 -0
- package/dist/person/getPersonTaggedImages.mjs +17 -0
- package/dist/person/getPersonTaggedImages.mjs.map +1 -0
- package/dist/person/getPersonTranslations.d.mts +13 -0
- package/dist/person/getPersonTranslations.d.mts.map +1 -0
- package/dist/person/getPersonTranslations.mjs +14 -0
- package/dist/person/getPersonTranslations.mjs.map +1 -0
- package/dist/person/getPersonTvCredits.d.mts +37 -0
- package/dist/person/getPersonTvCredits.d.mts.map +1 -0
- package/dist/person/getPersonTvCredits.mjs +17 -0
- package/dist/person/getPersonTvCredits.mjs.map +1 -0
- package/dist/person/getPopularPeople.d.mts +43 -0
- package/dist/person/getPopularPeople.d.mts.map +1 -0
- package/dist/person/getPopularPeople.mjs +17 -0
- package/dist/person/getPopularPeople.mjs.map +1 -0
- package/dist/person/index.d.mts +20 -0
- package/dist/person/index.mjs +19 -0
- package/dist/person/types/PersonCredits.d.mts +127 -0
- package/dist/person/types/PersonCredits.d.mts.map +1 -0
- package/dist/person/types/PersonCredits.mjs +81 -0
- package/dist/person/types/PersonCredits.mjs.map +1 -0
- package/dist/person/types/PersonDetails.d.mts +78 -0
- package/dist/person/types/PersonDetails.d.mts.map +1 -0
- package/dist/person/types/PersonDetails.mjs +55 -0
- package/dist/person/types/PersonDetails.mjs.map +1 -0
- package/dist/person/types/PersonExternalIds.d.mts +26 -0
- package/dist/person/types/PersonExternalIds.d.mts.map +1 -0
- package/dist/person/types/PersonExternalIds.mjs +30 -0
- package/dist/person/types/PersonExternalIds.mjs.map +1 -0
- package/dist/person/types/PersonListItem.d.mts +75 -0
- package/dist/person/types/PersonListItem.d.mts.map +1 -0
- package/dist/person/types/PersonListItem.mjs +46 -0
- package/dist/person/types/PersonListItem.mjs.map +1 -0
- package/dist/person/types/PersonTranslations.d.mts +18 -0
- package/dist/person/types/PersonTranslations.d.mts.map +1 -0
- package/dist/person/types/PersonTranslations.mjs +19 -0
- package/dist/person/types/PersonTranslations.mjs.map +1 -0
- package/dist/person/types/TaggedImages.d.mts +36 -0
- package/dist/person/types/TaggedImages.d.mts.map +1 -0
- package/dist/person/types/TaggedImages.mjs +31 -0
- package/dist/person/types/TaggedImages.mjs.map +1 -0
- package/dist/person/types/index.d.mts +7 -0
- package/dist/person/types/index.mjs +7 -0
- package/dist/requests/TmdbSession.d.mts +91 -0
- package/dist/requests/TmdbSession.d.mts.map +1 -0
- package/dist/requests/TmdbSession.mjs +203 -0
- package/dist/requests/TmdbSession.mjs.map +1 -0
- package/dist/requests/addParams.d.mts +15 -0
- package/dist/requests/addParams.d.mts.map +1 -0
- package/dist/requests/addParams.mjs +27 -0
- package/dist/requests/addParams.mjs.map +1 -0
- package/dist/requests/buildURL.d.mts +11 -0
- package/dist/requests/buildURL.d.mts.map +1 -0
- package/dist/requests/buildURL.mjs +15 -0
- package/dist/requests/buildURL.mjs.map +1 -0
- package/dist/requests/index.d.mts +7 -0
- package/dist/requests/index.mjs +7 -0
- package/dist/requests/methods.d.mts +22 -0
- package/dist/requests/methods.d.mts.map +1 -0
- package/dist/requests/methods.mjs +16 -0
- package/dist/requests/methods.mjs.map +1 -0
- package/dist/requests/request.d.mts +28 -0
- package/dist/requests/request.d.mts.map +1 -0
- package/dist/requests/request.mjs +62 -0
- package/dist/requests/request.mjs.map +1 -0
- package/dist/requests/toValidated.d.mts +11 -0
- package/dist/requests/toValidated.d.mts.map +1 -0
- package/dist/requests/toValidated.mjs +24 -0
- package/dist/requests/toValidated.mjs.map +1 -0
- package/dist/review/getReview.d.mts +13 -0
- package/dist/review/getReview.d.mts.map +1 -0
- package/dist/review/getReview.mjs +13 -0
- package/dist/review/getReview.mjs.map +1 -0
- package/dist/review/index.d.mts +4 -0
- package/dist/review/index.mjs +3 -0
- package/dist/review/types/Review.d.mts +79 -0
- package/dist/review/types/Review.d.mts.map +1 -0
- package/dist/review/types/Review.mjs +49 -0
- package/dist/review/types/Review.mjs.map +1 -0
- package/dist/review/types/index.d.mts +2 -0
- package/dist/review/types/index.mjs +1 -0
- package/dist/search/index.d.mts +8 -0
- package/dist/search/index.mjs +8 -0
- package/dist/search/searchCollections.d.mts +58 -0
- package/dist/search/searchCollections.d.mts.map +1 -0
- package/dist/search/searchCollections.mjs +25 -0
- package/dist/search/searchCollections.mjs.map +1 -0
- package/dist/search/searchCompanies.d.mts +37 -0
- package/dist/search/searchCompanies.d.mts.map +1 -0
- package/dist/search/searchCompanies.mjs +20 -0
- package/dist/search/searchCompanies.mjs.map +1 -0
- package/dist/search/searchKeywords.d.mts +37 -0
- package/dist/search/searchKeywords.d.mts.map +1 -0
- package/dist/search/searchKeywords.mjs +20 -0
- package/dist/search/searchKeywords.mjs.map +1 -0
- package/dist/search/searchMovies.d.mts +73 -0
- package/dist/search/searchMovies.d.mts.map +1 -0
- package/dist/search/searchMovies.mjs +28 -0
- package/dist/search/searchMovies.mjs.map +1 -0
- package/dist/search/searchMulti.d.mts +51 -0
- package/dist/search/searchMulti.d.mts.map +1 -0
- package/dist/search/searchMulti.mjs +24 -0
- package/dist/search/searchMulti.mjs.map +1 -0
- package/dist/search/searchPeople.d.mts +51 -0
- package/dist/search/searchPeople.d.mts.map +1 -0
- package/dist/search/searchPeople.mjs +24 -0
- package/dist/search/searchPeople.mjs.map +1 -0
- package/dist/search/searchTvSeries.d.mts +67 -0
- package/dist/search/searchTvSeries.d.mts.map +1 -0
- package/dist/search/searchTvSeries.mjs +28 -0
- package/dist/search/searchTvSeries.mjs.map +1 -0
- package/dist/trending/getTrending.d.mts +38 -0
- package/dist/trending/getTrending.d.mts.map +1 -0
- package/dist/trending/getTrending.mjs +18 -0
- package/dist/trending/getTrending.mjs.map +1 -0
- package/dist/trending/getTrendingMovies.d.mts +38 -0
- package/dist/trending/getTrendingMovies.d.mts.map +1 -0
- package/dist/trending/getTrendingMovies.mjs +18 -0
- package/dist/trending/getTrendingMovies.mjs.map +1 -0
- package/dist/trending/getTrendingPeople.d.mts +38 -0
- package/dist/trending/getTrendingPeople.d.mts.map +1 -0
- package/dist/trending/getTrendingPeople.mjs +18 -0
- package/dist/trending/getTrendingPeople.mjs.map +1 -0
- package/dist/trending/getTrendingTvSeries.d.mts +38 -0
- package/dist/trending/getTrendingTvSeries.d.mts.map +1 -0
- package/dist/trending/getTrendingTvSeries.mjs +18 -0
- package/dist/trending/getTrendingTvSeries.mjs.map +1 -0
- package/dist/trending/index.d.mts +5 -0
- package/dist/trending/index.mjs +5 -0
- package/dist/tv/getLatestTvSeries.d.mts +9 -0
- package/dist/tv/getLatestTvSeries.d.mts.map +1 -0
- package/dist/tv/getLatestTvSeries.mjs +11 -0
- package/dist/tv/getLatestTvSeries.mjs.map +1 -0
- package/dist/tv/getPopularTvSeries.d.mts +43 -0
- package/dist/tv/getPopularTvSeries.d.mts.map +1 -0
- package/dist/tv/getPopularTvSeries.mjs +17 -0
- package/dist/tv/getPopularTvSeries.mjs.map +1 -0
- package/dist/tv/getSimilarTvSeries.d.mts +44 -0
- package/dist/tv/getSimilarTvSeries.d.mts.map +1 -0
- package/dist/tv/getSimilarTvSeries.mjs +20 -0
- package/dist/tv/getSimilarTvSeries.mjs.map +1 -0
- package/dist/tv/getTopRatedTvSeries.d.mts +43 -0
- package/dist/tv/getTopRatedTvSeries.d.mts.map +1 -0
- package/dist/tv/getTopRatedTvSeries.mjs +17 -0
- package/dist/tv/getTopRatedTvSeries.mjs.map +1 -0
- package/dist/tv/getTvChangeList.d.mts +50 -0
- package/dist/tv/getTvChangeList.d.mts.map +1 -0
- package/dist/tv/getTvChangeList.mjs +19 -0
- package/dist/tv/getTvChangeList.mjs.map +1 -0
- package/dist/tv/getTvEpisode.d.mts +47 -0
- package/dist/tv/getTvEpisode.d.mts.map +1 -0
- package/dist/tv/getTvEpisode.mjs +29 -0
- package/dist/tv/getTvEpisode.mjs.map +1 -0
- package/dist/tv/getTvEpisodeChanges.d.mts +13 -0
- package/dist/tv/getTvEpisodeChanges.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeChanges.mjs +14 -0
- package/dist/tv/getTvEpisodeChanges.mjs.map +1 -0
- package/dist/tv/getTvEpisodeCredits.d.mts +39 -0
- package/dist/tv/getTvEpisodeCredits.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeCredits.mjs +19 -0
- package/dist/tv/getTvEpisodeCredits.mjs.map +1 -0
- package/dist/tv/getTvEpisodeExternalIds.d.mts +15 -0
- package/dist/tv/getTvEpisodeExternalIds.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeExternalIds.mjs +18 -0
- package/dist/tv/getTvEpisodeExternalIds.mjs.map +1 -0
- package/dist/tv/getTvEpisodeGroup.d.mts +13 -0
- package/dist/tv/getTvEpisodeGroup.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeGroup.mjs +13 -0
- package/dist/tv/getTvEpisodeGroup.mjs.map +1 -0
- package/dist/tv/getTvEpisodeImages.d.mts +47 -0
- package/dist/tv/getTvEpisodeImages.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeImages.mjs +23 -0
- package/dist/tv/getTvEpisodeImages.mjs.map +1 -0
- package/dist/tv/getTvEpisodeTranslations.d.mts +15 -0
- package/dist/tv/getTvEpisodeTranslations.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeTranslations.mjs +18 -0
- package/dist/tv/getTvEpisodeTranslations.mjs.map +1 -0
- package/dist/tv/getTvEpisodeVideos.d.mts +47 -0
- package/dist/tv/getTvEpisodeVideos.d.mts.map +1 -0
- package/dist/tv/getTvEpisodeVideos.mjs +23 -0
- package/dist/tv/getTvEpisodeVideos.mjs.map +1 -0
- package/dist/tv/getTvSeason.d.mts +46 -0
- package/dist/tv/getTvSeason.d.mts.map +1 -0
- package/dist/tv/getTvSeason.mjs +30 -0
- package/dist/tv/getTvSeason.mjs.map +1 -0
- package/dist/tv/getTvSeasonAggregateCredits.d.mts +38 -0
- package/dist/tv/getTvSeasonAggregateCredits.d.mts.map +1 -0
- package/dist/tv/getTvSeasonAggregateCredits.mjs +18 -0
- package/dist/tv/getTvSeasonAggregateCredits.mjs.map +1 -0
- package/dist/tv/getTvSeasonChanges.d.mts +51 -0
- package/dist/tv/getTvSeasonChanges.d.mts.map +1 -0
- package/dist/tv/getTvSeasonChanges.mjs +21 -0
- package/dist/tv/getTvSeasonChanges.mjs.map +1 -0
- package/dist/tv/getTvSeasonCredits.d.mts +38 -0
- package/dist/tv/getTvSeasonCredits.d.mts.map +1 -0
- package/dist/tv/getTvSeasonCredits.mjs +18 -0
- package/dist/tv/getTvSeasonCredits.mjs.map +1 -0
- package/dist/tv/getTvSeasonExternalIds.d.mts +14 -0
- package/dist/tv/getTvSeasonExternalIds.d.mts.map +1 -0
- package/dist/tv/getTvSeasonExternalIds.mjs +17 -0
- package/dist/tv/getTvSeasonExternalIds.mjs.map +1 -0
- package/dist/tv/getTvSeasonImages.d.mts +46 -0
- package/dist/tv/getTvSeasonImages.d.mts.map +1 -0
- package/dist/tv/getTvSeasonImages.mjs +22 -0
- package/dist/tv/getTvSeasonImages.mjs.map +1 -0
- package/dist/tv/getTvSeasonTranslations.d.mts +14 -0
- package/dist/tv/getTvSeasonTranslations.d.mts.map +1 -0
- package/dist/tv/getTvSeasonTranslations.mjs +17 -0
- package/dist/tv/getTvSeasonTranslations.mjs.map +1 -0
- package/dist/tv/getTvSeasonVideos.d.mts +46 -0
- package/dist/tv/getTvSeasonVideos.d.mts.map +1 -0
- package/dist/tv/getTvSeasonVideos.mjs +22 -0
- package/dist/tv/getTvSeasonVideos.mjs.map +1 -0
- package/dist/tv/getTvSeasonWatchProviders.d.mts +38 -0
- package/dist/tv/getTvSeasonWatchProviders.d.mts.map +1 -0
- package/dist/tv/getTvSeasonWatchProviders.mjs +18 -0
- package/dist/tv/getTvSeasonWatchProviders.mjs.map +1 -0
- package/dist/tv/getTvSeries.d.mts +45 -0
- package/dist/tv/getTvSeries.d.mts.map +1 -0
- package/dist/tv/getTvSeries.mjs +39 -0
- package/dist/tv/getTvSeries.mjs.map +1 -0
- package/dist/tv/getTvSeriesAggregateCredits.d.mts +37 -0
- package/dist/tv/getTvSeriesAggregateCredits.d.mts.map +1 -0
- package/dist/tv/getTvSeriesAggregateCredits.mjs +17 -0
- package/dist/tv/getTvSeriesAggregateCredits.mjs.map +1 -0
- package/dist/tv/getTvSeriesAiringToday.d.mts +50 -0
- package/dist/tv/getTvSeriesAiringToday.d.mts.map +1 -0
- package/dist/tv/getTvSeriesAiringToday.mjs +18 -0
- package/dist/tv/getTvSeriesAiringToday.mjs.map +1 -0
- package/dist/tv/getTvSeriesAlternativeTitles.d.mts +13 -0
- package/dist/tv/getTvSeriesAlternativeTitles.d.mts.map +1 -0
- package/dist/tv/getTvSeriesAlternativeTitles.mjs +14 -0
- package/dist/tv/getTvSeriesAlternativeTitles.mjs.map +1 -0
- package/dist/tv/getTvSeriesChanges.d.mts +51 -0
- package/dist/tv/getTvSeriesChanges.d.mts.map +1 -0
- package/dist/tv/getTvSeriesChanges.mjs +21 -0
- package/dist/tv/getTvSeriesChanges.mjs.map +1 -0
- package/dist/tv/getTvSeriesContentRatings.d.mts +13 -0
- package/dist/tv/getTvSeriesContentRatings.d.mts.map +1 -0
- package/dist/tv/getTvSeriesContentRatings.mjs +14 -0
- package/dist/tv/getTvSeriesContentRatings.mjs.map +1 -0
- package/dist/tv/getTvSeriesCredits.d.mts +37 -0
- package/dist/tv/getTvSeriesCredits.d.mts.map +1 -0
- package/dist/tv/getTvSeriesCredits.mjs +17 -0
- package/dist/tv/getTvSeriesCredits.mjs.map +1 -0
- package/dist/tv/getTvSeriesEpisodeGroups.d.mts +13 -0
- package/dist/tv/getTvSeriesEpisodeGroups.d.mts.map +1 -0
- package/dist/tv/getTvSeriesEpisodeGroups.mjs +14 -0
- package/dist/tv/getTvSeriesEpisodeGroups.mjs.map +1 -0
- package/dist/tv/getTvSeriesExternalIds.d.mts +13 -0
- package/dist/tv/getTvSeriesExternalIds.d.mts.map +1 -0
- package/dist/tv/getTvSeriesExternalIds.mjs +14 -0
- package/dist/tv/getTvSeriesExternalIds.mjs.map +1 -0
- package/dist/tv/getTvSeriesImages.d.mts +45 -0
- package/dist/tv/getTvSeriesImages.d.mts.map +1 -0
- package/dist/tv/getTvSeriesImages.mjs +21 -0
- package/dist/tv/getTvSeriesImages.mjs.map +1 -0
- package/dist/tv/getTvSeriesKeywords.d.mts +13 -0
- package/dist/tv/getTvSeriesKeywords.d.mts.map +1 -0
- package/dist/tv/getTvSeriesKeywords.mjs +14 -0
- package/dist/tv/getTvSeriesKeywords.mjs.map +1 -0
- package/dist/tv/getTvSeriesLists.d.mts +44 -0
- package/dist/tv/getTvSeriesLists.d.mts.map +1 -0
- package/dist/tv/getTvSeriesLists.mjs +20 -0
- package/dist/tv/getTvSeriesLists.mjs.map +1 -0
- package/dist/tv/getTvSeriesOnTheAir.d.mts +50 -0
- package/dist/tv/getTvSeriesOnTheAir.d.mts.map +1 -0
- package/dist/tv/getTvSeriesOnTheAir.mjs +18 -0
- package/dist/tv/getTvSeriesOnTheAir.mjs.map +1 -0
- package/dist/tv/getTvSeriesRecommendations.d.mts +44 -0
- package/dist/tv/getTvSeriesRecommendations.d.mts.map +1 -0
- package/dist/tv/getTvSeriesRecommendations.mjs +20 -0
- package/dist/tv/getTvSeriesRecommendations.mjs.map +1 -0
- package/dist/tv/getTvSeriesReviews.d.mts +44 -0
- package/dist/tv/getTvSeriesReviews.d.mts.map +1 -0
- package/dist/tv/getTvSeriesReviews.mjs +20 -0
- package/dist/tv/getTvSeriesReviews.mjs.map +1 -0
- package/dist/tv/getTvSeriesScreenedTheatrically.d.mts +13 -0
- package/dist/tv/getTvSeriesScreenedTheatrically.d.mts.map +1 -0
- package/dist/tv/getTvSeriesScreenedTheatrically.mjs +14 -0
- package/dist/tv/getTvSeriesScreenedTheatrically.mjs.map +1 -0
- package/dist/tv/getTvSeriesTranslations.d.mts +13 -0
- package/dist/tv/getTvSeriesTranslations.d.mts.map +1 -0
- package/dist/tv/getTvSeriesTranslations.mjs +14 -0
- package/dist/tv/getTvSeriesTranslations.mjs.map +1 -0
- package/dist/tv/getTvSeriesVideos.d.mts +45 -0
- package/dist/tv/getTvSeriesVideos.d.mts.map +1 -0
- package/dist/tv/getTvSeriesVideos.mjs +21 -0
- package/dist/tv/getTvSeriesVideos.mjs.map +1 -0
- package/dist/tv/getTvSeriesWatchProviders.d.mts +13 -0
- package/dist/tv/getTvSeriesWatchProviders.d.mts.map +1 -0
- package/dist/tv/getTvSeriesWatchProviders.mjs +14 -0
- package/dist/tv/getTvSeriesWatchProviders.mjs.map +1 -0
- package/dist/tv/index.d.mts +57 -0
- package/dist/tv/index.mjs +56 -0
- package/dist/tv/types/AggregateCredits.d.mts +53 -0
- package/dist/tv/types/AggregateCredits.d.mts.map +1 -0
- package/dist/tv/types/AggregateCredits.mjs +41 -0
- package/dist/tv/types/AggregateCredits.mjs.map +1 -0
- package/dist/tv/types/ContentRatings.d.mts +21 -0
- package/dist/tv/types/ContentRatings.d.mts.map +1 -0
- package/dist/tv/types/ContentRatings.mjs +24 -0
- package/dist/tv/types/ContentRatings.mjs.map +1 -0
- package/dist/tv/types/EpisodeGroups.d.mts +64 -0
- package/dist/tv/types/EpisodeGroups.d.mts.map +1 -0
- package/dist/tv/types/EpisodeGroups.mjs +52 -0
- package/dist/tv/types/EpisodeGroups.mjs.map +1 -0
- package/dist/tv/types/ScreenedTheatrically.d.mts +19 -0
- package/dist/tv/types/ScreenedTheatrically.d.mts.map +1 -0
- package/dist/tv/types/ScreenedTheatrically.mjs +22 -0
- package/dist/tv/types/ScreenedTheatrically.mjs.map +1 -0
- package/dist/tv/types/TvAlternativeTitles.d.mts +20 -0
- package/dist/tv/types/TvAlternativeTitles.d.mts.map +1 -0
- package/dist/tv/types/TvAlternativeTitles.mjs +23 -0
- package/dist/tv/types/TvAlternativeTitles.mjs.map +1 -0
- package/dist/tv/types/TvCredits.d.mts +26 -0
- package/dist/tv/types/TvCredits.d.mts.map +1 -0
- package/dist/tv/types/TvCredits.mjs +27 -0
- package/dist/tv/types/TvCredits.mjs.map +1 -0
- package/dist/tv/types/TvEpisode.d.mts +48 -0
- package/dist/tv/types/TvEpisode.d.mts.map +1 -0
- package/dist/tv/types/TvEpisode.mjs +36 -0
- package/dist/tv/types/TvEpisode.mjs.map +1 -0
- package/dist/tv/types/TvEpisodeDetails.d.mts +62 -0
- package/dist/tv/types/TvEpisodeDetails.d.mts.map +1 -0
- package/dist/tv/types/TvEpisodeDetails.mjs +36 -0
- package/dist/tv/types/TvEpisodeDetails.mjs.map +1 -0
- package/dist/tv/types/TvExternalIds.d.mts +47 -0
- package/dist/tv/types/TvExternalIds.d.mts.map +1 -0
- package/dist/tv/types/TvExternalIds.mjs +50 -0
- package/dist/tv/types/TvExternalIds.mjs.map +1 -0
- package/dist/tv/types/TvKeywords.d.mts +16 -0
- package/dist/tv/types/TvKeywords.d.mts.map +1 -0
- package/dist/tv/types/TvKeywords.mjs +18 -0
- package/dist/tv/types/TvKeywords.mjs.map +1 -0
- package/dist/tv/types/TvListItem.d.mts +106 -0
- package/dist/tv/types/TvListItem.d.mts.map +1 -0
- package/dist/tv/types/TvListItem.mjs +47 -0
- package/dist/tv/types/TvListItem.mjs.map +1 -0
- package/dist/tv/types/TvSeasonDetails.d.mts +99 -0
- package/dist/tv/types/TvSeasonDetails.d.mts.map +1 -0
- package/dist/tv/types/TvSeasonDetails.mjs +57 -0
- package/dist/tv/types/TvSeasonDetails.mjs.map +1 -0
- package/dist/tv/types/TvSeriesDetails.d.mts +193 -0
- package/dist/tv/types/TvSeriesDetails.d.mts.map +1 -0
- package/dist/tv/types/TvSeriesDetails.mjs +120 -0
- package/dist/tv/types/TvSeriesDetails.mjs.map +1 -0
- package/dist/tv/types/TvTranslations.d.mts +26 -0
- package/dist/tv/types/TvTranslations.d.mts.map +1 -0
- package/dist/tv/types/TvTranslations.mjs +25 -0
- package/dist/tv/types/TvTranslations.mjs.map +1 -0
- package/dist/tv/types/index.d.mts +15 -0
- package/dist/tv/types/index.mjs +15 -0
- package/dist/types/AlternativeNames.d.mts +18 -0
- package/dist/types/AlternativeNames.d.mts.map +1 -0
- package/dist/types/AlternativeNames.mjs +21 -0
- package/dist/types/AlternativeNames.mjs.map +1 -0
- package/dist/types/ChangeList.d.mts +17 -0
- package/dist/types/ChangeList.d.mts.map +1 -0
- package/dist/types/ChangeList.mjs +19 -0
- package/dist/types/ChangeList.mjs.map +1 -0
- package/dist/types/Changes.d.mts +46 -0
- package/dist/types/Changes.d.mts.map +1 -0
- package/dist/types/Changes.mjs +32 -0
- package/dist/types/Changes.mjs.map +1 -0
- package/dist/types/Credit.d.mts +89 -0
- package/dist/types/Credit.d.mts.map +1 -0
- package/dist/types/Credit.mjs +47 -0
- package/dist/types/Credit.mjs.map +1 -0
- package/dist/types/Genre.d.mts +18 -0
- package/dist/types/Genre.d.mts.map +1 -0
- package/dist/types/Genre.mjs +18 -0
- package/dist/types/Genre.mjs.map +1 -0
- package/dist/types/Images.d.mts +99 -0
- package/dist/types/Images.d.mts.map +1 -0
- package/dist/types/Images.mjs +75 -0
- package/dist/types/Images.mjs.map +1 -0
- package/dist/types/Keyword.d.mts +22 -0
- package/dist/types/Keyword.d.mts.map +1 -0
- package/dist/types/Keyword.mjs +21 -0
- package/dist/types/Keyword.mjs.map +1 -0
- package/dist/types/MediaListItem.d.mts +15 -0
- package/dist/types/MediaListItem.d.mts.map +1 -0
- package/dist/types/MediaListItem.mjs +21 -0
- package/dist/types/MediaListItem.mjs.map +1 -0
- package/dist/types/PagedResults.d.mts +26 -0
- package/dist/types/PagedResults.d.mts.map +1 -0
- package/dist/types/PagedResults.mjs +22 -0
- package/dist/types/PagedResults.mjs.map +1 -0
- package/dist/types/ProductionCompany.d.mts +24 -0
- package/dist/types/ProductionCompany.d.mts.map +1 -0
- package/dist/types/ProductionCompany.mjs +21 -0
- package/dist/types/ProductionCompany.mjs.map +1 -0
- package/dist/types/ProductionCountry.d.mts +20 -0
- package/dist/types/ProductionCountry.d.mts.map +1 -0
- package/dist/types/ProductionCountry.mjs +18 -0
- package/dist/types/ProductionCountry.mjs.map +1 -0
- package/dist/types/SpokenLanguage.d.mts +24 -0
- package/dist/types/SpokenLanguage.d.mts.map +1 -0
- package/dist/types/SpokenLanguage.mjs +20 -0
- package/dist/types/SpokenLanguage.mjs.map +1 -0
- package/dist/types/Translation.d.mts +27 -0
- package/dist/types/Translation.d.mts.map +1 -0
- package/dist/types/Translation.mjs +30 -0
- package/dist/types/Translation.mjs.map +1 -0
- package/dist/types/Video.d.mts +51 -0
- package/dist/types/Video.d.mts.map +1 -0
- package/dist/types/Video.mjs +37 -0
- package/dist/types/Video.mjs.map +1 -0
- package/dist/types/index.d.mts +15 -0
- package/dist/types/index.mjs +15 -0
- package/dist/utils/isNonNullable.d.mts +8 -0
- package/dist/utils/isNonNullable.d.mts.map +1 -0
- package/dist/utils/isNonNullable.mjs +10 -0
- package/dist/utils/isNonNullable.mjs.map +1 -0
- package/dist/utils/isObject.d.mts +2 -0
- package/dist/utils/isObject.d.mts.map +1 -0
- package/dist/utils/isObject.mjs +5 -0
- package/dist/utils/isObject.mjs.map +1 -0
- package/dist/utils/sleep.d.mts +5 -0
- package/dist/utils/sleep.d.mts.map +1 -0
- package/dist/utils/sleep.mjs +29 -0
- package/dist/utils/sleep.mjs.map +1 -0
- package/dist/utils/toCamelCase.d.mts +8 -0
- package/dist/utils/toCamelCase.d.mts.map +1 -0
- package/dist/utils/toCamelCase.mjs +11 -0
- package/dist/utils/toCamelCase.mjs.map +1 -0
- package/dist/utils/toCamelKeys.d.mts +17 -0
- package/dist/utils/toCamelKeys.d.mts.map +1 -0
- package/dist/utils/toCamelKeys.mjs +18 -0
- package/dist/utils/toCamelKeys.mjs.map +1 -0
- package/dist/utils/toSnakeCase.d.mts +2 -0
- package/dist/utils/toSnakeCase.d.mts.map +1 -0
- package/dist/utils/toSnakeCase.mjs +5 -0
- package/dist/utils/toSnakeCase.mjs.map +1 -0
- package/dist/utils/toSnakeKeys.d.mts +21 -0
- package/dist/utils/toSnakeKeys.d.mts.map +1 -0
- package/dist/utils/toSnakeKeys.mjs +18 -0
- package/dist/utils/toSnakeKeys.mjs.map +1 -0
- package/dist/validations/index.d.mts +4 -0
- package/dist/validations/index.mjs +4 -0
- package/dist/validations/integer.d.mts +8 -0
- package/dist/validations/integer.d.mts.map +1 -0
- package/dist/validations/integer.mjs +11 -0
- package/dist/validations/integer.mjs.map +1 -0
- package/dist/validations/isoDate.d.mts +4 -0
- package/dist/validations/isoDate.d.mts.map +1 -0
- package/dist/validations/isoDate.mjs +7 -0
- package/dist/validations/isoDate.mjs.map +1 -0
- package/dist/validations/schema.d.mts +96 -0
- package/dist/validations/schema.d.mts.map +1 -0
- package/dist/validations/schema.mjs +118 -0
- package/dist/validations/schema.mjs.map +1 -0
- package/dist/watch-providers/getMovieWatchProviderList.d.mts +43 -0
- package/dist/watch-providers/getMovieWatchProviderList.d.mts.map +1 -0
- package/dist/watch-providers/getMovieWatchProviderList.mjs +16 -0
- package/dist/watch-providers/getMovieWatchProviderList.mjs.map +1 -0
- package/dist/watch-providers/getTvWatchProviderList.d.mts +43 -0
- package/dist/watch-providers/getTvWatchProviderList.d.mts.map +1 -0
- package/dist/watch-providers/getTvWatchProviderList.mjs +16 -0
- package/dist/watch-providers/getTvWatchProviderList.mjs.map +1 -0
- package/dist/watch-providers/getWatchProviderRegions.d.mts +36 -0
- package/dist/watch-providers/getWatchProviderRegions.d.mts.map +1 -0
- package/dist/watch-providers/getWatchProviderRegions.mjs +13 -0
- package/dist/watch-providers/getWatchProviderRegions.mjs.map +1 -0
- package/dist/watch-providers/index.d.mts +8 -0
- package/dist/watch-providers/index.mjs +7 -0
- package/dist/watch-providers/types/WatchProviderList.d.mts +22 -0
- package/dist/watch-providers/types/WatchProviderList.d.mts.map +1 -0
- package/dist/watch-providers/types/WatchProviderList.mjs +22 -0
- package/dist/watch-providers/types/WatchProviderList.mjs.map +1 -0
- package/dist/watch-providers/types/WatchProviderRegion.d.mts +15 -0
- package/dist/watch-providers/types/WatchProviderRegion.d.mts.map +1 -0
- package/dist/watch-providers/types/WatchProviderRegion.mjs +14 -0
- package/dist/watch-providers/types/WatchProviderRegion.mjs.map +1 -0
- package/dist/watch-providers/types/WatchProviders.d.mts +33 -0
- package/dist/watch-providers/types/WatchProviders.d.mts.map +1 -0
- package/dist/watch-providers/types/WatchProviders.mjs +35 -0
- package/dist/watch-providers/types/WatchProviders.mjs.map +1 -0
- package/dist/watch-providers/types/index.d.mts +4 -0
- package/dist/watch-providers/types/index.mjs +4 -0
- package/package.json +39 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MovieMediaListItem } from "../../movie/types/MovieListItem.mjs";
|
|
2
|
+
import { TvMediaListItem } from "../../tv/types/TvListItem.mjs";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
declare const _taggedImageSchema: v.ObjectSchema<{
|
|
5
|
+
readonly id: v.StringSchema<undefined>;
|
|
6
|
+
/** `backdrop`, `poster`, `still`, … */
|
|
7
|
+
readonly imageType: v.StringSchema<undefined>;
|
|
8
|
+
/** The title the image is from. */
|
|
9
|
+
readonly media: v.GenericSchema<MovieMediaListItem | TvMediaListItem>;
|
|
10
|
+
readonly mediaType: v.StringSchema<undefined>;
|
|
11
|
+
readonly aspectRatio: v.NumberSchema<undefined>;
|
|
12
|
+
readonly filePath: v.StringSchema<undefined>;
|
|
13
|
+
readonly height: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
14
|
+
readonly iso_3166_1: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
15
|
+
readonly iso_639_1: v.NullableSchema<v.StringSchema<undefined>, undefined>;
|
|
16
|
+
readonly voteAverage: v.NumberSchema<undefined>;
|
|
17
|
+
readonly voteCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
18
|
+
readonly width: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
19
|
+
}, undefined>;
|
|
20
|
+
export interface TaggedImage extends v.InferOutput<typeof _taggedImageSchema> {}
|
|
21
|
+
declare const _taggedImagesSchema: v.ObjectSchema<{
|
|
22
|
+
readonly results: v.ArraySchema<v.GenericSchema<TaggedImage>, undefined>;
|
|
23
|
+
readonly page: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
24
|
+
readonly totalPages: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
25
|
+
readonly totalResults: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
26
|
+
readonly id: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>;
|
|
27
|
+
}, undefined>;
|
|
28
|
+
export interface TaggedImages extends v.InferOutput<typeof _taggedImagesSchema> {}
|
|
29
|
+
/**
|
|
30
|
+
* ### Tagged Images
|
|
31
|
+
*
|
|
32
|
+
* A page of images from movies and TV series that a person has been tagged in (`getPersonTaggedImages`).
|
|
33
|
+
*/
|
|
34
|
+
export declare const taggedImagesSchema: v.GenericSchema<TaggedImages>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=TaggedImages.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaggedImages.d.mts","names":[],"sources":["../../../src/person/types/TaggedImages.ts"],"mappings":";;;cAcM,oBAAkB,EAAA;;;;;;;;;;;;;;;;iBAaP,oBAAoB,EAAE,mBAAmB;cAEpD,qBAAmB,EAAA;;;;;;;iBAMR,qBAAqB,EAAE,mBAC/B;;;;;;qBAQI,oBAAkB,EAAA,cAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { schema, variantSchema } from "../../validations/schema.mjs";
|
|
2
|
+
import { integer } from "../../validations/integer.mjs";
|
|
3
|
+
import { pageEntries } from "../../types/PagedResults.mjs";
|
|
4
|
+
import { movieMediaListItemSchema } from "../../movie/types/MovieListItem.mjs";
|
|
5
|
+
import { tvMediaListItemSchema } from "../../tv/types/TvListItem.mjs";
|
|
6
|
+
import { imageEntries } from "../../types/Images.mjs";
|
|
7
|
+
import * as v from "valibot";
|
|
8
|
+
// src/person/types/TaggedImages.ts
|
|
9
|
+
const _taggedImageSchema = v.object({
|
|
10
|
+
...imageEntries,
|
|
11
|
+
id: v.string(),
|
|
12
|
+
/** `backdrop`, `poster`, `still`, … */
|
|
13
|
+
imageType: v.string(),
|
|
14
|
+
/** The title the image is from. */
|
|
15
|
+
media: variantSchema(`mediaType`, [movieMediaListItemSchema, tvMediaListItemSchema]),
|
|
16
|
+
mediaType: v.string()
|
|
17
|
+
});
|
|
18
|
+
const _taggedImagesSchema = v.object({
|
|
19
|
+
id: integer,
|
|
20
|
+
...pageEntries,
|
|
21
|
+
results: v.array(schema(_taggedImageSchema))
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* ### Tagged Images
|
|
25
|
+
*
|
|
26
|
+
* A page of images from movies and TV series that a person has been tagged in (`getPersonTaggedImages`).
|
|
27
|
+
*/
|
|
28
|
+
const taggedImagesSchema = schema(_taggedImagesSchema);
|
|
29
|
+
export { taggedImagesSchema };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=TaggedImages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaggedImages.mjs","names":[],"sources":["../../../src/person/types/TaggedImages.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { schema, variantSchema } from \"../../validations/schema.js\";\nimport { integer } from \"../../validations/integer.js\";\nimport { imageEntries } from \"../../types/Images.js\";\nimport { pageEntries } from \"../../types/PagedResults.js\";\nimport {\n movieMediaListItemSchema,\n type MovieMediaListItem\n} from \"../../movie/types/MovieListItem.js\";\nimport {\n tvMediaListItemSchema,\n type TvMediaListItem\n} from \"../../tv/types/TvListItem.js\";\n\nconst _taggedImageSchema = v.object({\n ...imageEntries,\n id: v.string(),\n /** `backdrop`, `poster`, `still`, … */\n imageType: v.string(),\n /** The title the image is from. */\n media: variantSchema<MovieMediaListItem | TvMediaListItem>(`mediaType`, [\n movieMediaListItemSchema,\n tvMediaListItemSchema\n ]),\n mediaType: v.string()\n});\n\nexport interface TaggedImage extends v.InferOutput<typeof _taggedImageSchema> {}\n\nconst _taggedImagesSchema = v.object({\n id: integer,\n ...pageEntries,\n results: v.array(schema<TaggedImage>(_taggedImageSchema))\n});\n\nexport interface TaggedImages extends v.InferOutput<\n typeof _taggedImagesSchema\n> {}\n\n/**\n * ### Tagged Images\n *\n * A page of images from movies and TV series that a person has been tagged in (`getPersonTaggedImages`).\n */\nexport const taggedImagesSchema = schema<TaggedImages>(_taggedImagesSchema);\n"],"mappings":";;;;;;;;AAcA,MAAM,qBAAqB,EAAE,OAAO;CAClC,GAAG;CACH,IAAI,EAAE,OAAO;;CAEb,WAAW,EAAE,OAAO;;CAEpB,OAAO,cAAoD,aAAa,CACtE,0BACA,qBACF,CAAC;CACD,WAAW,EAAE,OAAO;AACtB,CAAC;AAID,MAAM,sBAAsB,EAAE,OAAO;CACnC,IAAI;CACJ,GAAG;CACH,SAAS,EAAE,MAAM,OAAoB,kBAAkB,CAAC;AAC1D,CAAC;;;;;;AAWD,MAAa,qBAAqB,OAAqB,mBAAmB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PersonCombinedCast, PersonCombinedCredits, PersonCombinedCrew, PersonMovieCast, PersonMovieCredits, PersonMovieCrew, PersonTvCast, PersonTvCredits, PersonTvCrew, personCombinedCreditsSchema, personMovieCreditsSchema, personTvCreditsSchema } from "./PersonCredits.mjs";
|
|
2
|
+
import { PersonExternalIds, personExternalIdsSchema } from "./PersonExternalIds.mjs";
|
|
3
|
+
import { TaggedImage, TaggedImages, taggedImagesSchema } from "./TaggedImages.mjs";
|
|
4
|
+
import { PersonTranslationData, PersonTranslations, personTranslationsSchema } from "./PersonTranslations.mjs";
|
|
5
|
+
import { PersonDetails, personAppendedEntries, personDetailsEntries, personDetailsSchema } from "./PersonDetails.mjs";
|
|
6
|
+
import { PagedPersonMediaResults, PagedPersonResults, PersonListItem, PersonMediaListItem, knownFor, pagedPersonMediaResultsSchema, pagedPersonResultsSchema, personListItemEntries, personListItemSchema, personMediaListItemEntries, personMediaListItemSchema } from "./PersonListItem.mjs";
|
|
7
|
+
export { PagedPersonMediaResults, PagedPersonResults, PersonCombinedCast, PersonCombinedCredits, PersonCombinedCrew, PersonDetails, PersonExternalIds, PersonListItem, PersonMediaListItem, PersonMovieCast, PersonMovieCredits, PersonMovieCrew, PersonTranslationData, PersonTranslations, PersonTvCast, PersonTvCredits, PersonTvCrew, TaggedImage, TaggedImages, knownFor, pagedPersonMediaResultsSchema, pagedPersonResultsSchema, personAppendedEntries, personCombinedCreditsSchema, personDetailsEntries, personDetailsSchema, personExternalIdsSchema, personListItemEntries, personListItemSchema, personMediaListItemEntries, personMediaListItemSchema, personMovieCreditsSchema, personTranslationsSchema, personTvCreditsSchema, taggedImagesSchema };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { knownFor, pagedPersonMediaResultsSchema, pagedPersonResultsSchema, personListItemEntries, personListItemSchema, personMediaListItemEntries, personMediaListItemSchema } from "./PersonListItem.mjs";
|
|
2
|
+
import { personCombinedCreditsSchema, personMovieCreditsSchema, personTvCreditsSchema } from "./PersonCredits.mjs";
|
|
3
|
+
import { personExternalIdsSchema } from "./PersonExternalIds.mjs";
|
|
4
|
+
import { personTranslationsSchema } from "./PersonTranslations.mjs";
|
|
5
|
+
import { taggedImagesSchema } from "./TaggedImages.mjs";
|
|
6
|
+
import { personAppendedEntries, personDetailsEntries, personDetailsSchema } from "./PersonDetails.mjs";
|
|
7
|
+
export { knownFor, pagedPersonMediaResultsSchema, pagedPersonResultsSchema, personAppendedEntries, personCombinedCreditsSchema, personDetailsEntries, personDetailsSchema, personExternalIdsSchema, personListItemEntries, personListItemSchema, personMediaListItemEntries, personMediaListItemSchema, personMovieCreditsSchema, personTranslationsSchema, personTvCreditsSchema, taggedImagesSchema };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { RequestMethod } from "./request.mjs";
|
|
2
|
+
/** Base URL for the TMDB v3 REST API. */
|
|
3
|
+
export declare const endpoint: "https://api.themoviedb.org/3/";
|
|
4
|
+
/**
|
|
5
|
+
* Environment variable read for the **API Read Access Token** when no token has been set explicitly. The token is sent as `Authorization: Bearer <token>` and works against both the v3 and v4 endpoints.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TOKEN_ENV_VAR: "TMDB_API_TOKEN";
|
|
8
|
+
/**
|
|
9
|
+
* Environment variable read for the legacy **v3 API key** when no bearer token is available. Sent as the `?api_key=<key>` query parameter.
|
|
10
|
+
*/
|
|
11
|
+
export declare const API_KEY_ENV_VAR: "TMDB_API_KEY";
|
|
12
|
+
/**
|
|
13
|
+
* The API Read Access Token from the environment, or `null` when unavailable. `process` is absent on some runtimes (browsers, bare Cloudflare Workers), so the lookup is guarded rather than read directly.
|
|
14
|
+
*/
|
|
15
|
+
export declare const tokenFromEnv: () => string | null;
|
|
16
|
+
/** The legacy v3 API key from the environment, or `null` when unavailable. */
|
|
17
|
+
export declare const apiKeyFromEnv: () => string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The resolved credentials for a single request. A bearer token is preferred (sent as the `Authorization` header); when only a v3 API key is available it is appended to the query string instead.
|
|
20
|
+
*/
|
|
21
|
+
interface ResolvedAuth {
|
|
22
|
+
authorization?: string;
|
|
23
|
+
apiKey?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A client-side rate limit: at most `requests` dispatches in any `perMs` window. */
|
|
26
|
+
export interface RateLimit {
|
|
27
|
+
requests: number;
|
|
28
|
+
perMs: number;
|
|
29
|
+
}
|
|
30
|
+
/** What {@link TmdbSession.fetch} needs to send one request. */
|
|
31
|
+
export interface SessionRequest {
|
|
32
|
+
method: RequestMethod;
|
|
33
|
+
body?: string | null;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The default client-side limit. TMDB retired its 40-requests-per-10-seconds limit on 2019-12-16; its docs now put the ceiling "somewhere in the 40 requests per second range" and warn it "could change at any time" (https://developer.themoviedb.org/docs/rate-limiting, verified 2026-10-28). Half of that leaves headroom for other clients on the same IP.
|
|
38
|
+
*/
|
|
39
|
+
export declare const defaultRateLimit: RateLimit;
|
|
40
|
+
/**
|
|
41
|
+
* A session against the TMDB API. It holds the credentials (an API Read Access Token and/or a legacy v3 API key), keeps dispatches under a client-side {@link RateLimit}, and retries rate-limited and transient failures with backoff.
|
|
42
|
+
*
|
|
43
|
+
* Unlike discordkit's `DiscordSession`, requests are not serialised through a queue: TMDB has no per-route buckets to track, so requests run concurrently and only their _dispatch_ is spaced out. There is also no token exchange or refresh, because the API Read Access Token is used directly.
|
|
44
|
+
*/
|
|
45
|
+
export declare class TmdbSession {
|
|
46
|
+
#private;
|
|
47
|
+
readonly endpoint: string;
|
|
48
|
+
/** Retries after the first attempt, for `429`, `5xx` and network failures. */
|
|
49
|
+
maxRetries: number;
|
|
50
|
+
/** Base delay in ms for exponential backoff (`retryDelay * 2^attempt`), used when TMDB gives no `Retry-After`. */
|
|
51
|
+
retryDelay: number;
|
|
52
|
+
constructor(options?: {
|
|
53
|
+
token?: string;
|
|
54
|
+
apiKey?: string;
|
|
55
|
+
rateLimit?: RateLimit;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Set the **API Read Access Token** (the bare token, without a `Bearer ` prefix; it is added for you). This is the preferred credential and works against both the v3 and v4 endpoints.
|
|
59
|
+
*/
|
|
60
|
+
setToken: (token: string) => this;
|
|
61
|
+
/**
|
|
62
|
+
* Set the legacy **v3 API key**. Used only when no bearer token is present, sent as the `?api_key=` query parameter.
|
|
63
|
+
*/
|
|
64
|
+
setApiKey: (key: string) => this;
|
|
65
|
+
/** Replace the client-side rate limit, e.g. to go slower when sharing an IP with other TMDB clients. */
|
|
66
|
+
setRateLimit: (rateLimit: RateLimit) => this;
|
|
67
|
+
/** Clear all credentials and rate-limit state, and restore the default rate limit. */
|
|
68
|
+
clearSession: () => this;
|
|
69
|
+
/**
|
|
70
|
+
* Whether a request can authenticate right now: either a bearer token or a v3 API key is set (explicitly or via the environment).
|
|
71
|
+
*/
|
|
72
|
+
get hasAuth(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Resolve the credentials to use for a request. An explicit credential wins over the environment, and a bearer token (explicit or from the environment) wins over a v3 API key.
|
|
75
|
+
*
|
|
76
|
+
* @throws When no credential is available at all.
|
|
77
|
+
*/
|
|
78
|
+
resolveAuth: () => ResolvedAuth;
|
|
79
|
+
/**
|
|
80
|
+
* Send a request: wait for a dispatch slot, attach credentials, and retry `429`, `5xx` and network failures up to {@link maxRetries} times. The final response is returned whatever its status; turning a failed response into an error is the caller's job (see `request`).
|
|
81
|
+
*
|
|
82
|
+
* Aborting `signal` rejects with its reason, whether the request is waiting for a slot, in flight, or backing off.
|
|
83
|
+
*/
|
|
84
|
+
fetch: (resource: URL, init: SessionRequest) => Promise<Response>;
|
|
85
|
+
/** Requests currently waiting for a dispatch slot (useful for monitoring). */
|
|
86
|
+
getQueueSize: () => number;
|
|
87
|
+
}
|
|
88
|
+
/** Shared session singleton, configured once (`tmdb.setToken(…)`) and used by every operation. */
|
|
89
|
+
export declare const tmdb: TmdbSession;
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=TmdbSession.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TmdbSession.d.mts","names":[],"sources":["../../src/requests/TmdbSession.ts"],"mappings":";;qBAIa;;;;qBAKA;;;;qBAKA;;;;qBAKA;;qBAOA;;;;UASH;EACR;EACA;;;iBAIe;EACf;EACA;;;iBAIe;EACf,QAAQ;EACR;EACA,SAAS;;;;;qBAME,kBAAkB;;;;;;qBAwBlB;;WACF;;EAET;;EAEA;EAWY,YAAA;IACV;IACA;IACA,YAAY;;;;;EAUd,WAAY;;;;EAWZ,YAAa;;EASb,eAAgB,WAAW;;EAY3B;;;;MAWI;;;;;;EAcJ,mBAAkB;;;;;;EAiBlB,QAAe,UAAU,KAAK,MAAM,mBAAiB,QAAQ;;EAyC7D;;;qBA2CW,MAAM"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { sleep } from "../utils/sleep.mjs";
|
|
2
|
+
// src/requests/TmdbSession.ts
|
|
3
|
+
/** Base URL for the TMDB v3 REST API. */
|
|
4
|
+
const endpoint = "https://api.themoviedb.org/3/";
|
|
5
|
+
/**
|
|
6
|
+
* Environment variable read for the **API Read Access Token** when no token has been set explicitly. The token is sent as `Authorization: Bearer <token>` and works against both the v3 and v4 endpoints.
|
|
7
|
+
*/
|
|
8
|
+
const TOKEN_ENV_VAR = "TMDB_API_TOKEN";
|
|
9
|
+
/**
|
|
10
|
+
* Environment variable read for the legacy **v3 API key** when no bearer token is available. Sent as the `?api_key=<key>` query parameter.
|
|
11
|
+
*/
|
|
12
|
+
const API_KEY_ENV_VAR = "TMDB_API_KEY";
|
|
13
|
+
/**
|
|
14
|
+
* The API Read Access Token from the environment, or `null` when unavailable. `process` is absent on some runtimes (browsers, bare Cloudflare Workers), so the lookup is guarded rather than read directly.
|
|
15
|
+
*/
|
|
16
|
+
const tokenFromEnv = () => {
|
|
17
|
+
if (typeof process === `undefined`) return null;
|
|
18
|
+
const token = process.env[TOKEN_ENV_VAR];
|
|
19
|
+
return token === void 0 || token === `` ? null : token;
|
|
20
|
+
};
|
|
21
|
+
/** The legacy v3 API key from the environment, or `null` when unavailable. */
|
|
22
|
+
const apiKeyFromEnv = () => {
|
|
23
|
+
if (typeof process === `undefined`) return null;
|
|
24
|
+
const key = process.env[API_KEY_ENV_VAR];
|
|
25
|
+
return key === void 0 || key === `` ? null : key;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The default client-side limit. TMDB retired its 40-requests-per-10-seconds limit on 2019-12-16; its docs now put the ceiling "somewhere in the 40 requests per second range" and warn it "could change at any time" (https://developer.themoviedb.org/docs/rate-limiting, verified 2026-10-28). Half of that leaves headroom for other clients on the same IP.
|
|
29
|
+
*/
|
|
30
|
+
const defaultRateLimit = {
|
|
31
|
+
requests: 20,
|
|
32
|
+
perMs: 1e3
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Responses worth retrying: rate limited, or a transient failure on TMDB's side. Everything else (`401` bad credentials, `404` unknown id, `422` bad params) fails the same way every time.
|
|
36
|
+
*/
|
|
37
|
+
const retryableStatuses = /* @__PURE__ */ new Set([
|
|
38
|
+
429,
|
|
39
|
+
500,
|
|
40
|
+
502,
|
|
41
|
+
503,
|
|
42
|
+
504
|
|
43
|
+
]);
|
|
44
|
+
/**
|
|
45
|
+
* How long a `429`'s `Retry-After` asks us to wait, in ms, or `null` when absent or unparsable. TMDB doesn't document the header, so both of its HTTP forms are accepted: delta-seconds and an HTTP date.
|
|
46
|
+
*/
|
|
47
|
+
const retryAfterMs = (response) => {
|
|
48
|
+
const header = response.headers.get(`Retry-After`);
|
|
49
|
+
if (header === null || header.trim() === ``) return null;
|
|
50
|
+
const seconds = Number(header);
|
|
51
|
+
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
52
|
+
const date = Date.parse(header);
|
|
53
|
+
return Number.isNaN(date) ? null : Math.max(0, date - Date.now());
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A session against the TMDB API. It holds the credentials (an API Read Access Token and/or a legacy v3 API key), keeps dispatches under a client-side {@link RateLimit}, and retries rate-limited and transient failures with backoff.
|
|
57
|
+
*
|
|
58
|
+
* Unlike discordkit's `DiscordSession`, requests are not serialised through a queue: TMDB has no per-route buckets to track, so requests run concurrently and only their _dispatch_ is spaced out. There is also no token exchange or refresh, because the API Read Access Token is used directly.
|
|
59
|
+
*/
|
|
60
|
+
var TmdbSession = class {
|
|
61
|
+
endpoint = endpoint;
|
|
62
|
+
/** Retries after the first attempt, for `429`, `5xx` and network failures. */
|
|
63
|
+
maxRetries = 3;
|
|
64
|
+
/** Base delay in ms for exponential backoff (`retryDelay * 2^attempt`), used when TMDB gives no `Retry-After`. */
|
|
65
|
+
retryDelay = 500;
|
|
66
|
+
#bearerToken = null;
|
|
67
|
+
#apiKey = null;
|
|
68
|
+
#rateLimit = defaultRateLimit;
|
|
69
|
+
#dispatches = [];
|
|
70
|
+
#turn = Promise.resolve();
|
|
71
|
+
#waiting = 0;
|
|
72
|
+
constructor(options) {
|
|
73
|
+
if (options?.token) this.setToken(options.token);
|
|
74
|
+
if (options?.apiKey) this.setApiKey(options.apiKey);
|
|
75
|
+
if (options?.rateLimit) this.setRateLimit(options.rateLimit);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Set the **API Read Access Token** (the bare token, without a `Bearer ` prefix; it is added for you). This is the preferred credential and works against both the v3 and v4 endpoints.
|
|
79
|
+
*/
|
|
80
|
+
setToken = (token) => {
|
|
81
|
+
if (token.length === 0) throw new Error(`Must provide a non-empty string to set the API token`);
|
|
82
|
+
this.#bearerToken = token;
|
|
83
|
+
return this;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Set the legacy **v3 API key**. Used only when no bearer token is present, sent as the `?api_key=` query parameter.
|
|
87
|
+
*/
|
|
88
|
+
setApiKey = (key) => {
|
|
89
|
+
if (key.length === 0) throw new Error(`Must provide a non-empty string to set the API key`);
|
|
90
|
+
this.#apiKey = key;
|
|
91
|
+
return this;
|
|
92
|
+
};
|
|
93
|
+
/** Replace the client-side rate limit, e.g. to go slower when sharing an IP with other TMDB clients. */
|
|
94
|
+
setRateLimit = (rateLimit) => {
|
|
95
|
+
const { requests, perMs } = rateLimit;
|
|
96
|
+
if (!Number.isInteger(requests) || requests < 1 || !(perMs > 0)) throw new Error(`A rate limit needs a whole number of requests (>= 1) per a positive number of ms, received ${requests} per ${perMs}ms`);
|
|
97
|
+
this.#rateLimit = {
|
|
98
|
+
requests,
|
|
99
|
+
perMs
|
|
100
|
+
};
|
|
101
|
+
return this;
|
|
102
|
+
};
|
|
103
|
+
/** Clear all credentials and rate-limit state, and restore the default rate limit. */
|
|
104
|
+
clearSession = () => {
|
|
105
|
+
this.#bearerToken = null;
|
|
106
|
+
this.#apiKey = null;
|
|
107
|
+
this.#rateLimit = defaultRateLimit;
|
|
108
|
+
this.#dispatches = [];
|
|
109
|
+
return this;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Whether a request can authenticate right now: either a bearer token or a v3 API key is set (explicitly or via the environment).
|
|
113
|
+
*/
|
|
114
|
+
get hasAuth() {
|
|
115
|
+
return this.#bearerToken !== null || tokenFromEnv() !== null || this.#apiKey !== null || apiKeyFromEnv() !== null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Resolve the credentials to use for a request. An explicit credential wins over the environment, and a bearer token (explicit or from the environment) wins over a v3 API key.
|
|
119
|
+
*
|
|
120
|
+
* @throws When no credential is available at all.
|
|
121
|
+
*/
|
|
122
|
+
resolveAuth = () => {
|
|
123
|
+
const bearer = this.#bearerToken ?? tokenFromEnv();
|
|
124
|
+
if (bearer) return { authorization: `Bearer ${bearer}` };
|
|
125
|
+
const key = this.#apiKey ?? apiKeyFromEnv();
|
|
126
|
+
if (key) return { apiKey: key };
|
|
127
|
+
throw new Error(`No TMDB credentials are set, so the request cannot be authorized. Call tmdb.setToken("<API Read Access Token>"), or set ${TOKEN_ENV_VAR} (preferred) / ${API_KEY_ENV_VAR} in the environment.`);
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Send a request: wait for a dispatch slot, attach credentials, and retry `429`, `5xx` and network failures up to {@link maxRetries} times. The final response is returned whatever its status; turning a failed response into an error is the caller's job (see `request`).
|
|
131
|
+
*
|
|
132
|
+
* Aborting `signal` rejects with its reason, whether the request is waiting for a slot, in flight, or backing off.
|
|
133
|
+
*/
|
|
134
|
+
fetch = async (resource, init) => {
|
|
135
|
+
for (let attempt = 0;; attempt++) {
|
|
136
|
+
await this.#acquire(init.signal);
|
|
137
|
+
const auth = this.resolveAuth();
|
|
138
|
+
const url = new URL(resource);
|
|
139
|
+
const headers = { Accept: `application/json` };
|
|
140
|
+
if (auth.authorization) headers.Authorization = auth.authorization;
|
|
141
|
+
if (auth.apiKey) url.searchParams.set(`api_key`, auth.apiKey);
|
|
142
|
+
if (init.body) headers[`Content-Type`] = `application/json`;
|
|
143
|
+
let response;
|
|
144
|
+
try {
|
|
145
|
+
response = await fetch(url, {
|
|
146
|
+
method: init.method,
|
|
147
|
+
body: init.body,
|
|
148
|
+
headers,
|
|
149
|
+
signal: init.signal
|
|
150
|
+
});
|
|
151
|
+
} catch (error) {
|
|
152
|
+
if (init.signal?.aborted || attempt >= this.maxRetries) throw error;
|
|
153
|
+
await sleep(this.retryDelay * 2 ** attempt, init.signal);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (!retryableStatuses.has(response.status) || attempt >= this.maxRetries) return response;
|
|
157
|
+
const wait = retryAfterMs(response) ?? this.retryDelay * 2 ** attempt;
|
|
158
|
+
await response.body?.cancel();
|
|
159
|
+
await sleep(wait, init.signal);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
/** Requests currently waiting for a dispatch slot (useful for monitoring). */
|
|
163
|
+
getQueueSize = () => this.#waiting;
|
|
164
|
+
/**
|
|
165
|
+
* Claim one dispatch slot under the rate limit. A caller whose signal aborts while waiting gives up its turn without using a slot; a later caller then moves straight on.
|
|
166
|
+
*/
|
|
167
|
+
#acquire = async (signal) => {
|
|
168
|
+
this.#waiting++;
|
|
169
|
+
const previous = this.#turn;
|
|
170
|
+
const turn = (async () => {
|
|
171
|
+
await previous;
|
|
172
|
+
await this.#claimSlot(signal);
|
|
173
|
+
})();
|
|
174
|
+
this.#turn = (async () => {
|
|
175
|
+
try {
|
|
176
|
+
await turn;
|
|
177
|
+
} catch {}
|
|
178
|
+
})();
|
|
179
|
+
try {
|
|
180
|
+
await turn;
|
|
181
|
+
} finally {
|
|
182
|
+
this.#waiting--;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
#claimSlot = async (signal) => {
|
|
186
|
+
for (;;) {
|
|
187
|
+
signal?.throwIfAborted();
|
|
188
|
+
const now = Date.now();
|
|
189
|
+
const { requests, perMs } = this.#rateLimit;
|
|
190
|
+
this.#dispatches = this.#dispatches.filter((at) => now - at < perMs);
|
|
191
|
+
if (this.#dispatches.length < requests) {
|
|
192
|
+
this.#dispatches.push(now);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
await sleep(perMs - (now - this.#dispatches[0]), signal);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
/** Shared session singleton, configured once (`tmdb.setToken(…)`) and used by every operation. */
|
|
200
|
+
const tmdb = new TmdbSession();
|
|
201
|
+
export { API_KEY_ENV_VAR, TOKEN_ENV_VAR, TmdbSession, apiKeyFromEnv, defaultRateLimit, endpoint, tmdb, tokenFromEnv };
|
|
202
|
+
|
|
203
|
+
//# sourceMappingURL=TmdbSession.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TmdbSession.mjs","names":[],"sources":["../../src/requests/TmdbSession.ts"],"sourcesContent":["import { sleep } from \"../utils/sleep.js\";\nimport type { RequestMethod } from \"./request.js\";\n\n/** Base URL for the TMDB v3 REST API. */\nexport const endpoint = \"https://api.themoviedb.org/3/\" as const;\n\n/**\n * Environment variable read for the **API Read Access Token** when no token has been set explicitly. The token is sent as `Authorization: Bearer <token>` and works against both the v3 and v4 endpoints.\n */\nexport const TOKEN_ENV_VAR = \"TMDB_API_TOKEN\" as const;\n\n/**\n * Environment variable read for the legacy **v3 API key** when no bearer token is available. Sent as the `?api_key=<key>` query parameter.\n */\nexport const API_KEY_ENV_VAR = \"TMDB_API_KEY\" as const;\n\n/**\n * The API Read Access Token from the environment, or `null` when unavailable. `process` is absent on some runtimes (browsers, bare Cloudflare Workers), so the lookup is guarded rather than read directly.\n */\nexport const tokenFromEnv = (): string | null => {\n if (typeof process === `undefined`) return null;\n const token = process.env[TOKEN_ENV_VAR];\n return token === undefined || token === `` ? null : token;\n};\n\n/** The legacy v3 API key from the environment, or `null` when unavailable. */\nexport const apiKeyFromEnv = (): string | null => {\n if (typeof process === `undefined`) return null;\n const key = process.env[API_KEY_ENV_VAR];\n return key === undefined || key === `` ? null : key;\n};\n\n/**\n * The resolved credentials for a single request. A bearer token is preferred (sent as the `Authorization` header); when only a v3 API key is available it is appended to the query string instead.\n */\ninterface ResolvedAuth {\n authorization?: string;\n apiKey?: string;\n}\n\n/** A client-side rate limit: at most `requests` dispatches in any `perMs` window. */\nexport interface RateLimit {\n requests: number;\n perMs: number;\n}\n\n/** What {@link TmdbSession.fetch} needs to send one request. */\nexport interface SessionRequest {\n method: RequestMethod;\n body?: string | null;\n signal?: AbortSignal;\n}\n\n/**\n * The default client-side limit. TMDB retired its 40-requests-per-10-seconds limit on 2019-12-16; its docs now put the ceiling \"somewhere in the 40 requests per second range\" and warn it \"could change at any time\" (https://developer.themoviedb.org/docs/rate-limiting, verified 2026-10-28). Half of that leaves headroom for other clients on the same IP.\n */\nexport const defaultRateLimit: RateLimit = { requests: 20, perMs: 1000 };\n\n/**\n * Responses worth retrying: rate limited, or a transient failure on TMDB's side. Everything else (`401` bad credentials, `404` unknown id, `422` bad params) fails the same way every time.\n */\nconst retryableStatuses = new Set([429, 500, 502, 503, 504]);\n\n/**\n * How long a `429`'s `Retry-After` asks us to wait, in ms, or `null` when absent or unparsable. TMDB doesn't document the header, so both of its HTTP forms are accepted: delta-seconds and an HTTP date.\n */\nconst retryAfterMs = (response: Response): number | null => {\n const header = response.headers.get(`Retry-After`);\n if (header === null || header.trim() === ``) return null;\n const seconds = Number(header);\n if (Number.isFinite(seconds)) return Math.max(0, seconds * 1000);\n const date = Date.parse(header);\n return Number.isNaN(date) ? null : Math.max(0, date - Date.now());\n};\n\n/**\n * A session against the TMDB API. It holds the credentials (an API Read Access Token and/or a legacy v3 API key), keeps dispatches under a client-side {@link RateLimit}, and retries rate-limited and transient failures with backoff.\n *\n * Unlike discordkit's `DiscordSession`, requests are not serialised through a queue: TMDB has no per-route buckets to track, so requests run concurrently and only their _dispatch_ is spaced out. There is also no token exchange or refresh, because the API Read Access Token is used directly.\n */\nexport class TmdbSession {\n readonly endpoint: string = endpoint;\n /** Retries after the first attempt, for `429`, `5xx` and network failures. */\n maxRetries: number = 3;\n /** Base delay in ms for exponential backoff (`retryDelay * 2^attempt`), used when TMDB gives no `Retry-After`. */\n retryDelay: number = 500;\n\n #bearerToken: string | null = null;\n #apiKey: string | null = null;\n\n #rateLimit: RateLimit = defaultRateLimit;\n #dispatches: number[] = [];\n // Callers take turns claiming a dispatch slot, so two concurrent callers can't both see the same free slot. Only the claiming is sequential; the fetches overlap.\n #turn: Promise<void> = Promise.resolve();\n #waiting = 0;\n\n constructor(options?: {\n token?: string;\n apiKey?: string;\n rateLimit?: RateLimit;\n }) {\n if (options?.token) this.setToken(options.token);\n if (options?.apiKey) this.setApiKey(options.apiKey);\n if (options?.rateLimit) this.setRateLimit(options.rateLimit);\n }\n\n /**\n * Set the **API Read Access Token** (the bare token, without a `Bearer ` prefix; it is added for you). This is the preferred credential and works against both the v3 and v4 endpoints.\n */\n setToken = (token: string): this => {\n if (token.length === 0) {\n throw new Error(`Must provide a non-empty string to set the API token`);\n }\n this.#bearerToken = token;\n return this;\n };\n\n /**\n * Set the legacy **v3 API key**. Used only when no bearer token is present, sent as the `?api_key=` query parameter.\n */\n setApiKey = (key: string): this => {\n if (key.length === 0) {\n throw new Error(`Must provide a non-empty string to set the API key`);\n }\n this.#apiKey = key;\n return this;\n };\n\n /** Replace the client-side rate limit, e.g. to go slower when sharing an IP with other TMDB clients. */\n setRateLimit = (rateLimit: RateLimit): this => {\n const { requests, perMs } = rateLimit;\n if (!Number.isInteger(requests) || requests < 1 || !(perMs > 0)) {\n throw new Error(\n `A rate limit needs a whole number of requests (>= 1) per a positive number of ms, received ${requests} per ${perMs}ms`\n );\n }\n this.#rateLimit = { requests, perMs };\n return this;\n };\n\n /** Clear all credentials and rate-limit state, and restore the default rate limit. */\n clearSession = (): this => {\n this.#bearerToken = null;\n this.#apiKey = null;\n this.#rateLimit = defaultRateLimit;\n this.#dispatches = [];\n return this;\n };\n\n /**\n * Whether a request can authenticate right now: either a bearer token or a v3 API key is set (explicitly or via the environment).\n */\n get hasAuth(): boolean {\n return (\n this.#bearerToken !== null ||\n tokenFromEnv() !== null ||\n this.#apiKey !== null ||\n apiKeyFromEnv() !== null\n );\n }\n\n /**\n * Resolve the credentials to use for a request. An explicit credential wins over the environment, and a bearer token (explicit or from the environment) wins over a v3 API key.\n *\n * @throws When no credential is available at all.\n */\n resolveAuth = (): ResolvedAuth => {\n const bearer = this.#bearerToken ?? tokenFromEnv();\n if (bearer) return { authorization: `Bearer ${bearer}` };\n\n const key = this.#apiKey ?? apiKeyFromEnv();\n if (key) return { apiKey: key };\n\n throw new Error(\n `No TMDB credentials are set, so the request cannot be authorized. Call tmdb.setToken(\"<API Read Access Token>\"), or set ${TOKEN_ENV_VAR} (preferred) / ${API_KEY_ENV_VAR} in the environment.`\n );\n };\n\n /**\n * Send a request: wait for a dispatch slot, attach credentials, and retry `429`, `5xx` and network failures up to {@link maxRetries} times. The final response is returned whatever its status; turning a failed response into an error is the caller's job (see `request`).\n *\n * Aborting `signal` rejects with its reason, whether the request is waiting for a slot, in flight, or backing off.\n */\n fetch = async (resource: URL, init: SessionRequest): Promise<Response> => {\n for (let attempt = 0; ; attempt++) {\n await this.#acquire(init.signal);\n\n const auth = this.resolveAuth();\n const url = new URL(resource);\n const headers: Record<string, string> = { Accept: `application/json` };\n if (auth.authorization) headers.Authorization = auth.authorization;\n if (auth.apiKey) url.searchParams.set(`api_key`, auth.apiKey);\n if (init.body) headers[`Content-Type`] = `application/json`;\n\n let response: Response;\n try {\n response = await fetch(url, {\n method: init.method,\n body: init.body,\n headers,\n signal: init.signal\n });\n } catch (error) {\n // An abort is the caller's decision, not a transient failure.\n if (init.signal?.aborted || attempt >= this.maxRetries) throw error;\n await sleep(this.retryDelay * 2 ** attempt, init.signal);\n continue;\n }\n\n if (\n !retryableStatuses.has(response.status) ||\n attempt >= this.maxRetries\n ) {\n return response;\n }\n\n const wait = retryAfterMs(response) ?? this.retryDelay * 2 ** attempt;\n // Release the connection held by the unread body before waiting.\n await response.body?.cancel();\n await sleep(wait, init.signal);\n }\n };\n\n /** Requests currently waiting for a dispatch slot (useful for monitoring). */\n getQueueSize = (): number => this.#waiting;\n\n /**\n * Claim one dispatch slot under the rate limit. A caller whose signal aborts while waiting gives up its turn without using a slot; a later caller then moves straight on.\n */\n #acquire = async (signal?: AbortSignal): Promise<void> => {\n this.#waiting++;\n const previous = this.#turn;\n const turn = (async (): Promise<void> => {\n await previous;\n await this.#claimSlot(signal);\n })();\n // The next caller waits on this turn settling, never on it succeeding: an aborted turn must not stall the callers behind it. The abort itself reaches this caller through `await turn` below.\n this.#turn = (async (): Promise<void> => {\n try {\n await turn;\n } catch {\n // handled by the caller that owns the turn\n }\n })();\n try {\n await turn;\n } finally {\n this.#waiting--;\n }\n };\n\n #claimSlot = async (signal?: AbortSignal): Promise<void> => {\n for (;;) {\n signal?.throwIfAborted();\n const now = Date.now();\n const { requests, perMs } = this.#rateLimit;\n this.#dispatches = this.#dispatches.filter((at) => now - at < perMs);\n if (this.#dispatches.length < requests) {\n this.#dispatches.push(now);\n return;\n }\n await sleep(perMs - (now - this.#dispatches[0]), signal);\n }\n };\n}\n\n/** Shared session singleton, configured once (`tmdb.setToken(…)`) and used by every operation. */\nexport const tmdb: TmdbSession = new TmdbSession();\n"],"mappings":";;;AAIA,MAAa,WAAW;;;;AAKxB,MAAa,gBAAgB;;;;AAK7B,MAAa,kBAAkB;;;;AAK/B,MAAa,qBAAoC;CAC/C,IAAI,OAAO,YAAY,aAAa,OAAO;CAC3C,MAAM,QAAQ,QAAQ,IAAI;CAC1B,OAAO,UAAU,KAAA,KAAa,UAAU,KAAK,OAAO;AACtD;;AAGA,MAAa,sBAAqC;CAChD,IAAI,OAAO,YAAY,aAAa,OAAO;CAC3C,MAAM,MAAM,QAAQ,IAAI;CACxB,OAAO,QAAQ,KAAA,KAAa,QAAQ,KAAK,OAAO;AAClD;;;;AA0BA,MAAa,mBAA8B;CAAE,UAAU;CAAI,OAAO;AAAK;;;;AAKvE,MAAM,oCAAoB,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAK;AAAG,CAAC;;;;AAK3D,MAAM,gBAAgB,aAAsC;CAC1D,MAAM,SAAS,SAAS,QAAQ,IAAI,aAAa;CACjD,IAAI,WAAW,QAAQ,OAAO,KAAK,MAAM,IAAI,OAAO;CACpD,MAAM,UAAU,OAAO,MAAM;CAC7B,IAAI,OAAO,SAAS,OAAO,GAAG,OAAO,KAAK,IAAI,GAAG,UAAU,GAAI;CAC/D,MAAM,OAAO,KAAK,MAAM,MAAM;CAC9B,OAAO,OAAO,MAAM,IAAI,IAAI,OAAO,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,CAAC;AAClE;;;;;;AAOA,IAAa,cAAb,MAAyB;CACvB,WAA4B;;CAE5B,aAAqB;;CAErB,aAAqB;CAErB,eAA8B;CAC9B,UAAyB;CAEzB,aAAwB;CACxB,cAAwB,CAAC;CAEzB,QAAuB,QAAQ,QAAQ;CACvC,WAAW;CAEX,YAAY,SAIT;EACD,IAAI,SAAS,OAAO,KAAK,SAAS,QAAQ,KAAK;EAC/C,IAAI,SAAS,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAClD,IAAI,SAAS,WAAW,KAAK,aAAa,QAAQ,SAAS;CAC7D;;;;CAKA,YAAY,UAAwB;EAClC,IAAI,MAAM,WAAW,GACnB,MAAM,IAAI,MAAM,sDAAsD;EAExE,KAAK,eAAe;EACpB,OAAO;CACT;;;;CAKA,aAAa,QAAsB;EACjC,IAAI,IAAI,WAAW,GACjB,MAAM,IAAI,MAAM,oDAAoD;EAEtE,KAAK,UAAU;EACf,OAAO;CACT;;CAGA,gBAAgB,cAA+B;EAC7C,MAAM,EAAE,UAAU,UAAU;EAC5B,IAAI,CAAC,OAAO,UAAU,QAAQ,KAAK,WAAW,KAAK,EAAE,QAAQ,IAC3D,MAAM,IAAI,MACR,8FAA8F,SAAS,OAAO,MAAM,GACtH;EAEF,KAAK,aAAa;GAAE;GAAU;EAAM;EACpC,OAAO;CACT;;CAGA,qBAA2B;EACzB,KAAK,eAAe;EACpB,KAAK,UAAU;EACf,KAAK,aAAa;EAClB,KAAK,cAAc,CAAC;EACpB,OAAO;CACT;;;;CAKA,IAAI,UAAmB;EACrB,OACE,KAAK,iBAAiB,QACtB,aAAa,MAAM,QACnB,KAAK,YAAY,QACjB,cAAc,MAAM;CAExB;;;;;;CAOA,oBAAkC;EAChC,MAAM,SAAS,KAAK,gBAAgB,aAAa;EACjD,IAAI,QAAQ,OAAO,EAAE,eAAe,UAAU,SAAS;EAEvD,MAAM,MAAM,KAAK,WAAW,cAAc;EAC1C,IAAI,KAAK,OAAO,EAAE,QAAQ,IAAI;EAE9B,MAAM,IAAI,MACR,2HAA2H,cAAc,iBAAiB,gBAAgB,qBAC5K;CACF;;;;;;CAOA,QAAQ,OAAO,UAAe,SAA4C;EACxE,KAAK,IAAI,UAAU,IAAK,WAAW;GACjC,MAAM,KAAK,SAAS,KAAK,MAAM;GAE/B,MAAM,OAAO,KAAK,YAAY;GAC9B,MAAM,MAAM,IAAI,IAAI,QAAQ;GAC5B,MAAM,UAAkC,EAAE,QAAQ,mBAAmB;GACrE,IAAI,KAAK,eAAe,QAAQ,gBAAgB,KAAK;GACrD,IAAI,KAAK,QAAQ,IAAI,aAAa,IAAI,WAAW,KAAK,MAAM;GAC5D,IAAI,KAAK,MAAM,QAAQ,kBAAkB;GAEzC,IAAI;GACJ,IAAI;IACF,WAAW,MAAM,MAAM,KAAK;KAC1B,QAAQ,KAAK;KACb,MAAM,KAAK;KACX;KACA,QAAQ,KAAK;IACf,CAAC;GACH,SAAS,OAAO;IAEd,IAAI,KAAK,QAAQ,WAAW,WAAW,KAAK,YAAY,MAAM;IAC9D,MAAM,MAAM,KAAK,aAAa,KAAK,SAAS,KAAK,MAAM;IACvD;GACF;GAEA,IACE,CAAC,kBAAkB,IAAI,SAAS,MAAM,KACtC,WAAW,KAAK,YAEhB,OAAO;GAGT,MAAM,OAAO,aAAa,QAAQ,KAAK,KAAK,aAAa,KAAK;GAE9D,MAAM,SAAS,MAAM,OAAO;GAC5B,MAAM,MAAM,MAAM,KAAK,MAAM;EAC/B;CACF;;CAGA,qBAA6B,KAAK;;;;CAKlC,WAAW,OAAO,WAAwC;EACxD,KAAK;EACL,MAAM,WAAW,KAAK;EACtB,MAAM,QAAQ,YAA2B;GACvC,MAAM;GACN,MAAM,KAAK,WAAW,MAAM;EAC9B,EAAA,CAAG;EAEH,KAAK,SAAS,YAA2B;GACvC,IAAI;IACF,MAAM;GACR,QAAQ,CAER;EACF,EAAA,CAAG;EACH,IAAI;GACF,MAAM;EACR,UAAU;GACR,KAAK;EACP;CACF;CAEA,aAAa,OAAO,WAAwC;EAC1D,SAAS;GACP,QAAQ,eAAe;GACvB,MAAM,MAAM,KAAK,IAAI;GACrB,MAAM,EAAE,UAAU,UAAU,KAAK;GACjC,KAAK,cAAc,KAAK,YAAY,QAAQ,OAAO,MAAM,KAAK,KAAK;GACnE,IAAI,KAAK,YAAY,SAAS,UAAU;IACtC,KAAK,YAAY,KAAK,GAAG;IACzB;GACF;GACA,MAAM,MAAM,SAAS,MAAM,KAAK,YAAY,KAAK,MAAM;EACzD;CACF;AACF;;AAGA,MAAa,OAAoB,IAAI,YAAY"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ParamValue = Array<number | string> | boolean | number | string | null | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* The shape of query params accepted by the typed helpers. `null`/`undefined` values are skipped. A nested object is a range: `{ voteAverage: { gte: 7, lte: 9 } }`.
|
|
4
|
+
*/
|
|
5
|
+
export type RequestParams = Partial<Record<string, ParamValue | Partial<Record<string, ParamValue>>>>;
|
|
6
|
+
/**
|
|
7
|
+
* Append query params to a URL. Keys are converted from camelCase to snake_case (TMDB's wire format).
|
|
8
|
+
*
|
|
9
|
+
* Arrays are **comma-joined**, never repeated: TMDB reads lists as one comma-separated value (`append_to_response=credits,images`, `with_genres=28,12` meaning AND). For OR-logic TMDB uses `|`, which callers pass as a single string (`with_genres: "28|12"`).
|
|
10
|
+
*
|
|
11
|
+
* Nested objects become TMDB's dotted range params, the way the old tmdb-api's `buildNumberRange`/`buildDateRange` did: `{ primaryReleaseDate: { gte: "2020-01-01" } }` → `primary_release_date.gte=2020-01-01`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const addParams: (url: URL, params: RequestParams) => URL;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=addParams.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addParams.d.mts","names":[],"sources":["../../src/requests/addParams.ts"],"mappings":"A,KAEK,aACD;;;;YAUQ,gBAAgB,QAC1B,eAAe,aAAa,QAAQ,eAAe;;;;;;;;qBAaxC,YAAa,KAAK,KAAK,QAAQ,kBAAgB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { toSnakeCase } from "../utils/toSnakeCase.mjs";
|
|
2
|
+
// src/requests/addParams.ts
|
|
3
|
+
const serialize = (value) => Array.isArray(value) ? value.join(`,`) : String(value);
|
|
4
|
+
/**
|
|
5
|
+
* Append query params to a URL. Keys are converted from camelCase to snake_case (TMDB's wire format).
|
|
6
|
+
*
|
|
7
|
+
* Arrays are **comma-joined**, never repeated: TMDB reads lists as one comma-separated value (`append_to_response=credits,images`, `with_genres=28,12` meaning AND). For OR-logic TMDB uses `|`, which callers pass as a single string (`with_genres: "28|12"`).
|
|
8
|
+
*
|
|
9
|
+
* Nested objects become TMDB's dotted range params, the way the old tmdb-api's `buildNumberRange`/`buildDateRange` did: `{ primaryReleaseDate: { gte: "2020-01-01" } }` → `primary_release_date.gte=2020-01-01`.
|
|
10
|
+
*/
|
|
11
|
+
const addParams = (url, params) => {
|
|
12
|
+
for (const [key, value] of Object.entries(params)) {
|
|
13
|
+
if (value === null || value === void 0) continue;
|
|
14
|
+
if (typeof value === `object` && !Array.isArray(value)) {
|
|
15
|
+
for (const [bound, limit] of Object.entries(value)) {
|
|
16
|
+
if (limit === null || limit === void 0) continue;
|
|
17
|
+
url.searchParams.set(`${toSnakeCase(key)}.${bound}`, serialize(limit));
|
|
18
|
+
}
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
url.searchParams.set(toSnakeCase(key), serialize(value));
|
|
22
|
+
}
|
|
23
|
+
return url;
|
|
24
|
+
};
|
|
25
|
+
export { addParams };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=addParams.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addParams.mjs","names":[],"sources":["../../src/requests/addParams.ts"],"sourcesContent":["import { toSnakeCase } from \"../utils/toSnakeCase.js\";\n\ntype ParamValue =\n | Array<number | string>\n | boolean\n | number\n | string\n | null\n | undefined;\n\n/**\n * The shape of query params accepted by the typed helpers. `null`/`undefined` values are skipped. A nested object is a range: `{ voteAverage: { gte: 7, lte: 9 } }`.\n */\nexport type RequestParams = Partial<\n Record<string, ParamValue | Partial<Record<string, ParamValue>>>\n>;\n\nconst serialize = (value: Exclude<ParamValue, null | undefined>): string =>\n Array.isArray(value) ? value.join(`,`) : String(value);\n\n/**\n * Append query params to a URL. Keys are converted from camelCase to snake_case (TMDB's wire format).\n *\n * Arrays are **comma-joined**, never repeated: TMDB reads lists as one comma-separated value (`append_to_response=credits,images`, `with_genres=28,12` meaning AND). For OR-logic TMDB uses `|`, which callers pass as a single string (`with_genres: \"28|12\"`).\n *\n * Nested objects become TMDB's dotted range params, the way the old tmdb-api's `buildNumberRange`/`buildDateRange` did: `{ primaryReleaseDate: { gte: \"2020-01-01\" } }` → `primary_release_date.gte=2020-01-01`.\n */\nexport const addParams = (url: URL, params: RequestParams): URL => {\n for (const [key, value] of Object.entries(params)) {\n if (value === null || value === undefined) continue;\n if (typeof value === `object` && !Array.isArray(value)) {\n for (const [bound, limit] of Object.entries(value)) {\n if (limit === null || limit === undefined) continue;\n url.searchParams.set(`${toSnakeCase(key)}.${bound}`, serialize(limit));\n }\n continue;\n }\n url.searchParams.set(toSnakeCase(key), serialize(value));\n }\n return url;\n};\n"],"mappings":";;AAiBA,MAAM,aAAa,UACjB,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,GAAG,IAAI,OAAO,KAAK;;;;;;;;AASvD,MAAa,aAAa,KAAU,WAA+B;CACjE,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW;EAC3C,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAAG;GACtD,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,GAAG;IAClD,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW;IAC3C,IAAI,aAAa,IAAI,GAAG,YAAY,GAAG,EAAE,GAAG,SAAS,UAAU,KAAK,CAAC;GACvE;GACA;EACF;EACA,IAAI,aAAa,IAAI,YAAY,GAAG,GAAG,UAAU,KAAK,CAAC;CACzD;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RequestParams } from "./addParams.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Build a full URL against the TMDB endpoint, appending query params.
|
|
4
|
+
*
|
|
5
|
+
* @param resource - The path, e.g. `/search/movie` or `search/movie`.
|
|
6
|
+
* @param params - Optional query params (camelCase keys are converted to snake_case).
|
|
7
|
+
*
|
|
8
|
+
* @__NO_SIDE_EFFECTS__
|
|
9
|
+
*/
|
|
10
|
+
export declare const buildURL: (resource: string, params?: RequestParams) => URL;
|
|
11
|
+
//# sourceMappingURL=buildURL.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildURL.d.mts","names":[],"sources":["../../src/requests/buildURL.ts"],"mappings":";;;;;;;;;qBAYa,WAAY,kBAAkB,SAAS,kBAAgB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { addParams } from "./addParams.mjs";
|
|
2
|
+
import { endpoint } from "./TmdbSession.mjs";
|
|
3
|
+
// src/requests/buildURL.ts
|
|
4
|
+
/**
|
|
5
|
+
* Build a full URL against the TMDB endpoint, appending query params.
|
|
6
|
+
*
|
|
7
|
+
* @param resource - The path, e.g. `/search/movie` or `search/movie`.
|
|
8
|
+
* @param params - Optional query params (camelCase keys are converted to snake_case).
|
|
9
|
+
*
|
|
10
|
+
* @__NO_SIDE_EFFECTS__
|
|
11
|
+
*/
|
|
12
|
+
const buildURL = (resource, params) => addParams(new URL(resource.replace(/^\//, ``), endpoint), params ?? {});
|
|
13
|
+
export { buildURL };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=buildURL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildURL.mjs","names":[],"sources":["../../src/requests/buildURL.ts"],"sourcesContent":["import { addParams } from \"./addParams.js\";\nimport { endpoint } from \"./TmdbSession.js\";\nimport type { RequestParams } from \"./addParams.js\";\n\n/**\n * Build a full URL against the TMDB endpoint, appending query params.\n *\n * @param resource - The path, e.g. `/search/movie` or `search/movie`.\n * @param params - Optional query params (camelCase keys are converted to snake_case).\n *\n * @__NO_SIDE_EFFECTS__\n */\nexport const buildURL = (resource: string, params?: RequestParams): URL =>\n addParams(new URL(resource.replace(/^\\//, ``), endpoint), params ?? {});\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,YAAY,UAAkB,WACzC,UAAU,IAAI,IAAI,SAAS,QAAQ,OAAO,EAAE,GAAG,QAAQ,GAAG,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RequestBody, RequestMethod, RequestOptions, TmdbApiError, request } from "./request.mjs";
|
|
2
|
+
import { RequestParams, addParams } from "./addParams.mjs";
|
|
3
|
+
import { Fetcher, get, patch, post, put, remove } from "./methods.mjs";
|
|
4
|
+
import { API_KEY_ENV_VAR, RateLimit, SessionRequest, TOKEN_ENV_VAR, TmdbSession, apiKeyFromEnv, defaultRateLimit, endpoint, tmdb, tokenFromEnv } from "./TmdbSession.mjs";
|
|
5
|
+
import { toValidated } from "./toValidated.mjs";
|
|
6
|
+
import { buildURL } from "./buildURL.mjs";
|
|
7
|
+
export { API_KEY_ENV_VAR, type Fetcher, type RateLimit, type RequestBody, type RequestMethod, type RequestOptions, type RequestParams, type SessionRequest, TOKEN_ENV_VAR, TmdbApiError, TmdbSession, addParams, apiKeyFromEnv, buildURL, defaultRateLimit, endpoint, get, patch, post, put, remove, request, tmdb, toValidated, tokenFromEnv };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { addParams } from "./addParams.mjs";
|
|
2
|
+
import { API_KEY_ENV_VAR, TOKEN_ENV_VAR, TmdbSession, apiKeyFromEnv, defaultRateLimit, endpoint, tmdb, tokenFromEnv } from "./TmdbSession.mjs";
|
|
3
|
+
import { buildURL } from "./buildURL.mjs";
|
|
4
|
+
import { TmdbApiError, request } from "./request.mjs";
|
|
5
|
+
import { get, patch, post, put, remove } from "./methods.mjs";
|
|
6
|
+
import { toValidated } from "./toValidated.mjs";
|
|
7
|
+
export { API_KEY_ENV_VAR, TOKEN_ENV_VAR, TmdbApiError, TmdbSession, addParams, apiKeyFromEnv, buildURL, defaultRateLimit, endpoint, get, patch, post, put, remove, request, tmdb, toValidated, tokenFromEnv };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequestBody, RequestOptions } from "./request.mjs";
|
|
2
|
+
import { RequestParams } from "./addParams.mjs";
|
|
3
|
+
import { GenericSchema, GenericSchemaAsync, InferOutput } from "valibot";
|
|
4
|
+
/**
|
|
5
|
+
* A typed fetcher. When the input schema is `null` the fetcher takes only the per-call {@link RequestOptions}; otherwise it takes the schema's output as its first argument and the options second.
|
|
6
|
+
*/
|
|
7
|
+
export type Fetcher<
|
|
8
|
+
/** A schema to validate the input arguments of a fetch call */
|
|
9
|
+
S extends GenericSchema | GenericSchemaAsync | null = null,
|
|
10
|
+
/** The return value expected from the fetch call */
|
|
11
|
+
R = void> = S extends null ? (options?: RequestOptions) => Promise<R> : (config: InferOutput<NonNullable<S>>, options?: RequestOptions) => Promise<R>;
|
|
12
|
+
/** Perform a `GET` request to the given resource, with optional query params. */
|
|
13
|
+
export declare const get: <T = void>(url: string, params?: RequestParams, options?: RequestOptions) => Promise<T>;
|
|
14
|
+
/** Perform a `POST` request to the given resource with an optional body. */
|
|
15
|
+
export declare const post: <T = void>(url: string, body?: RequestBody, options?: RequestOptions) => Promise<T>;
|
|
16
|
+
/** Perform a `PUT` request to the given resource with an optional body. */
|
|
17
|
+
export declare const put: <T = void>(url: string, body?: RequestBody, options?: RequestOptions) => Promise<T>;
|
|
18
|
+
/** Perform a `PATCH` request to the given resource with an optional body. */
|
|
19
|
+
export declare const patch: <T = void>(url: string, body?: RequestBody, options?: RequestOptions) => Promise<T>;
|
|
20
|
+
/** Perform a `DELETE` request to the given resource. */
|
|
21
|
+
export declare const remove: <T = void>(url: string, options?: RequestOptions) => Promise<T>;
|
|
22
|
+
//# sourceMappingURL=methods.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.d.mts","names":[],"sources":["../../src/requests/methods.ts"],"mappings":";;;;;;YASY;;AAEV,UAAU,gBAAgB;;AAE1B,YACE,kBACC,UAAU,mBAAmB,QAAQ,MAEpC,QAAQ,YAAY,YAAY,KAChC,UAAU,mBACP,QAAQ;;qBAGJ,MAAa,UACxB,aACA,SAAS,eACT,UAAU,mBACT,QAAQ;;qBAGE,OAAc,UACzB,aACA,OAAO,aACP,UAAU,mBACT,QAAQ;;qBAGE,MAAa,UACxB,aACA,OAAO,aACP,UAAU,mBACT,QAAQ;;qBAGE,QAAe,UAC1B,aACA,OAAO,aACP,UAAU,mBACT,QAAQ;;qBAGE,SAAgB,UAC3B,aACA,UAAU,mBACT,QAAQ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { buildURL } from "./buildURL.mjs";
|
|
2
|
+
import { request } from "./request.mjs";
|
|
3
|
+
// src/requests/methods.ts
|
|
4
|
+
/** Perform a `GET` request to the given resource, with optional query params. */
|
|
5
|
+
const get = async (url, params, options) => request(buildURL(url, params), `GET`, void 0, options);
|
|
6
|
+
/** Perform a `POST` request to the given resource with an optional body. */
|
|
7
|
+
const post = async (url, body, options) => request(buildURL(url), `POST`, body, options);
|
|
8
|
+
/** Perform a `PUT` request to the given resource with an optional body. */
|
|
9
|
+
const put = async (url, body, options) => request(buildURL(url), `PUT`, body, options);
|
|
10
|
+
/** Perform a `PATCH` request to the given resource with an optional body. */
|
|
11
|
+
const patch = async (url, body, options) => request(buildURL(url), `PATCH`, body, options);
|
|
12
|
+
/** Perform a `DELETE` request to the given resource. */
|
|
13
|
+
const remove = async (url, options) => request(buildURL(url), `DELETE`, void 0, options);
|
|
14
|
+
export { get, patch, post, put, remove };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=methods.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.mjs","names":[],"sources":["../../src/requests/methods.ts"],"sourcesContent":["import type { GenericSchema, GenericSchemaAsync, InferOutput } from \"valibot\";\nimport { buildURL } from \"./buildURL.js\";\nimport { request } from \"./request.js\";\nimport type { RequestBody, RequestOptions } from \"./request.js\";\nimport type { RequestParams } from \"./addParams.js\";\n\n/**\n * A typed fetcher. When the input schema is `null` the fetcher takes only the per-call {@link RequestOptions}; otherwise it takes the schema's output as its first argument and the options second.\n */\nexport type Fetcher<\n /** A schema to validate the input arguments of a fetch call */\n S extends GenericSchema | GenericSchemaAsync | null = null,\n /** The return value expected from the fetch call */\n R = void\n> = S extends null\n ? (options?: RequestOptions) => Promise<R>\n : (\n config: InferOutput<NonNullable<S>>,\n options?: RequestOptions\n ) => Promise<R>;\n\n/** Perform a `GET` request to the given resource, with optional query params. */\nexport const get = async <T = void>(\n url: string,\n params?: RequestParams,\n options?: RequestOptions\n): Promise<T> => request(buildURL(url, params), `GET`, undefined, options);\n\n/** Perform a `POST` request to the given resource with an optional body. */\nexport const post = async <T = void>(\n url: string,\n body?: RequestBody,\n options?: RequestOptions\n): Promise<T> => request(buildURL(url), `POST`, body, options);\n\n/** Perform a `PUT` request to the given resource with an optional body. */\nexport const put = async <T = void>(\n url: string,\n body?: RequestBody,\n options?: RequestOptions\n): Promise<T> => request(buildURL(url), `PUT`, body, options);\n\n/** Perform a `PATCH` request to the given resource with an optional body. */\nexport const patch = async <T = void>(\n url: string,\n body?: RequestBody,\n options?: RequestOptions\n): Promise<T> => request(buildURL(url), `PATCH`, body, options);\n\n/** Perform a `DELETE` request to the given resource. */\nexport const remove = async <T = void>(\n url: string,\n options?: RequestOptions\n): Promise<T> => request(buildURL(url), `DELETE`, undefined, options);\n"],"mappings":";;;;AAsBA,MAAa,MAAM,OACjB,KACA,QACA,YACe,QAAQ,SAAS,KAAK,MAAM,GAAG,OAAO,KAAA,GAAW,OAAO;;AAGzE,MAAa,OAAO,OAClB,KACA,MACA,YACe,QAAQ,SAAS,GAAG,GAAG,QAAQ,MAAM,OAAO;;AAG7D,MAAa,MAAM,OACjB,KACA,MACA,YACe,QAAQ,SAAS,GAAG,GAAG,OAAO,MAAM,OAAO;;AAG5D,MAAa,QAAQ,OACnB,KACA,MACA,YACe,QAAQ,SAAS,GAAG,GAAG,SAAS,MAAM,OAAO;;AAG9D,MAAa,SAAS,OACpB,KACA,YACe,QAAQ,SAAS,GAAG,GAAG,UAAU,KAAA,GAAW,OAAO"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type RequestBody = object | null | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* The HTTP methods the TMDB REST API uses, and the only ones the typed helpers in `methods.ts` emit. Most of TMDB is read-only `GET`; the account, list, rating and session endpoints also `POST` and `DELETE`.
|
|
4
|
+
*/
|
|
5
|
+
export type RequestMethod = `GET` | `POST` | `PUT` | `PATCH` | `DELETE`;
|
|
6
|
+
/**
|
|
7
|
+
* Per-call options a {@link Fetcher} accepts as its last argument and forwards to the request layer.
|
|
8
|
+
*/
|
|
9
|
+
export interface RequestOptions {
|
|
10
|
+
/** Abort the request: while it waits for a rate-limit slot, while it is in flight, or while it backs off before a retry. */
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A structured error thrown when the TMDB API responds with a non-2xx status. TMDB reports failures as `{ status_code, status_message }` in the body; `statusCode` is `0` when the body didn't carry one.
|
|
15
|
+
*
|
|
16
|
+
* The message names the method and path but never the query string, which can hold a v3 `api_key`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class TmdbApiError extends Error {
|
|
19
|
+
readonly status: number;
|
|
20
|
+
readonly statusCode: number;
|
|
21
|
+
readonly statusMessage: string;
|
|
22
|
+
constructor(status: number, statusCode: number, statusMessage: string, request?: {
|
|
23
|
+
method: RequestMethod;
|
|
24
|
+
path: string;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export declare const request: <T>(resource: URL, method?: RequestMethod, body?: RequestBody, options?: RequestOptions) => Promise<T>;
|
|
28
|
+
//# sourceMappingURL=request.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.mts","names":[],"sources":["../../src/requests/request.ts"],"mappings":"A,YAKY;;;;YAKA;;;;iBAKK;;EAEf,SAAS;;;;;;;qBAQE,qBAAqB;WACvB;WACA;WACA;EAGP,YAAA,gBACA,oBACA,uBACA;IAAY,QAAQ;IAAe;;;qBAW1B,UAAiB,GAC5B,UAAU,KACV,SAAQ,eACR,OAAO,aACP,UAAU,mBACT,QAAQ"}
|