@guardian/google-admanager-api
Version:
Google Ad Manager API Client Library for NodeJs
34 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdManagerClient = void 0;
const constants_1 = require("../common/constants");
const googleSoap_service_1 = require("./googleSoap.service");
class AdManagerClient {
constructor(networkCode, credential, applicationName, apiVersion) {
this.logRequests = false;
this.logResponses = false;
this.networkCode = networkCode;
this.credential = credential;
this.applicationName = applicationName || constants_1.DEFAULT_APPLICATION_NAME;
this.apiVersion = apiVersion || constants_1.DEFAULT_API_VERSION;
}
async getService(serviceName) {
try {
const token = await this.credential.getToken();
if (!token) {
throw new Error("Token is not available");
}
return await new googleSoap_service_1.GoogleSoapService(serviceName, {
networkCode: this.networkCode,
token: token,
applicationName: this.applicationName,
apiVersion: this.apiVersion,
}).createClient(this.logRequests, this.logResponses);
}
catch (err) {
throw new Error(err);
}
}
}
exports.AdManagerClient = AdManagerClient;
//# sourceMappingURL=adManager.client.js.map