dfp-lib
Version:
This project hosts the Node.JS client library for the SOAP-based DFP API at Google.
156 lines (155 loc) • 8.39 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 xmlElement_1 = require("../../common/soap/xmlElement");
const contentPage_1 = require("../soap/contentPage");
const statement_1 = require("../soap/statement");
const dfpService_1 = require("../lib/dfpService");
const objectValue_1 = require("../soap/objectValue");
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 authenticationError_1 = require("../soap/authenticationError");
const booleanValue_1 = require("../soap/booleanValue");
const cmsContent_1 = require("../soap/cmsContent");
const collectionSizeError_1 = require("../soap/collectionSizeError");
const commonError_1 = require("../soap/commonError");
const content_1 = require("../soap/content");
const contentPartnerError_1 = require("../soap/contentPartnerError");
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 featureError_1 = require("../soap/featureError");
const internalApiError_1 = require("../soap/internalApiError");
const invalidUrlError_1 = require("../soap/invalidUrlError");
const notNullError_1 = require("../soap/notNullError");
const numberValue_1 = require("../soap/numberValue");
const parseError_1 = require("../soap/parseError");
const permissionError_1 = require("../soap/permissionError");
const publisherQueryLanguageContextError_1 = require("../soap/publisherQueryLanguageContextError");
const publisherQueryLanguageSyntaxError_1 = require("../soap/publisherQueryLanguageSyntaxError");
const quotaError_1 = require("../soap/quotaError");
const requiredCollectionError_1 = require("../soap/requiredCollectionError");
const requiredError_1 = require("../soap/requiredError");
const requiredNumberError_1 = require("../soap/requiredNumberError");
const serverError_1 = require("../soap/serverError");
const setValue_1 = require("../soap/setValue");
const soapRequestHeader_1 = require("../../common/soap/soapRequestHeader");
const soapResponseHeader_1 = require("../../common/soap/soapResponseHeader");
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 value_1 = require("../soap/value");
class GetContentByStatementAndCustomTargetingValueResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetContentByStatementAndCustomTargetingValueResponse.XSI_TYPE = "";
class GetContentByStatementAndCustomTargetingValue extends xmlElement_1.XMLElement {
constructor(filterStatement = null, customTargetingValueId = null) {
super();
this.filterStatement = filterStatement;
this.customTargetingValueId = customTargetingValueId;
}
}
GetContentByStatementAndCustomTargetingValue.XSI_TYPE = "";
class GetContentByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetContentByStatementResponse.XSI_TYPE = "";
class GetContentByStatement extends xmlElement_1.XMLElement {
constructor(statement = null) {
super();
this.statement = statement;
}
}
GetContentByStatement.XSI_TYPE = "";
class ContentService extends dfpService_1.DfpService {
constructor(user, options = {}) {
options['classmap'] = ContentService.CLASS_MAP;
super(ContentService.SERVICE_NAME, user, ContentService.ENDPOINT, options);
}
getContentByStatement(statement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetContentByStatement(statement);
const result = (yield this.client.__soapCall("getContentByStatement", args)).getContentByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
getContentByStatementAndCustomTargetingValue(filterStatement, customTargetingValueId) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetContentByStatementAndCustomTargetingValue(filterStatement, customTargetingValueId);
const result = (yield this.client.__soapCall("getContentByStatementAndCustomTargetingValue", args)).getContentByStatementAndCustomTargetingValueResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
}
ContentService.SERVICE_NAME = "ContentService";
ContentService.ENDPOINT = "https://ads.google.com/apis/ads/publisher/v201611/ContentService";
ContentService.CLASS_MAP = {
"ObjectValue": objectValue_1.ObjectValue,
"ApiError": apiError_1.ApiError,
"ApiException": apiException_1.ApiException,
"ApiVersionError": apiVersionError_1.ApiVersionError,
"ApplicationException": applicationException_1.ApplicationException,
"AuthenticationError": authenticationError_1.AuthenticationError,
"BooleanValue": booleanValue_1.BooleanValue,
"CmsContent": cmsContent_1.CmsContent,
"CollectionSizeError": collectionSizeError_1.CollectionSizeError,
"CommonError": commonError_1.CommonError,
"Content": content_1.Content,
"ContentPage": contentPage_1.ContentPage,
"ContentPartnerError": contentPartnerError_1.ContentPartnerError,
"Date": dfpDate_1.DfpDate,
"DateTime": dfpDateTime_1.DfpDateTime,
"DateTimeValue": dateTimeValue_1.DateTimeValue,
"DateValue": dateValue_1.DateValue,
"FeatureError": featureError_1.FeatureError,
"InternalApiError": internalApiError_1.InternalApiError,
"InvalidUrlError": invalidUrlError_1.InvalidUrlError,
"NotNullError": notNullError_1.NotNullError,
"NumberValue": numberValue_1.NumberValue,
"ParseError": parseError_1.ParseError,
"PermissionError": permissionError_1.PermissionError,
"PublisherQueryLanguageContextError": publisherQueryLanguageContextError_1.PublisherQueryLanguageContextError,
"PublisherQueryLanguageSyntaxError": publisherQueryLanguageSyntaxError_1.PublisherQueryLanguageSyntaxError,
"QuotaError": quotaError_1.QuotaError,
"RequiredCollectionError": requiredCollectionError_1.RequiredCollectionError,
"RequiredError": requiredError_1.RequiredError,
"RequiredNumberError": requiredNumberError_1.RequiredNumberError,
"ServerError": serverError_1.ServerError,
"SetValue": setValue_1.SetValue,
"SoapRequestHeader": soapRequestHeader_1.SoapRequestHeader,
"SoapResponseHeader": soapResponseHeader_1.SoapResponseHeader,
"Statement": statement_1.Statement,
"StatementError": statementError_1.StatementError,
"StringLengthError": stringLengthError_1.StringLengthError,
"String_ValueMapEntry": stringValueMapEntry_1.StringValueMapEntry,
"TextValue": textValue_1.TextValue,
"TypeError": typeError_1.TypeError,
"Value": value_1.Value,
"getContentByStatement": GetContentByStatement,
"getContentByStatementResponse": GetContentByStatementResponse,
"getContentByStatementAndCustomTargetingValue": GetContentByStatementAndCustomTargetingValue,
"getContentByStatementAndCustomTargetingValueResponse": GetContentByStatementAndCustomTargetingValueResponse,
};
exports.ContentService = ContentService;