UNPKG

@denizelderenbos/google-ads-api

Version:
48 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Client = void 0; const customer_1 = require("./customer"); const service_1 = require("./service"); class Client { constructor(options) { this.options = options; } Customer(customerOptions, hooks) { const cus = new customer_1.Customer(this.options, customerOptions, hooks); return cus; } async listAccessibleCustomers(refreshToken, loginCustomerId, linkedCustomerId) { const customerOptions = { customer_id: '', refresh_token: refreshToken, }; if (loginCustomerId) { customerOptions.login_customer_id = loginCustomerId; } if (linkedCustomerId) { customerOptions.linked_customer_id = linkedCustomerId; } const service = new service_1.Service(this.options, customerOptions); // prettier-ignore // @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; //# sourceMappingURL=client.js.map