@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
154 lines (153 loc) • 6.45 kB
JavaScript
;
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.2
// protoc v3.21.12
// source: google/ads/googleads/v21/services/payments_account_service.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaymentsAccountServiceClient = exports.PaymentsAccountServiceService = exports.ListPaymentsAccountsResponse = exports.ListPaymentsAccountsRequest = void 0;
/* eslint-disable */
const grpc_js_1 = require("@grpc/grpc-js");
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const payments_account_js_1 = require("../resources/payments_account.js");
function createBaseListPaymentsAccountsRequest() {
return { customer_id: "" };
}
exports.ListPaymentsAccountsRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.customer_id !== undefined && message.customer_id !== "") {
writer.uint32(10).string(message.customer_id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPaymentsAccountsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.customer_id = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { customer_id: isSet(object.customer_id) ? globalThis.String(object.customer_id) : "" };
},
toJSON(message) {
const obj = {};
if (message.customer_id !== undefined && message.customer_id !== "") {
obj.customer_id = message.customer_id;
}
return obj;
},
create(base) {
return exports.ListPaymentsAccountsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListPaymentsAccountsRequest();
message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseListPaymentsAccountsResponse() {
return { payments_accounts: [] };
}
exports.ListPaymentsAccountsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.payments_accounts !== undefined && message.payments_accounts.length !== 0) {
for (const v of message.payments_accounts) {
payments_account_js_1.PaymentsAccount.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPaymentsAccountsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.payments_accounts.push(payments_account_js_1.PaymentsAccount.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
payments_accounts: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.payments_accounts)
? object.payments_accounts.map((e) => payments_account_js_1.PaymentsAccount.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.payments_accounts) === null || _a === void 0 ? void 0 : _a.length) {
obj.payments_accounts = message.payments_accounts.map((e) => payments_account_js_1.PaymentsAccount.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListPaymentsAccountsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListPaymentsAccountsResponse();
message.payments_accounts = ((_a = object.payments_accounts) === null || _a === void 0 ? void 0 : _a.map((e) => payments_account_js_1.PaymentsAccount.fromPartial(e))) || [];
return message;
},
};
exports.PaymentsAccountServiceService = {
/**
* Returns all payments accounts associated with all managers
* between the login customer ID and specified serving customer in the
* hierarchy, inclusive.
*
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [HeaderError]()
* [InternalError]()
* [PaymentsAccountError]()
* [QuotaError]()
* [RequestError]()
*/
listPaymentsAccounts: {
path: "/google.ads.googleads.v21.services.PaymentsAccountService/ListPaymentsAccounts",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.ListPaymentsAccountsRequest.encode(value).finish()),
requestDeserialize: (value) => exports.ListPaymentsAccountsRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.ListPaymentsAccountsResponse.encode(value).finish()),
responseDeserialize: (value) => exports.ListPaymentsAccountsResponse.decode(value),
},
};
exports.PaymentsAccountServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.PaymentsAccountServiceService, "google.ads.googleads.v21.services.PaymentsAccountService");
function isSet(value) {
return value !== null && value !== undefined;
}