
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@mediamath/terminalone
Advanced tools
Node implementation of a T1 API Library. Uses Bluebird for fast, simple callback handling via promises.
npm install terminalone
Checkout, then npm install .
For cookie authentication:
var t1 = require('terminalone');
var config = {
'user': t1_username,
'password': t1_user_password,
'api_key': application_mashery_key
};
var connection = new t1.T1Connection(config);
For oauth2 authentication, your web application will need to redirect to the T1 user authentication page during the process. The approach is outlined below:
var t1 = require('terminalone');
//the callback URL should match the one you specified in the developer portal for your application
var config = {
'api_key': application_mashery_key,
'client_secret': application_mashery_secret,
'redirect_uri': application_callback_url
}
var connection = new t1.T1Connection(config);
// tokenUpdatedCallback is an optional callback to a function, taking
// a single argument which describes an access token.
// This can be used update your token databse on automatic token refresh.
var authorizationUrl = connection.fetchAuthUrl(tokenUpdatedCallback);
// Redirect example using Express (see http://expressjs.com/api.html#res.redirect)
res.redirect(authorizationUri);
var code = // Get the access token object (the authorization code is given from the previous step).
connection.getToken(code)
.then(console.log('oauth complete'));
Retrieve, edit and save a single entity
var agencyPromise = new t1.Entity('agency')
.get(1234, connection)
.then(function(agency) {this.agency = agency});
agency.name = 'new name';
agency.save(connection).done(console.log('saved'));
Returns a generator to entities
var userParams = {
'page_limit':10
};
t1.EntityList.get('campaigns', connection, userParams).then(function(list) {this.pg1 = list});
t1.EntityList.getNextPage(pg1, connection).then(function(list) {this.pg2 = list});
for (var entity of pg1.entities) {console.log(entity)}
It's possible to include related entities by including in a 'with' property in userParams.
var userParams = {
'page_limit':10
'with':['strategies']
};
t1.EntityList.get('campaigns', connection, userParams).then(function(list) {this.pg1 = list});
t1.EntityList.getNextPage(pg1, connection).then(function(list) {this.pg2 = list});
for (var entity of pg1.entities) {console.log(entity)}
To get a strategy's targeting segments:
var targetingSegmentsPromise = new t1.StrategyTargetSegments()
.get(strategyId, connection)
.then(function(targetingSegments) {this.targetingSegments = targetingSegments});
To edit strategy targeting segments:
targetingSegments.include = [[1, 'OR']];
targetingSegments.exclude = [[119, 'OR']];
targetingSegments.include_op = 'OR';
targetingSegments.exclude_op = 'OR';
targetingSegments.save(connection).done(console.log('saved'));
To get a strategy's targeting values:
var targetValuesPromise = new t1.StrategyTargetValues()
.get(strategyId, connection)
.then(function(targetValues) {this.targetValues = targetValues});
To edit strategy targeting segments:
targetValues.include = [[1, 'OR']];
targetValues.addTargetValues('REGN', 'INCLUDE', 'OR', [23, 251]);
targetValues.save(connection).done(console.log('saved'));
=======
To get a strategy's audience segments:
var audienceSegmentsPromise = new t1.StrategyAudienceegments()
.get(strategyId, connection)
.then(function(audienceSegments) {this.targetingSegments = targetingSegments});
To edit strategy audience segments:
audienceSegments.include = [1405158];
audienceSegments.exclude = [1405158];
targetingSegments.include_op = 'OR';
targetingSegments.exclude_op = 'OR';
targetingSegments.save(connection).done(console.log('saved'));
FAQs
Connection Module for T1 API written in node.js
The npm package @mediamath/terminalone receives a total of 22 weekly downloads. As such, @mediamath/terminalone popularity was classified as not popular.
We found that @mediamath/terminalone demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.