dfp-lib
Version:
This project hosts the Node.JS client library for the SOAP-based DFP API at Google.
220 lines (219 loc) • 10.9 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
const dfpService_1 = require("../lib/dfpService");
const xmlElement_1 = require("../../common/soap/xmlElement");
const objectValue_1 = require("../soap/objectValue");
const activatePlacements_1 = require("../soap/activatePlacements");
const apiError_1 = require("../soap/apiError");
const apiException_1 = require("../soap/apiException");
const apiVersionError_1 = require("../soap/apiVersionError");
const applicationException_1 = require("../soap/applicationException");
const archivePlacements_1 = require("../soap/archivePlacements");
const authenticationError_1 = require("../soap/authenticationError");
const booleanValue_1 = require("../soap/booleanValue");
const collectionSizeError_1 = require("../soap/collectionSizeError");
const commonError_1 = require("../soap/commonError");
const dfpDate_1 = require("../soap/dfpDate");
const dfpDateTime_1 = require("../soap/dfpDateTime");
const dateTimeValue_1 = require("../soap/dateTimeValue");
const dateValue_1 = require("../soap/dateValue");
const deactivatePlacements_1 = require("../soap/deactivatePlacements");
const entityChildrenLimitReachedError_1 = require("../soap/entityChildrenLimitReachedError");
const entityLimitReachedError_1 = require("../soap/entityLimitReachedError");
const featureError_1 = require("../soap/featureError");
const internalApiError_1 = require("../soap/internalApiError");
const notNullError_1 = require("../soap/notNullError");
const nullError_1 = require("../soap/nullError");
const numberValue_1 = require("../soap/numberValue");
const parseError_1 = require("../soap/parseError");
const permissionError_1 = require("../soap/permissionError");
const placementAction_1 = require("../soap/placementAction");
const placement_1 = require("../soap/placement");
const placementError_1 = require("../soap/placementError");
const placementPage_1 = require("../soap/placementPage");
const publisherQueryLanguageContextError_1 = require("../soap/publisherQueryLanguageContextError");
const publisherQueryLanguageSyntaxError_1 = require("../soap/publisherQueryLanguageSyntaxError");
const quotaError_1 = require("../soap/quotaError");
const rangeError_1 = require("../soap/rangeError");
const regExError_1 = require("../soap/regExError");
const requiredCollectionError_1 = require("../soap/requiredCollectionError");
const requiredError_1 = require("../soap/requiredError");
const serverError_1 = require("../soap/serverError");
const setValue_1 = require("../soap/setValue");
const siteTargetingInfo_1 = require("../soap/siteTargetingInfo");
const soapRequestHeader_1 = require("../../common/soap/soapRequestHeader");
const soapResponseHeader_1 = require("../../common/soap/soapResponseHeader");
const statement_1 = require("../soap/statement");
const statementError_1 = require("../soap/statementError");
const stringLengthError_1 = require("../soap/stringLengthError");
const stringValueMapEntry_1 = require("../soap/stringValueMapEntry");
const textValue_1 = require("../soap/textValue");
const typeError_1 = require("../soap/typeError");
const uniqueError_1 = require("../soap/uniqueError");
const updateResult_1 = require("../soap/updateResult");
const value_1 = require("../soap/value");
class CreatePlacements extends xmlElement_1.XMLElement {
constructor(placements = null) {
super();
this.placements = placements;
}
}
CreatePlacements.XSI_TYPE = "";
class CreatePlacementsResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
CreatePlacementsResponse.XSI_TYPE = "";
class GetPlacementsByStatement extends xmlElement_1.XMLElement {
constructor(filterStatement = null) {
super();
this.filterStatement = filterStatement;
}
}
GetPlacementsByStatement.XSI_TYPE = "";
class GetPlacementsByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetPlacementsByStatementResponse.XSI_TYPE = "";
class PerformPlacementAction extends xmlElement_1.XMLElement {
constructor(placementAction = null, filterStatement = null) {
super();
this.placementAction = placementAction;
this.filterStatement = filterStatement;
}
}
PerformPlacementAction.XSI_TYPE = "";
class PerformPlacementActionResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
PerformPlacementActionResponse.XSI_TYPE = "";
class UpdatePlacements extends xmlElement_1.XMLElement {
constructor(placements = null) {
super();
this.placements = placements;
}
}
UpdatePlacements.XSI_TYPE = "";
class UpdatePlacementsResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
UpdatePlacementsResponse.XSI_TYPE = "";
class PlacementService extends dfpService_1.DfpService {
constructor(user, options = {}) {
options['classmap'] = PlacementService.CLASS_MAP;
super(PlacementService.SERVICE_NAME, user, PlacementService.ENDPOINT, options);
}
createPlacements(placements) {
return __awaiter(this, void 0, void 0, function* () {
const args = new CreatePlacements(placements);
const result = (yield this.client.__soapCall("createPlacements", args)).createPlacementsResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
getPlacementsByStatement(filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetPlacementsByStatement(filterStatement);
const result = (yield this.client.__soapCall("getPlacementsByStatement", args)).getPlacementsByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
performPlacementAction(placementAction, filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new PerformPlacementAction(placementAction, filterStatement);
const result = (yield this.client.__soapCall("performPlacementAction", args)).performPlacementActionResponse;
return result.rval;
});
}
updatePlacements(placements) {
return __awaiter(this, void 0, void 0, function* () {
const args = new UpdatePlacements(placements);
const result = (yield this.client.__soapCall("updatePlacements", args)).updatePlacementsResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
}
PlacementService.SERVICE_NAME = "PlacementService";
PlacementService.ENDPOINT = "https://ads.google.com/apis/ads/publisher/v201611/PlacementService";
PlacementService.CLASS_MAP = {
"ObjectValue": objectValue_1.ObjectValue,
"ActivatePlacements": activatePlacements_1.ActivatePlacements,
"ApiError": apiError_1.ApiError,
"ApiException": apiException_1.ApiException,
"ApiVersionError": apiVersionError_1.ApiVersionError,
"ApplicationException": applicationException_1.ApplicationException,
"ArchivePlacements": archivePlacements_1.ArchivePlacements,
"AuthenticationError": authenticationError_1.AuthenticationError,
"BooleanValue": booleanValue_1.BooleanValue,
"CollectionSizeError": collectionSizeError_1.CollectionSizeError,
"CommonError": commonError_1.CommonError,
"Date": dfpDate_1.DfpDate,
"DateTime": dfpDateTime_1.DfpDateTime,
"DateTimeValue": dateTimeValue_1.DateTimeValue,
"DateValue": dateValue_1.DateValue,
"DeactivatePlacements": deactivatePlacements_1.DeactivatePlacements,
"EntityChildrenLimitReachedError": entityChildrenLimitReachedError_1.EntityChildrenLimitReachedError,
"EntityLimitReachedError": entityLimitReachedError_1.EntityLimitReachedError,
"FeatureError": featureError_1.FeatureError,
"InternalApiError": internalApiError_1.InternalApiError,
"NotNullError": notNullError_1.NotNullError,
"NullError": nullError_1.NullError,
"NumberValue": numberValue_1.NumberValue,
"ParseError": parseError_1.ParseError,
"PermissionError": permissionError_1.PermissionError,
"PlacementAction": placementAction_1.PlacementAction,
"Placement": placement_1.Placement,
"PlacementError": placementError_1.PlacementError,
"PlacementPage": placementPage_1.PlacementPage,
"PublisherQueryLanguageContextError": publisherQueryLanguageContextError_1.PublisherQueryLanguageContextError,
"PublisherQueryLanguageSyntaxError": publisherQueryLanguageSyntaxError_1.PublisherQueryLanguageSyntaxError,
"QuotaError": quotaError_1.QuotaError,
"RangeError": rangeError_1.RangeError,
"RegExError": regExError_1.RegExError,
"RequiredCollectionError": requiredCollectionError_1.RequiredCollectionError,
"RequiredError": requiredError_1.RequiredError,
"ServerError": serverError_1.ServerError,
"SetValue": setValue_1.SetValue,
"SiteTargetingInfo": siteTargetingInfo_1.SiteTargetingInfo,
"SoapRequestHeader": soapRequestHeader_1.SoapRequestHeader,
"SoapResponseHeader": soapResponseHeader_1.SoapResponseHeader,
"Statement": statement_1.Statement,
"StatementError": statementError_1.StatementError,
"StringLengthError": stringLengthError_1.StringLengthError,
"StringValueMapEntry": stringValueMapEntry_1.StringValueMapEntry,
"TextValue": textValue_1.TextValue,
"TypeError": typeError_1.TypeError,
"UniqueError": uniqueError_1.UniqueError,
"UpdateResult": updateResult_1.UpdateResult,
"Value": value_1.Value,
"createPlacements": CreatePlacements,
"createPlacementsResponse": CreatePlacementsResponse,
"getPlacementsByStatement": GetPlacementsByStatement,
"getPlacementsByStatementResponse": GetPlacementsByStatementResponse,
"performPlacementAction": PerformPlacementAction,
"performPlacementActionResponse": PerformPlacementActionResponse,
"updatePlacements": UpdatePlacements,
"updatePlacementsResponse": UpdatePlacementsResponse
};
exports.PlacementService = PlacementService;