UNPKG

@animeapis/credentials

Version:

Animeshon Credentials API Client for Node.js

859 lines (783 loc) 1.19 MB
// Copyright 2022 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").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._animeapis_credentials_protos || ($protobuf.roots._animeapis_credentials_protos = {}); $root.animeshon = (function() { /** * Namespace animeshon. * @exports animeshon * @namespace */ var animeshon = {}; animeshon.credentials = (function() { /** * Namespace credentials. * @memberof animeshon * @namespace */ var credentials = {}; credentials.v1alpha1 = (function() { /** * Namespace v1alpha1. * @memberof animeshon.credentials * @namespace */ var v1alpha1 = {}; v1alpha1.Keeper = (function() { /** * Constructs a new Keeper service. * @memberof animeshon.credentials.v1alpha1 * @classdesc Represents a Keeper * @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 Keeper(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } (Keeper.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Keeper; /** * Creates new Keeper service using the specified rpc implementation. * @function create * @memberof animeshon.credentials.v1alpha1.Keeper * @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 {Keeper} RPC service. Useful where requests and/or responses are streamed. */ Keeper.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** * Callback as used by {@link animeshon.credentials.v1alpha1.Keeper#getCredentials}. * @memberof animeshon.credentials.v1alpha1.Keeper * @typedef GetCredentialsCallback * @type {function} * @param {Error|null} error Error, if any * @param {animeshon.credentials.v1alpha1.Credentials} [response] Credentials */ /** * Calls GetCredentials. * @function getCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IGetCredentialsRequest} request GetCredentialsRequest message or plain object * @param {animeshon.credentials.v1alpha1.Keeper.GetCredentialsCallback} callback Node-style callback called with the error, if any, and Credentials * @returns {undefined} * @variation 1 */ Object.defineProperty(Keeper.prototype.getCredentials = function getCredentials(request, callback) { return this.rpcCall(getCredentials, $root.animeshon.credentials.v1alpha1.GetCredentialsRequest, $root.animeshon.credentials.v1alpha1.Credentials, request, callback); }, "name", { value: "GetCredentials" }); /** * Calls GetCredentials. * @function getCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IGetCredentialsRequest} request GetCredentialsRequest message or plain object * @returns {Promise<animeshon.credentials.v1alpha1.Credentials>} Promise * @variation 2 */ /** * Callback as used by {@link animeshon.credentials.v1alpha1.Keeper#listCredentials}. * @memberof animeshon.credentials.v1alpha1.Keeper * @typedef ListCredentialsCallback * @type {function} * @param {Error|null} error Error, if any * @param {animeshon.credentials.v1alpha1.ListCredentialsResponse} [response] ListCredentialsResponse */ /** * Calls ListCredentials. * @function listCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IListCredentialsRequest} request ListCredentialsRequest message or plain object * @param {animeshon.credentials.v1alpha1.Keeper.ListCredentialsCallback} callback Node-style callback called with the error, if any, and ListCredentialsResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Keeper.prototype.listCredentials = function listCredentials(request, callback) { return this.rpcCall(listCredentials, $root.animeshon.credentials.v1alpha1.ListCredentialsRequest, $root.animeshon.credentials.v1alpha1.ListCredentialsResponse, request, callback); }, "name", { value: "ListCredentials" }); /** * Calls ListCredentials. * @function listCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IListCredentialsRequest} request ListCredentialsRequest message or plain object * @returns {Promise<animeshon.credentials.v1alpha1.ListCredentialsResponse>} Promise * @variation 2 */ /** * Callback as used by {@link animeshon.credentials.v1alpha1.Keeper#createCredentials}. * @memberof animeshon.credentials.v1alpha1.Keeper * @typedef CreateCredentialsCallback * @type {function} * @param {Error|null} error Error, if any * @param {animeshon.credentials.v1alpha1.Credentials} [response] Credentials */ /** * Calls CreateCredentials. * @function createCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.ICreateCredentialsRequest} request CreateCredentialsRequest message or plain object * @param {animeshon.credentials.v1alpha1.Keeper.CreateCredentialsCallback} callback Node-style callback called with the error, if any, and Credentials * @returns {undefined} * @variation 1 */ Object.defineProperty(Keeper.prototype.createCredentials = function createCredentials(request, callback) { return this.rpcCall(createCredentials, $root.animeshon.credentials.v1alpha1.CreateCredentialsRequest, $root.animeshon.credentials.v1alpha1.Credentials, request, callback); }, "name", { value: "CreateCredentials" }); /** * Calls CreateCredentials. * @function createCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.ICreateCredentialsRequest} request CreateCredentialsRequest message or plain object * @returns {Promise<animeshon.credentials.v1alpha1.Credentials>} Promise * @variation 2 */ /** * Callback as used by {@link animeshon.credentials.v1alpha1.Keeper#deleteCredentials}. * @memberof animeshon.credentials.v1alpha1.Keeper * @typedef DeleteCredentialsCallback * @type {function} * @param {Error|null} error Error, if any * @param {google.protobuf.Empty} [response] Empty */ /** * Calls DeleteCredentials. * @function deleteCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IDeleteCredentialsRequest} request DeleteCredentialsRequest message or plain object * @param {animeshon.credentials.v1alpha1.Keeper.DeleteCredentialsCallback} callback Node-style callback called with the error, if any, and Empty * @returns {undefined} * @variation 1 */ Object.defineProperty(Keeper.prototype.deleteCredentials = function deleteCredentials(request, callback) { return this.rpcCall(deleteCredentials, $root.animeshon.credentials.v1alpha1.DeleteCredentialsRequest, $root.google.protobuf.Empty, request, callback); }, "name", { value: "DeleteCredentials" }); /** * Calls DeleteCredentials. * @function deleteCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IDeleteCredentialsRequest} request DeleteCredentialsRequest message or plain object * @returns {Promise<google.protobuf.Empty>} Promise * @variation 2 */ /** * Callback as used by {@link animeshon.credentials.v1alpha1.Keeper#actAsCredentials}. * @memberof animeshon.credentials.v1alpha1.Keeper * @typedef ActAsCredentialsCallback * @type {function} * @param {Error|null} error Error, if any * @param {animeshon.credentials.v1alpha1.ActAsCredentialsResponse} [response] ActAsCredentialsResponse */ /** * Calls ActAsCredentials. * @function actAsCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IActAsCredentialsRequest} request ActAsCredentialsRequest message or plain object * @param {animeshon.credentials.v1alpha1.Keeper.ActAsCredentialsCallback} callback Node-style callback called with the error, if any, and ActAsCredentialsResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(Keeper.prototype.actAsCredentials = function actAsCredentials(request, callback) { return this.rpcCall(actAsCredentials, $root.animeshon.credentials.v1alpha1.ActAsCredentialsRequest, $root.animeshon.credentials.v1alpha1.ActAsCredentialsResponse, request, callback); }, "name", { value: "ActAsCredentials" }); /** * Calls ActAsCredentials. * @function actAsCredentials * @memberof animeshon.credentials.v1alpha1.Keeper * @instance * @param {animeshon.credentials.v1alpha1.IActAsCredentialsRequest} request ActAsCredentialsRequest message or plain object * @returns {Promise<animeshon.credentials.v1alpha1.ActAsCredentialsResponse>} Promise * @variation 2 */ return Keeper; })(); v1alpha1.OAuth2 = (function() { /** * Constructs a new OAuth2 service. * @memberof animeshon.credentials.v1alpha1 * @classdesc Represents a OAuth2 * @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 OAuth2(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } (OAuth2.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = OAuth2; /** * Creates new OAuth2 service using the specified rpc implementation. * @function create * @memberof animeshon.credentials.v1alpha1.OAuth2 * @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 {OAuth2} RPC service. Useful where requests and/or responses are streamed. */ OAuth2.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** * Callback as used by {@link animeshon.credentials.v1alpha1.OAuth2#signIn}. * @memberof animeshon.credentials.v1alpha1.OAuth2 * @typedef SignInCallback * @type {function} * @param {Error|null} error Error, if any * @param {animeshon.credentials.v1alpha1.SignInResponse} [response] SignInResponse */ /** * Calls SignIn. * @function signIn * @memberof animeshon.credentials.v1alpha1.OAuth2 * @instance * @param {animeshon.credentials.v1alpha1.ISignInRequest} request SignInRequest message or plain object * @param {animeshon.credentials.v1alpha1.OAuth2.SignInCallback} callback Node-style callback called with the error, if any, and SignInResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(OAuth2.prototype.signIn = function signIn(request, callback) { return this.rpcCall(signIn, $root.animeshon.credentials.v1alpha1.SignInRequest, $root.animeshon.credentials.v1alpha1.SignInResponse, request, callback); }, "name", { value: "SignIn" }); /** * Calls SignIn. * @function signIn * @memberof animeshon.credentials.v1alpha1.OAuth2 * @instance * @param {animeshon.credentials.v1alpha1.ISignInRequest} request SignInRequest message or plain object * @returns {Promise<animeshon.credentials.v1alpha1.SignInResponse>} Promise * @variation 2 */ /** * Callback as used by {@link animeshon.credentials.v1alpha1.OAuth2#exchange}. * @memberof animeshon.credentials.v1alpha1.OAuth2 * @typedef ExchangeCallback * @type {function} * @param {Error|null} error Error, if any * @param {animeshon.credentials.v1alpha1.ExchangeResponse} [response] ExchangeResponse */ /** * Calls Exchange. * @function exchange * @memberof animeshon.credentials.v1alpha1.OAuth2 * @instance * @param {animeshon.credentials.v1alpha1.IExchangeRequest} request ExchangeRequest message or plain object * @param {animeshon.credentials.v1alpha1.OAuth2.ExchangeCallback} callback Node-style callback called with the error, if any, and ExchangeResponse * @returns {undefined} * @variation 1 */ Object.defineProperty(OAuth2.prototype.exchange = function exchange(request, callback) { return this.rpcCall(exchange, $root.animeshon.credentials.v1alpha1.ExchangeRequest, $root.animeshon.credentials.v1alpha1.ExchangeResponse, request, callback); }, "name", { value: "Exchange" }); /** * Calls Exchange. * @function exchange * @memberof animeshon.credentials.v1alpha1.OAuth2 * @instance * @param {animeshon.credentials.v1alpha1.IExchangeRequest} request ExchangeRequest message or plain object * @returns {Promise<animeshon.credentials.v1alpha1.ExchangeResponse>} Promise * @variation 2 */ return OAuth2; })(); v1alpha1.Credentials = (function() { /** * Properties of a Credentials. * @memberof animeshon.credentials.v1alpha1 * @interface ICredentials * @property {string|null} [name] Credentials name * @property {string|null} [uid] Credentials uid * @property {string|null} [principal] Credentials principal * @property {google.protobuf.IBoolValue|null} [active] Credentials active * @property {animeshon.credentials.v1alpha1.Credentials.AuthenticationMethod|null} [authenticationMethod] Credentials authenticationMethod * @property {google.protobuf.ITimestamp|null} [lastActivityTime] Credentials lastActivityTime */ /** * Constructs a new Credentials. * @memberof animeshon.credentials.v1alpha1 * @classdesc Represents a Credentials. * @implements ICredentials * @constructor * @param {animeshon.credentials.v1alpha1.ICredentials=} [properties] Properties to set */ function Credentials(properties) { 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]]; } /** * Credentials name. * @member {string} name * @memberof animeshon.credentials.v1alpha1.Credentials * @instance */ Credentials.prototype.name = ""; /** * Credentials uid. * @member {string} uid * @memberof animeshon.credentials.v1alpha1.Credentials * @instance */ Credentials.prototype.uid = ""; /** * Credentials principal. * @member {string} principal * @memberof animeshon.credentials.v1alpha1.Credentials * @instance */ Credentials.prototype.principal = ""; /** * Credentials active. * @member {google.protobuf.IBoolValue|null|undefined} active * @memberof animeshon.credentials.v1alpha1.Credentials * @instance */ Credentials.prototype.active = null; /** * Credentials authenticationMethod. * @member {animeshon.credentials.v1alpha1.Credentials.AuthenticationMethod} authenticationMethod * @memberof animeshon.credentials.v1alpha1.Credentials * @instance */ Credentials.prototype.authenticationMethod = 0; /** * Credentials lastActivityTime. * @member {google.protobuf.ITimestamp|null|undefined} lastActivityTime * @memberof animeshon.credentials.v1alpha1.Credentials * @instance */ Credentials.prototype.lastActivityTime = null; /** * Creates a new Credentials instance using the specified properties. * @function create * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {animeshon.credentials.v1alpha1.ICredentials=} [properties] Properties to set * @returns {animeshon.credentials.v1alpha1.Credentials} Credentials instance */ Credentials.create = function create(properties) { return new Credentials(properties); }; /** * Encodes the specified Credentials message. Does not implicitly {@link animeshon.credentials.v1alpha1.Credentials.verify|verify} messages. * @function encode * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {animeshon.credentials.v1alpha1.ICredentials} message Credentials message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Credentials.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.uid != null && Object.hasOwnProperty.call(message, "uid")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.uid); if (message.principal != null && Object.hasOwnProperty.call(message, "principal")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.principal); if (message.active != null && Object.hasOwnProperty.call(message, "active")) $root.google.protobuf.BoolValue.encode(message.active, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.authenticationMethod != null && Object.hasOwnProperty.call(message, "authenticationMethod")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.authenticationMethod); if (message.lastActivityTime != null && Object.hasOwnProperty.call(message, "lastActivityTime")) $root.google.protobuf.Timestamp.encode(message.lastActivityTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** * Encodes the specified Credentials message, length delimited. Does not implicitly {@link animeshon.credentials.v1alpha1.Credentials.verify|verify} messages. * @function encodeDelimited * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {animeshon.credentials.v1alpha1.ICredentials} message Credentials message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Credentials.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a Credentials message from the specified reader or buffer. * @function decode * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {animeshon.credentials.v1alpha1.Credentials} Credentials * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Credentials.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.animeshon.credentials.v1alpha1.Credentials(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.name = reader.string(); break; case 2: message.uid = reader.string(); break; case 3: message.principal = reader.string(); break; case 4: message.active = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); break; case 5: message.authenticationMethod = reader.int32(); break; case 6: message.lastActivityTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a Credentials message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {animeshon.credentials.v1alpha1.Credentials} Credentials * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Credentials.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** * Verifies a Credentials message. * @function verify * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {Object.<string,*>} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ Credentials.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.uid != null && message.hasOwnProperty("uid")) if (!$util.isString(message.uid)) return "uid: string expected"; if (message.principal != null && message.hasOwnProperty("principal")) if (!$util.isString(message.principal)) return "principal: string expected"; if (message.active != null && message.hasOwnProperty("active")) { var error = $root.google.protobuf.BoolValue.verify(message.active); if (error) return "active." + error; } if (message.authenticationMethod != null && message.hasOwnProperty("authenticationMethod")) switch (message.authenticationMethod) { default: return "authenticationMethod: enum value expected"; case 0: case 1: case 2: break; } if (message.lastActivityTime != null && message.hasOwnProperty("lastActivityTime")) { var error = $root.google.protobuf.Timestamp.verify(message.lastActivityTime); if (error) return "lastActivityTime." + error; } return null; }; /** * Creates a Credentials message from a plain object. Also converts values to their respective internal types. * @function fromObject * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {Object.<string,*>} object Plain object * @returns {animeshon.credentials.v1alpha1.Credentials} Credentials */ Credentials.fromObject = function fromObject(object) { if (object instanceof $root.animeshon.credentials.v1alpha1.Credentials) return object; var message = new $root.animeshon.credentials.v1alpha1.Credentials(); if (object.name != null) message.name = String(object.name); if (object.uid != null) message.uid = String(object.uid); if (object.principal != null) message.principal = String(object.principal); if (object.active != null) { if (typeof object.active !== "object") throw TypeError(".animeshon.credentials.v1alpha1.Credentials.active: object expected"); message.active = $root.google.protobuf.BoolValue.fromObject(object.active); } switch (object.authenticationMethod) { case "AUTHENTICATION_METHOD_UNSPECIFIED": case 0: message.authenticationMethod = 0; break; case "BASIC": case 1: message.authenticationMethod = 1; break; case "OAUTH2": case 2: message.authenticationMethod = 2; break; } if (object.lastActivityTime != null) { if (typeof object.lastActivityTime !== "object") throw TypeError(".animeshon.credentials.v1alpha1.Credentials.lastActivityTime: object expected"); message.lastActivityTime = $root.google.protobuf.Timestamp.fromObject(object.lastActivityTime); } return message; }; /** * Creates a plain object from a Credentials message. Also converts values to other types if specified. * @function toObject * @memberof animeshon.credentials.v1alpha1.Credentials * @static * @param {animeshon.credentials.v1alpha1.Credentials} message Credentials * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.<string,*>} Plain object */ Credentials.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { object.name = ""; object.uid = ""; object.principal = ""; object.active = null; object.authenticationMethod = options.enums === String ? "AUTHENTICATION_METHOD_UNSPECIFIED" : 0; object.lastActivityTime = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; if (message.uid != null && message.hasOwnProperty("uid")) object.uid = message.uid; if (message.principal != null && message.hasOwnProperty("principal")) object.principal = message.principal; if (message.active != null && message.hasOwnProperty("active")) object.active = $root.google.protobuf.BoolValue.toObject(message.active, options); if (message.authenticationMethod != null && message.hasOwnProperty("authenticationMethod")) object.authenticationMethod = options.enums === String ? $root.animeshon.credentials.v1alpha1.Credentials.AuthenticationMethod[message.authenticationMethod] : message.authenticationMethod; if (message.lastActivityTime != null && message.hasOwnProperty("lastActivityTime")) object.lastActivityTime = $root.google.protobuf.Timestamp.toObject(message.lastActivityTime, options); return object; }; /** * Converts this Credentials to JSON. * @function toJSON * @memberof animeshon.credentials.v1alpha1.Credentials * @instance * @returns {Object.<string,*>} JSON object */ Credentials.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** * AuthenticationMethod enum. * @name animeshon.credentials.v1alpha1.Credentials.AuthenticationMethod * @enum {number} * @property {number} AUTHENTICATION_METHOD_UNSPECIFIED=0 AUTHENTICATION_METHOD_UNSPECIFIED value * @property {number} BASIC=1 BASIC value * @property {number} OAUTH2=2 OAUTH2 value */ Credentials.AuthenticationMethod = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "AUTHENTICATION_METHOD_UNSPECIFIED"] = 0; values[valuesById[1] = "BASIC"] = 1; values[valuesById[2] = "OAUTH2"] = 2; return values; })(); return Credentials; })(); v1alpha1.CreateCredentialsRequest = (function() { /** * Properties of a CreateCredentialsRequest. * @memberof animeshon.credentials.v1alpha1 * @interface ICreateCredentialsRequest * @property {animeshon.credentials.v1alpha1.ICredentials|null} [credentials] CreateCredentialsRequest credentials * @property {animeshon.credentials.v1alpha1.CreateCredentialsRequest.IBasic|null} [basic] CreateCredentialsRequest basic * @property {animeshon.credentials.v1alpha1.CreateCredentialsRequest.IOAuth2|null} [oauth2] CreateCredentialsRequest oauth2 */ /** * Constructs a new CreateCredentialsRequest. * @memberof animeshon.credentials.v1alpha1 * @classdesc Represents a CreateCredentialsRequest. * @implements ICreateCredentialsRequest * @constructor * @param {animeshon.credentials.v1alpha1.ICreateCredentialsRequest=} [properties] Properties to set */ function CreateCredentialsRequest(properties) { 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]]; } /** * CreateCredentialsRequest credentials. * @member {animeshon.credentials.v1alpha1.ICredentials|null|undefined} credentials * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @instance */ CreateCredentialsRequest.prototype.credentials = null; /** * CreateCredentialsRequest basic. * @member {animeshon.credentials.v1alpha1.CreateCredentialsRequest.IBasic|null|undefined} basic * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @instance */ CreateCredentialsRequest.prototype.basic = null; /** * CreateCredentialsRequest oauth2. * @member {animeshon.credentials.v1alpha1.CreateCredentialsRequest.IOAuth2|null|undefined} oauth2 * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @instance */ CreateCredentialsRequest.prototype.oauth2 = null; // OneOf field names bound to virtual getters and setters var $oneOfFields; /** * CreateCredentialsRequest payload. * @member {"basic"|"oauth2"|undefined} payload * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @instance */ Object.defineProperty(CreateCredentialsRequest.prototype, "payload", { get: $util.oneOfGetter($oneOfFields = ["basic", "oauth2"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new CreateCredentialsRequest instance using the specified properties. * @function create * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @static * @param {animeshon.credentials.v1alpha1.ICreateCredentialsRequest=} [properties] Properties to set * @returns {animeshon.credentials.v1alpha1.CreateCredentialsRequest} CreateCredentialsRequest instance */ CreateCredentialsRequest.create = function create(properties) { return new CreateCredentialsRequest(properties); }; /** * Encodes the specified CreateCredentialsRequest message. Does not implicitly {@link animeshon.credentials.v1alpha1.CreateCredentialsRequest.verify|verify} messages. * @function encode * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @static * @param {animeshon.credentials.v1alpha1.ICreateCredentialsRequest} message CreateCredentialsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CreateCredentialsRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.credentials != null && Object.hasOwnProperty.call(message, "credentials")) $root.animeshon.credentials.v1alpha1.Credentials.encode(message.credentials, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.basic != null && Object.hasOwnProperty.call(message, "basic")) $root.animeshon.credentials.v1alpha1.CreateCredentialsRequest.Basic.encode(message.basic, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.oauth2 != null && Object.hasOwnProperty.call(message, "oauth2")) $root.animeshon.credentials.v1alpha1.CreateCredentialsRequest.OAuth2.encode(message.oauth2, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** * Encodes the specified CreateCredentialsRequest message, length delimited. Does not implicitly {@link animeshon.credentials.v1alpha1.CreateCredentialsRequest.verify|verify} messages. * @function encodeDelimited * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @static * @param {animeshon.credentials.v1alpha1.ICreateCredentialsRequest} message CreateCredentialsRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ CreateCredentialsRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** * Decodes a CreateCredentialsRequest message from the specified reader or buffer. * @function decode * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand * @returns {animeshon.credentials.v1alpha1.CreateCredentialsRequest} CreateCredentialsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CreateCredentialsRequest.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.animeshon.credentials.v1alpha1.CreateCredentialsRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: message.credentials = $root.animeshon.credentials.v1alpha1.Credentials.decode(reader, reader.uint32()); break; case 2: message.basic = $root.animeshon.credentials.v1alpha1.CreateCredentialsRequest.Basic.decode(reader, reader.uint32()); break; case 3: message.oauth2 = $root.animeshon.credentials.v1alpha1.CreateCredentialsRequest.OAuth2.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }; /** * Decodes a CreateCredentialsRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited * @memberof animeshon.credentials.v1alpha1.CreateCredentialsRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @returns {animeshon.credentials.v1alpha1.CreateCredentialsRequest} CreateCredentialsRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ CreateCredentialsRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Read