Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@honkandgo/spotifyads

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@honkandgo/spotifyads - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

dist/spotifyads.js

@@ -1,2 +0,2 @@

var t,n=(t=require("node-fetch"))&&"object"==typeof t&&"default"in t?t.default:t,e=require("querystring"),r=["clientId","clientSecret"];module.exports=function(t){void 0===t&&(t={});var u=function(t){var u=t.clientId,o=t.clientSecret,c=function(t,n){if(null==t)return{};var e,r,u={},o=Object.keys(t);for(r=0;r<o.length;r++)n.indexOf(e=o[r])>=0||(u[e]=t[e]);return u}(t,r),s=function(t){void 0===t&&(t=3600);var n={},e=function(t){var e=n[t];if(e){var r=Date.now();if(e.inserted+1e3*e.maxAge>r)return e.value;delete n[t]}};return{get:e,set:function(e,r,u){n[e]={value:r,maxAge:u||t,inserted:Date.now()}},has:function(t){return void 0!==e(t)}}}(1800),a=function(t,r,a,i){try{return void 0===i&&(i=c.refreshToken),Promise.resolve(function(t){try{return s.has(t)||s.set(t,function(t){try{return Promise.resolve(n("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(u+":"+o).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:e.stringify({refresh_token:t,grant_type:"refresh_token"})}).then(function(t){return t.json()}).then(function(t){return t.access_token}))}catch(t){return Promise.reject(t)}}(t)),Promise.resolve(s.get(t))}catch(t){return Promise.reject(t)}}(i)).then(function(e){var u="https://api-partner.spotify.com/ads/v1.4"+(r.startsWith("/")?"":"/")+r;return u="GET"===t&&a?u+"?"+new URLSearchParams(a):u,Promise.resolve(n(u,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+e},body:a&&"GET"!==t?JSON.stringify(a):null})).then(function(t){return function(n,e){try{var r=Promise.resolve(t.json())}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}(0,function(n){if(200!==t.status)throw new Error(JSON.stringify(n))})})})}catch(t){return Promise.reject(t)}};return{get:function(t,n,e){return a("GET",t,n,e)},post:function(t,n,e){return a("POST",t,n,e)},put:function(t,n,e){return a("PUT",t,n,e)}}}(t),o=u.get,c=u.post,s=u.put;return{listAdAccounts:function(t){return o("/currentUser/adAccounts",null,t)},createCampaign:function(t,n,e){return c("/adAccounts/"+t+"/campaigns",n,e)},updateCampaign:function(t,n,e,r){return s("/adAccounts/"+t+"/campaigns/"+n,e,r)},updateCampaignStatus:function(t,n,e,r){return s("/adAccounts/"+t+"/campaigns/"+n+"/status/"+e,null,r)},getCampaign:function(t,n,e,r){return o("/adAccounts/"+t+"/campaigns/"+n,e,r)},getCampaignsByAdAccount:function(t,n){return o("/adAccounts/"+t+"/campaigns",null,n)},createAd:function(t,n,e){return c("/adAccounts/"+t+"/ads",n,e)},updateAd:function(t,n,e,r){return s("/adAccounts/"+t+"/ads/"+n,e,r)},getAd:function(t,n,e,r){return o("/adAccounts/"+t+"/ads/"+n,e,r)},getAds:function(t,n){return c("/ads",t,n)},getAdsByAdAccount:function(t,n){return o("/adAccounts/"+t+"/ads",null,n)},createAdvertiser:function(t,n,e){return c("/adAccounts/"+t+"/advertisers",n,e)},getAdvertisersByAdAccount:function(t,n){return o("/adAccounts/"+t+"/advertisers",null,n)},getImageUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/image",n,e)},getImageAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/image",n,e)},getVideoAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/video",n,e)},getVideoUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/video",n,e)},getAudioAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/audio",n,e)},getAudioUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/fullmix",n,e)},getAdSets:function(t,n){return c("/adSets",t,n)},updateAdSetStatus:function(t,n,e,r){return s("/adAccounts/"+t+"/adSets/"+n+"/status/"+e,null,r)},updateAdSet:function(t,n,e,r){return s("/adAccounts/"+t+"/adSets/"+n,e,r)},createAdSet:function(t,n,e,r){return c("/adAccounts/"+t+"/campaigns/"+n+"/adSets",e,r)},createReport:function(t,n){return c("/report",t,n)}}};
var t,e=(t=require("node-fetch"))&&"object"==typeof t&&"default"in t?t.default:t,n=require("querystring"),r=["clientId","clientSecret"];module.exports=function(t){void 0===t&&(t={});var u=function(t){var u=t.clientId,o=t.clientSecret,c=function(t,e){if(null==t)return{};var n,r,u={},o=Object.keys(t);for(r=0;r<o.length;r++)e.indexOf(n=o[r])>=0||(u[n]=t[n]);return u}(t,r),s=function(t){void 0===t&&(t=3600);var e={},n=function(t){var n=e[t];if(n){var r=Date.now();if(n.inserted+1e3*n.maxAge>r)return n.value;delete e[t]}};return{get:n,set:function(n,r,u){e[n]={value:r,maxAge:u||t,inserted:Date.now()}},has:function(t){return void 0!==n(t)}}}(1800),a=function(t,r,a,i){try{return void 0===i&&(i=c.refreshToken),Promise.resolve(function(t){try{return s.has(t)||s.set(t,function(t){try{return Promise.resolve(e("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(u+":"+o).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:n.stringify({refresh_token:t,grant_type:"refresh_token"})}).then(function(t){return t.json()}).then(function(t){return t.access_token}))}catch(t){return Promise.reject(t)}}(t)),Promise.resolve(s.get(t))}catch(t){return Promise.reject(t)}}(i)).then(function(n){var u="https://api-partner.spotify.com/ads/v1.4"+(r.startsWith("/")?"":"/")+r;return u="GET"===t&&a?u+"?"+new URLSearchParams(a):u,Promise.resolve(e(u,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n},body:a&&"GET"!==t?JSON.stringify(a):null})).then(function(t){return function(e,n){try{var r=Promise.resolve(t.json())}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(e){if(200!==t.status)throw new Error(JSON.stringify(e))})})})}catch(t){return Promise.reject(t)}};return{get:function(t,e,n){return a("GET",t,e,n)},post:function(t,e,n){return a("POST",t,e,n)},put:function(t,e,n){return a("PUT",t,e,n)}}}(t),o=u.get,c=u.post,s=u.put;return{listAdAccounts:function(t){return o("/currentUser/adAccounts",null,t)},createCampaign:function(t,e,n){return c("/adAccounts/"+t+"/campaigns",e,n)},updateCampaign:function(t,e,n,r){return s("/adAccounts/"+t+"/campaigns/"+e,n,r)},updateCampaignStatus:function(t,e,n,r){return s("/adAccounts/"+t+"/campaigns/"+e+"/status/"+n,null,r)},getCampaign:function(t,e,n,r){return o("/adAccounts/"+t+"/campaigns/"+e,n,r)},getCampaignsByAdAccount:function(t,e){return o("/adAccounts/"+t+"/campaigns",null,e)},createAd:function(t,e,n){return c("/adAccounts/"+t+"/ads",e,n)},updateAd:function(t,e,n,r){return s("/adAccounts/"+t+"/ads/"+e,n,r)},getAd:function(t,e,n,r){return o("/adAccounts/"+t+"/ads/"+e,n,r)},getAds:function(t,e){return c("/ads",t,e)},getAdsByAdAccount:function(t,e){return o("/adAccounts/"+t+"/ads",null,e)},createAdvertiser:function(t,e,n){return c("/adAccounts/"+t+"/advertisers",e,n)},getAdvertisersByAdAccount:function(t,e){return o("/adAccounts/"+t+"/advertisers",null,e)},getImageUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/image",e,n)},getImageAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/image",e,n)},getVideoAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/video",e,n)},getVideoUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/video",e,n)},getAudioAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/audio",e,n)},getAudioUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/fullmix",e,n)},getAdSets:function(t,e){return c("/adSets",t,e)},updateAdSetStatus:function(t,e,n,r){return s("/adAccounts/"+t+"/adSets/"+e+"/status/"+n,null,r)},updateAdSet:function(t,e,n,r){return s("/adAccounts/"+t+"/adSets/"+e,n,r)},createAdSet:function(t,e,n,r){return c("/adAccounts/"+t+"/campaigns/"+e+"/adSets",n,r)},createReport:function(t,e){return c("/report",t,e)},getGeoTargets:function(t){return o("/targets/geos",t)}}};
//# sourceMappingURL=spotifyads.js.map

@@ -1,2 +0,2 @@

import t from"node-fetch";import{stringify as e}from"querystring";const s=["clientId","clientSecret"];export default function(a={}){const{get:n,post:c,put:o}=(a=>{let{clientId:n,clientSecret:c}=a,o=function(t,e){if(null==t)return{};var s,a,n={},c=Object.keys(t);for(a=0;a<c.length;a++)e.indexOf(s=c[a])>=0||(n[s]=t[s]);return n}(a,s);const d=((t=3600)=>{const e={},s=t=>{const s=e[t];if(s){const a=Date.now();if(s.inserted+1e3*s.maxAge>a)return s.value;delete e[t]}};return{get:s,set:(s,a,n)=>{e[s]={value:a,maxAge:n||t,inserted:Date.now()}},has:t=>void 0!==s(t)}})(1800),r=async(s,a,r,u=o.refreshToken)=>{const i=await(async s=>(d.has(s)||d.set(s,(async s=>t("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(`${n}:${c}`).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:e({refresh_token:s,grant_type:"refresh_token"})}).then(t=>t.json()).then(t=>t.access_token))(s)),d.get(s)))(u);let A=`https://api-partner.spotify.com/ads/v1.4${a.startsWith("/")?"":"/"}${a}`;A="GET"===s&&r?A+"?"+new URLSearchParams(r):A;const p=await t(A,{method:s,headers:{"Content-Type":"application/json",Authorization:"Bearer "+i},body:r&&"GET"!==s?JSON.stringify(r):null});try{return await p.json()}catch(t){if(200!==p.status)throw new Error(JSON.stringify(t))}};return{get:async(t,e,s)=>r("GET",t,e,s),post:async(t,e,s)=>r("POST",t,e,s),put:async(t,e,s)=>r("PUT",t,e,s)}})(a);return{listAdAccounts:t=>n("/currentUser/adAccounts",null,t),createCampaign:(t,e,s)=>c(`/adAccounts/${t}/campaigns`,e,s),updateCampaign:(t,e,s,a)=>o(`/adAccounts/${t}/campaigns/${e}`,s,a),updateCampaignStatus:(t,e,s,a)=>o(`/adAccounts/${t}/campaigns/${e}/status/${s}`,null,a),getCampaign:(t,e,s,a)=>n(`/adAccounts/${t}/campaigns/${e}`,s,a),getCampaignsByAdAccount:(t,e)=>n(`/adAccounts/${t}/campaigns`,null,e),createAd:(t,e,s)=>c(`/adAccounts/${t}/ads`,e,s),updateAd:(t,e,s,a)=>o(`/adAccounts/${t}/ads/${e}`,s,a),getAd:(t,e,s,a)=>n(`/adAccounts/${t}/ads/${e}`,s,a),getAds:(t,e)=>c("/ads",t,e),getAdsByAdAccount:(t,e)=>n(`/adAccounts/${t}/ads`,null,e),createAdvertiser:(t,e,s)=>c(`/adAccounts/${t}/advertisers`,e,s),getAdvertisersByAdAccount:(t,e)=>n(`/adAccounts/${t}/advertisers`,null,e),getImageUploadUrl:(t,e,s)=>c(`/adAccounts/${t}/assets/image`,e,s),getImageAssets:(t,e,s)=>n(`/adAccounts/${t}/assets/image`,e,s),getVideoAssets:(t,e,s)=>n(`/adAccounts/${t}/assets/video`,e,s),getVideoUploadUrl:(t,e,s)=>c(`/adAccounts/${t}/assets/video`,e,s),getAudioAssets:(t,e,s)=>n(`/adAccounts/${t}/assets/audio`,e,s),getAudioUploadUrl:(t,e,s)=>c(`/adAccounts/${t}/assets/fullmix`,e,s),getAdSets:(t,e)=>c("/adSets",t,e),updateAdSetStatus:(t,e,s,a)=>o(`/adAccounts/${t}/adSets/${e}/status/${s}`,null,a),updateAdSet:(t,e,s,a)=>o(`/adAccounts/${t}/adSets/${e}`,s,a),createAdSet:(t,e,s,a)=>c(`/adAccounts/${t}/campaigns/${e}/adSets`,s,a),createReport:(t,e)=>c("/report",t,e)}}
import t from"node-fetch";import{stringify as e}from"querystring";const s=["clientId","clientSecret"];export default function(a={}){const{get:n,post:c,put:o}=(a=>{let{clientId:n,clientSecret:c}=a,o=function(t,e){if(null==t)return{};var s,a,n={},c=Object.keys(t);for(a=0;a<c.length;a++)e.indexOf(s=c[a])>=0||(n[s]=t[s]);return n}(a,s);const r=((t=3600)=>{const e={},s=t=>{const s=e[t];if(s){const a=Date.now();if(s.inserted+1e3*s.maxAge>a)return s.value;delete e[t]}};return{get:s,set:(s,a,n)=>{e[s]={value:a,maxAge:n||t,inserted:Date.now()}},has:t=>void 0!==s(t)}})(1800),d=async(s,a,d,u=o.refreshToken)=>{const i=await(async s=>(r.has(s)||r.set(s,(async s=>t("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(`${n}:${c}`).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:e({refresh_token:s,grant_type:"refresh_token"})}).then(t=>t.json()).then(t=>t.access_token))(s)),r.get(s)))(u);let A=`https://api-partner.spotify.com/ads/v1.4${a.startsWith("/")?"":"/"}${a}`;A="GET"===s&&d?A+"?"+new URLSearchParams(d):A;const g=await t(A,{method:s,headers:{"Content-Type":"application/json",Authorization:"Bearer "+i},body:d&&"GET"!==s?JSON.stringify(d):null});try{return await g.json()}catch(t){if(200!==g.status)throw new Error(JSON.stringify(t))}};return{get:async(t,e,s)=>d("GET",t,e,s),post:async(t,e,s)=>d("POST",t,e,s),put:async(t,e,s)=>d("PUT",t,e,s)}})(a);return{listAdAccounts:t=>n("/currentUser/adAccounts",null,t),createCampaign:(t,e,s)=>c(`/adAccounts/${t}/campaigns`,e,s),updateCampaign:(t,e,s,a)=>o(`/adAccounts/${t}/campaigns/${e}`,s,a),updateCampaignStatus:(t,e,s,a)=>o(`/adAccounts/${t}/campaigns/${e}/status/${s}`,null,a),getCampaign:(t,e,s,a)=>n(`/adAccounts/${t}/campaigns/${e}`,s,a),getCampaignsByAdAccount:(t,e)=>n(`/adAccounts/${t}/campaigns`,null,e),createAd:(t,e,s)=>c(`/adAccounts/${t}/ads`,e,s),updateAd:(t,e,s,a)=>o(`/adAccounts/${t}/ads/${e}`,s,a),getAd:(t,e,s,a)=>n(`/adAccounts/${t}/ads/${e}`,s,a),getAds:(t,e)=>c("/ads",t,e),getAdsByAdAccount:(t,e)=>n(`/adAccounts/${t}/ads`,null,e),createAdvertiser:(t,e,s)=>c(`/adAccounts/${t}/advertisers`,e,s),getAdvertisersByAdAccount:(t,e)=>n(`/adAccounts/${t}/advertisers`,null,e),getImageUploadUrl:(t,e,s)=>c(`/adAccounts/${t}/assets/image`,e,s),getImageAssets:(t,e,s)=>n(`/adAccounts/${t}/assets/image`,e,s),getVideoAssets:(t,e,s)=>n(`/adAccounts/${t}/assets/video`,e,s),getVideoUploadUrl:(t,e,s)=>c(`/adAccounts/${t}/assets/video`,e,s),getAudioAssets:(t,e,s)=>n(`/adAccounts/${t}/assets/audio`,e,s),getAudioUploadUrl:(t,e,s)=>c(`/adAccounts/${t}/assets/fullmix`,e,s),getAdSets:(t,e)=>c("/adSets",t,e),updateAdSetStatus:(t,e,s,a)=>o(`/adAccounts/${t}/adSets/${e}/status/${s}`,null,a),updateAdSet:(t,e,s,a)=>o(`/adAccounts/${t}/adSets/${e}`,s,a),createAdSet:(t,e,s,a)=>c(`/adAccounts/${t}/campaigns/${e}/adSets`,s,a),createReport:(t,e)=>c("/report",t,e),getGeoTargets:t=>n("/targets/geos",t)}}
//# sourceMappingURL=spotifyads.modern.js.map

@@ -1,2 +0,2 @@

import t from"node-fetch";import{stringify as n}from"querystring";var e=["clientId","clientSecret"];export default function(r){void 0===r&&(r={});var u=function(r){var u=r.clientId,o=r.clientSecret,c=function(t,n){if(null==t)return{};var e,r,u={},o=Object.keys(t);for(r=0;r<o.length;r++)n.indexOf(e=o[r])>=0||(u[e]=t[e]);return u}(r,e),s=function(t){void 0===t&&(t=3600);var n={},e=function(t){var e=n[t];if(e){var r=Date.now();if(e.inserted+1e3*e.maxAge>r)return e.value;delete n[t]}};return{get:e,set:function(e,r,u){n[e]={value:r,maxAge:u||t,inserted:Date.now()}},has:function(t){return void 0!==e(t)}}}(1800),a=function(e,r,a,i){try{return void 0===i&&(i=c.refreshToken),Promise.resolve(function(e){try{return s.has(e)||s.set(e,function(e){try{return Promise.resolve(t("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(u+":"+o).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:n({refresh_token:e,grant_type:"refresh_token"})}).then(function(t){return t.json()}).then(function(t){return t.access_token}))}catch(t){return Promise.reject(t)}}(e)),Promise.resolve(s.get(e))}catch(t){return Promise.reject(t)}}(i)).then(function(n){var u="https://api-partner.spotify.com/ads/v1.4"+(r.startsWith("/")?"":"/")+r;return u="GET"===e&&a?u+"?"+new URLSearchParams(a):u,Promise.resolve(t(u,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n},body:a&&"GET"!==e?JSON.stringify(a):null})).then(function(t){return function(n,e){try{var r=Promise.resolve(t.json())}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}(0,function(n){if(200!==t.status)throw new Error(JSON.stringify(n))})})})}catch(t){return Promise.reject(t)}};return{get:function(t,n,e){return a("GET",t,n,e)},post:function(t,n,e){return a("POST",t,n,e)},put:function(t,n,e){return a("PUT",t,n,e)}}}(r),o=u.get,c=u.post,s=u.put;return{listAdAccounts:function(t){return o("/currentUser/adAccounts",null,t)},createCampaign:function(t,n,e){return c("/adAccounts/"+t+"/campaigns",n,e)},updateCampaign:function(t,n,e,r){return s("/adAccounts/"+t+"/campaigns/"+n,e,r)},updateCampaignStatus:function(t,n,e,r){return s("/adAccounts/"+t+"/campaigns/"+n+"/status/"+e,null,r)},getCampaign:function(t,n,e,r){return o("/adAccounts/"+t+"/campaigns/"+n,e,r)},getCampaignsByAdAccount:function(t,n){return o("/adAccounts/"+t+"/campaigns",null,n)},createAd:function(t,n,e){return c("/adAccounts/"+t+"/ads",n,e)},updateAd:function(t,n,e,r){return s("/adAccounts/"+t+"/ads/"+n,e,r)},getAd:function(t,n,e,r){return o("/adAccounts/"+t+"/ads/"+n,e,r)},getAds:function(t,n){return c("/ads",t,n)},getAdsByAdAccount:function(t,n){return o("/adAccounts/"+t+"/ads",null,n)},createAdvertiser:function(t,n,e){return c("/adAccounts/"+t+"/advertisers",n,e)},getAdvertisersByAdAccount:function(t,n){return o("/adAccounts/"+t+"/advertisers",null,n)},getImageUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/image",n,e)},getImageAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/image",n,e)},getVideoAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/video",n,e)},getVideoUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/video",n,e)},getAudioAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/audio",n,e)},getAudioUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/fullmix",n,e)},getAdSets:function(t,n){return c("/adSets",t,n)},updateAdSetStatus:function(t,n,e,r){return s("/adAccounts/"+t+"/adSets/"+n+"/status/"+e,null,r)},updateAdSet:function(t,n,e,r){return s("/adAccounts/"+t+"/adSets/"+n,e,r)},createAdSet:function(t,n,e,r){return c("/adAccounts/"+t+"/campaigns/"+n+"/adSets",e,r)},createReport:function(t,n){return c("/report",t,n)}}}
import t from"node-fetch";import{stringify as n}from"querystring";var e=["clientId","clientSecret"];export default function(r){void 0===r&&(r={});var u=function(r){var u=r.clientId,o=r.clientSecret,c=function(t,n){if(null==t)return{};var e,r,u={},o=Object.keys(t);for(r=0;r<o.length;r++)n.indexOf(e=o[r])>=0||(u[e]=t[e]);return u}(r,e),s=function(t){void 0===t&&(t=3600);var n={},e=function(t){var e=n[t];if(e){var r=Date.now();if(e.inserted+1e3*e.maxAge>r)return e.value;delete n[t]}};return{get:e,set:function(e,r,u){n[e]={value:r,maxAge:u||t,inserted:Date.now()}},has:function(t){return void 0!==e(t)}}}(1800),a=function(e,r,a,i){try{return void 0===i&&(i=c.refreshToken),Promise.resolve(function(e){try{return s.has(e)||s.set(e,function(e){try{return Promise.resolve(t("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(u+":"+o).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:n({refresh_token:e,grant_type:"refresh_token"})}).then(function(t){return t.json()}).then(function(t){return t.access_token}))}catch(t){return Promise.reject(t)}}(e)),Promise.resolve(s.get(e))}catch(t){return Promise.reject(t)}}(i)).then(function(n){var u="https://api-partner.spotify.com/ads/v1.4"+(r.startsWith("/")?"":"/")+r;return u="GET"===e&&a?u+"?"+new URLSearchParams(a):u,Promise.resolve(t(u,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n},body:a&&"GET"!==e?JSON.stringify(a):null})).then(function(t){return function(n,e){try{var r=Promise.resolve(t.json())}catch(t){return e(t)}return r&&r.then?r.then(void 0,e):r}(0,function(n){if(200!==t.status)throw new Error(JSON.stringify(n))})})})}catch(t){return Promise.reject(t)}};return{get:function(t,n,e){return a("GET",t,n,e)},post:function(t,n,e){return a("POST",t,n,e)},put:function(t,n,e){return a("PUT",t,n,e)}}}(r),o=u.get,c=u.post,s=u.put;return{listAdAccounts:function(t){return o("/currentUser/adAccounts",null,t)},createCampaign:function(t,n,e){return c("/adAccounts/"+t+"/campaigns",n,e)},updateCampaign:function(t,n,e,r){return s("/adAccounts/"+t+"/campaigns/"+n,e,r)},updateCampaignStatus:function(t,n,e,r){return s("/adAccounts/"+t+"/campaigns/"+n+"/status/"+e,null,r)},getCampaign:function(t,n,e,r){return o("/adAccounts/"+t+"/campaigns/"+n,e,r)},getCampaignsByAdAccount:function(t,n){return o("/adAccounts/"+t+"/campaigns",null,n)},createAd:function(t,n,e){return c("/adAccounts/"+t+"/ads",n,e)},updateAd:function(t,n,e,r){return s("/adAccounts/"+t+"/ads/"+n,e,r)},getAd:function(t,n,e,r){return o("/adAccounts/"+t+"/ads/"+n,e,r)},getAds:function(t,n){return c("/ads",t,n)},getAdsByAdAccount:function(t,n){return o("/adAccounts/"+t+"/ads",null,n)},createAdvertiser:function(t,n,e){return c("/adAccounts/"+t+"/advertisers",n,e)},getAdvertisersByAdAccount:function(t,n){return o("/adAccounts/"+t+"/advertisers",null,n)},getImageUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/image",n,e)},getImageAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/image",n,e)},getVideoAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/video",n,e)},getVideoUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/video",n,e)},getAudioAssets:function(t,n,e){return o("/adAccounts/"+t+"/assets/audio",n,e)},getAudioUploadUrl:function(t,n,e){return c("/adAccounts/"+t+"/assets/fullmix",n,e)},getAdSets:function(t,n){return c("/adSets",t,n)},updateAdSetStatus:function(t,n,e,r){return s("/adAccounts/"+t+"/adSets/"+n+"/status/"+e,null,r)},updateAdSet:function(t,n,e,r){return s("/adAccounts/"+t+"/adSets/"+n,e,r)},createAdSet:function(t,n,e,r){return c("/adAccounts/"+t+"/campaigns/"+n+"/adSets",e,r)},createReport:function(t,n){return c("/report",t,n)},getGeoTargets:function(t){return o("/targets/geos",t)}}}
//# sourceMappingURL=spotifyads.module.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("node-fetch"),require("querystring")):"function"==typeof define&&define.amd?define(["node-fetch","querystring"],e):(t=t||self).spotifyads=e(t.nodeFetch,t.querystring)}(this,function(t,e){t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var n=["clientId","clientSecret"];return function(r){void 0===r&&(r={});var u=function(r){var u=r.clientId,o=r.clientSecret,c=function(t,e){if(null==t)return{};var n,r,u={},o=Object.keys(t);for(r=0;r<o.length;r++)e.indexOf(n=o[r])>=0||(u[n]=t[n]);return u}(r,n),s=function(t){void 0===t&&(t=3600);var e={},n=function(t){var n=e[t];if(n){var r=Date.now();if(n.inserted+1e3*n.maxAge>r)return n.value;delete e[t]}};return{get:n,set:function(n,r,u){e[n]={value:r,maxAge:u||t,inserted:Date.now()}},has:function(t){return void 0!==n(t)}}}(1800),a=function(n,r,a,i){try{return void 0===i&&(i=c.refreshToken),Promise.resolve(function(n){try{return s.has(n)||s.set(n,function(n){try{return Promise.resolve(t("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(u+":"+o).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:e.stringify({refresh_token:n,grant_type:"refresh_token"})}).then(function(t){return t.json()}).then(function(t){return t.access_token}))}catch(t){return Promise.reject(t)}}(n)),Promise.resolve(s.get(n))}catch(t){return Promise.reject(t)}}(i)).then(function(e){var u="https://api-partner.spotify.com/ads/v1.4"+(r.startsWith("/")?"":"/")+r;return u="GET"===n&&a?u+"?"+new URLSearchParams(a):u,Promise.resolve(t(u,{method:n,headers:{"Content-Type":"application/json",Authorization:"Bearer "+e},body:a&&"GET"!==n?JSON.stringify(a):null})).then(function(t){return function(e,n){try{var r=Promise.resolve(t.json())}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(e){if(200!==t.status)throw new Error(JSON.stringify(e))})})})}catch(t){return Promise.reject(t)}};return{get:function(t,e,n){return a("GET",t,e,n)},post:function(t,e,n){return a("POST",t,e,n)},put:function(t,e,n){return a("PUT",t,e,n)}}}(r),o=u.get,c=u.post,s=u.put;return{listAdAccounts:function(t){return o("/currentUser/adAccounts",null,t)},createCampaign:function(t,e,n){return c("/adAccounts/"+t+"/campaigns",e,n)},updateCampaign:function(t,e,n,r){return s("/adAccounts/"+t+"/campaigns/"+e,n,r)},updateCampaignStatus:function(t,e,n,r){return s("/adAccounts/"+t+"/campaigns/"+e+"/status/"+n,null,r)},getCampaign:function(t,e,n,r){return o("/adAccounts/"+t+"/campaigns/"+e,n,r)},getCampaignsByAdAccount:function(t,e){return o("/adAccounts/"+t+"/campaigns",null,e)},createAd:function(t,e,n){return c("/adAccounts/"+t+"/ads",e,n)},updateAd:function(t,e,n,r){return s("/adAccounts/"+t+"/ads/"+e,n,r)},getAd:function(t,e,n,r){return o("/adAccounts/"+t+"/ads/"+e,n,r)},getAds:function(t,e){return c("/ads",t,e)},getAdsByAdAccount:function(t,e){return o("/adAccounts/"+t+"/ads",null,e)},createAdvertiser:function(t,e,n){return c("/adAccounts/"+t+"/advertisers",e,n)},getAdvertisersByAdAccount:function(t,e){return o("/adAccounts/"+t+"/advertisers",null,e)},getImageUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/image",e,n)},getImageAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/image",e,n)},getVideoAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/video",e,n)},getVideoUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/video",e,n)},getAudioAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/audio",e,n)},getAudioUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/fullmix",e,n)},getAdSets:function(t,e){return c("/adSets",t,e)},updateAdSetStatus:function(t,e,n,r){return s("/adAccounts/"+t+"/adSets/"+e+"/status/"+n,null,r)},updateAdSet:function(t,e,n,r){return s("/adAccounts/"+t+"/adSets/"+e,n,r)},createAdSet:function(t,e,n,r){return c("/adAccounts/"+t+"/campaigns/"+e+"/adSets",n,r)},createReport:function(t,e){return c("/report",t,e)}}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("node-fetch"),require("querystring")):"function"==typeof define&&define.amd?define(["node-fetch","querystring"],e):(t=t||self).spotifyads=e(t.nodeFetch,t.querystring)}(this,function(t,e){t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var n=["clientId","clientSecret"];return function(r){void 0===r&&(r={});var u=function(r){var u=r.clientId,o=r.clientSecret,c=function(t,e){if(null==t)return{};var n,r,u={},o=Object.keys(t);for(r=0;r<o.length;r++)e.indexOf(n=o[r])>=0||(u[n]=t[n]);return u}(r,n),s=function(t){void 0===t&&(t=3600);var e={},n=function(t){var n=e[t];if(n){var r=Date.now();if(n.inserted+1e3*n.maxAge>r)return n.value;delete e[t]}};return{get:n,set:function(n,r,u){e[n]={value:r,maxAge:u||t,inserted:Date.now()}},has:function(t){return void 0!==n(t)}}}(1800),a=function(n,r,a,i){try{return void 0===i&&(i=c.refreshToken),Promise.resolve(function(n){try{return s.has(n)||s.set(n,function(n){try{return Promise.resolve(t("https://accounts.spotify.com/api/token",{method:"POST",headers:{Authorization:"Basic "+Buffer.from(u+":"+o).toString("base64"),"Content-Type":"application/x-www-form-urlencoded"},body:e.stringify({refresh_token:n,grant_type:"refresh_token"})}).then(function(t){return t.json()}).then(function(t){return t.access_token}))}catch(t){return Promise.reject(t)}}(n)),Promise.resolve(s.get(n))}catch(t){return Promise.reject(t)}}(i)).then(function(e){var u="https://api-partner.spotify.com/ads/v1.4"+(r.startsWith("/")?"":"/")+r;return u="GET"===n&&a?u+"?"+new URLSearchParams(a):u,Promise.resolve(t(u,{method:n,headers:{"Content-Type":"application/json",Authorization:"Bearer "+e},body:a&&"GET"!==n?JSON.stringify(a):null})).then(function(t){return function(e,n){try{var r=Promise.resolve(t.json())}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}(0,function(e){if(200!==t.status)throw new Error(JSON.stringify(e))})})})}catch(t){return Promise.reject(t)}};return{get:function(t,e,n){return a("GET",t,e,n)},post:function(t,e,n){return a("POST",t,e,n)},put:function(t,e,n){return a("PUT",t,e,n)}}}(r),o=u.get,c=u.post,s=u.put;return{listAdAccounts:function(t){return o("/currentUser/adAccounts",null,t)},createCampaign:function(t,e,n){return c("/adAccounts/"+t+"/campaigns",e,n)},updateCampaign:function(t,e,n,r){return s("/adAccounts/"+t+"/campaigns/"+e,n,r)},updateCampaignStatus:function(t,e,n,r){return s("/adAccounts/"+t+"/campaigns/"+e+"/status/"+n,null,r)},getCampaign:function(t,e,n,r){return o("/adAccounts/"+t+"/campaigns/"+e,n,r)},getCampaignsByAdAccount:function(t,e){return o("/adAccounts/"+t+"/campaigns",null,e)},createAd:function(t,e,n){return c("/adAccounts/"+t+"/ads",e,n)},updateAd:function(t,e,n,r){return s("/adAccounts/"+t+"/ads/"+e,n,r)},getAd:function(t,e,n,r){return o("/adAccounts/"+t+"/ads/"+e,n,r)},getAds:function(t,e){return c("/ads",t,e)},getAdsByAdAccount:function(t,e){return o("/adAccounts/"+t+"/ads",null,e)},createAdvertiser:function(t,e,n){return c("/adAccounts/"+t+"/advertisers",e,n)},getAdvertisersByAdAccount:function(t,e){return o("/adAccounts/"+t+"/advertisers",null,e)},getImageUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/image",e,n)},getImageAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/image",e,n)},getVideoAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/video",e,n)},getVideoUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/video",e,n)},getAudioAssets:function(t,e,n){return o("/adAccounts/"+t+"/assets/audio",e,n)},getAudioUploadUrl:function(t,e,n){return c("/adAccounts/"+t+"/assets/fullmix",e,n)},getAdSets:function(t,e){return c("/adSets",t,e)},updateAdSetStatus:function(t,e,n,r){return s("/adAccounts/"+t+"/adSets/"+e+"/status/"+n,null,r)},updateAdSet:function(t,e,n,r){return s("/adAccounts/"+t+"/adSets/"+e,n,r)},createAdSet:function(t,e,n,r){return c("/adAccounts/"+t+"/campaigns/"+e+"/adSets",n,r)},createReport:function(t,e){return c("/report",t,e)},getGeoTargets:function(t){return o("/targets/geos",t)}}}});
//# sourceMappingURL=spotifyads.umd.js.map
{
"name": "@honkandgo/spotifyads",
"version": "1.1.0",
"version": "1.2.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -109,3 +109,8 @@ import { makeApi } from './api'

// Geo targets
const getGeoTargets = (params) => {
return get('/targets/geos', params)
}
return {

@@ -135,4 +140,5 @@ listAdAccounts,

createAdSet,
createReport
createReport,
getGeoTargets
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc