@google-cloud/essential-contacts
Version:
Essential contacts client for Node.js
811 lines (747 loc) • 1.21 MB
JavaScript
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal);
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots._google_cloud_essential_contacts_protos || ($protobuf.roots._google_cloud_essential_contacts_protos = {});
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.cloud = (function() {
/**
* Namespace cloud.
* @memberof google
* @namespace
*/
var cloud = {};
cloud.essentialcontacts = (function() {
/**
* Namespace essentialcontacts.
* @memberof google.cloud
* @namespace
*/
var essentialcontacts = {};
essentialcontacts.v1 = (function() {
/**
* Namespace v1.
* @memberof google.cloud.essentialcontacts
* @namespace
*/
var v1 = {};
/**
* NotificationCategory enum.
* @name google.cloud.essentialcontacts.v1.NotificationCategory
* @enum {number}
* @property {number} NOTIFICATION_CATEGORY_UNSPECIFIED=0 NOTIFICATION_CATEGORY_UNSPECIFIED value
* @property {number} ALL=2 ALL value
* @property {number} SUSPENSION=3 SUSPENSION value
* @property {number} SECURITY=5 SECURITY value
* @property {number} TECHNICAL=6 TECHNICAL value
* @property {number} BILLING=7 BILLING value
* @property {number} LEGAL=8 LEGAL value
* @property {number} PRODUCT_UPDATES=9 PRODUCT_UPDATES value
* @property {number} TECHNICAL_INCIDENTS=10 TECHNICAL_INCIDENTS value
*/
v1.NotificationCategory = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "NOTIFICATION_CATEGORY_UNSPECIFIED"] = 0;
values[valuesById[2] = "ALL"] = 2;
values[valuesById[3] = "SUSPENSION"] = 3;
values[valuesById[5] = "SECURITY"] = 5;
values[valuesById[6] = "TECHNICAL"] = 6;
values[valuesById[7] = "BILLING"] = 7;
values[valuesById[8] = "LEGAL"] = 8;
values[valuesById[9] = "PRODUCT_UPDATES"] = 9;
values[valuesById[10] = "TECHNICAL_INCIDENTS"] = 10;
return values;
})();
/**
* ValidationState enum.
* @name google.cloud.essentialcontacts.v1.ValidationState
* @enum {number}
* @property {number} VALIDATION_STATE_UNSPECIFIED=0 VALIDATION_STATE_UNSPECIFIED value
* @property {number} VALID=1 VALID value
* @property {number} INVALID=2 INVALID value
*/
v1.ValidationState = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "VALIDATION_STATE_UNSPECIFIED"] = 0;
values[valuesById[1] = "VALID"] = 1;
values[valuesById[2] = "INVALID"] = 2;
return values;
})();
v1.EssentialContactsService = (function() {
/**
* Constructs a new EssentialContactsService service.
* @memberof google.cloud.essentialcontacts.v1
* @classdesc Represents an EssentialContactsService
* @extends $protobuf.rpc.Service
* @constructor
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
*/
function EssentialContactsService(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(EssentialContactsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = EssentialContactsService;
/**
* Creates new EssentialContactsService service using the specified rpc implementation.
* @function create
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @static
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
* @returns {EssentialContactsService} RPC service. Useful where requests and/or responses are streamed.
*/
EssentialContactsService.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|createContact}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef CreateContactCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.essentialcontacts.v1.Contact} [response] Contact
*/
/**
* Calls CreateContact.
* @function createContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.ICreateContactRequest} request CreateContactRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.CreateContactCallback} callback Node-style callback called with the error, if any, and Contact
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.createContact = function createContact(request, callback) {
return this.rpcCall(createContact, $root.google.cloud.essentialcontacts.v1.CreateContactRequest, $root.google.cloud.essentialcontacts.v1.Contact, request, callback);
}, "name", { value: "CreateContact" });
/**
* Calls CreateContact.
* @function createContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.ICreateContactRequest} request CreateContactRequest message or plain object
* @returns {Promise<google.cloud.essentialcontacts.v1.Contact>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|updateContact}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef UpdateContactCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.essentialcontacts.v1.Contact} [response] Contact
*/
/**
* Calls UpdateContact.
* @function updateContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IUpdateContactRequest} request UpdateContactRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.UpdateContactCallback} callback Node-style callback called with the error, if any, and Contact
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.updateContact = function updateContact(request, callback) {
return this.rpcCall(updateContact, $root.google.cloud.essentialcontacts.v1.UpdateContactRequest, $root.google.cloud.essentialcontacts.v1.Contact, request, callback);
}, "name", { value: "UpdateContact" });
/**
* Calls UpdateContact.
* @function updateContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IUpdateContactRequest} request UpdateContactRequest message or plain object
* @returns {Promise<google.cloud.essentialcontacts.v1.Contact>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|listContacts}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef ListContactsCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.essentialcontacts.v1.ListContactsResponse} [response] ListContactsResponse
*/
/**
* Calls ListContacts.
* @function listContacts
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IListContactsRequest} request ListContactsRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.ListContactsCallback} callback Node-style callback called with the error, if any, and ListContactsResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.listContacts = function listContacts(request, callback) {
return this.rpcCall(listContacts, $root.google.cloud.essentialcontacts.v1.ListContactsRequest, $root.google.cloud.essentialcontacts.v1.ListContactsResponse, request, callback);
}, "name", { value: "ListContacts" });
/**
* Calls ListContacts.
* @function listContacts
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IListContactsRequest} request ListContactsRequest message or plain object
* @returns {Promise<google.cloud.essentialcontacts.v1.ListContactsResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|getContact}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef GetContactCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.essentialcontacts.v1.Contact} [response] Contact
*/
/**
* Calls GetContact.
* @function getContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IGetContactRequest} request GetContactRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.GetContactCallback} callback Node-style callback called with the error, if any, and Contact
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.getContact = function getContact(request, callback) {
return this.rpcCall(getContact, $root.google.cloud.essentialcontacts.v1.GetContactRequest, $root.google.cloud.essentialcontacts.v1.Contact, request, callback);
}, "name", { value: "GetContact" });
/**
* Calls GetContact.
* @function getContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IGetContactRequest} request GetContactRequest message or plain object
* @returns {Promise<google.cloud.essentialcontacts.v1.Contact>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|deleteContact}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef DeleteContactCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.protobuf.Empty} [response] Empty
*/
/**
* Calls DeleteContact.
* @function deleteContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IDeleteContactRequest} request DeleteContactRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.DeleteContactCallback} callback Node-style callback called with the error, if any, and Empty
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.deleteContact = function deleteContact(request, callback) {
return this.rpcCall(deleteContact, $root.google.cloud.essentialcontacts.v1.DeleteContactRequest, $root.google.protobuf.Empty, request, callback);
}, "name", { value: "DeleteContact" });
/**
* Calls DeleteContact.
* @function deleteContact
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IDeleteContactRequest} request DeleteContactRequest message or plain object
* @returns {Promise<google.protobuf.Empty>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|computeContacts}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef ComputeContactsCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.essentialcontacts.v1.ComputeContactsResponse} [response] ComputeContactsResponse
*/
/**
* Calls ComputeContacts.
* @function computeContacts
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IComputeContactsRequest} request ComputeContactsRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.ComputeContactsCallback} callback Node-style callback called with the error, if any, and ComputeContactsResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.computeContacts = function computeContacts(request, callback) {
return this.rpcCall(computeContacts, $root.google.cloud.essentialcontacts.v1.ComputeContactsRequest, $root.google.cloud.essentialcontacts.v1.ComputeContactsResponse, request, callback);
}, "name", { value: "ComputeContacts" });
/**
* Calls ComputeContacts.
* @function computeContacts
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.IComputeContactsRequest} request ComputeContactsRequest message or plain object
* @returns {Promise<google.cloud.essentialcontacts.v1.ComputeContactsResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.essentialcontacts.v1.EssentialContactsService|sendTestMessage}.
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @typedef SendTestMessageCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.protobuf.Empty} [response] Empty
*/
/**
* Calls SendTestMessage.
* @function sendTestMessage
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.ISendTestMessageRequest} request SendTestMessageRequest message or plain object
* @param {google.cloud.essentialcontacts.v1.EssentialContactsService.SendTestMessageCallback} callback Node-style callback called with the error, if any, and Empty
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(EssentialContactsService.prototype.sendTestMessage = function sendTestMessage(request, callback) {
return this.rpcCall(sendTestMessage, $root.google.cloud.essentialcontacts.v1.SendTestMessageRequest, $root.google.protobuf.Empty, request, callback);
}, "name", { value: "SendTestMessage" });
/**
* Calls SendTestMessage.
* @function sendTestMessage
* @memberof google.cloud.essentialcontacts.v1.EssentialContactsService
* @instance
* @param {google.cloud.essentialcontacts.v1.ISendTestMessageRequest} request SendTestMessageRequest message or plain object
* @returns {Promise<google.protobuf.Empty>} Promise
* @variation 2
*/
return EssentialContactsService;
})();
v1.Contact = (function() {
/**
* Properties of a Contact.
* @memberof google.cloud.essentialcontacts.v1
* @interface IContact
* @property {string|null} [name] Contact name
* @property {string|null} [email] Contact email
* @property {Array.<google.cloud.essentialcontacts.v1.NotificationCategory>|null} [notificationCategorySubscriptions] Contact notificationCategorySubscriptions
* @property {string|null} [languageTag] Contact languageTag
* @property {google.cloud.essentialcontacts.v1.ValidationState|null} [validationState] Contact validationState
* @property {google.protobuf.ITimestamp|null} [validateTime] Contact validateTime
*/
/**
* Constructs a new Contact.
* @memberof google.cloud.essentialcontacts.v1
* @classdesc Represents a Contact.
* @implements IContact
* @constructor
* @param {google.cloud.essentialcontacts.v1.IContact=} [properties] Properties to set
*/
function Contact(properties) {
this.notificationCategorySubscriptions = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Contact name.
* @member {string} name
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
*/
Contact.prototype.name = "";
/**
* Contact email.
* @member {string} email
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
*/
Contact.prototype.email = "";
/**
* Contact notificationCategorySubscriptions.
* @member {Array.<google.cloud.essentialcontacts.v1.NotificationCategory>} notificationCategorySubscriptions
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
*/
Contact.prototype.notificationCategorySubscriptions = $util.emptyArray;
/**
* Contact languageTag.
* @member {string} languageTag
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
*/
Contact.prototype.languageTag = "";
/**
* Contact validationState.
* @member {google.cloud.essentialcontacts.v1.ValidationState} validationState
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
*/
Contact.prototype.validationState = 0;
/**
* Contact validateTime.
* @member {google.protobuf.ITimestamp|null|undefined} validateTime
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
*/
Contact.prototype.validateTime = null;
/**
* Creates a new Contact instance using the specified properties.
* @function create
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {google.cloud.essentialcontacts.v1.IContact=} [properties] Properties to set
* @returns {google.cloud.essentialcontacts.v1.Contact} Contact instance
*/
Contact.create = function create(properties) {
return new Contact(properties);
};
/**
* Encodes the specified Contact message. Does not implicitly {@link google.cloud.essentialcontacts.v1.Contact.verify|verify} messages.
* @function encode
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {google.cloud.essentialcontacts.v1.IContact} message Contact message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Contact.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
if (message.email != null && Object.hasOwnProperty.call(message, "email"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.email);
if (message.notificationCategorySubscriptions != null && message.notificationCategorySubscriptions.length) {
writer.uint32(/* id 3, wireType 2 =*/26).fork();
for (var i = 0; i < message.notificationCategorySubscriptions.length; ++i)
writer.int32(message.notificationCategorySubscriptions[i]);
writer.ldelim();
}
if (message.languageTag != null && Object.hasOwnProperty.call(message, "languageTag"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageTag);
if (message.validationState != null && Object.hasOwnProperty.call(message, "validationState"))
writer.uint32(/* id 8, wireType 0 =*/64).int32(message.validationState);
if (message.validateTime != null && Object.hasOwnProperty.call(message, "validateTime"))
$root.google.protobuf.Timestamp.encode(message.validateTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
return writer;
};
/**
* Encodes the specified Contact message, length delimited. Does not implicitly {@link google.cloud.essentialcontacts.v1.Contact.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {google.cloud.essentialcontacts.v1.IContact} message Contact message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Contact.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Contact message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.essentialcontacts.v1.Contact} Contact
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Contact.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.essentialcontacts.v1.Contact();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.name = reader.string();
break;
}
case 2: {
message.email = reader.string();
break;
}
case 3: {
if (!(message.notificationCategorySubscriptions && message.notificationCategorySubscriptions.length))
message.notificationCategorySubscriptions = [];
if ((tag & 7) === 2) {
var end2 = reader.uint32() + reader.pos;
while (reader.pos < end2)
message.notificationCategorySubscriptions.push(reader.int32());
} else
message.notificationCategorySubscriptions.push(reader.int32());
break;
}
case 4: {
message.languageTag = reader.string();
break;
}
case 8: {
message.validationState = reader.int32();
break;
}
case 9: {
message.validateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Contact message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.essentialcontacts.v1.Contact} Contact
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Contact.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Contact message.
* @function verify
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Contact.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.name != null && message.hasOwnProperty("name"))
if (!$util.isString(message.name))
return "name: string expected";
if (message.email != null && message.hasOwnProperty("email"))
if (!$util.isString(message.email))
return "email: string expected";
if (message.notificationCategorySubscriptions != null && message.hasOwnProperty("notificationCategorySubscriptions")) {
if (!Array.isArray(message.notificationCategorySubscriptions))
return "notificationCategorySubscriptions: array expected";
for (var i = 0; i < message.notificationCategorySubscriptions.length; ++i)
switch (message.notificationCategorySubscriptions[i]) {
default:
return "notificationCategorySubscriptions: enum value[] expected";
case 0:
case 2:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
break;
}
}
if (message.languageTag != null && message.hasOwnProperty("languageTag"))
if (!$util.isString(message.languageTag))
return "languageTag: string expected";
if (message.validationState != null && message.hasOwnProperty("validationState"))
switch (message.validationState) {
default:
return "validationState: enum value expected";
case 0:
case 1:
case 2:
break;
}
if (message.validateTime != null && message.hasOwnProperty("validateTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.validateTime);
if (error)
return "validateTime." + error;
}
return null;
};
/**
* Creates a Contact message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.essentialcontacts.v1.Contact} Contact
*/
Contact.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.essentialcontacts.v1.Contact)
return object;
var message = new $root.google.cloud.essentialcontacts.v1.Contact();
if (object.name != null)
message.name = String(object.name);
if (object.email != null)
message.email = String(object.email);
if (object.notificationCategorySubscriptions) {
if (!Array.isArray(object.notificationCategorySubscriptions))
throw TypeError(".google.cloud.essentialcontacts.v1.Contact.notificationCategorySubscriptions: array expected");
message.notificationCategorySubscriptions = [];
for (var i = 0; i < object.notificationCategorySubscriptions.length; ++i)
switch (object.notificationCategorySubscriptions[i]) {
default:
if (typeof object.notificationCategorySubscriptions[i] === "number") {
message.notificationCategorySubscriptions[i] = object.notificationCategorySubscriptions[i];
break;
}
case "NOTIFICATION_CATEGORY_UNSPECIFIED":
case 0:
message.notificationCategorySubscriptions[i] = 0;
break;
case "ALL":
case 2:
message.notificationCategorySubscriptions[i] = 2;
break;
case "SUSPENSION":
case 3:
message.notificationCategorySubscriptions[i] = 3;
break;
case "SECURITY":
case 5:
message.notificationCategorySubscriptions[i] = 5;
break;
case "TECHNICAL":
case 6:
message.notificationCategorySubscriptions[i] = 6;
break;
case "BILLING":
case 7:
message.notificationCategorySubscriptions[i] = 7;
break;
case "LEGAL":
case 8:
message.notificationCategorySubscriptions[i] = 8;
break;
case "PRODUCT_UPDATES":
case 9:
message.notificationCategorySubscriptions[i] = 9;
break;
case "TECHNICAL_INCIDENTS":
case 10:
message.notificationCategorySubscriptions[i] = 10;
break;
}
}
if (object.languageTag != null)
message.languageTag = String(object.languageTag);
switch (object.validationState) {
default:
if (typeof object.validationState === "number") {
message.validationState = object.validationState;
break;
}
break;
case "VALIDATION_STATE_UNSPECIFIED":
case 0:
message.validationState = 0;
break;
case "VALID":
case 1:
message.validationState = 1;
break;
case "INVALID":
case 2:
message.validationState = 2;
break;
}
if (object.validateTime != null) {
if (typeof object.validateTime !== "object")
throw TypeError(".google.cloud.essentialcontacts.v1.Contact.validateTime: object expected");
message.validateTime = $root.google.protobuf.Timestamp.fromObject(object.validateTime);
}
return message;
};
/**
* Creates a plain object from a Contact message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {google.cloud.essentialcontacts.v1.Contact} message Contact
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Contact.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.notificationCategorySubscriptions = [];
if (options.defaults) {
object.name = "";
object.email = "";
object.languageTag = "";
object.validationState = options.enums === String ? "VALIDATION_STATE_UNSPECIFIED" : 0;
object.validateTime = null;
}
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.email != null && message.hasOwnProperty("email"))
object.email = message.email;
if (message.notificationCategorySubscriptions && message.notificationCategorySubscriptions.length) {
object.notificationCategorySubscriptions = [];
for (var j = 0; j < message.notificationCategorySubscriptions.length; ++j)
object.notificationCategorySubscriptions[j] = options.enums === String ? $root.google.cloud.essentialcontacts.v1.NotificationCategory[message.notificationCategorySubscriptions[j]] === undefined ? message.notificationCategorySubscriptions[j] : $root.google.cloud.essentialcontacts.v1.NotificationCategory[message.notificationCategorySubscriptions[j]] : message.notificationCategorySubscriptions[j];
}
if (message.languageTag != null && message.hasOwnProperty("languageTag"))
object.languageTag = message.languageTag;
if (message.validationState != null && message.hasOwnProperty("validationState"))
object.validationState = options.enums === String ? $root.google.cloud.essentialcontacts.v1.ValidationState[message.validationState] === undefined ? message.validationState : $root.google.cloud.essentialcontacts.v1.ValidationState[message.validationState] : message.validationState;
if (message.validateTime != null && message.hasOwnProperty("validateTime"))
object.validateTime = $root.google.protobuf.Timestamp.toObject(message.validateTime, options);
return object;
};
/**
* Converts this Contact to JSON.
* @function toJSON
* @memberof google.cloud.essentialcontacts.v1.Contact
* @instance
* @returns {Object.<string,*>} JSON object
*/
Contact.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for Contact
* @function getTypeUrl
* @memberof google.cloud.essentialcontacts.v1.Contact
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
Contact.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.essentialcontacts.v1.Contact";
};
return Contact;
})();
v1.ListContactsRequest = (function() {
/**
* Properties of a ListContac