@honkandgo/googleads
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -1,2 +0,2 @@ | ||
var e,t=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e){void 0===e&&(e={});var r=function(e){var r=e.clientId,n=e.clientSecret,o=e.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(e,["clientId","clientSecret","developerToken"]),i=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),u=function(e,u,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(e){try{return i.has(e)||i.set(e,function(e){try{return Promise.resolve(t("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:e,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(e)),Promise.resolve(i.get(e))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(u.startsWith("/")?"":"/")+u;return Promise.resolve(t(n,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){if(404===e.status)throw new Error("404 "+u);return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return u("GET",e,t,r)},post:function(e,t,r){return u("POST",e,t,r)}}}(e),n=r.get,o=r.post;return{listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)}}}; | ||
var e,t=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e){void 0===e&&(e={});var r=function(e){var r=e.clientId,n=e.clientSecret,o=e.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(e,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(e,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(e){try{return u.has(e)||u.set(e,function(e){try{return Promise.resolve(t("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:e,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(e)),Promise.resolve(u.get(e))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(t(n,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){if(404===e.status)throw new Error("404 "+i);return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(e),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)}}}; | ||
//# sourceMappingURL=googleads.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"node-fetch";export default function(t={}){const{get:s,post:o}=(t=>{let{clientId:s,clientSecret:o,developerToken:r}=t,n=function(e,t){if(null==e)return{};var s,o,r={},n=Object.keys(e);for(o=0;o<n.length;o++)t.indexOf(s=n[o])>=0||(r[s]=e[s]);return r}(t,["clientId","clientSecret","developerToken"]);const a=((e=3600)=>{const t={},s=e=>{const s=t[e];if(s){const o=Date.now();if(s.inserted+1e3*s.maxAge>o)return s.value;delete t[e]}};return{get:s,set:(s,o,r)=>{t[s]={value:o,maxAge:r||e,inserted:Date.now()}},has:e=>void 0!==s(e)}})(1800),c=async(t,c,i,l=n.refreshToken)=>{const u=await(async t=>(a.has(t)||a.set(t,(async t=>e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:s,client_secret:o,refresh_token:t,grant_type:"refresh_token"})}).then(e=>e.json()).then(e=>e.access_token))(t)),a.get(t)))(l),g=`https://googleads.googleapis.com/v6${c.startsWith("/")?"":"/"}${c}`,h=await e(g,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+u,"Developer-Token":r},body:i?JSON.stringify(i):null});if(404===h.status)throw new Error("404 "+c);const m=await h.json();if(m.error)throw new Error(JSON.stringify(m.error));return m};return{get:async(e,t,s)=>c("GET",e,t,s),post:async(e,t,s)=>c("POST",e,t,s)}})(t);return{listAccessibleCustomers:e=>s("/customers:listAccessibleCustomers",null,e),get:s,post:o,search:(e,t,s)=>o(`/customers/${e}/googleAds:search`,t,s),searchStream:(e,t,s)=>o(`/customers/${e}/googleAds:searchStream`,t,s),mutate:(e,t,s)=>o(`/customers/${e}/googleAds:mutate`,t,s),mutateCampaigns:(e,t,s)=>o(`/customers/${e}/campaigns:mutate`,t,s)}} | ||
import e from"node-fetch";export default function(t={}){const{get:s,post:o}=(t=>{let{clientId:s,clientSecret:o,developerToken:r}=t,n=function(e,t){if(null==e)return{};var s,o,r={},n=Object.keys(e);for(o=0;o<n.length;o++)t.indexOf(s=n[o])>=0||(r[s]=e[s]);return r}(t,["clientId","clientSecret","developerToken"]);const a=((e=3600)=>{const t={},s=e=>{const s=t[e];if(s){const o=Date.now();if(s.inserted+1e3*s.maxAge>o)return s.value;delete t[e]}};return{get:s,set:(s,o,r)=>{t[s]={value:o,maxAge:r||e,inserted:Date.now()}},has:e=>void 0!==s(e)}})(1800),c=async(t,c,i,g=n.refreshToken)=>{const l=await(async t=>(a.has(t)||a.set(t,(async t=>e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:s,client_secret:o,refresh_token:t,grant_type:"refresh_token"})}).then(e=>e.json()).then(e=>e.access_token))(t)),a.get(t)))(g),u=`https://googleads.googleapis.com/v6${c.startsWith("/")?"":"/"}${c}`,h=await e(u,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+l,"Developer-Token":r},body:i?JSON.stringify(i):null});if(404===h.status)throw new Error("404 "+c);const m=await h.json();if(m.error)throw new Error(JSON.stringify(m.error));return m};return{get:async(e,t,s)=>c("GET",e,t,s),post:async(e,t,s)=>c("POST",e,t,s)}})(t);return{suggestGeoTargetConstants:(e,t)=>o("/geoTargetConstants:suggest",e,t),listAccessibleCustomers:e=>s("/customers:listAccessibleCustomers",null,e),get:s,post:o,search:(e,t,s)=>o(`/customers/${e}/googleAds:search`,t,s),searchStream:(e,t,s)=>o(`/customers/${e}/googleAds:searchStream`,t,s),mutate:(e,t,s)=>o(`/customers/${e}/googleAds:mutate`,t,s),mutateCampaigns:(e,t,s)=>o(`/customers/${e}/campaigns:mutate`,t,s)}} | ||
//# sourceMappingURL=googleads.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"node-fetch";export default function(t){void 0===t&&(t={});var r=function(t){var r=t.clientId,n=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(t,["clientId","clientSecret","developerToken"]),i=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),u=function(t,u,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return i.has(t)||i.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(i.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(u.startsWith("/")?"":"/")+u;return Promise.resolve(e(n,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){if(404===e.status)throw new Error("404 "+u);return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return u("GET",e,t,r)},post:function(e,t,r){return u("POST",e,t,r)}}}(t),n=r.get,o=r.post;return{listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)}}} | ||
import e from"node-fetch";export default function(t){void 0===t&&(t={});var r=function(t){var r=t.clientId,n=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(t,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return u.has(t)||u.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(u.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(n,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){if(404===e.status)throw new Error("404 "+i);return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(t),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)}}} | ||
//# sourceMappingURL=googleads.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("node-fetch")):"function"==typeof define&&define.amd?define(["node-fetch"],t):(e=e||self).googleads=t(e.nodeFetch)}(this,function(e){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(t){void 0===t&&(t={});var r=function(t){var r=t.clientId,n=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(t,["clientId","clientSecret","developerToken"]),i=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),u=function(t,u,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return i.has(t)||i.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(i.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(u.startsWith("/")?"":"/")+u;return Promise.resolve(e(n,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){if(404===e.status)throw new Error("404 "+u);return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return u("GET",e,t,r)},post:function(e,t,r){return u("POST",e,t,r)}}}(t),n=r.get,o=r.post;return{listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)}}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("node-fetch")):"function"==typeof define&&define.amd?define(["node-fetch"],t):(e=e||self).googleads=t(e.nodeFetch)}(this,function(e){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(t){void 0===t&&(t={});var r=function(t){var r=t.clientId,n=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(t,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return u.has(t)||u.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(u.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(n,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){if(404===e.status)throw new Error("404 "+i);return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(t),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)}}}}); | ||
//# sourceMappingURL=googleads.umd.js.map |
{ | ||
"name": "@honkandgo/googleads", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -6,2 +6,6 @@ import { makeApi } from './api' | ||
const suggestGeoTargetConstants = (params, refreshToken) => { | ||
return post('/geoTargetConstants:suggest', params, refreshToken) | ||
} | ||
const listAccessibleCustomers = (refreshToken) => { | ||
@@ -28,2 +32,3 @@ return get('/customers:listAccessibleCustomers', null, refreshToken) | ||
return { | ||
suggestGeoTargetConstants, | ||
listAccessibleCustomers, | ||
@@ -30,0 +35,0 @@ get, |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39088
146