dfp-lib
Version:
This project hosts the Node.JS client library for the SOAP-based DFP API at Google.
206 lines (205 loc) • 10.6 kB
JavaScript
;
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 contentBundle_1 = require("../soap/contentBundle");
const updateResult_1 = require("../soap/updateResult");
const contentBundleAction_1 = require("../soap/contentBundleAction");
const statement_1 = require("../soap/statement");
const contentBundlePage_1 = require("../soap/contentBundlePage");
const dfpService_1 = require("../lib/dfpService");
const objectValue_1 = require("../soap/objectValue");
const activateContentBundles_1 = require("../soap/activateContentBundles");
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 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 deactivateContentBundles_1 = require("../soap/deactivateContentBundles");
const excludeContentFromContentBundle_1 = require("../soap/excludeContentFromContentBundle");
const featureError_1 = require("../soap/featureError");
const includeContentInContentBundle_1 = require("../soap/includeContentInContentBundle");
const internalApiError_1 = require("../soap/internalApiError");
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 placementError_1 = require("../soap/placementError");
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 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 stringValueMapEntry_1 = require("../soap/stringValueMapEntry");
const textValue_1 = require("../soap/textValue");
const uniqueError_1 = require("../soap/uniqueError");
const value_1 = require("../soap/value");
class UpdateContentBundlesResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
UpdateContentBundlesResponse.XSI_TYPE = "";
class UpdateContentBundles extends xmlElement_1.XMLElement {
constructor(contentBundles = null) {
super();
this.contentBundles = contentBundles;
}
}
UpdateContentBundles.XSI_TYPE = "";
class PerformContentBundleActionResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
PerformContentBundleActionResponse.XSI_TYPE = "";
class PerformContentBundleAction extends xmlElement_1.XMLElement {
constructor(contentBundleAction = null, filterStatement = null) {
super();
this.contentBundleAction = contentBundleAction;
this.filterStatement = filterStatement;
}
}
PerformContentBundleAction.XSI_TYPE = "";
class GetContentBundlesByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetContentBundlesByStatementResponse.XSI_TYPE = "";
class GetContentBundlesByStatement extends xmlElement_1.XMLElement {
constructor(filterStatement = null) {
super();
this.filterStatement = filterStatement;
}
}
GetContentBundlesByStatement.XSI_TYPE = "";
class CreateContentBundlesResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
CreateContentBundlesResponse.XSI_TYPE = "";
class CreateContentBundles extends xmlElement_1.XMLElement {
constructor(contentBundles = null) {
super();
this.contentBundles = contentBundles;
}
}
CreateContentBundles.XSI_TYPE = "";
class ContentBundleService extends dfpService_1.DfpService {
constructor(user, options = {}) {
options['classmap'] = ContentBundleService.CLASS_MAP;
super(ContentBundleService.SERVICE_NAME, user, ContentBundleService.ENDPOINT, options);
}
createContentBundles(contentBundles) {
return __awaiter(this, void 0, void 0, function* () {
const args = new CreateContentBundles(contentBundles);
const result = (yield this.client.__soapCall("createContentBundles", args)).createContentBundlesResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
getContentBundlesByStatement(filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetContentBundlesByStatement(filterStatement);
const result = (yield this.client.__soapCall("getContentBundlesByStatement", args)).getContentBundlesByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
performContentBundleAction(contentBundleAction, filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new PerformContentBundleAction(contentBundleAction, filterStatement);
const result = (yield this.client.__soapCall("performContentBundleAction", args)).performContentBundleActionResponse;
return result.rval;
});
}
updateContentBundles(contentBundles) {
return __awaiter(this, void 0, void 0, function* () {
const args = new UpdateContentBundles(contentBundles);
const result = (yield this.client.__soapCall("updateContentBundles", args)).updateContentBundlesResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
}
ContentBundleService.SERVICE_NAME = "ContentBundleService";
ContentBundleService.ENDPOINT = "https://ads.google.com/apis/ads/publisher/v201611/ContentBundleService";
ContentBundleService.CLASS_MAP = {
"ObjectValue": objectValue_1.ObjectValue,
"ActivateContentBundles": activateContentBundles_1.ActivateContentBundles,
"ApiError": apiError_1.ApiError,
"ApiException": apiException_1.ApiException,
"ApiVersionError": apiVersionError_1.ApiVersionError,
"ApplicationException": applicationException_1.ApplicationException,
"AuthenticationError": authenticationError_1.AuthenticationError,
"BooleanValue": booleanValue_1.BooleanValue,
"CollectionSizeError": collectionSizeError_1.CollectionSizeError,
"CommonError": commonError_1.CommonError,
"ContentBundleAction": contentBundleAction_1.ContentBundleAction,
"ContentBundle": contentBundle_1.ContentBundle,
"ContentBundlePage": contentBundlePage_1.ContentBundlePage,
"Date": dfpDate_1.DfpDate,
"DateTime": dfpDateTime_1.DfpDateTime,
"DateTimeValue": dateTimeValue_1.DateTimeValue,
"DateValue": dateValue_1.DateValue,
"DeactivateContentBundles": deactivateContentBundles_1.DeactivateContentBundles,
"ExcludeContentFromContentBundle": excludeContentFromContentBundle_1.ExcludeContentFromContentBundle,
"FeatureError": featureError_1.FeatureError,
"IncludeContentInContentBundle": includeContentInContentBundle_1.IncludeContentInContentBundle,
"InternalApiError": internalApiError_1.InternalApiError,
"NotNullError": notNullError_1.NotNullError,
"NumberValue": numberValue_1.NumberValue,
"ParseError": parseError_1.ParseError,
"PermissionError": permissionError_1.PermissionError,
"PlacementError": placementError_1.PlacementError,
"PublisherQueryLanguageContextError": publisherQueryLanguageContextError_1.PublisherQueryLanguageContextError,
"PublisherQueryLanguageSyntaxError": publisherQueryLanguageSyntaxError_1.PublisherQueryLanguageSyntaxError,
"QuotaError": quotaError_1.QuotaError,
"RequiredCollectionError": requiredCollectionError_1.RequiredCollectionError,
"RequiredError": requiredError_1.RequiredError,
"ServerError": serverError_1.ServerError,
"SetValue": setValue_1.SetValue,
"SoapRequestHeader": soapRequestHeader_1.SoapRequestHeader,
"SoapResponseHeader": soapResponseHeader_1.SoapResponseHeader,
"Statement": statement_1.Statement,
"StatementError": statementError_1.StatementError,
"String_ValueMapEntry": stringValueMapEntry_1.StringValueMapEntry,
"TextValue": textValue_1.TextValue,
"UniqueError": uniqueError_1.UniqueError,
"UpdateResult": updateResult_1.UpdateResult,
"Value": value_1.Value,
"createContentBundles": CreateContentBundles,
"createContentBundlesResponse": CreateContentBundlesResponse,
"getContentBundlesByStatement": GetContentBundlesByStatement,
"getContentBundlesByStatementResponse": GetContentBundlesByStatementResponse,
"performContentBundleAction": PerformContentBundleAction,
"performContentBundleActionResponse": PerformContentBundleActionResponse,
"updateContentBundles": UpdateContentBundles,
"updateContentBundlesResponse": UpdateContentBundlesResponse,
};
exports.ContentBundleService = ContentBundleService;