UNPKG

@dmgt/google-ad-manager-api

Version:
281 lines 20.6 kB
"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/v202505/adruleservice"); const adjustmentservice_1 = require("../service/v202505/adjustmentservice"); const adstxtservice_1 = require("../service/v202505/adstxtservice"); const audiencesegmentservice_1 = require("../service/v202505/audiencesegmentservice"); const cdnconfigurationservice_1 = require("../service/v202505/cdnconfigurationservice"); const cmsmetadataservice_1 = require("../service/v202505/cmsmetadataservice"); const companyservice_1 = require("../service/v202505/companyservice"); const contactservice_1 = require("../service/v202505/contactservice"); const contentbundleservice_1 = require("../service/v202505/contentbundleservice"); const contentservice_1 = require("../service/v202505/contentservice"); const creativeservice_1 = require("../service/v202505/creativeservice"); const creativesetservice_1 = require("../service/v202505/creativesetservice"); const creativetemplateservice_1 = require("../service/v202505/creativetemplateservice"); const creativewrapperservice_1 = require("../service/v202505/creativewrapperservice"); const customfieldservice_1 = require("../service/v202505/customfieldservice"); const customtargetingservice_1 = require("../service/v202505/customtargetingservice"); const daiauthenticationkeyservice_1 = require("../service/v202505/daiauthenticationkeyservice"); const daiencodingprofileservice_1 = require("../service/v202505/daiencodingprofileservice"); const forecastservice_1 = require("../service/v202505/forecastservice"); const inventoryservice_1 = require("../service/v202505/inventoryservice"); const labelservice_1 = require("../service/v202505/labelservice"); const lineitemcreativeassociationservice_1 = require("../service/v202505/lineitemcreativeassociationservice"); const lineitemservice_1 = require("../service/v202505/lineitemservice"); const lineitemtemplateservice_1 = require("../service/v202505/lineitemtemplateservice"); const livestreameventservice_1 = require("../service/v202505/livestreameventservice"); const mobileapplicationservice_1 = require("../service/v202505/mobileapplicationservice"); const nativestyleservice_1 = require("../service/v202505/nativestyleservice"); const networkservice_1 = require("../service/v202505/networkservice"); const orderservice_1 = require("../service/v202505/orderservice"); const placementservice_1 = require("../service/v202505/placementservice"); const proposallineitemservice_1 = require("../service/v202505/proposallineitemservice"); const proposalservice_1 = require("../service/v202505/proposalservice"); const publisherquerylanguageservice_1 = require("../service/v202505/publisherquerylanguageservice"); const reportservice_1 = require("../service/v202505/reportservice"); const segmentpopulationservice_1 = require("../service/v202505/segmentpopulationservice"); const siteservice_1 = require("../service/v202505/siteservice"); const streamactivitymonitorservice_1 = require("../service/v202505/streamactivitymonitorservice"); const suggestedadunitservice_1 = require("../service/v202505/suggestedadunitservice"); const targetingpresetservice_1 = require("../service/v202505/targetingpresetservice"); const teamservice_1 = require("../service/v202505/teamservice"); const userservice_1 = require("../service/v202505/userservice"); const userteamassociationservice_1 = require("../service/v202505/userteamassociationservice"); const yieldgroupservice_1 = require("../service/v202505/yieldgroupservice"); exports.AdRuleService = tslib_1.__importStar(require("../service/v202505/adruleservice")); exports.AdjustmentService = tslib_1.__importStar(require("../service/v202505/adjustmentservice")); exports.AdsTxtService = tslib_1.__importStar(require("../service/v202505/adstxtservice")); exports.AudienceSegmentService = tslib_1.__importStar(require("../service/v202505/audiencesegmentservice")); exports.CdnConfigurationService = tslib_1.__importStar(require("../service/v202505/cdnconfigurationservice")); exports.CmsMetadataService = tslib_1.__importStar(require("../service/v202505/cmsmetadataservice")); exports.CompanyService = tslib_1.__importStar(require("../service/v202505/companyservice")); exports.ContactService = tslib_1.__importStar(require("../service/v202505/contactservice")); exports.ContentBundleService = tslib_1.__importStar(require("../service/v202505/contentbundleservice")); exports.ContentService = tslib_1.__importStar(require("../service/v202505/contentservice")); exports.CreativeService = tslib_1.__importStar(require("../service/v202505/creativeservice")); exports.CreativeSetService = tslib_1.__importStar(require("../service/v202505/creativesetservice")); exports.CreativeTemplateService = tslib_1.__importStar(require("../service/v202505/creativetemplateservice")); exports.CreativeWrapperService = tslib_1.__importStar(require("../service/v202505/creativewrapperservice")); exports.CustomFieldService = tslib_1.__importStar(require("../service/v202505/customfieldservice")); exports.CustomTargetingService = tslib_1.__importStar(require("../service/v202505/customtargetingservice")); exports.DaiAuthenticationKeyService = tslib_1.__importStar(require("../service/v202505/daiauthenticationkeyservice")); exports.DaiEncodingProfileService = tslib_1.__importStar(require("../service/v202505/daiencodingprofileservice")); exports.ForecastService = tslib_1.__importStar(require("../service/v202505/forecastservice")); exports.InventoryService = tslib_1.__importStar(require("../service/v202505/inventoryservice")); exports.LabelService = tslib_1.__importStar(require("../service/v202505/labelservice")); exports.LineItemCreativeAssociationService = tslib_1.__importStar(require("../service/v202505/lineitemcreativeassociationservice")); exports.LineItemService = tslib_1.__importStar(require("../service/v202505/lineitemservice")); exports.LineItemTemplateService = tslib_1.__importStar(require("../service/v202505/lineitemtemplateservice")); exports.LiveStreamEventService = tslib_1.__importStar(require("../service/v202505/livestreameventservice")); exports.MobileApplicationService = tslib_1.__importStar(require("../service/v202505/mobileapplicationservice")); exports.NativeStyleService = tslib_1.__importStar(require("../service/v202505/nativestyleservice")); exports.NetworkService = tslib_1.__importStar(require("../service/v202505/networkservice")); exports.OrderService = tslib_1.__importStar(require("../service/v202505/orderservice")); exports.PlacementService = tslib_1.__importStar(require("../service/v202505/placementservice")); exports.ProposalLineItemService = tslib_1.__importStar(require("../service/v202505/proposallineitemservice")); exports.ProposalService = tslib_1.__importStar(require("../service/v202505/proposalservice")); exports.PublisherQueryLanguageService = tslib_1.__importStar(require("../service/v202505/publisherquerylanguageservice")); exports.ReportService = tslib_1.__importStar(require("../service/v202505/reportservice")); exports.SegmentPopulationService = tslib_1.__importStar(require("../service/v202505/segmentpopulationservice")); exports.SiteService = tslib_1.__importStar(require("../service/v202505/siteservice")); exports.StreamActivityMonitorService = tslib_1.__importStar(require("../service/v202505/streamactivitymonitorservice")); exports.SuggestedAdUnitService = tslib_1.__importStar(require("../service/v202505/suggestedadunitservice")); exports.TargetingPresetService = tslib_1.__importStar(require("../service/v202505/targetingpresetservice")); exports.TeamService = tslib_1.__importStar(require("../service/v202505/teamservice")); exports.UserService = tslib_1.__importStar(require("../service/v202505/userservice")); exports.UserTeamAssociationService = tslib_1.__importStar(require("../service/v202505/userteamassociationservice")); exports.YieldGroupService = tslib_1.__importStar(require("../service/v202505/yieldgroupservice")); class GoogleAdManager { #applicationName; #authorize; #credentialsPromise; #networkCode; #version = 'v202505'; 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=v202505.js.map