dfp-lib
Version:
This project hosts the Node.JS client library for the SOAP-based DFP API at Google.
267 lines (266 loc) • 11.9 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 user_1 = require("../soap/user");
const updateResult_1 = require("../soap/updateResult");
const userAction_1 = require("../soap/userAction");
const statement_1 = require("../soap/statement");
const userPage_1 = require("../soap/userPage");
const dfpService_1 = require("../lib/dfpService");
const objectValue_1 = require("../soap/objectValue");
const activateUsers_1 = require("../soap/activateUsers");
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 baseCustomFieldValue_1 = require("../soap/baseCustomFieldValue");
const booleanValue_1 = require("../soap/booleanValue");
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 deactivateUsers_1 = require("../soap/deactivateUsers");
const dropDownCustomFieldValue_1 = require("../soap/dropDownCustomFieldValue");
const featureError_1 = require("../soap/featureError");
const internalApiError_1 = require("../soap/internalApiError");
const invalidEmailError_1 = require("../soap/invalidEmailError");
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 role_1 = require("../soap/role");
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 teamError_1 = require("../soap/teamError");
const textValue_1 = require("../soap/textValue");
const timeZoneError_1 = require("../soap/timeZoneError");
const tokenError_1 = require("../soap/tokenError");
const typeError_1 = require("../soap/typeError");
const uniqueError_1 = require("../soap/uniqueError");
const userRecord_1 = require("../soap/userRecord");
const value_1 = require("../soap/value");
class GetAllRoles extends xmlElement_1.XMLElement {
constructor() {
super();
}
}
GetAllRoles.XSI_TYPE = "";
class GetAllRolesResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetAllRolesResponse.XSI_TYPE = "";
class GetCurrentUser extends xmlElement_1.XMLElement {
constructor() {
super();
}
}
GetCurrentUser.XSI_TYPE = "";
class GetCurrentUserResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetCurrentUserResponse.XSI_TYPE = "";
class UpdateUsersResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
UpdateUsersResponse.XSI_TYPE = "";
class UpdateUsers extends xmlElement_1.XMLElement {
constructor(users = null) {
super();
this.users = users;
}
}
UpdateUsers.XSI_TYPE = "";
class PerformUserActionResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
PerformUserActionResponse.XSI_TYPE = "";
class PerformUserAction extends xmlElement_1.XMLElement {
constructor(userAction = null, filterStatement = null) {
super();
this.userAction = userAction;
this.filterStatement = filterStatement;
}
}
PerformUserAction.XSI_TYPE = "";
class GetUsersByStatementResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
GetUsersByStatementResponse.XSI_TYPE = "";
class GetUsersByStatement extends xmlElement_1.XMLElement {
constructor(filterStatement = null) {
super();
this.filterStatement = filterStatement;
}
}
GetUsersByStatement.XSI_TYPE = "";
class CreateUsersResponse extends xmlElement_1.XMLElement {
constructor(rval = null) {
super();
this.rval = rval;
}
}
CreateUsersResponse.XSI_TYPE = "";
class CreateUsers extends xmlElement_1.XMLElement {
constructor(users = null) {
super();
this.users = users;
}
}
CreateUsers.XSI_TYPE = "";
class UserService extends dfpService_1.DfpService {
constructor(user, options = {}) {
options['classmap'] = UserService.CLASS_MAP;
super(UserService.SERVICE_NAME, user, UserService.ENDPOINT, options);
}
createUsers(users) {
return __awaiter(this, void 0, void 0, function* () {
const args = new CreateUsers(users);
const result = (yield this.client.__soapCall("createUsers", args)).createUsersResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
getAllRoles() {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetAllRoles();
const result = (yield this.client.__soapCall("getAllRoles", args)).getAllRolesResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
getCurrentUser() {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetCurrentUser();
const result = (yield this.client.__soapCall("getCurrentUser", args)).getCurrentUserResponse;
return result.rval;
});
}
getUsersByStatement(filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new GetUsersByStatement(filterStatement);
const result = (yield this.client.__soapCall("getUsersByStatement", args)).getUsersByStatementResponse;
result.rval.results = (Array.isArray(result.rval.results)) ? result.rval.results :
(result.rval.results == null) ? [] : [result.rval.results];
return result.rval;
});
}
performUserAction(userAction, filterStatement) {
return __awaiter(this, void 0, void 0, function* () {
const args = new PerformUserAction(userAction, filterStatement);
const result = (yield this.client.__soapCall("performUserAction", args)).performUserActionResponse;
return result.rval;
});
}
updateUsers(users) {
return __awaiter(this, void 0, void 0, function* () {
const args = new UpdateUsers(users);
const result = (yield this.client.__soapCall("updateUsers", args)).updateUsersResponse;
return (Array.isArray(result.rval)) ? result.rval :
(result.rval == null) ? [] : [result.rval];
});
}
}
UserService.SERVICE_NAME = "UserService";
UserService.ENDPOINT = "https://ads.google.com/apis/ads/publisher/v201611/UserService";
UserService.CLASS_MAP = {
"ObjectValue": objectValue_1.ObjectValue,
"ActivateUsers": activateUsers_1.ActivateUsers,
"ApiError": apiError_1.ApiError,
"ApiException": apiException_1.ApiException,
"ApiVersionError": apiVersionError_1.ApiVersionError,
"ApplicationException": applicationException_1.ApplicationException,
"AuthenticationError": authenticationError_1.AuthenticationError,
"BaseCustomFieldValue": baseCustomFieldValue_1.BaseCustomFieldValue,
"BooleanValue": booleanValue_1.BooleanValue,
"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,
"DeactivateUsers": deactivateUsers_1.DeactivateUsers,
"DropDownCustomFieldValue": dropDownCustomFieldValue_1.DropDownCustomFieldValue,
"FeatureError": featureError_1.FeatureError,
"InternalApiError": internalApiError_1.InternalApiError,
"InvalidEmailError": invalidEmailError_1.InvalidEmailError,
"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,
"Role": role_1.Role,
"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,
"TeamError": teamError_1.TeamError,
"TextValue": textValue_1.TextValue,
"TimeZoneError": timeZoneError_1.TimeZoneError,
"TokenError": tokenError_1.TokenError,
"TypeError": typeError_1.TypeError,
"UniqueError": uniqueError_1.UniqueError,
"UpdateResult": updateResult_1.UpdateResult,
"UserAction": userAction_1.UserAction,
"User": user_1.User,
"UserPage": userPage_1.UserPage,
"UserRecord": userRecord_1.UserRecord,
"Value": value_1.Value,
"createUsers": CreateUsers,
"createUsersResponse": CreateUsersResponse,
"getAllRoles": GetAllRoles,
"getAllRolesResponse": GetAllRolesResponse,
"getCurrentUser": GetCurrentUser,
"getCurrentUserResponse": GetCurrentUserResponse,
"getUsersByStatement": GetUsersByStatement,
"getUsersByStatementResponse": GetUsersByStatementResponse,
"performUserAction": PerformUserAction,
"performUserActionResponse": PerformUserActionResponse,
"updateUsers": UpdateUsers,
"updateUsersResponse": UpdateUsersResponse,
};
exports.UserService = UserService;