dfp-lib
Version:
This project hosts the Node.JS client library for the SOAP-based DFP API at Google.
351 lines (350 loc) • 19.7 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 proposal_1 = require("../soap/proposal");
const updateResult_1 = require("../soap/updateResult");
const proposalAction_1 = require("../soap/proposalAction");
const statement_1 = require("../soap/statement");
const proposalPage_1 = require("../soap/proposalPage");
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 appliedLabel_1 = require("../soap/appliedLabel");
const archiveProposals_1 = require("../soap/archiveProposals");
const authenticationError_1 = require("../soap/authenticationError");
const availableBillingError_1 = require("../soap/availableBillingError");
const baseCustomFieldValue_1 = require("../soap/baseCustomFieldValue");
const billingError_1 = require("../soap/billingError");
const booleanValue_1 = require("../soap/booleanValue");
const bypassProposalWorkflowRules_1 = require("../soap/bypassProposalWorkflowRules");
const cancelRetractionForProposals_1 = require("../soap/cancelRetractionForProposals");
const collectionSizeError_1 = require("../soap/collectionSizeError");
const commonError_1 = require("../soap/commonError");
const customFieldValue_1 = require("../soap/customFieldValue");
const customFieldValueError_1 = require("../soap/customFieldValueError");
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 dropDownCustomFieldValue_1 = require("../soap/dropDownCustomFieldValue");
const entityChildrenLimitReachedError_1 = require("../soap/entityChildrenLimitReachedError");
const entityLimitReachedError_1 = require("../soap/entityLimitReachedError");
const exchangeRateError_1 = require("../soap/exchangeRateError");
const featureError_1 = require("../soap/featureError");
const forecastError_1 = require("../soap/forecastError");
const internalApiError_1 = require("../soap/internalApiError");
const invalidUrlError_1 = require("../soap/invalidUrlError");
const labelEntityAssociationError_1 = require("../soap/labelEntityAssociationError");
const lineItemOperationError_1 = require("../soap/lineItemOperationError");
const money_1 = require("../soap/money");
const notNullError_1 = require("../soap/notNullError");
const nullError_1 = require("../soap/nullError");
const numberValue_1 = require("../soap/numberValue");
const packageActionError_1 = require("../soap/packageActionError");
const packageError_1 = require("../soap/packageError");
const parseError_1 = require("../soap/parseError");
const permissionError_1 = require("../soap/permissionError");
const precisionError_1 = require("../soap/precisionError");
const productError_1 = require("../soap/productError");
const proposalActionError_1 = require("../soap/proposalActionError");
const proposalLink_1 = require("../soap/proposalLink");
const proposalCompanyAssociation_1 = require("../soap/proposalCompanyAssociation");
const proposalError_1 = require("../soap/proposalError");
const proposalLineItemError_1 = require("../soap/proposalLineItemError");
const proposalTermsAndConditions_1 = require("../soap/proposalTermsAndConditions");
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 requiredCollectionError_1 = require("../soap/requiredCollectionError");
const requiredError_1 = require("../soap/requiredError");
const requiredNumberError_1 = require("../soap/requiredNumberError");
const retractProposals_1 = require("../soap/retractProposals");
const retractionDetails_1 = require("../soap/retractionDetails");
const requestApprovalProgressAction_1 = require("../soap/requestApprovalProgressAction");
const reserveInventoryProgressAction_1 = require("../soap/reserveInventoryProgressAction");
const salespersonSplit_1 = require("../soap/salespersonSplit");
const audienceSegmentError_1 = require("../soap/audienceSegmentError");
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 submitProposalsForApprovalBypassValidation_1 = require("../soap/submitProposalsForApprovalBypassValidation");
const submitProposalsForApproval_1 = require("../soap/submitProposalsForApproval");
const teamError_1 = require("../soap/teamError");
const textValue_1 = require("../soap/textValue");
const timeZoneError_1 = require("../soap/timeZoneError");
const typeError_1 = require("../soap/typeError");
const unarchiveProposals_1 = require("../soap/unarchiveProposals");
const uniqueError_1 = require("../soap/uniqueError");
const value_1 = require("../soap/value");
const workflowActionError_1 = require("../soap/workflowActionError");
const workflowValidationError_1 = require("../soap/workflowValidationError");
const offlineError_1 = require("../soap/offlineError");
const sendNotificationProgressAction_1 = require("../soap/sendNotificationProgressAction");
const submitProposalsForArchival_1 = require("../soap/submitProposalsForArchival");
const progressAction_1 = require("../soap/progressAction");
const progressStep_1 = require("../soap/progressStep");
const progressRule_1 = require("../soap/progressRule");
const workflowProgress_1 = require("../soap/workflowProgress");
const marketplaceCommentPage_1 = require("../soap/marketplaceCommentPage");
const dealError_1 = require("../soap/dealError");
const discardLocalVersionEdits_1 = require("../soap/discardLocalVersionEdits");
const editProposalsForNegotiation_1 = require("../soap/editProposalsForNegotiation");
const marketplaceComment_1 = require("../soap/marketplaceComment");
const proposalMarketplaceInfo_1 = require("../soap/proposalMarketplaceInfo");
const proposalLineItemProgrammaticError_1 = require("../soap/proposalLineItemProgrammaticError");
const requestBuyerAcceptance_1 = require("../soap/requestBuyerAcceptance");
const reserveProposals_1 = require("../soap/reserveProposals");
const syncProposalsWithMarketplace_1 = require("../soap/syncProposalsWithMarketplace");
const terminateNegotiations_1 = require("../soap/terminateNegotiations");
const updateOrderWithSellerData_1 = require("../soap/updateOrderWithSellerData");
class UpdateProposalsResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
UpdateProposalsResponse.XSI_TYPE = "";
class UpdateProposals extends xmlElement_1.XMLElement {
constructor(proposals = null) {
super();
this.proposals = proposals;
}
}
UpdateProposals.XSI_TYPE = "";
class PerformProposalActionResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
PerformProposalActionResponse.XSI_TYPE = "";
class PerformProposalAction extends xmlElement_1.XMLElement {
constructor(proposalAction = null, filterStatement = null) {
super();
this.proposalAction = proposalAction;
this.filterStatement = filterStatement;
}
}
PerformProposalAction.XSI_TYPE = "";
class GetProposalsByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetProposalsByStatementResponse.XSI_TYPE = "";
class GetProposalsByStatement extends xmlElement_1.XMLElement {
constructor(filterStatement = null) {
super();
this.filterStatement = filterStatement;
}
}
GetProposalsByStatement.XSI_TYPE = "";
class CreateProposalsResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
CreateProposalsResponse.XSI_TYPE = "";
class CreateProposals extends xmlElement_1.XMLElement {
constructor(proposals = null) {
super();
this.proposals = proposals;
}
}
CreateProposals.XSI_TYPE = "";
class GetMarketplaceCommentsByStatement extends xmlElement_1.XMLElement {
constructor(filterStatement = null) {
super();
this.filterStatement = filterStatement;
}
}
GetMarketplaceCommentsByStatement.XSI_TYPE = "";
class GetMarketplaceCommentsByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetMarketplaceCommentsByStatementResponse.XSI_TYPE = "";
class ProposalService extends dfpService_1.DfpService {
constructor(user, options = {}) {
options['classmap'] = ProposalService.CLASS_MAP;
super(ProposalService.SERVICE_NAME, user, ProposalService.ENDPOINT, options);
}
createProposals(proposals) {
return __awaiter(this, void 0, void 0, function* () {
const args = new CreateProposals(proposals);
const result = (yield this.client.__soapCall("createProposals", args)).createProposalsResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
getMarketplaceCommentsByStatement(filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetMarketplaceCommentsByStatement(filterStatement);
const result = (yield this.client.__soapCall("getMarketplaceCommentsByStatement", args)).getMarketplaceCommentsByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
getProposalsByStatement(filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetProposalsByStatement(filterStatement);
const result = (yield this.client.__soapCall("getProposalsByStatement", args)).getProposalsByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
performProposalAction(proposalAction, filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new PerformProposalAction(proposalAction, filterStatement);
const result = (yield this.client.__soapCall("performProposalAction", args)).performProposalActionResponse;
return result.rval;
});
}
updateProposals(proposals) {
return __awaiter(this, void 0, void 0, function* () {
const args = new UpdateProposals(proposals);
const result = (yield this.client.__soapCall("updateProposals", args)).updateProposalsResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
}
ProposalService.SERVICE_NAME = "ProposalService";
ProposalService.ENDPOINT = "https://ads.google.com/apis/ads/publisher/v201611/ProposalService";
ProposalService.CLASS_MAP = {
"ObjectValue": objectValue_1.ObjectValue,
"ApiError": apiError_1.ApiError,
"ApiException": apiException_1.ApiException,
"ApiVersionError": apiVersionError_1.ApiVersionError,
"ApplicationException": applicationException_1.ApplicationException,
"AppliedLabel": appliedLabel_1.AppliedLabel,
"ArchiveProposals": archiveProposals_1.ArchiveProposals,
"AuthenticationError": authenticationError_1.AuthenticationError,
"AvailableBillingError": availableBillingError_1.AvailableBillingError,
"BaseCustomFieldValue": baseCustomFieldValue_1.BaseCustomFieldValue,
"BillingError": billingError_1.BillingError,
"BooleanValue": booleanValue_1.BooleanValue,
"BypassProposalWorkflowRules": bypassProposalWorkflowRules_1.BypassProposalWorkflowRules,
"CancelRetractionForProposals": cancelRetractionForProposals_1.CancelRetractionForProposals,
"CollectionSizeError": collectionSizeError_1.CollectionSizeError,
"CommonError": commonError_1.CommonError,
"CustomFieldValue": customFieldValue_1.CustomFieldValue,
"CustomFieldValueError": customFieldValueError_1.CustomFieldValueError,
"Date": dfpDate_1.DfpDate,
"DateTime": dfpDateTime_1.DfpDateTime,
"DateTimeValue": dateTimeValue_1.DateTimeValue,
"DateValue": dateValue_1.DateValue,
"DealError": dealError_1.DealError,
"DiscardLocalVersionEdits": discardLocalVersionEdits_1.DiscardLocalVersionEdits,
"DropDownCustomFieldValue": dropDownCustomFieldValue_1.DropDownCustomFieldValue,
"EditProposalsForNegotiation": editProposalsForNegotiation_1.EditProposalsForNegotiation,
"EntityChildrenLimitReachedError": entityChildrenLimitReachedError_1.EntityChildrenLimitReachedError,
"EntityLimitReachedError": entityLimitReachedError_1.EntityLimitReachedError,
"ExchangeRateError": exchangeRateError_1.ExchangeRateError,
"FeatureError": featureError_1.FeatureError,
"ForecastError": forecastError_1.ForecastError,
"InternalApiError": internalApiError_1.InternalApiError,
"InvalidUrlError": invalidUrlError_1.InvalidUrlError,
"LabelEntityAssociationError": labelEntityAssociationError_1.LabelEntityAssociationError,
"LineItemOperationError": lineItemOperationError_1.LineItemOperationError,
"MarketplaceComment": marketplaceComment_1.MarketplaceComment,
"MarketplaceCommentPage": marketplaceCommentPage_1.MarketplaceCommentPage,
"ProposalMarketplaceInfo": proposalMarketplaceInfo_1.ProposalMarketplaceInfo,
"Money": money_1.Money,
"NotNullError": notNullError_1.NotNullError,
"NullError": nullError_1.NullError,
"NumberValue": numberValue_1.NumberValue,
"OfflineError": offlineError_1.OfflineError,
"PackageActionError": packageActionError_1.PackageActionError,
"PackageError": packageError_1.PackageError,
"ParseError": parseError_1.ParseError,
"PermissionError": permissionError_1.PermissionError,
"PrecisionError": precisionError_1.PrecisionError,
"ProductError": productError_1.ProductError,
"ProposalAction": proposalAction_1.ProposalAction,
"ProposalActionError": proposalActionError_1.ProposalActionError,
"ProposalLink": proposalLink_1.ProposalLink,
"ProposalCompanyAssociation": proposalCompanyAssociation_1.ProposalCompanyAssociation,
"Proposal": proposal_1.Proposal,
"ProposalError": proposalError_1.ProposalError,
"ProposalLineItemError": proposalLineItemError_1.ProposalLineItemError,
"ProposalLineItemProgrammaticError": proposalLineItemProgrammaticError_1.ProposalLineItemProgrammaticError,
"ProposalPage": proposalPage_1.ProposalPage,
"ProposalTermsAndConditions": proposalTermsAndConditions_1.ProposalTermsAndConditions,
"PublisherQueryLanguageContextError": publisherQueryLanguageContextError_1.PublisherQueryLanguageContextError,
"PublisherQueryLanguageSyntaxError": publisherQueryLanguageSyntaxError_1.PublisherQueryLanguageSyntaxError,
"QuotaError": quotaError_1.QuotaError,
"RangeError": rangeError_1.RangeError,
"RequestApprovalProgressAction": requestApprovalProgressAction_1.RequestApprovalProgressAction,
"RequestBuyerAcceptance": requestBuyerAcceptance_1.RequestBuyerAcceptance,
"RequiredCollectionError": requiredCollectionError_1.RequiredCollectionError,
"RequiredError": requiredError_1.RequiredError,
"RequiredNumberError": requiredNumberError_1.RequiredNumberError,
"ReserveInventoryProgressAction": reserveInventoryProgressAction_1.ReserveInventoryProgressAction,
"ReserveProposals": reserveProposals_1.ReserveProposals,
"RetractProposals": retractProposals_1.RetractProposals,
"RetractionDetails": retractionDetails_1.RetractionDetails,
"SalespersonSplit": salespersonSplit_1.SalespersonSplit,
"AudienceSegmentError": audienceSegmentError_1.AudienceSegmentError,
"SendNotificationProgressAction": sendNotificationProgressAction_1.SendNotificationProgressAction,
"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,
"SubmitProposalsForApprovalBypassValidation": submitProposalsForApprovalBypassValidation_1.SubmitProposalsForApprovalBypassValidation,
"SubmitProposalsForApproval": submitProposalsForApproval_1.SubmitProposalsForApproval,
"SubmitProposalsForArchival": submitProposalsForArchival_1.SubmitProposalsForArchival,
"SyncProposalsWithMarketplace": syncProposalsWithMarketplace_1.SyncProposalsWithMarketplace,
"TeamError": teamError_1.TeamError,
"TerminateNegotiations": terminateNegotiations_1.TerminateNegotiations,
"TextValue": textValue_1.TextValue,
"TimeZoneError": timeZoneError_1.TimeZoneError,
"TypeError": typeError_1.TypeError,
"UnarchiveProposals": unarchiveProposals_1.UnarchiveProposals,
"UniqueError": uniqueError_1.UniqueError,
"UpdateOrderWithSellerData": updateOrderWithSellerData_1.UpdateOrderWithSellerData,
"UpdateResult": updateResult_1.UpdateResult,
"Value": value_1.Value,
"WorkflowActionError": workflowActionError_1.WorkflowActionError,
"ProgressAction": progressAction_1.ProgressAction,
"WorkflowProgress": workflowProgress_1.WorkflowProgress,
"ProgressStep": progressStep_1.ProgressStep,
"ProgressRule": progressRule_1.ProgressRule,
"WorkflowValidationError": workflowValidationError_1.WorkflowValidationError,
"createProposals": CreateProposals,
"createProposalsResponse": CreateProposalsResponse,
"getMarketplaceCommentsByStatement": GetMarketplaceCommentsByStatement,
"getMarketplaceCommentsByStatementResponse": GetMarketplaceCommentsByStatementResponse,
"getProposalsByStatement": GetProposalsByStatement,
"getProposalsByStatementResponse": GetProposalsByStatementResponse,
"performProposalAction": PerformProposalAction,
"performProposalActionResponse": PerformProposalActionResponse,
"updateProposals": UpdateProposals,
"updateProposalsResponse": UpdateProposalsResponse,
};
exports.ProposalService = ProposalService;