@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
325 lines (324 loc) • 13.3 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/api/resource.proto
/* eslint-disable */
import _m0 from "protobufjs/minimal.js";
/**
* A description of the historical or future-looking state of the
* resource pattern.
*/
export var ResourceDescriptor_History;
(function (ResourceDescriptor_History) {
/** HISTORY_UNSPECIFIED - The "unset" value. */
ResourceDescriptor_History[ResourceDescriptor_History["HISTORY_UNSPECIFIED"] = 0] = "HISTORY_UNSPECIFIED";
/**
* ORIGINALLY_SINGLE_PATTERN - The resource originally had one pattern and launched as such, and
* additional patterns were added later.
*/
ResourceDescriptor_History[ResourceDescriptor_History["ORIGINALLY_SINGLE_PATTERN"] = 1] = "ORIGINALLY_SINGLE_PATTERN";
/**
* FUTURE_MULTI_PATTERN - The resource has one pattern, but the API owner expects to add more
* later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
* that from being necessary once there are multiple patterns.)
*/
ResourceDescriptor_History[ResourceDescriptor_History["FUTURE_MULTI_PATTERN"] = 2] = "FUTURE_MULTI_PATTERN";
ResourceDescriptor_History[ResourceDescriptor_History["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ResourceDescriptor_History || (ResourceDescriptor_History = {}));
export function resourceDescriptor_HistoryFromJSON(object) {
switch (object) {
case 0:
case "HISTORY_UNSPECIFIED":
return ResourceDescriptor_History.HISTORY_UNSPECIFIED;
case 1:
case "ORIGINALLY_SINGLE_PATTERN":
return ResourceDescriptor_History.ORIGINALLY_SINGLE_PATTERN;
case 2:
case "FUTURE_MULTI_PATTERN":
return ResourceDescriptor_History.FUTURE_MULTI_PATTERN;
case -1:
case "UNRECOGNIZED":
default:
return ResourceDescriptor_History.UNRECOGNIZED;
}
}
export function resourceDescriptor_HistoryToJSON(object) {
switch (object) {
case ResourceDescriptor_History.HISTORY_UNSPECIFIED:
return "HISTORY_UNSPECIFIED";
case ResourceDescriptor_History.ORIGINALLY_SINGLE_PATTERN:
return "ORIGINALLY_SINGLE_PATTERN";
case ResourceDescriptor_History.FUTURE_MULTI_PATTERN:
return "FUTURE_MULTI_PATTERN";
case ResourceDescriptor_History.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** A flag representing a specific style that a resource claims to conform to. */
export var ResourceDescriptor_Style;
(function (ResourceDescriptor_Style) {
/** STYLE_UNSPECIFIED - The unspecified value. Do not use. */
ResourceDescriptor_Style[ResourceDescriptor_Style["STYLE_UNSPECIFIED"] = 0] = "STYLE_UNSPECIFIED";
/**
* DECLARATIVE_FRIENDLY - This resource is intended to be "declarative-friendly".
*
* Declarative-friendly resources must be more strictly consistent, and
* setting this to true communicates to tools that this resource should
* adhere to declarative-friendly expectations.
*
* Note: This is used by the API linter (linter.aip.dev) to enable
* additional checks.
*/
ResourceDescriptor_Style[ResourceDescriptor_Style["DECLARATIVE_FRIENDLY"] = 1] = "DECLARATIVE_FRIENDLY";
ResourceDescriptor_Style[ResourceDescriptor_Style["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ResourceDescriptor_Style || (ResourceDescriptor_Style = {}));
export function resourceDescriptor_StyleFromJSON(object) {
switch (object) {
case 0:
case "STYLE_UNSPECIFIED":
return ResourceDescriptor_Style.STYLE_UNSPECIFIED;
case 1:
case "DECLARATIVE_FRIENDLY":
return ResourceDescriptor_Style.DECLARATIVE_FRIENDLY;
case -1:
case "UNRECOGNIZED":
default:
return ResourceDescriptor_Style.UNRECOGNIZED;
}
}
export function resourceDescriptor_StyleToJSON(object) {
switch (object) {
case ResourceDescriptor_Style.STYLE_UNSPECIFIED:
return "STYLE_UNSPECIFIED";
case ResourceDescriptor_Style.DECLARATIVE_FRIENDLY:
return "DECLARATIVE_FRIENDLY";
case ResourceDescriptor_Style.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseResourceDescriptor() {
return { type: "", pattern: [], name_field: "", history: 0, plural: "", singular: "", style: [] };
}
export const ResourceDescriptor = {
encode(message, writer = _m0.Writer.create()) {
if (message.type !== undefined && message.type !== "") {
writer.uint32(10).string(message.type);
}
if (message.pattern !== undefined && message.pattern.length !== 0) {
for (const v of message.pattern) {
writer.uint32(18).string(v);
}
}
if (message.name_field !== undefined && message.name_field !== "") {
writer.uint32(26).string(message.name_field);
}
if (message.history !== undefined && message.history !== 0) {
writer.uint32(32).int32(message.history);
}
if (message.plural !== undefined && message.plural !== "") {
writer.uint32(42).string(message.plural);
}
if (message.singular !== undefined && message.singular !== "") {
writer.uint32(50).string(message.singular);
}
if (message.style !== undefined && message.style.length !== 0) {
writer.uint32(82).fork();
for (const v of message.style) {
writer.int32(v);
}
writer.ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResourceDescriptor();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.type = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.pattern.push(reader.string());
continue;
case 3:
if (tag !== 26) {
break;
}
message.name_field = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.history = reader.int32();
continue;
case 5:
if (tag !== 42) {
break;
}
message.plural = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.singular = reader.string();
continue;
case 10:
if (tag === 80) {
message.style.push(reader.int32());
continue;
}
if (tag === 82) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.style.push(reader.int32());
}
continue;
}
break;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
type: isSet(object.type) ? globalThis.String(object.type) : "",
pattern: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.pattern) ? object.pattern.map((e) => globalThis.String(e)) : [],
name_field: isSet(object.name_field) ? globalThis.String(object.name_field) : "",
history: isSet(object.history) ? resourceDescriptor_HistoryFromJSON(object.history) : 0,
plural: isSet(object.plural) ? globalThis.String(object.plural) : "",
singular: isSet(object.singular) ? globalThis.String(object.singular) : "",
style: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.style)
? object.style.map((e) => resourceDescriptor_StyleFromJSON(e))
: [],
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if (message.type !== undefined && message.type !== "") {
obj.type = message.type;
}
if ((_a = message.pattern) === null || _a === void 0 ? void 0 : _a.length) {
obj.pattern = message.pattern;
}
if (message.name_field !== undefined && message.name_field !== "") {
obj.name_field = message.name_field;
}
if (message.history !== undefined && message.history !== 0) {
obj.history = resourceDescriptor_HistoryToJSON(message.history);
}
if (message.plural !== undefined && message.plural !== "") {
obj.plural = message.plural;
}
if (message.singular !== undefined && message.singular !== "") {
obj.singular = message.singular;
}
if ((_b = message.style) === null || _b === void 0 ? void 0 : _b.length) {
obj.style = message.style.map((e) => resourceDescriptor_StyleToJSON(e));
}
return obj;
},
create(base) {
return ResourceDescriptor.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g;
const message = createBaseResourceDescriptor();
message.type = (_a = object.type) !== null && _a !== void 0 ? _a : "";
message.pattern = ((_b = object.pattern) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
message.name_field = (_c = object.name_field) !== null && _c !== void 0 ? _c : "";
message.history = (_d = object.history) !== null && _d !== void 0 ? _d : 0;
message.plural = (_e = object.plural) !== null && _e !== void 0 ? _e : "";
message.singular = (_f = object.singular) !== null && _f !== void 0 ? _f : "";
message.style = ((_g = object.style) === null || _g === void 0 ? void 0 : _g.map((e) => e)) || [];
return message;
},
};
function createBaseResourceReference() {
return { type: "", child_type: "" };
}
export const ResourceReference = {
encode(message, writer = _m0.Writer.create()) {
if (message.type !== undefined && message.type !== "") {
writer.uint32(10).string(message.type);
}
if (message.child_type !== undefined && message.child_type !== "") {
writer.uint32(18).string(message.child_type);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseResourceReference();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.type = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.child_type = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
type: isSet(object.type) ? globalThis.String(object.type) : "",
child_type: isSet(object.child_type) ? globalThis.String(object.child_type) : "",
};
},
toJSON(message) {
const obj = {};
if (message.type !== undefined && message.type !== "") {
obj.type = message.type;
}
if (message.child_type !== undefined && message.child_type !== "") {
obj.child_type = message.child_type;
}
return obj;
},
create(base) {
return ResourceReference.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseResourceReference();
message.type = (_a = object.type) !== null && _a !== void 0 ? _a : "";
message.child_type = (_b = object.child_type) !== null && _b !== void 0 ? _b : "";
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}