@assistant/actions
Version:
Actions API client for Node.js
833 lines (771 loc) • 3.36 MB
JavaScript
// Copyright 2021 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._assistant_actions_protos || ($protobuf.roots._assistant_actions_protos = {});
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.actions = (function() {
/**
* Namespace actions.
* @memberof google
* @namespace
*/
var actions = {};
actions.sdk = (function() {
/**
* Namespace sdk.
* @memberof google.actions
* @namespace
*/
var sdk = {};
sdk.v2 = (function() {
/**
* Namespace v2.
* @memberof google.actions.sdk
* @namespace
*/
var v2 = {};
v2.AccountLinking = (function() {
/**
* Properties of an AccountLinking.
* @memberof google.actions.sdk.v2
* @interface IAccountLinking
* @property {boolean|null} [enableAccountCreation] AccountLinking enableAccountCreation
* @property {google.actions.sdk.v2.AccountLinking.LinkingType|null} [linkingType] AccountLinking linkingType
* @property {google.actions.sdk.v2.AccountLinking.AuthGrantType|null} [authGrantType] AccountLinking authGrantType
* @property {string|null} [appClientId] AccountLinking appClientId
* @property {string|null} [authorizationUrl] AccountLinking authorizationUrl
* @property {string|null} [tokenUrl] AccountLinking tokenUrl
* @property {Array.<string>|null} [scopes] AccountLinking scopes
* @property {string|null} [learnMoreUrl] AccountLinking learnMoreUrl
* @property {boolean|null} [useBasicAuthHeader] AccountLinking useBasicAuthHeader
*/
/**
* Constructs a new AccountLinking.
* @memberof google.actions.sdk.v2
* @classdesc Represents an AccountLinking.
* @implements IAccountLinking
* @constructor
* @param {google.actions.sdk.v2.IAccountLinking=} [properties] Properties to set
*/
function AccountLinking(properties) {
this.scopes = [];
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]];
}
/**
* AccountLinking enableAccountCreation.
* @member {boolean} enableAccountCreation
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.enableAccountCreation = false;
/**
* AccountLinking linkingType.
* @member {google.actions.sdk.v2.AccountLinking.LinkingType} linkingType
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.linkingType = 0;
/**
* AccountLinking authGrantType.
* @member {google.actions.sdk.v2.AccountLinking.AuthGrantType} authGrantType
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.authGrantType = 0;
/**
* AccountLinking appClientId.
* @member {string} appClientId
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.appClientId = "";
/**
* AccountLinking authorizationUrl.
* @member {string} authorizationUrl
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.authorizationUrl = "";
/**
* AccountLinking tokenUrl.
* @member {string} tokenUrl
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.tokenUrl = "";
/**
* AccountLinking scopes.
* @member {Array.<string>} scopes
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.scopes = $util.emptyArray;
/**
* AccountLinking learnMoreUrl.
* @member {string} learnMoreUrl
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.learnMoreUrl = "";
/**
* AccountLinking useBasicAuthHeader.
* @member {boolean} useBasicAuthHeader
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
*/
AccountLinking.prototype.useBasicAuthHeader = false;
/**
* Creates a new AccountLinking instance using the specified properties.
* @function create
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {google.actions.sdk.v2.IAccountLinking=} [properties] Properties to set
* @returns {google.actions.sdk.v2.AccountLinking} AccountLinking instance
*/
AccountLinking.create = function create(properties) {
return new AccountLinking(properties);
};
/**
* Encodes the specified AccountLinking message. Does not implicitly {@link google.actions.sdk.v2.AccountLinking.verify|verify} messages.
* @function encode
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {google.actions.sdk.v2.IAccountLinking} message AccountLinking message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AccountLinking.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.enableAccountCreation != null && Object.hasOwnProperty.call(message, "enableAccountCreation"))
writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enableAccountCreation);
if (message.linkingType != null && Object.hasOwnProperty.call(message, "linkingType"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.linkingType);
if (message.authGrantType != null && Object.hasOwnProperty.call(message, "authGrantType"))
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.authGrantType);
if (message.appClientId != null && Object.hasOwnProperty.call(message, "appClientId"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.appClientId);
if (message.authorizationUrl != null && Object.hasOwnProperty.call(message, "authorizationUrl"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.authorizationUrl);
if (message.tokenUrl != null && Object.hasOwnProperty.call(message, "tokenUrl"))
writer.uint32(/* id 6, wireType 2 =*/50).string(message.tokenUrl);
if (message.scopes != null && message.scopes.length)
for (var i = 0; i < message.scopes.length; ++i)
writer.uint32(/* id 7, wireType 2 =*/58).string(message.scopes[i]);
if (message.learnMoreUrl != null && Object.hasOwnProperty.call(message, "learnMoreUrl"))
writer.uint32(/* id 8, wireType 2 =*/66).string(message.learnMoreUrl);
if (message.useBasicAuthHeader != null && Object.hasOwnProperty.call(message, "useBasicAuthHeader"))
writer.uint32(/* id 9, wireType 0 =*/72).bool(message.useBasicAuthHeader);
return writer;
};
/**
* Encodes the specified AccountLinking message, length delimited. Does not implicitly {@link google.actions.sdk.v2.AccountLinking.verify|verify} messages.
* @function encodeDelimited
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {google.actions.sdk.v2.IAccountLinking} message AccountLinking message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AccountLinking.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an AccountLinking message from the specified reader or buffer.
* @function decode
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.actions.sdk.v2.AccountLinking} AccountLinking
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AccountLinking.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.google.actions.sdk.v2.AccountLinking();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.enableAccountCreation = reader.bool();
break;
case 2:
message.linkingType = reader.int32();
break;
case 3:
message.authGrantType = reader.int32();
break;
case 4:
message.appClientId = reader.string();
break;
case 5:
message.authorizationUrl = reader.string();
break;
case 6:
message.tokenUrl = reader.string();
break;
case 7:
if (!(message.scopes && message.scopes.length))
message.scopes = [];
message.scopes.push(reader.string());
break;
case 8:
message.learnMoreUrl = reader.string();
break;
case 9:
message.useBasicAuthHeader = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an AccountLinking message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.actions.sdk.v2.AccountLinking} AccountLinking
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AccountLinking.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an AccountLinking message.
* @function verify
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AccountLinking.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.enableAccountCreation != null && message.hasOwnProperty("enableAccountCreation"))
if (typeof message.enableAccountCreation !== "boolean")
return "enableAccountCreation: boolean expected";
if (message.linkingType != null && message.hasOwnProperty("linkingType"))
switch (message.linkingType) {
default:
return "linkingType: enum value expected";
case 0:
case 1:
case 2:
case 3:
break;
}
if (message.authGrantType != null && message.hasOwnProperty("authGrantType"))
switch (message.authGrantType) {
default:
return "authGrantType: enum value expected";
case 0:
case 1:
case 2:
break;
}
if (message.appClientId != null && message.hasOwnProperty("appClientId"))
if (!$util.isString(message.appClientId))
return "appClientId: string expected";
if (message.authorizationUrl != null && message.hasOwnProperty("authorizationUrl"))
if (!$util.isString(message.authorizationUrl))
return "authorizationUrl: string expected";
if (message.tokenUrl != null && message.hasOwnProperty("tokenUrl"))
if (!$util.isString(message.tokenUrl))
return "tokenUrl: string expected";
if (message.scopes != null && message.hasOwnProperty("scopes")) {
if (!Array.isArray(message.scopes))
return "scopes: array expected";
for (var i = 0; i < message.scopes.length; ++i)
if (!$util.isString(message.scopes[i]))
return "scopes: string[] expected";
}
if (message.learnMoreUrl != null && message.hasOwnProperty("learnMoreUrl"))
if (!$util.isString(message.learnMoreUrl))
return "learnMoreUrl: string expected";
if (message.useBasicAuthHeader != null && message.hasOwnProperty("useBasicAuthHeader"))
if (typeof message.useBasicAuthHeader !== "boolean")
return "useBasicAuthHeader: boolean expected";
return null;
};
/**
* Creates an AccountLinking message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.actions.sdk.v2.AccountLinking} AccountLinking
*/
AccountLinking.fromObject = function fromObject(object) {
if (object instanceof $root.google.actions.sdk.v2.AccountLinking)
return object;
var message = new $root.google.actions.sdk.v2.AccountLinking();
if (object.enableAccountCreation != null)
message.enableAccountCreation = Boolean(object.enableAccountCreation);
switch (object.linkingType) {
case "LINKING_TYPE_UNSPECIFIED":
case 0:
message.linkingType = 0;
break;
case "GOOGLE_SIGN_IN":
case 1:
message.linkingType = 1;
break;
case "OAUTH_AND_GOOGLE_SIGN_IN":
case 2:
message.linkingType = 2;
break;
case "OAUTH":
case 3:
message.linkingType = 3;
break;
}
switch (object.authGrantType) {
case "AUTH_GRANT_TYPE_UNSPECIFIED":
case 0:
message.authGrantType = 0;
break;
case "AUTH_CODE":
case 1:
message.authGrantType = 1;
break;
case "IMPLICIT":
case 2:
message.authGrantType = 2;
break;
}
if (object.appClientId != null)
message.appClientId = String(object.appClientId);
if (object.authorizationUrl != null)
message.authorizationUrl = String(object.authorizationUrl);
if (object.tokenUrl != null)
message.tokenUrl = String(object.tokenUrl);
if (object.scopes) {
if (!Array.isArray(object.scopes))
throw TypeError(".google.actions.sdk.v2.AccountLinking.scopes: array expected");
message.scopes = [];
for (var i = 0; i < object.scopes.length; ++i)
message.scopes[i] = String(object.scopes[i]);
}
if (object.learnMoreUrl != null)
message.learnMoreUrl = String(object.learnMoreUrl);
if (object.useBasicAuthHeader != null)
message.useBasicAuthHeader = Boolean(object.useBasicAuthHeader);
return message;
};
/**
* Creates a plain object from an AccountLinking message. Also converts values to other types if specified.
* @function toObject
* @memberof google.actions.sdk.v2.AccountLinking
* @static
* @param {google.actions.sdk.v2.AccountLinking} message AccountLinking
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AccountLinking.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.scopes = [];
if (options.defaults) {
object.enableAccountCreation = false;
object.linkingType = options.enums === String ? "LINKING_TYPE_UNSPECIFIED" : 0;
object.authGrantType = options.enums === String ? "AUTH_GRANT_TYPE_UNSPECIFIED" : 0;
object.appClientId = "";
object.authorizationUrl = "";
object.tokenUrl = "";
object.learnMoreUrl = "";
object.useBasicAuthHeader = false;
}
if (message.enableAccountCreation != null && message.hasOwnProperty("enableAccountCreation"))
object.enableAccountCreation = message.enableAccountCreation;
if (message.linkingType != null && message.hasOwnProperty("linkingType"))
object.linkingType = options.enums === String ? $root.google.actions.sdk.v2.AccountLinking.LinkingType[message.linkingType] : message.linkingType;
if (message.authGrantType != null && message.hasOwnProperty("authGrantType"))
object.authGrantType = options.enums === String ? $root.google.actions.sdk.v2.AccountLinking.AuthGrantType[message.authGrantType] : message.authGrantType;
if (message.appClientId != null && message.hasOwnProperty("appClientId"))
object.appClientId = message.appClientId;
if (message.authorizationUrl != null && message.hasOwnProperty("authorizationUrl"))
object.authorizationUrl = message.authorizationUrl;
if (message.tokenUrl != null && message.hasOwnProperty("tokenUrl"))
object.tokenUrl = message.tokenUrl;
if (message.scopes && message.scopes.length) {
object.scopes = [];
for (var j = 0; j < message.scopes.length; ++j)
object.scopes[j] = message.scopes[j];
}
if (message.learnMoreUrl != null && message.hasOwnProperty("learnMoreUrl"))
object.learnMoreUrl = message.learnMoreUrl;
if (message.useBasicAuthHeader != null && message.hasOwnProperty("useBasicAuthHeader"))
object.useBasicAuthHeader = message.useBasicAuthHeader;
return object;
};
/**
* Converts this AccountLinking to JSON.
* @function toJSON
* @memberof google.actions.sdk.v2.AccountLinking
* @instance
* @returns {Object.<string,*>} JSON object
*/
AccountLinking.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* LinkingType enum.
* @name google.actions.sdk.v2.AccountLinking.LinkingType
* @enum {number}
* @property {number} LINKING_TYPE_UNSPECIFIED=0 LINKING_TYPE_UNSPECIFIED value
* @property {number} GOOGLE_SIGN_IN=1 GOOGLE_SIGN_IN value
* @property {number} OAUTH_AND_GOOGLE_SIGN_IN=2 OAUTH_AND_GOOGLE_SIGN_IN value
* @property {number} OAUTH=3 OAUTH value
*/
AccountLinking.LinkingType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "LINKING_TYPE_UNSPECIFIED"] = 0;
values[valuesById[1] = "GOOGLE_SIGN_IN"] = 1;
values[valuesById[2] = "OAUTH_AND_GOOGLE_SIGN_IN"] = 2;
values[valuesById[3] = "OAUTH"] = 3;
return values;
})();
/**
* AuthGrantType enum.
* @name google.actions.sdk.v2.AccountLinking.AuthGrantType
* @enum {number}
* @property {number} AUTH_GRANT_TYPE_UNSPECIFIED=0 AUTH_GRANT_TYPE_UNSPECIFIED value
* @property {number} AUTH_CODE=1 AUTH_CODE value
* @property {number} IMPLICIT=2 IMPLICIT value
*/
AccountLinking.AuthGrantType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "AUTH_GRANT_TYPE_UNSPECIFIED"] = 0;
values[valuesById[1] = "AUTH_CODE"] = 1;
values[valuesById[2] = "IMPLICIT"] = 2;
return values;
})();
return AccountLinking;
})();
v2.AccountLinkingSecret = (function() {
/**
* Properties of an AccountLinkingSecret.
* @memberof google.actions.sdk.v2
* @interface IAccountLinkingSecret
* @property {Uint8Array|null} [encryptedClientSecret] AccountLinkingSecret encryptedClientSecret
* @property {string|null} [encryptionKeyVersion] AccountLinkingSecret encryptionKeyVersion
*/
/**
* Constructs a new AccountLinkingSecret.
* @memberof google.actions.sdk.v2
* @classdesc Represents an AccountLinkingSecret.
* @implements IAccountLinkingSecret
* @constructor
* @param {google.actions.sdk.v2.IAccountLinkingSecret=} [properties] Properties to set
*/
function AccountLinkingSecret(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]];
}
/**
* AccountLinkingSecret encryptedClientSecret.
* @member {Uint8Array} encryptedClientSecret
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @instance
*/
AccountLinkingSecret.prototype.encryptedClientSecret = $util.newBuffer([]);
/**
* AccountLinkingSecret encryptionKeyVersion.
* @member {string} encryptionKeyVersion
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @instance
*/
AccountLinkingSecret.prototype.encryptionKeyVersion = "";
/**
* Creates a new AccountLinkingSecret instance using the specified properties.
* @function create
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {google.actions.sdk.v2.IAccountLinkingSecret=} [properties] Properties to set
* @returns {google.actions.sdk.v2.AccountLinkingSecret} AccountLinkingSecret instance
*/
AccountLinkingSecret.create = function create(properties) {
return new AccountLinkingSecret(properties);
};
/**
* Encodes the specified AccountLinkingSecret message. Does not implicitly {@link google.actions.sdk.v2.AccountLinkingSecret.verify|verify} messages.
* @function encode
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {google.actions.sdk.v2.IAccountLinkingSecret} message AccountLinkingSecret message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AccountLinkingSecret.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.encryptedClientSecret != null && Object.hasOwnProperty.call(message, "encryptedClientSecret"))
writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.encryptedClientSecret);
if (message.encryptionKeyVersion != null && Object.hasOwnProperty.call(message, "encryptionKeyVersion"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.encryptionKeyVersion);
return writer;
};
/**
* Encodes the specified AccountLinkingSecret message, length delimited. Does not implicitly {@link google.actions.sdk.v2.AccountLinkingSecret.verify|verify} messages.
* @function encodeDelimited
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {google.actions.sdk.v2.IAccountLinkingSecret} message AccountLinkingSecret message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AccountLinkingSecret.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an AccountLinkingSecret message from the specified reader or buffer.
* @function decode
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.actions.sdk.v2.AccountLinkingSecret} AccountLinkingSecret
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AccountLinkingSecret.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.google.actions.sdk.v2.AccountLinkingSecret();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.encryptedClientSecret = reader.bytes();
break;
case 2:
message.encryptionKeyVersion = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an AccountLinkingSecret message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.actions.sdk.v2.AccountLinkingSecret} AccountLinkingSecret
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AccountLinkingSecret.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an AccountLinkingSecret message.
* @function verify
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AccountLinkingSecret.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.encryptedClientSecret != null && message.hasOwnProperty("encryptedClientSecret"))
if (!(message.encryptedClientSecret && typeof message.encryptedClientSecret.length === "number" || $util.isString(message.encryptedClientSecret)))
return "encryptedClientSecret: buffer expected";
if (message.encryptionKeyVersion != null && message.hasOwnProperty("encryptionKeyVersion"))
if (!$util.isString(message.encryptionKeyVersion))
return "encryptionKeyVersion: string expected";
return null;
};
/**
* Creates an AccountLinkingSecret message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.actions.sdk.v2.AccountLinkingSecret} AccountLinkingSecret
*/
AccountLinkingSecret.fromObject = function fromObject(object) {
if (object instanceof $root.google.actions.sdk.v2.AccountLinkingSecret)
return object;
var message = new $root.google.actions.sdk.v2.AccountLinkingSecret();
if (object.encryptedClientSecret != null)
if (typeof object.encryptedClientSecret === "string")
$util.base64.decode(object.encryptedClientSecret, message.encryptedClientSecret = $util.newBuffer($util.base64.length(object.encryptedClientSecret)), 0);
else if (object.encryptedClientSecret.length)
message.encryptedClientSecret = object.encryptedClientSecret;
if (object.encryptionKeyVersion != null)
message.encryptionKeyVersion = String(object.encryptionKeyVersion);
return message;
};
/**
* Creates a plain object from an AccountLinkingSecret message. Also converts values to other types if specified.
* @function toObject
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @static
* @param {google.actions.sdk.v2.AccountLinkingSecret} message AccountLinkingSecret
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AccountLinkingSecret.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
if (options.bytes === String)
object.encryptedClientSecret = "";
else {
object.encryptedClientSecret = [];
if (options.bytes !== Array)
object.encryptedClientSecret = $util.newBuffer(object.encryptedClientSecret);
}
object.encryptionKeyVersion = "";
}
if (message.encryptedClientSecret != null && message.hasOwnProperty("encryptedClientSecret"))
object.encryptedClientSecret = options.bytes === String ? $util.base64.encode(message.encryptedClientSecret, 0, message.encryptedClientSecret.length) : options.bytes === Array ? Array.prototype.slice.call(message.encryptedClientSecret) : message.encryptedClientSecret;
if (message.encryptionKeyVersion != null && message.hasOwnProperty("encryptionKeyVersion"))
object.encryptionKeyVersion = message.encryptionKeyVersion;
return object;
};
/**
* Converts this AccountLinkingSecret to JSON.
* @function toJSON
* @memberof google.actions.sdk.v2.AccountLinkingSecret
* @instance
* @returns {Object.<string,*>} JSON object
*/
AccountLinkingSecret.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return AccountLinkingSecret;
})();
v2.Actions = (function() {
/**
* Properties of an Actions.
* @memberof google.actions.sdk.v2
* @interface IActions
* @property {Object.<string,google.actions.sdk.v2.Actions.ICustomAction>|null} [custom] Actions custom
*/
/**
* Constructs a new Actions.
* @memberof google.actions.sdk.v2
* @classdesc Represents an Actions.
* @implements IActions
* @constructor
* @param {google.actions.sdk.v2.IActions=} [properties] Properties to set
*/
function Actions(properties) {
this.custom = {};
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]];
}
/**
* Actions custom.
* @member {Object.<string,google.actions.sdk.v2.Actions.ICustomAction>} custom
* @memberof google.actions.sdk.v2.Actions
* @instance
*/
Actions.prototype.custom = $util.emptyObject;
/**
* Creates a new Actions instance using the specified properties.
* @function create
* @memberof google.actions.sdk.v2.Actions
* @static
* @param {google.actions.sdk.v2.IActions=} [properties] Properties to set
* @returns {google.actions.sdk.v2.Actions} Actions instance
*/
Actions.create = function create(properties) {
return new Actions(properties);
};
/**
* Encodes the specified Actions message. Does not implicitly {@link google.actions.sdk.v2.Actions.verify|verify} messages.
* @function encode
* @memberof google.actions.sdk.v2.Actions
* @static
* @param {google.actions.sdk.v2.IActions} message Actions message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Actions.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.custom != null && Object.hasOwnProperty.call(message, "custom"))
for (var keys = Object.keys(message.custom), i = 0; i < keys.length; ++i) {
writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]);
$root.google.actions.sdk.v2.Actions.CustomAction.encode(message.custom[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim();
}
return writer;
};
/**
* Encodes the specified Actions message, length delimited. Does not implicitly {@link google.actions.sdk.v2.Actions.verify|verify} messages.
* @function encodeDelimited
* @memberof google.actions.sdk.v2.Actions
* @static
* @param {google.actions.sdk.v2.IActions} message Actions message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Actions.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an Actions message from the specified reader or buffer.
* @function decode
* @memberof google.actions.sdk.v2.Actions
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.actions.sdk.v2.Actions} Actions
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/