/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/spotify-web-api-ts@1.4.5/cjs/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __awaiter=this&&this.__awaiter||function(e,i,t,r){return new(t||(t=Promise))((function(s,o){function n(e){try{p(r.next(e))}catch(e){o(e)}}function a(e){try{p(r.throw(e))}catch(e){o(e)}}function p(e){var i;e.done?s(e.value):(i=e.value,i instanceof t?i:new t((function(e){e(i)}))).then(n,a)}p((r=r.apply(e,i||[])).next())}))},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const axios_1=__importDefault(require("axios")),qs_1=__importDefault(require("qs")),AlbumsApi_1=require("./apis/AlbumsApi"),ArtistsApi_1=require("./apis/ArtistsApi"),BrowseApi_1=require("./apis/BrowseApi"),EpisodesApi_1=require("./apis/EpisodesApi"),FollowApi_1=require("./apis/FollowApi"),LibraryApi_1=require("./apis/LibraryApi"),PersonalizationApi_1=require("./apis/PersonalizationApi"),PlayerApi_1=require("./apis/PlayerApi"),PlaylistsApi_1=require("./apis/PlaylistsApi"),SearchApi_1=require("./apis/SearchApi"),ShowsApi_1=require("./apis/ShowsApi"),TracksApi_1=require("./apis/TracksApi"),UsersApi_1=require("./apis/UsersApi"),constants_1=require("./constants"),encodeToBase64_1=require("./helpers/encodeToBase64"),getAuthorizationUrl_1=require("./helpers/getAuthorizationUrl"),Http_1=require("./helpers/Http");class SpotifyWebApi{constructor(e){var i,t,r,s;this.clientId=null!==(i=null==e?void 0:e.clientId)&&void 0!==i?i:"",this.clientSecret=null!==(t=null==e?void 0:e.clientSecret)&&void 0!==t?t:"",this.redirectUri=null!==(r=null==e?void 0:e.redirectUri)&&void 0!==r?r:"",this.http=new Http_1.Http(null!==(s=null==e?void 0:e.accessToken)&&void 0!==s?s:""),this.albums=new AlbumsApi_1.AlbumsApi(this.http),this.artists=new ArtistsApi_1.ArtistsApi(this.http),this.browse=new BrowseApi_1.BrowseApi(this.http),this.episodes=new EpisodesApi_1.EpisodesApi(this.http),this.follow=new FollowApi_1.FollowApi(this.http),this.library=new LibraryApi_1.LibraryApi(this.http),this.personalization=new PersonalizationApi_1.PersonalizationApi(this.http),this.player=new PlayerApi_1.PlayerApi(this.http),this.playlists=new PlaylistsApi_1.PlaylistsApi(this.http),this.search=new SearchApi_1.SearchApi(this.http),this.shows=new ShowsApi_1.ShowsApi(this.http),this.tracks=new TracksApi_1.TracksApi(this.http),this.users=new UsersApi_1.UsersApi(this.http)}getAccessToken(){return this.http.getAccessToken()}setAccessToken(e){this.http.setAccessToken(e)}getClientId(){return this.clientId}getClientSecret(){return this.clientSecret}getRedirectUri(){return this.redirectUri}getRefreshableAuthorizationUrl(e){return getAuthorizationUrl_1.getAuthorizationUrl(this.clientId,this.redirectUri,"code",e)}getTemporaryAuthorizationUrl(e){return getAuthorizationUrl_1.getAuthorizationUrl(this.clientId,this.redirectUri,"token",e)}getRefreshableUserTokens(e){return __awaiter(this,void 0,void 0,(function*(){return(yield axios_1.default.post(constants_1.TOKEN_URL,qs_1.default.stringify({code:e,grant_type:"authorization_code",redirect_uri:this.redirectUri}),{headers:{Authorization:`Basic ${encodeToBase64_1.encodeToBase64(`${this.clientId}:${this.clientSecret}`)}`,"Content-Type":"application/x-www-form-urlencoded"}})).data}))}getRefreshedAccessToken(e){return __awaiter(this,void 0,void 0,(function*(){return(yield axios_1.default.post(constants_1.TOKEN_URL,qs_1.default.stringify({grant_type:"refresh_token",refresh_token:e}),{headers:{Authorization:`Basic ${encodeToBase64_1.encodeToBase64(`${this.clientId}:${this.clientSecret}`)}`,"Content-Type":"application/x-www-form-urlencoded"}})).data}))}getTemporaryAppTokens(){return __awaiter(this,void 0,void 0,(function*(){return(yield axios_1.default.post(constants_1.TOKEN_URL,qs_1.default.stringify({grant_type:"client_credentials"}),{headers:{Authorization:`Basic ${encodeToBase64_1.encodeToBase64(`${this.clientId}:${this.clientSecret}`)}`,"Content-Type":"application/x-www-form-urlencoded"}})).data}))}}exports.SpotifyWebApi=SpotifyWebApi;
//# sourceMappingURL=/sm/9af6783cd04f6720b1daa973e7860fc9fb0527dcc362d7b99c68b207de7d4a47.map