google-ads-api
Version:
Google Ads API Client Library for Node.js
41 lines (40 loc) • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
const customer_1 = require("./customer");
const service_1 = require("./service");
class Client {
options;
constructor(options) {
this.options = options;
}
Customer(customerOptions, hooks) {
const cus = new customer_1.Customer(this.options, customerOptions, hooks);
return cus;
}
async listAccessibleCustomers(refreshToken) {
const service = new service_1.Service(this.options, {
customer_id: "",
refresh_token: refreshToken,
});
// @ts-expect-error Protected usage is fine here
const customerService = await service.loadService("CustomerServiceClient");
try {
// @ts-expect-error Type definition is incorrect, response is an array
const [response] = await customerService.listAccessibleCustomers({}, {
// @ts-expect-error Field not included in type definitions
otherArgs: {
// @ts-expect-error Protected usage is fine here
headers: service.callHeaders,
},
});
return response;
}
catch (err) {
console.log(err);
// @ts-expect-error Protected usage is fine here
throw service.getGoogleAdsError(err);
}
}
}
exports.Client = Client;