UNPKG

@htdangkhoa/google-ads

Version:
315 lines (314 loc) 13.5 kB
"use strict"; // 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/v19/resources/batch_job.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BatchJob_BatchJobMetadata = exports.BatchJob = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_js_1 = __importDefault(require("protobufjs/minimal.js")); const batch_job_status_js_1 = require("../enums/batch_job_status.js"); function createBaseBatchJob() { return { resource_name: "", id: undefined, next_add_sequence_token: undefined, metadata: undefined, status: 0, long_running_operation: undefined, }; } exports.BatchJob = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.resource_name !== undefined && message.resource_name !== "") { writer.uint32(10).string(message.resource_name); } if (message.id !== undefined) { writer.uint32(56).int64(message.id); } if (message.next_add_sequence_token !== undefined) { writer.uint32(66).string(message.next_add_sequence_token); } if (message.metadata !== undefined) { exports.BatchJob_BatchJobMetadata.encode(message.metadata, writer.uint32(34).fork()).ldelim(); } if (message.status !== undefined && message.status !== 0) { writer.uint32(40).int32(message.status); } if (message.long_running_operation !== undefined) { writer.uint32(74).string(message.long_running_operation); } 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 = createBaseBatchJob(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 7: if (tag !== 56) { break; } message.id = longToString(reader.int64()); continue; case 8: if (tag !== 66) { break; } message.next_add_sequence_token = reader.string(); continue; case 4: if (tag !== 34) { break; } message.metadata = exports.BatchJob_BatchJobMetadata.decode(reader, reader.uint32()); continue; case 5: if (tag !== 40) { break; } message.status = reader.int32(); continue; case 9: if (tag !== 74) { break; } message.long_running_operation = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { resource_name: isSet(object.resource_name) ? globalThis.String(object.resource_name) : "", id: isSet(object.id) ? globalThis.String(object.id) : undefined, next_add_sequence_token: isSet(object.next_add_sequence_token) ? globalThis.String(object.next_add_sequence_token) : undefined, metadata: isSet(object.metadata) ? exports.BatchJob_BatchJobMetadata.fromJSON(object.metadata) : undefined, status: isSet(object.status) ? (0, batch_job_status_js_1.batchJobStatusEnum_BatchJobStatusFromJSON)(object.status) : 0, long_running_operation: isSet(object.long_running_operation) ? globalThis.String(object.long_running_operation) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.id !== undefined) { obj.id = message.id; } if (message.next_add_sequence_token !== undefined) { obj.next_add_sequence_token = message.next_add_sequence_token; } if (message.metadata !== undefined) { obj.metadata = exports.BatchJob_BatchJobMetadata.toJSON(message.metadata); } if (message.status !== undefined && message.status !== 0) { obj.status = (0, batch_job_status_js_1.batchJobStatusEnum_BatchJobStatusToJSON)(message.status); } if (message.long_running_operation !== undefined) { obj.long_running_operation = message.long_running_operation; } return obj; }, create(base) { return exports.BatchJob.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseBatchJob(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined; message.next_add_sequence_token = (_c = object.next_add_sequence_token) !== null && _c !== void 0 ? _c : undefined; message.metadata = (object.metadata !== undefined && object.metadata !== null) ? exports.BatchJob_BatchJobMetadata.fromPartial(object.metadata) : undefined; message.status = (_d = object.status) !== null && _d !== void 0 ? _d : 0; message.long_running_operation = (_e = object.long_running_operation) !== null && _e !== void 0 ? _e : undefined; return message; }, }; function createBaseBatchJob_BatchJobMetadata() { return { creation_date_time: undefined, start_date_time: undefined, completion_date_time: undefined, estimated_completion_ratio: undefined, operation_count: undefined, executed_operation_count: undefined, execution_limit_seconds: undefined, }; } exports.BatchJob_BatchJobMetadata = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.creation_date_time !== undefined) { writer.uint32(66).string(message.creation_date_time); } if (message.start_date_time !== undefined) { writer.uint32(58).string(message.start_date_time); } if (message.completion_date_time !== undefined) { writer.uint32(74).string(message.completion_date_time); } if (message.estimated_completion_ratio !== undefined) { writer.uint32(81).double(message.estimated_completion_ratio); } if (message.operation_count !== undefined) { writer.uint32(88).int64(message.operation_count); } if (message.executed_operation_count !== undefined) { writer.uint32(96).int64(message.executed_operation_count); } if (message.execution_limit_seconds !== undefined) { writer.uint32(104).int32(message.execution_limit_seconds); } 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 = createBaseBatchJob_BatchJobMetadata(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 8: if (tag !== 66) { break; } message.creation_date_time = reader.string(); continue; case 7: if (tag !== 58) { break; } message.start_date_time = reader.string(); continue; case 9: if (tag !== 74) { break; } message.completion_date_time = reader.string(); continue; case 10: if (tag !== 81) { break; } message.estimated_completion_ratio = reader.double(); continue; case 11: if (tag !== 88) { break; } message.operation_count = longToString(reader.int64()); continue; case 12: if (tag !== 96) { break; } message.executed_operation_count = longToString(reader.int64()); continue; case 13: if (tag !== 104) { break; } message.execution_limit_seconds = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { creation_date_time: isSet(object.creation_date_time) ? globalThis.String(object.creation_date_time) : undefined, start_date_time: isSet(object.start_date_time) ? globalThis.String(object.start_date_time) : undefined, completion_date_time: isSet(object.completion_date_time) ? globalThis.String(object.completion_date_time) : undefined, estimated_completion_ratio: isSet(object.estimated_completion_ratio) ? globalThis.Number(object.estimated_completion_ratio) : undefined, operation_count: isSet(object.operation_count) ? globalThis.String(object.operation_count) : undefined, executed_operation_count: isSet(object.executed_operation_count) ? globalThis.String(object.executed_operation_count) : undefined, execution_limit_seconds: isSet(object.execution_limit_seconds) ? globalThis.Number(object.execution_limit_seconds) : undefined, }; }, toJSON(message) { const obj = {}; if (message.creation_date_time !== undefined) { obj.creation_date_time = message.creation_date_time; } if (message.start_date_time !== undefined) { obj.start_date_time = message.start_date_time; } if (message.completion_date_time !== undefined) { obj.completion_date_time = message.completion_date_time; } if (message.estimated_completion_ratio !== undefined) { obj.estimated_completion_ratio = message.estimated_completion_ratio; } if (message.operation_count !== undefined) { obj.operation_count = message.operation_count; } if (message.executed_operation_count !== undefined) { obj.executed_operation_count = message.executed_operation_count; } if (message.execution_limit_seconds !== undefined) { obj.execution_limit_seconds = Math.round(message.execution_limit_seconds); } return obj; }, create(base) { return exports.BatchJob_BatchJobMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g; const message = createBaseBatchJob_BatchJobMetadata(); message.creation_date_time = (_a = object.creation_date_time) !== null && _a !== void 0 ? _a : undefined; message.start_date_time = (_b = object.start_date_time) !== null && _b !== void 0 ? _b : undefined; message.completion_date_time = (_c = object.completion_date_time) !== null && _c !== void 0 ? _c : undefined; message.estimated_completion_ratio = (_d = object.estimated_completion_ratio) !== null && _d !== void 0 ? _d : undefined; message.operation_count = (_e = object.operation_count) !== null && _e !== void 0 ? _e : undefined; message.executed_operation_count = (_f = object.executed_operation_count) !== null && _f !== void 0 ? _f : undefined; message.execution_limit_seconds = (_g = object.execution_limit_seconds) !== null && _g !== void 0 ? _g : undefined; return message; }, }; function longToString(long) { return long.toString(); } if (minimal_js_1.default.util.Long !== long_1.default) { minimal_js_1.default.util.Long = long_1.default; minimal_js_1.default.configure(); } function isSet(value) { return value !== null && value !== undefined; }