@dmgt/google-ad-manager-api
Version:
Typed Google Ad Manager API
281 lines • 20.6 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoogleAdManager = exports.YieldGroupService = exports.UserTeamAssociationService = exports.UserService = exports.TeamService = exports.TargetingPresetService = exports.SuggestedAdUnitService = exports.StreamActivityMonitorService = exports.SiteService = exports.SegmentPopulationService = exports.ReportService = exports.PublisherQueryLanguageService = exports.ProposalService = exports.ProposalLineItemService = exports.PlacementService = exports.OrderService = exports.NetworkService = exports.NativeStyleService = exports.MobileApplicationService = exports.LiveStreamEventService = exports.LineItemTemplateService = exports.LineItemService = exports.LineItemCreativeAssociationService = exports.LabelService = exports.InventoryService = exports.ForecastService = exports.DaiEncodingProfileService = exports.DaiAuthenticationKeyService = exports.CustomTargetingService = exports.CustomFieldService = exports.CreativeWrapperService = exports.CreativeTemplateService = exports.CreativeSetService = exports.CreativeService = exports.ContentService = exports.ContentBundleService = exports.ContactService = exports.CompanyService = exports.CmsMetadataService = exports.CdnConfigurationService = exports.AudienceSegmentService = exports.AdsTxtService = exports.AdjustmentService = exports.AdRuleService = void 0;
const tslib_1 = require("tslib");
const soap_1 = require("soap");
const adruleservice_1 = require("../service/v202411/adruleservice");
const adjustmentservice_1 = require("../service/v202411/adjustmentservice");
const adstxtservice_1 = require("../service/v202411/adstxtservice");
const audiencesegmentservice_1 = require("../service/v202411/audiencesegmentservice");
const cdnconfigurationservice_1 = require("../service/v202411/cdnconfigurationservice");
const cmsmetadataservice_1 = require("../service/v202411/cmsmetadataservice");
const companyservice_1 = require("../service/v202411/companyservice");
const contactservice_1 = require("../service/v202411/contactservice");
const contentbundleservice_1 = require("../service/v202411/contentbundleservice");
const contentservice_1 = require("../service/v202411/contentservice");
const creativeservice_1 = require("../service/v202411/creativeservice");
const creativesetservice_1 = require("../service/v202411/creativesetservice");
const creativetemplateservice_1 = require("../service/v202411/creativetemplateservice");
const creativewrapperservice_1 = require("../service/v202411/creativewrapperservice");
const customfieldservice_1 = require("../service/v202411/customfieldservice");
const customtargetingservice_1 = require("../service/v202411/customtargetingservice");
const daiauthenticationkeyservice_1 = require("../service/v202411/daiauthenticationkeyservice");
const daiencodingprofileservice_1 = require("../service/v202411/daiencodingprofileservice");
const forecastservice_1 = require("../service/v202411/forecastservice");
const inventoryservice_1 = require("../service/v202411/inventoryservice");
const labelservice_1 = require("../service/v202411/labelservice");
const lineitemcreativeassociationservice_1 = require("../service/v202411/lineitemcreativeassociationservice");
const lineitemservice_1 = require("../service/v202411/lineitemservice");
const lineitemtemplateservice_1 = require("../service/v202411/lineitemtemplateservice");
const livestreameventservice_1 = require("../service/v202411/livestreameventservice");
const mobileapplicationservice_1 = require("../service/v202411/mobileapplicationservice");
const nativestyleservice_1 = require("../service/v202411/nativestyleservice");
const networkservice_1 = require("../service/v202411/networkservice");
const orderservice_1 = require("../service/v202411/orderservice");
const placementservice_1 = require("../service/v202411/placementservice");
const proposallineitemservice_1 = require("../service/v202411/proposallineitemservice");
const proposalservice_1 = require("../service/v202411/proposalservice");
const publisherquerylanguageservice_1 = require("../service/v202411/publisherquerylanguageservice");
const reportservice_1 = require("../service/v202411/reportservice");
const segmentpopulationservice_1 = require("../service/v202411/segmentpopulationservice");
const siteservice_1 = require("../service/v202411/siteservice");
const streamactivitymonitorservice_1 = require("../service/v202411/streamactivitymonitorservice");
const suggestedadunitservice_1 = require("../service/v202411/suggestedadunitservice");
const targetingpresetservice_1 = require("../service/v202411/targetingpresetservice");
const teamservice_1 = require("../service/v202411/teamservice");
const userservice_1 = require("../service/v202411/userservice");
const userteamassociationservice_1 = require("../service/v202411/userteamassociationservice");
const yieldgroupservice_1 = require("../service/v202411/yieldgroupservice");
exports.AdRuleService = tslib_1.__importStar(require("../service/v202411/adruleservice"));
exports.AdjustmentService = tslib_1.__importStar(require("../service/v202411/adjustmentservice"));
exports.AdsTxtService = tslib_1.__importStar(require("../service/v202411/adstxtservice"));
exports.AudienceSegmentService = tslib_1.__importStar(require("../service/v202411/audiencesegmentservice"));
exports.CdnConfigurationService = tslib_1.__importStar(require("../service/v202411/cdnconfigurationservice"));
exports.CmsMetadataService = tslib_1.__importStar(require("../service/v202411/cmsmetadataservice"));
exports.CompanyService = tslib_1.__importStar(require("../service/v202411/companyservice"));
exports.ContactService = tslib_1.__importStar(require("../service/v202411/contactservice"));
exports.ContentBundleService = tslib_1.__importStar(require("../service/v202411/contentbundleservice"));
exports.ContentService = tslib_1.__importStar(require("../service/v202411/contentservice"));
exports.CreativeService = tslib_1.__importStar(require("../service/v202411/creativeservice"));
exports.CreativeSetService = tslib_1.__importStar(require("../service/v202411/creativesetservice"));
exports.CreativeTemplateService = tslib_1.__importStar(require("../service/v202411/creativetemplateservice"));
exports.CreativeWrapperService = tslib_1.__importStar(require("../service/v202411/creativewrapperservice"));
exports.CustomFieldService = tslib_1.__importStar(require("../service/v202411/customfieldservice"));
exports.CustomTargetingService = tslib_1.__importStar(require("../service/v202411/customtargetingservice"));
exports.DaiAuthenticationKeyService = tslib_1.__importStar(require("../service/v202411/daiauthenticationkeyservice"));
exports.DaiEncodingProfileService = tslib_1.__importStar(require("../service/v202411/daiencodingprofileservice"));
exports.ForecastService = tslib_1.__importStar(require("../service/v202411/forecastservice"));
exports.InventoryService = tslib_1.__importStar(require("../service/v202411/inventoryservice"));
exports.LabelService = tslib_1.__importStar(require("../service/v202411/labelservice"));
exports.LineItemCreativeAssociationService = tslib_1.__importStar(require("../service/v202411/lineitemcreativeassociationservice"));
exports.LineItemService = tslib_1.__importStar(require("../service/v202411/lineitemservice"));
exports.LineItemTemplateService = tslib_1.__importStar(require("../service/v202411/lineitemtemplateservice"));
exports.LiveStreamEventService = tslib_1.__importStar(require("../service/v202411/livestreameventservice"));
exports.MobileApplicationService = tslib_1.__importStar(require("../service/v202411/mobileapplicationservice"));
exports.NativeStyleService = tslib_1.__importStar(require("../service/v202411/nativestyleservice"));
exports.NetworkService = tslib_1.__importStar(require("../service/v202411/networkservice"));
exports.OrderService = tslib_1.__importStar(require("../service/v202411/orderservice"));
exports.PlacementService = tslib_1.__importStar(require("../service/v202411/placementservice"));
exports.ProposalLineItemService = tslib_1.__importStar(require("../service/v202411/proposallineitemservice"));
exports.ProposalService = tslib_1.__importStar(require("../service/v202411/proposalservice"));
exports.PublisherQueryLanguageService = tslib_1.__importStar(require("../service/v202411/publisherquerylanguageservice"));
exports.ReportService = tslib_1.__importStar(require("../service/v202411/reportservice"));
exports.SegmentPopulationService = tslib_1.__importStar(require("../service/v202411/segmentpopulationservice"));
exports.SiteService = tslib_1.__importStar(require("../service/v202411/siteservice"));
exports.StreamActivityMonitorService = tslib_1.__importStar(require("../service/v202411/streamactivitymonitorservice"));
exports.SuggestedAdUnitService = tslib_1.__importStar(require("../service/v202411/suggestedadunitservice"));
exports.TargetingPresetService = tslib_1.__importStar(require("../service/v202411/targetingpresetservice"));
exports.TeamService = tslib_1.__importStar(require("../service/v202411/teamservice"));
exports.UserService = tslib_1.__importStar(require("../service/v202411/userservice"));
exports.UserTeamAssociationService = tslib_1.__importStar(require("../service/v202411/userteamassociationservice"));
exports.YieldGroupService = tslib_1.__importStar(require("../service/v202411/yieldgroupservice"));
class GoogleAdManager {
#applicationName;
#authorize;
#credentialsPromise;
#networkCode;
#version = 'v202411';
get version() {
return this.#version;
}
constructor(options) {
this.#applicationName = options.applicationName;
this.#authorize = options.authorize;
this.#networkCode = options.networkCode.toString();
}
get credentials() {
if (!this.#credentialsPromise)
this.authorize();
return this.#credentialsPromise;
}
authorize() {
this.#credentialsPromise = this.#authorize();
return this.#credentialsPromise;
}
createAdRuleServiceClient = this.#wrapClientCreator(adruleservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/AdRuleService?wsdl');
createAdjustmentServiceClient = this.#wrapClientCreator(adjustmentservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/AdjustmentService?wsdl');
createAdsTxtServiceClient = this.#wrapClientCreator(adstxtservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/AdsTxtService?wsdl');
createAudienceSegmentServiceClient = this.#wrapClientCreator(audiencesegmentservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/AudienceSegmentService?wsdl');
createCdnConfigurationServiceClient = this.#wrapClientCreator(cdnconfigurationservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CdnConfigurationService?wsdl');
createCmsMetadataServiceClient = this.#wrapClientCreator(cmsmetadataservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CmsMetadataService?wsdl');
createCompanyServiceClient = this.#wrapClientCreator(companyservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CompanyService?wsdl');
createContactServiceClient = this.#wrapClientCreator(contactservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ContactService?wsdl');
createContentBundleServiceClient = this.#wrapClientCreator(contentbundleservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ContentBundleService?wsdl');
createContentServiceClient = this.#wrapClientCreator(contentservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ContentService?wsdl');
createCreativeServiceClient = this.#wrapClientCreator(creativeservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CreativeService?wsdl');
createCreativeSetServiceClient = this.#wrapClientCreator(creativesetservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CreativeSetService?wsdl');
createCreativeTemplateServiceClient = this.#wrapClientCreator(creativetemplateservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CreativeTemplateService?wsdl');
createCreativeWrapperServiceClient = this.#wrapClientCreator(creativewrapperservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CreativeWrapperService?wsdl');
createCustomFieldServiceClient = this.#wrapClientCreator(customfieldservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CustomFieldService?wsdl');
createCustomTargetingServiceClient = this.#wrapClientCreator(customtargetingservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/CustomTargetingService?wsdl');
createDaiAuthenticationKeyServiceClient = this.#wrapClientCreator(daiauthenticationkeyservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/DaiAuthenticationKeyService?wsdl');
createDaiEncodingProfileServiceClient = this.#wrapClientCreator(daiencodingprofileservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/DaiEncodingProfileService?wsdl');
createForecastServiceClient = this.#wrapClientCreator(forecastservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ForecastService?wsdl');
createInventoryServiceClient = this.#wrapClientCreator(inventoryservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/InventoryService?wsdl');
createLabelServiceClient = this.#wrapClientCreator(labelservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/LabelService?wsdl');
createLineItemCreativeAssociationServiceClient = this.#wrapClientCreator(lineitemcreativeassociationservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/LineItemCreativeAssociationService?wsdl');
createLineItemServiceClient = this.#wrapClientCreator(lineitemservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/LineItemService?wsdl');
createLineItemTemplateServiceClient = this.#wrapClientCreator(lineitemtemplateservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/LineItemTemplateService?wsdl');
createLiveStreamEventServiceClient = this.#wrapClientCreator(livestreameventservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/LiveStreamEventService?wsdl');
createMobileApplicationServiceClient = this.#wrapClientCreator(mobileapplicationservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/MobileApplicationService?wsdl');
createNativeStyleServiceClient = this.#wrapClientCreator(nativestyleservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/NativeStyleService?wsdl');
createNetworkServiceClient = this.#wrapClientCreator(networkservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/NetworkService?wsdl');
createOrderServiceClient = this.#wrapClientCreator(orderservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/OrderService?wsdl');
createPlacementServiceClient = this.#wrapClientCreator(placementservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/PlacementService?wsdl');
createProposalLineItemServiceClient = this.#wrapClientCreator(proposallineitemservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ProposalLineItemService?wsdl');
createProposalServiceClient = this.#wrapClientCreator(proposalservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ProposalService?wsdl');
createPublisherQueryLanguageServiceClient = this.#wrapClientCreator(publisherquerylanguageservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/PublisherQueryLanguageService?wsdl');
createReportServiceClient = this.#wrapClientCreator(reportservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/ReportService?wsdl');
createSegmentPopulationServiceClient = this.#wrapClientCreator(segmentpopulationservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/SegmentPopulationService?wsdl');
createSiteServiceClient = this.#wrapClientCreator(siteservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/SiteService?wsdl');
createStreamActivityMonitorServiceClient = this.#wrapClientCreator(streamactivitymonitorservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/StreamActivityMonitorService?wsdl');
createSuggestedAdUnitServiceClient = this.#wrapClientCreator(suggestedadunitservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/SuggestedAdUnitService?wsdl');
createTargetingPresetServiceClient = this.#wrapClientCreator(targetingpresetservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/TargetingPresetService?wsdl');
createTeamServiceClient = this.#wrapClientCreator(teamservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/TeamService?wsdl');
createUserServiceClient = this.#wrapClientCreator(userservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/UserService?wsdl');
createUserTeamAssociationServiceClient = this.#wrapClientCreator(userteamassociationservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/UserTeamAssociationService?wsdl');
createYieldGroupServiceClient = this.#wrapClientCreator(yieldgroupservice_1.createClientAsync, 'https://ads.google.com/apis/ads/publisher/' +
this.#version +
'/YieldGroupService?wsdl');
get #soapHeaders() {
return {
RequestHeader: {
attributes: {
'soapenv:actor': 'http://schemas.xmlsoap.org/soap/actor/next',
'soapenv:mustUnderstand': 0,
'xsi:type': 'ns1:SoapRequestHeader',
'xmlns:ns1': `https://www.google.com/apis/ads/publisher/${this.#version}`,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:soapenv': 'http://schemas.xmlsoap.org/soap/envelope/',
},
'ns1:networkCode': this.#networkCode,
'ns1:applicationName': this.#applicationName,
},
};
}
#wrapClientCreator(createClient, wsdlPath) {
return async () => {
const [token, client] = await Promise.all([
this.credentials,
createClient(wsdlPath, {
ignoredNamespaces: {
namespaces: ['tns'],
},
}),
]);
if (!token.access_token) {
console.error(token);
throw new Error('Failed to authenticate with Google');
}
client.addSoapHeader(this.#soapHeaders);
client.setSecurity(new soap_1.BearerSecurity(token.access_token));
return client;
};
}
}
exports.GoogleAdManager = GoogleAdManager;
//# sourceMappingURL=v202411.js.map