@honkandgo/googleads
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -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"]),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/v8"+(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){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)},mutateCustomAudiences:function(e,t,r){return o("/customers/"+e+"/customAudiences:mutate",t,r)}}}; | ||
var e,t=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("querystring");module.exports=function(e){void 0===e&&(e={});var n=function(e){var n=e.clientId,o=e.clientSecret,s=e.developerToken,u=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),c=function(e,c,a,f){try{return void 0===f&&(f=u.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:n,client_secret:o,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)}}(f)).then(function(n){var o="https://googleads.googleapis.com/v8"+(c.startsWith("/")?"":"/")+c;return o="GET"===e&&a?o+"?"+r.stringify(a):o,Promise.resolve(t(o,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n,"Developer-Token":s},body:a&&"GET"!==e?JSON.stringify(a):null})).then(function(e){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 c("GET",e,t,r)},post:function(e,t,r){return c("POST",e,t,r)}}}(e),o=n.get,s=n.post;return{suggestGeoTargetConstants:function(e,t){return s("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return o("/customers:listAccessibleCustomers",null,e)},get:o,post:s,mutateBatchJob:function(e,t,r){return s("/customers/"+e+"/batchJobs:mutate",t,r)},listResults:function(e,t,r){return o(e+":listResults",t,r)},addOperations:function(e,t,r){return s(e+":addOperations",t,r)},runBatchJob:function(e,t){return s(e+":run",null,t)},search:function(e,t,r){return s("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return s("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return s("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return s("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return s("/customers/"+e+"/customAudiences: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:n}=t,r=function(e,t){if(null==e)return{};var s,o,n={},r=Object.keys(e);for(o=0;o<r.length;o++)t.indexOf(s=r[o])>=0||(n[s]=e[s]);return n}(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,n)=>{t[s]={value:o,maxAge:n||e,inserted:Date.now()}},has:e=>void 0!==s(e)}})(1800),c=async(t,c,i,u=r.refreshToken)=>{const g=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)))(u),l=`https://googleads.googleapis.com/v8${c.startsWith("/")?"":"/"}${c}`,m=await e(l,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+g,"Developer-Token":n},body:i?JSON.stringify(i):null}),d=await m.json();if(d.error)throw new Error(JSON.stringify(d.error));return d};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),mutateCustomAudiences:(e,t,s)=>o(`/customers/${e}/customAudiences:mutate`,t,s)}} | ||
import e from"node-fetch";import{stringify as t}from"querystring";export default function(s={}){const{get:o,post:r}=(s=>{let{clientId:o,clientSecret:r,developerToken:n}=s,a=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}(s,["clientId","clientSecret","developerToken"]);const c=((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),i=async(s,i,u,l=a.refreshToken)=>{const g=await(async t=>(c.has(t)||c.set(t,(async t=>e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:o,client_secret:r,refresh_token:t,grant_type:"refresh_token"})}).then(e=>e.json()).then(e=>e.access_token))(t)),c.get(t)))(l);let m=`https://googleads.googleapis.com/v8${i.startsWith("/")?"":"/"}${i}`;m="GET"===s&&u?m+"?"+t(u):m;const d=await e(m,{method:s,headers:{"Content-Type":"application/json",Authorization:"Bearer "+g,"Developer-Token":n},body:u&&"GET"!==s?JSON.stringify(u):null}),h=await d.json();if(h.error)throw new Error(JSON.stringify(h.error));return h};return{get:async(e,t,s)=>i("GET",e,t,s),post:async(e,t,s)=>i("POST",e,t,s)}})(s);return{suggestGeoTargetConstants:(e,t)=>r("/geoTargetConstants:suggest",e,t),listAccessibleCustomers:e=>o("/customers:listAccessibleCustomers",null,e),get:o,post:r,mutateBatchJob:(e,t,s)=>r(`/customers/${e}/batchJobs:mutate`,t,s),listResults:(e,t,s)=>o(e+":listResults",t,s),addOperations:(e,t,s)=>r(e+":addOperations",t,s),runBatchJob:(e,t)=>r(e+":run",null,t),search:(e,t,s)=>r(`/customers/${e}/googleAds:search`,t,s),searchStream:(e,t,s)=>r(`/customers/${e}/googleAds:searchStream`,t,s),mutate:(e,t,s)=>r(`/customers/${e}/googleAds:mutate`,t,s),mutateCampaigns:(e,t,s)=>r(`/customers/${e}/campaigns:mutate`,t,s),mutateCustomAudiences:(e,t,s)=>r(`/customers/${e}/customAudiences: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"]),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/v8"+(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){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)},mutateCustomAudiences:function(e,t,r){return o("/customers/"+e+"/customAudiences:mutate",t,r)}}} | ||
import e from"node-fetch";import{stringify as t}from"querystring";export default function(r){void 0===r&&(r={});var n=function(r){var n=r.clientId,o=r.clientSecret,s=r.developerToken,u=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}(r,["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),c=function(r,c,a,f){try{return void 0===f&&(f=u.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:n,client_secret:o,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)}}(f)).then(function(n){var o="https://googleads.googleapis.com/v8"+(c.startsWith("/")?"":"/")+c;return o="GET"===r&&a?o+"?"+t(a):o,Promise.resolve(e(o,{method:r,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n,"Developer-Token":s},body:a&&"GET"!==r?JSON.stringify(a):null})).then(function(e){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 c("GET",e,t,r)},post:function(e,t,r){return c("POST",e,t,r)}}}(r),o=n.get,s=n.post;return{suggestGeoTargetConstants:function(e,t){return s("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return o("/customers:listAccessibleCustomers",null,e)},get:o,post:s,mutateBatchJob:function(e,t,r){return s("/customers/"+e+"/batchJobs:mutate",t,r)},listResults:function(e,t,r){return o(e+":listResults",t,r)},addOperations:function(e,t,r){return s(e+":addOperations",t,r)},runBatchJob:function(e,t){return s(e+":run",null,t)},search:function(e,t,r){return s("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return s("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return s("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return s("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return s("/customers/"+e+"/customAudiences: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 n=function(t){var n=t.clientId,r=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},n=function(e){var n=t[e];if(n){var r=Date.now();if(n.inserted+1e3*n.maxAge>r)return n.value;delete t[e]}};return{get:n,set:function(n,r,o){t[n]={value:r,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==n(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:n,client_secret:r,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(n){var r="https://googleads.googleapis.com/v8"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(r,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){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,n){return i("GET",e,t,n)},post:function(e,t,n){return i("POST",e,t,n)}}}(t),r=n.get,o=n.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return r("/customers:listAccessibleCustomers",null,e)},get:r,post:o,search:function(e,t,n){return o("/customers/"+e+"/googleAds:search",t,n)},searchStream:function(e,t,n){return o("/customers/"+e+"/googleAds:searchStream",t,n)},mutate:function(e,t,n){return o("/customers/"+e+"/googleAds:mutate",t,n)},mutateCampaigns:function(e,t,n){return o("/customers/"+e+"/campaigns:mutate",t,n)},mutateCustomAudiences:function(e,t,n){return o("/customers/"+e+"/customAudiences:mutate",t,n)}}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("node-fetch"),require("querystring")):"function"==typeof define&&define.amd?define(["node-fetch","querystring"],t):(e=e||self).googleads=t(e.nodeFetch,e.querystring)}(this,function(e,t){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(r){void 0===r&&(r={});var n=function(r){var n=r.clientId,o=r.clientSecret,u=r.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t.indexOf(r=u[n])>=0||(o[r]=e[r]);return o}(r,["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),c=function(r,c,a,f){try{return void 0===f&&(f=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:n,client_secret:o,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)}}(f)).then(function(n){var o="https://googleads.googleapis.com/v8"+(c.startsWith("/")?"":"/")+c;return o="GET"===r&&a?o+"?"+t.stringify(a):o,Promise.resolve(e(o,{method:r,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n,"Developer-Token":u},body:a&&"GET"!==r?JSON.stringify(a):null})).then(function(e){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 c("GET",e,t,r)},post:function(e,t,r){return c("POST",e,t,r)}}}(r),o=n.get,u=n.post;return{suggestGeoTargetConstants:function(e,t){return u("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return o("/customers:listAccessibleCustomers",null,e)},get:o,post:u,mutateBatchJob:function(e,t,r){return u("/customers/"+e+"/batchJobs:mutate",t,r)},listResults:function(e,t,r){return o(e+":listResults",t,r)},addOperations:function(e,t,r){return u(e+":addOperations",t,r)},runBatchJob:function(e,t){return u(e+":run",null,t)},search:function(e,t,r){return u("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return u("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return u("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return u("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return u("/customers/"+e+"/customAudiences:mutate",t,r)}}}}); | ||
//# sourceMappingURL=googleads.umd.js.map |
{ | ||
"name": "@honkandgo/googleads", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"license": "MIT", | ||
@@ -19,3 +19,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"node-fetch": "^2.6.1" | ||
"node-fetch": "^2.6.1", | ||
"querystring": "^0.2.1" | ||
}, | ||
@@ -22,0 +23,0 @@ "devDependencies": { |
import fetch from 'node-fetch' | ||
import { makePool } from './pool' | ||
import { stringify } from 'querystring' | ||
@@ -29,5 +30,6 @@ export const makeApi = ({ clientId, clientSecret, developerToken, ...options }) => { | ||
const accessToken = await getCachedAccessToken(refreshToken) | ||
const url = `https://googleads.googleapis.com/v8${ | ||
let url = `https://googleads.googleapis.com/v8${ | ||
endpoint.startsWith('/') ? '' : '/' | ||
}${endpoint}` | ||
url = (method === 'GET' && params) ? url + '?' + stringify(params) : url | ||
const res = await fetch(url, { | ||
@@ -40,3 +42,3 @@ method, | ||
}, | ||
body: params ? JSON.stringify(params) : null | ||
body: (params && method !== 'GET') ? JSON.stringify(params) : null | ||
}) | ||
@@ -43,0 +45,0 @@ /* |
@@ -26,2 +26,19 @@ import { makeApi } from './api' | ||
const mutateBatchJob = (customerId, params, refreshToken) => { | ||
return post(`/customers/${customerId}/batchJobs:mutate`, params, refreshToken) | ||
} | ||
const addOperations = (batchJob, params, refreshToken) => { | ||
return post(`${batchJob}:addOperations`, params, refreshToken) | ||
} | ||
const runBatchJob = (batchJob, refreshToken) => { | ||
return post(`${batchJob}:run`, null, refreshToken) | ||
} | ||
const listResults = (batchJob, params, refreshToken) => { | ||
return get(`${batchJob}:listResults`, params, refreshToken) | ||
} | ||
const mutateCampaigns = (customerId, params, refreshToken) => { | ||
@@ -40,2 +57,6 @@ return post(`/customers/${customerId}/campaigns:mutate`, params, refreshToken) | ||
post, | ||
mutateBatchJob, | ||
listResults, | ||
addOperations, | ||
runBatchJob, | ||
search, | ||
@@ -42,0 +63,0 @@ searchStream, |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
47274
175
2
3
+ Addedquerystring@^0.2.1
+ Addedquerystring@0.2.1(transitive)