dfp-lib
Version:
This project hosts the Node.JS client library for the SOAP-based DFP API at Google.
218 lines (217 loc) • 10.5 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 dfpService_1 = require("../lib/dfpService");
const xmlElement_1 = require("../../common/soap/xmlElement");
const apiError_1 = require("../soap/apiError");
const apiVersionError_1 = require("../soap/apiVersionError");
const applicationException_1 = require("../soap/applicationException");
const authenticationError_1 = require("../soap/authenticationError");
const collectionSizeError_1 = require("../soap/collectionSizeError");
const commonError_1 = require("../soap/commonError");
const featureError_1 = require("../soap/featureError");
const value_1 = require("../soap/value");
const textValue_1 = require("../soap/textValue");
const objectValue_1 = require("../soap/objectValue");
const booleanValue_1 = require("../soap/booleanValue");
const numberValue_1 = require("../soap/numberValue");
const setValue_1 = require("../soap/setValue");
const internalApiError_1 = require("../soap/internalApiError");
const apiException_1 = require("../soap/apiException");
const soapRequestHeader_1 = require("../../common/soap/soapRequestHeader");
const soapResponseHeader_1 = require("../../common/soap/soapResponseHeader");
const parseError_1 = require("../soap/parseError");
const permissionError_1 = require("../soap/permissionError");
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 notNullError_1 = require("../soap/notNullError");
const quotaError_1 = require("../soap/quotaError");
const statementError_1 = require("../soap/statementError");
const publisherQueryLanguageContextError_1 = require("../soap/publisherQueryLanguageContextError");
const requiredCollectionError_1 = require("../soap/requiredCollectionError");
const requiredError_1 = require("../soap/requiredError");
const serverError_1 = require("../soap/serverError");
const publisherQueryLanguageSyntaxError_1 = require("../soap/publisherQueryLanguageSyntaxError");
const savedQuery_1 = require("../soap/savedQuery");
const savedQueryPage_1 = require("../soap/savedQueryPage");
const stringLengthError_1 = require("../soap/stringLengthError");
const stringValueMapEntry_1 = require("../soap/stringValueMapEntry");
const statement_1 = require("../soap/statement");
const reportDownloadOptions_1 = require("../soap/reportDownloadOptions");
const reportJob_1 = require("../soap/reportJob");
const reportError_1 = require("../soap/reportError");
const reportQuery_1 = require("../soap/reportQuery");
class GetReportDownloadURL extends xmlElement_1.XMLElement {
constructor(reportJobId = null, exportFormat = null) {
super();
this.reportJobId = reportJobId;
this.exportFormat = exportFormat;
}
}
class GetReportDownloadURLResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetReportDownloadURLResponse.XSI_TYPE = "GetReportDownloadURLResponse";
class GetReportDownloadUrlWithOptions extends xmlElement_1.XMLElement {
constructor(reportJobId = null, reportDownloadOptions = null) {
super();
this.reportJobId = reportJobId;
this.reportDownloadOptions = reportDownloadOptions;
}
}
class GetReportDownloadUrlWithOptionsResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetReportDownloadUrlWithOptionsResponse.XSI_TYPE = "GetReportDownloadUrlWithOptionsResponse";
class GetReportJobStatus extends xmlElement_1.XMLElement {
constructor(reportJobId = null) {
super();
this.reportJobId = reportJobId;
}
}
class GetReportJobStatusResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetReportJobStatusResponse.XSI_TYPE = "GetReportJobStatusResponse";
class RunReportJob extends xmlElement_1.XMLElement {
constructor(reportJob = null) {
super();
this.reportJob = reportJob;
}
}
class RunReportJobResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
RunReportJobResponse.XSI_TYPE = "RunReportJobResponse";
class GetSavedQueriesByStatement extends xmlElement_1.XMLElement {
constructor(filterStatement = null) {
super();
this.filterStatement = filterStatement;
}
}
GetSavedQueriesByStatement.XSI_TYPE = "";
class GetSavedQueriesByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetSavedQueriesByStatementResponse.XSI_TYPE = "";
class ReportService extends dfpService_1.DfpService {
constructor(user, options = {}) {
options['classmap'] = ReportService.CLASS_MAP;
super(ReportService.SERVICE_NAME, user, ReportService.ENDPOINT, options);
}
getReportDownloadURL(reportJobId, exportFormat) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetReportDownloadURL(reportJobId, exportFormat);
const result = (yield this.client.__soapCall("getReportDownloadURL", args)).getReportDownloadURLResponse;
return result.rval;
});
}
getReportDownloadUrlWithOptions(reportJobId, reportDownloadOptions) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetReportDownloadUrlWithOptions(reportJobId, reportDownloadOptions);
const result = (yield this.client.__soapCall("getReportDownloadUrlWithOptions", args)).getReportDownloadUrlWithOptionsResponse;
return result.rval;
});
}
getReportJobStatus(reportJobId) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetReportJobStatus(reportJobId);
const result = (yield this.client.__soapCall("getReportJobStatus", args)).getReportJobStatusResponse;
return result.rval;
});
}
getSavedQueriesByStatement(filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetSavedQueriesByStatement(filterStatement);
const result = (yield this.client.__soapCall("getSavedQueriesByStatement", args)).getSavedQueriesByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
runReportJob(reportJob) {
return __awaiter(this, void 0, void 0, function* () {
const args = new RunReportJob(reportJob);
const result = (yield this.client.__soapCall("runReportJob", args)).runReportJobResponse;
return result.rval;
});
}
}
ReportService.SERVICE_NAME = "ReportService";
ReportService.ENDPOINT = "https://ads.google.com/apis/ads/publisher/v201611/ReportService";
ReportService.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,
"CollectionSizeError": collectionSizeError_1.CollectionSizeError,
"CommonError": commonError_1.CommonError,
"Date": dfpDate_1.DfpDate,
"DateTime": dfpDateTime_1.DfpDateTime,
"DateTimeValue": dateTimeValue_1.DateTimeValue,
"DateValue": dateValue_1.DateValue,
"FeatureError": featureError_1.FeatureError,
"InternalApiError": internalApiError_1.InternalApiError,
"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,
"ReportDownloadOptions": reportDownloadOptions_1.ReportDownloadOptions,
"ReportError": reportError_1.ReportError,
"ReportJob": reportJob_1.ReportJob,
"ReportQuery": reportQuery_1.ReportQuery,
"RequiredCollectionError": requiredCollectionError_1.RequiredCollectionError,
"RequiredError": requiredError_1.RequiredError,
"SavedQuery": savedQuery_1.SavedQuery,
"SavedQueryPage": savedQueryPage_1.SavedQueryPage,
"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,
"StringValueMapEntry": stringValueMapEntry_1.StringValueMapEntry,
"TextValue": textValue_1.TextValue,
"Value": value_1.Value,
"getReportDownloadURL": GetReportDownloadURL,
"getReportDownloadURLResponse": GetReportDownloadURLResponse,
"getReportDownloadUrlWithOptions": GetReportDownloadUrlWithOptions,
"getReportDownloadUrlWithOptionsResponse": GetReportDownloadUrlWithOptionsResponse,
"getReportJobStatus": GetReportJobStatus,
"getReportJobStatusResponse": GetReportJobStatusResponse,
"getSavedQueriesByStatement": GetSavedQueriesByStatement,
"getSavedQueriesByStatementResponse": GetSavedQueriesByStatementResponse,
"runReportJob": RunReportJob,
"runReportJobResponse": RunReportJobResponse
};
exports.ReportService = ReportService;