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

node-snapchat-marketing

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-snapchat-marketing - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

52

index.js

@@ -15,4 +15,5 @@ const fetch = require("node-fetch")

me: "https://adsapi.snapchat.com/v1/me",
mediaBase: "https://adsapi.snapchat.com/v1/adaccounts",
organizations: "https://adsapi.snapchat.com/v1/me/organizations",
specificOrganization: "https://adsapi.snapchat.com/v1/organizations"
specificOrganization: "https://adsapi.snapchat.com/v1/organizations",
},

@@ -43,3 +44,3 @@ httpOptions: {}

Snap.prototype.me = function()
Snap.prototype.me = function(callback)
{

@@ -59,2 +60,4 @@ this.httpOptions = {

// Organizations
// TODO - Add withAdAccounts option
Snap.prototype.getAllOrganizations = function(callback)

@@ -93,2 +96,42 @@ {

// Media
Snap.prototype.createMedia = function(options, callback)
{
if(typeof options === 'function')
throw new Error("Must pass in options")
this.httpOptions = {
method:'POST',
withCredentials:true,
credentials:'include',
headers : {
'Authorization': 'Bearer ' + this.options.accessToken,
'Content-Type': 'application/json'
},
body: JSON.stringify(options)
}
console.log(this.options.urls.mediaBase +`/${options.media[0].ad_account_id}/media`);
request(this.options.urls.mediaBase +`/${options.media[0].ad_account_id}/media`, this.httpOptions, callback)
}
Snap.prototype.getAllMedia = function(ad_account_id, callback)
{
if(typeof options === 'function')
throw new Error("Must pass in options")
this.httpOptions = {
method:'GET',
withCredentials:true,
credentials:'include',
headers : {
'Authorization': 'Bearer ' + this.options.accessToken,
'Content-Type': 'application/json'
}
}
request(this.options.urls.mediaBase +`/${ad_account_id}/media`, this.httpOptions, callback)
}
// Other
Snap.prototype.setAccessToken = function(accessToken)

@@ -102,3 +145,3 @@ {

fetch(url, options).then(res => res.json()).then(resData => {
if(resData.request_status === 'SUCCESS')
if(resData.access_token || resData.request_status === 'SUCCESS')
callback(null, resData)

@@ -108,4 +151,7 @@ else

})
.catch(err => {
callback(err, null)
})
}
module.exports = Snap

2

package.json
{
"name": "node-snapchat-marketing",
"version": "1.0.1",
"version": "1.0.2",
"description": "Nodejs client for unofficial Snapchat Marketing API",

@@ -5,0 +5,0 @@ "main": "index.js",

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