@animeapis/webcache
Version:
Webcache client for Node.js
903 lines (828 loc) • 836 kB
JavaScript
// 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_webcache_protos || ($protobuf.roots._animeapis_webcache_protos = {});
$root.animeshon = (function() {
/**
* Namespace animeshon.
* @exports animeshon
* @namespace
*/
var animeshon = {};
animeshon.webcache = (function() {
/**
* Namespace webcache.
* @memberof animeshon
* @namespace
*/
var webcache = {};
webcache.v1alpha1 = (function() {
/**
* Namespace v1alpha1.
* @memberof animeshon.webcache
* @namespace
*/
var v1alpha1 = {};
v1alpha1.WebCache = (function() {
/**
* Constructs a new WebCache service.
* @memberof animeshon.webcache.v1alpha1
* @classdesc Represents a WebCache
* @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 WebCache(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(WebCache.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = WebCache;
/**
* Creates new WebCache service using the specified rpc implementation.
* @function create
* @memberof animeshon.webcache.v1alpha1.WebCache
* @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 {WebCache} RPC service. Useful where requests and/or responses are streamed.
*/
WebCache.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link animeshon.webcache.v1alpha1.WebCache#createCache}.
* @memberof animeshon.webcache.v1alpha1.WebCache
* @typedef CreateCacheCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.webcache.v1alpha1.Cache} [response] Cache
*/
/**
* Calls CreateCache.
* @function createCache
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.ICreateCacheRequest} request CreateCacheRequest message or plain object
* @param {animeshon.webcache.v1alpha1.WebCache.CreateCacheCallback} callback Node-style callback called with the error, if any, and Cache
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(WebCache.prototype.createCache = function createCache(request, callback) {
return this.rpcCall(createCache, $root.animeshon.webcache.v1alpha1.CreateCacheRequest, $root.animeshon.webcache.v1alpha1.Cache, request, callback);
}, "name", { value: "CreateCache" });
/**
* Calls CreateCache.
* @function createCache
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.ICreateCacheRequest} request CreateCacheRequest message or plain object
* @returns {Promise<animeshon.webcache.v1alpha1.Cache>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.webcache.v1alpha1.WebCache#listCaches}.
* @memberof animeshon.webcache.v1alpha1.WebCache
* @typedef ListCachesCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.webcache.v1alpha1.ListCachesResponse} [response] ListCachesResponse
*/
/**
* Calls ListCaches.
* @function listCaches
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.IListCachesRequest} request ListCachesRequest message or plain object
* @param {animeshon.webcache.v1alpha1.WebCache.ListCachesCallback} callback Node-style callback called with the error, if any, and ListCachesResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(WebCache.prototype.listCaches = function listCaches(request, callback) {
return this.rpcCall(listCaches, $root.animeshon.webcache.v1alpha1.ListCachesRequest, $root.animeshon.webcache.v1alpha1.ListCachesResponse, request, callback);
}, "name", { value: "ListCaches" });
/**
* Calls ListCaches.
* @function listCaches
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.IListCachesRequest} request ListCachesRequest message or plain object
* @returns {Promise<animeshon.webcache.v1alpha1.ListCachesResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.webcache.v1alpha1.WebCache#getCache}.
* @memberof animeshon.webcache.v1alpha1.WebCache
* @typedef GetCacheCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.webcache.v1alpha1.Cache} [response] Cache
*/
/**
* Calls GetCache.
* @function getCache
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.IGetCacheRequest} request GetCacheRequest message or plain object
* @param {animeshon.webcache.v1alpha1.WebCache.GetCacheCallback} callback Node-style callback called with the error, if any, and Cache
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(WebCache.prototype.getCache = function getCache(request, callback) {
return this.rpcCall(getCache, $root.animeshon.webcache.v1alpha1.GetCacheRequest, $root.animeshon.webcache.v1alpha1.Cache, request, callback);
}, "name", { value: "GetCache" });
/**
* Calls GetCache.
* @function getCache
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.IGetCacheRequest} request GetCacheRequest message or plain object
* @returns {Promise<animeshon.webcache.v1alpha1.Cache>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.webcache.v1alpha1.WebCache#deleteCache}.
* @memberof animeshon.webcache.v1alpha1.WebCache
* @typedef DeleteCacheCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.protobuf.Empty} [response] Empty
*/
/**
* Calls DeleteCache.
* @function deleteCache
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.IDeleteCacheRequest} request DeleteCacheRequest message or plain object
* @param {animeshon.webcache.v1alpha1.WebCache.DeleteCacheCallback} callback Node-style callback called with the error, if any, and Empty
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(WebCache.prototype.deleteCache = function deleteCache(request, callback) {
return this.rpcCall(deleteCache, $root.animeshon.webcache.v1alpha1.DeleteCacheRequest, $root.google.protobuf.Empty, request, callback);
}, "name", { value: "DeleteCache" });
/**
* Calls DeleteCache.
* @function deleteCache
* @memberof animeshon.webcache.v1alpha1.WebCache
* @instance
* @param {animeshon.webcache.v1alpha1.IDeleteCacheRequest} request DeleteCacheRequest message or plain object
* @returns {Promise<google.protobuf.Empty>} Promise
* @variation 2
*/
return WebCache;
})();
v1alpha1.Cache = (function() {
/**
* Properties of a Cache.
* @memberof animeshon.webcache.v1alpha1
* @interface ICache
* @property {string|null} [name] Cache name
* @property {string|null} [scheme] Cache scheme
* @property {string|null} [uri] Cache uri
* @property {string|null} [mimeType] Cache mimeType
* @property {number|null} [statusCode] Cache statusCode
* @property {string|null} [redirectUri] Cache redirectUri
* @property {string|null} [resource] Cache resource
* @property {string|null} [revisionId] Cache revisionId
* @property {google.protobuf.ITimestamp|null} [revisionCreateTime] Cache revisionCreateTime
* @property {google.protobuf.ITimestamp|null} [revisionExpireTime] Cache revisionExpireTime
*/
/**
* Constructs a new Cache.
* @memberof animeshon.webcache.v1alpha1
* @classdesc Represents a Cache.
* @implements ICache
* @constructor
* @param {animeshon.webcache.v1alpha1.ICache=} [properties] Properties to set
*/
function Cache(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]];
}
/**
* Cache name.
* @member {string} name
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.name = "";
/**
* Cache scheme.
* @member {string} scheme
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.scheme = "";
/**
* Cache uri.
* @member {string} uri
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.uri = "";
/**
* Cache mimeType.
* @member {string} mimeType
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.mimeType = "";
/**
* Cache statusCode.
* @member {number} statusCode
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.statusCode = 0;
/**
* Cache redirectUri.
* @member {string} redirectUri
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.redirectUri = "";
/**
* Cache resource.
* @member {string} resource
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.resource = "";
/**
* Cache revisionId.
* @member {string} revisionId
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.revisionId = "";
/**
* Cache revisionCreateTime.
* @member {google.protobuf.ITimestamp|null|undefined} revisionCreateTime
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.revisionCreateTime = null;
/**
* Cache revisionExpireTime.
* @member {google.protobuf.ITimestamp|null|undefined} revisionExpireTime
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
*/
Cache.prototype.revisionExpireTime = null;
/**
* Creates a new Cache instance using the specified properties.
* @function create
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {animeshon.webcache.v1alpha1.ICache=} [properties] Properties to set
* @returns {animeshon.webcache.v1alpha1.Cache} Cache instance
*/
Cache.create = function create(properties) {
return new Cache(properties);
};
/**
* Encodes the specified Cache message. Does not implicitly {@link animeshon.webcache.v1alpha1.Cache.verify|verify} messages.
* @function encode
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {animeshon.webcache.v1alpha1.ICache} message Cache message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Cache.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.scheme != null && Object.hasOwnProperty.call(message, "scheme"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.scheme);
if (message.uri != null && Object.hasOwnProperty.call(message, "uri"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.uri);
if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.mimeType);
if (message.statusCode != null && Object.hasOwnProperty.call(message, "statusCode"))
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.statusCode);
if (message.redirectUri != null && Object.hasOwnProperty.call(message, "redirectUri"))
writer.uint32(/* id 6, wireType 2 =*/50).string(message.redirectUri);
if (message.resource != null && Object.hasOwnProperty.call(message, "resource"))
writer.uint32(/* id 7, wireType 2 =*/58).string(message.resource);
if (message.revisionId != null && Object.hasOwnProperty.call(message, "revisionId"))
writer.uint32(/* id 8, wireType 2 =*/66).string(message.revisionId);
if (message.revisionCreateTime != null && Object.hasOwnProperty.call(message, "revisionCreateTime"))
$root.google.protobuf.Timestamp.encode(message.revisionCreateTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
if (message.revisionExpireTime != null && Object.hasOwnProperty.call(message, "revisionExpireTime"))
$root.google.protobuf.Timestamp.encode(message.revisionExpireTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
return writer;
};
/**
* Encodes the specified Cache message, length delimited. Does not implicitly {@link animeshon.webcache.v1alpha1.Cache.verify|verify} messages.
* @function encodeDelimited
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {animeshon.webcache.v1alpha1.ICache} message Cache message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Cache.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Cache message from the specified reader or buffer.
* @function decode
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {animeshon.webcache.v1alpha1.Cache} Cache
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Cache.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.webcache.v1alpha1.Cache();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.name = reader.string();
break;
case 2:
message.scheme = reader.string();
break;
case 3:
message.uri = reader.string();
break;
case 4:
message.mimeType = reader.string();
break;
case 5:
message.statusCode = reader.int32();
break;
case 6:
message.redirectUri = reader.string();
break;
case 7:
message.resource = reader.string();
break;
case 8:
message.revisionId = reader.string();
break;
case 9:
message.revisionCreateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
case 10:
message.revisionExpireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Cache message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {animeshon.webcache.v1alpha1.Cache} Cache
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Cache.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Cache message.
* @function verify
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Cache.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.scheme != null && message.hasOwnProperty("scheme"))
if (!$util.isString(message.scheme))
return "scheme: string expected";
if (message.uri != null && message.hasOwnProperty("uri"))
if (!$util.isString(message.uri))
return "uri: string expected";
if (message.mimeType != null && message.hasOwnProperty("mimeType"))
if (!$util.isString(message.mimeType))
return "mimeType: string expected";
if (message.statusCode != null && message.hasOwnProperty("statusCode"))
if (!$util.isInteger(message.statusCode))
return "statusCode: integer expected";
if (message.redirectUri != null && message.hasOwnProperty("redirectUri"))
if (!$util.isString(message.redirectUri))
return "redirectUri: string expected";
if (message.resource != null && message.hasOwnProperty("resource"))
if (!$util.isString(message.resource))
return "resource: string expected";
if (message.revisionId != null && message.hasOwnProperty("revisionId"))
if (!$util.isString(message.revisionId))
return "revisionId: string expected";
if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.revisionCreateTime);
if (error)
return "revisionCreateTime." + error;
}
if (message.revisionExpireTime != null && message.hasOwnProperty("revisionExpireTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.revisionExpireTime);
if (error)
return "revisionExpireTime." + error;
}
return null;
};
/**
* Creates a Cache message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {Object.<string,*>} object Plain object
* @returns {animeshon.webcache.v1alpha1.Cache} Cache
*/
Cache.fromObject = function fromObject(object) {
if (object instanceof $root.animeshon.webcache.v1alpha1.Cache)
return object;
var message = new $root.animeshon.webcache.v1alpha1.Cache();
if (object.name != null)
message.name = String(object.name);
if (object.scheme != null)
message.scheme = String(object.scheme);
if (object.uri != null)
message.uri = String(object.uri);
if (object.mimeType != null)
message.mimeType = String(object.mimeType);
if (object.statusCode != null)
message.statusCode = object.statusCode | 0;
if (object.redirectUri != null)
message.redirectUri = String(object.redirectUri);
if (object.resource != null)
message.resource = String(object.resource);
if (object.revisionId != null)
message.revisionId = String(object.revisionId);
if (object.revisionCreateTime != null) {
if (typeof object.revisionCreateTime !== "object")
throw TypeError(".animeshon.webcache.v1alpha1.Cache.revisionCreateTime: object expected");
message.revisionCreateTime = $root.google.protobuf.Timestamp.fromObject(object.revisionCreateTime);
}
if (object.revisionExpireTime != null) {
if (typeof object.revisionExpireTime !== "object")
throw TypeError(".animeshon.webcache.v1alpha1.Cache.revisionExpireTime: object expected");
message.revisionExpireTime = $root.google.protobuf.Timestamp.fromObject(object.revisionExpireTime);
}
return message;
};
/**
* Creates a plain object from a Cache message. Also converts values to other types if specified.
* @function toObject
* @memberof animeshon.webcache.v1alpha1.Cache
* @static
* @param {animeshon.webcache.v1alpha1.Cache} message Cache
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Cache.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.name = "";
object.scheme = "";
object.uri = "";
object.mimeType = "";
object.statusCode = 0;
object.redirectUri = "";
object.resource = "";
object.revisionId = "";
object.revisionCreateTime = null;
object.revisionExpireTime = null;
}
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.scheme != null && message.hasOwnProperty("scheme"))
object.scheme = message.scheme;
if (message.uri != null && message.hasOwnProperty("uri"))
object.uri = message.uri;
if (message.mimeType != null && message.hasOwnProperty("mimeType"))
object.mimeType = message.mimeType;
if (message.statusCode != null && message.hasOwnProperty("statusCode"))
object.statusCode = message.statusCode;
if (message.redirectUri != null && message.hasOwnProperty("redirectUri"))
object.redirectUri = message.redirectUri;
if (message.resource != null && message.hasOwnProperty("resource"))
object.resource = message.resource;
if (message.revisionId != null && message.hasOwnProperty("revisionId"))
object.revisionId = message.revisionId;
if (message.revisionCreateTime != null && message.hasOwnProperty("revisionCreateTime"))
object.revisionCreateTime = $root.google.protobuf.Timestamp.toObject(message.revisionCreateTime, options);
if (message.revisionExpireTime != null && message.hasOwnProperty("revisionExpireTime"))
object.revisionExpireTime = $root.google.protobuf.Timestamp.toObject(message.revisionExpireTime, options);
return object;
};
/**
* Converts this Cache to JSON.
* @function toJSON
* @memberof animeshon.webcache.v1alpha1.Cache
* @instance
* @returns {Object.<string,*>} JSON object
*/
Cache.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return Cache;
})();
v1alpha1.CreateCacheRequest = (function() {
/**
* Properties of a CreateCacheRequest.
* @memberof animeshon.webcache.v1alpha1
* @interface ICreateCacheRequest
* @property {animeshon.webcache.v1alpha1.ICache|null} [cache] CreateCacheRequest cache
* @property {google.protobuf.IDuration|null} [ttl] CreateCacheRequest ttl
*/
/**
* Constructs a new CreateCacheRequest.
* @memberof animeshon.webcache.v1alpha1
* @classdesc Represents a CreateCacheRequest.
* @implements ICreateCacheRequest
* @constructor
* @param {animeshon.webcache.v1alpha1.ICreateCacheRequest=} [properties] Properties to set
*/
function CreateCacheRequest(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]];
}
/**
* CreateCacheRequest cache.
* @member {animeshon.webcache.v1alpha1.ICache|null|undefined} cache
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @instance
*/
CreateCacheRequest.prototype.cache = null;
/**
* CreateCacheRequest ttl.
* @member {google.protobuf.IDuration|null|undefined} ttl
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @instance
*/
CreateCacheRequest.prototype.ttl = null;
/**
* Creates a new CreateCacheRequest instance using the specified properties.
* @function create
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {animeshon.webcache.v1alpha1.ICreateCacheRequest=} [properties] Properties to set
* @returns {animeshon.webcache.v1alpha1.CreateCacheRequest} CreateCacheRequest instance
*/
CreateCacheRequest.create = function create(properties) {
return new CreateCacheRequest(properties);
};
/**
* Encodes the specified CreateCacheRequest message. Does not implicitly {@link animeshon.webcache.v1alpha1.CreateCacheRequest.verify|verify} messages.
* @function encode
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {animeshon.webcache.v1alpha1.ICreateCacheRequest} message CreateCacheRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CreateCacheRequest.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.cache != null && Object.hasOwnProperty.call(message, "cache"))
$root.animeshon.webcache.v1alpha1.Cache.encode(message.cache, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
if (message.ttl != null && Object.hasOwnProperty.call(message, "ttl"))
$root.google.protobuf.Duration.encode(message.ttl, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified CreateCacheRequest message, length delimited. Does not implicitly {@link animeshon.webcache.v1alpha1.CreateCacheRequest.verify|verify} messages.
* @function encodeDelimited
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {animeshon.webcache.v1alpha1.ICreateCacheRequest} message CreateCacheRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CreateCacheRequest.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CreateCacheRequest message from the specified reader or buffer.
* @function decode
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {animeshon.webcache.v1alpha1.CreateCacheRequest} CreateCacheRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CreateCacheRequest.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.webcache.v1alpha1.CreateCacheRequest();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.cache = $root.animeshon.webcache.v1alpha1.Cache.decode(reader, reader.uint32());
break;
case 2:
message.ttl = $root.google.protobuf.Duration.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CreateCacheRequest message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {animeshon.webcache.v1alpha1.CreateCacheRequest} CreateCacheRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CreateCacheRequest.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CreateCacheRequest message.
* @function verify
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CreateCacheRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.cache != null && message.hasOwnProperty("cache")) {
var error = $root.animeshon.webcache.v1alpha1.Cache.verify(message.cache);
if (error)
return "cache." + error;
}
if (message.ttl != null && message.hasOwnProperty("ttl")) {
var error = $root.google.protobuf.Duration.verify(message.ttl);
if (error)
return "ttl." + error;
}
return null;
};
/**
* Creates a CreateCacheRequest message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {Object.<string,*>} object Plain object
* @returns {animeshon.webcache.v1alpha1.CreateCacheRequest} CreateCacheRequest
*/
CreateCacheRequest.fromObject = function fromObject(object) {
if (object instanceof $root.animeshon.webcache.v1alpha1.CreateCacheRequest)
return object;
var message = new $root.animeshon.webcache.v1alpha1.CreateCacheRequest();
if (object.cache != null) {
if (typeof object.cache !== "object")
throw TypeError(".animeshon.webcache.v1alpha1.CreateCacheRequest.cache: object expected");
message.cache = $root.animeshon.webcache.v1alpha1.Cache.fromObject(object.cache);
}
if (object.ttl != null) {
if (typeof object.ttl !== "object")
throw TypeError(".animeshon.webcache.v1alpha1.CreateCacheRequest.ttl: object expected");
message.ttl = $root.google.protobuf.Duration.fromObject(object.ttl);
}
return message;
};
/**
* Creates a plain object from a CreateCacheRequest message. Also converts values to other types if specified.
* @function toObject
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @static
* @param {animeshon.webcache.v1alpha1.CreateCacheRequest} message CreateCacheRequest
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CreateCacheRequest.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.cache = null;
object.ttl = null;
}
if (message.cache != null && message.hasOwnProperty("cache"))
object.cache = $root.animeshon.webcache.v1alpha1.Cache.toObject(message.cache, options);
if (message.ttl != null && message.hasOwnProperty("ttl"))
object.ttl = $root.google.protobuf.Duration.toObject(message.ttl, options);
return object;
};
/**
* Converts this CreateCacheRequest to JSON.
* @function toJSON
* @memberof animeshon.webcache.v1alpha1.CreateCacheRequest
* @instance
* @returns {Object.<string,*>} JSON object
*/
CreateCacheRequest.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return CreateCacheRequest;
})();
v1alpha1.ListCachesRequest = (function() {
/**
* Properties of a ListCachesRequest.
* @memberof animeshon.webcache.v1alpha1
* @interface IListCachesRequest
* @property {number|null} [pageSize] ListCachesRequest pageSize
* @property {string|null} [pageToken] ListCachesRequest pageToken
* @property {string|null} [filter] ListCachesRequest filter
* @property {boolean|null} [onlyLatestRevision] ListCachesRequest onlyLatestRevision
*/
/**
* Constructs a new ListCachesRequest.
* @memberof animeshon.webcache.v1alpha1
* @classdesc Represents a ListCachesRequest.
* @implements IListCachesRequest
* @constructor
* @param {animeshon.webcache.v1alpha1.IListCachesRequest=} [properties] Properties to set
*/
function ListCachesRequest(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]];
}
/**
* ListCachesRequest pageSize.
* @member {number} pageSize
* @memberof animeshon.webcache.v1alpha1.ListCachesRequest
* @instance
*/
ListCachesRequest.prototype.pageSize = 0;
/**
* ListCachesRequest pageToken.
* @member {string} pageToken
* @memberof animeshon.webcache.v1alpha1.ListCachesRequest
* @instance
*/
ListCachesRequest.prototype.pageToken = "";
/**
* ListCachesRequest filter.
* @member {string} filter
* @memberof animeshon.webcache.v1alpha1.ListCachesRequest
* @instance
*/
ListCachesRequest.prototype.filter = "";
/**
* ListCachesRequest onlyLatestRevision.
* @member {boolean} onlyLatestRevision
* @memberof animeshon.webcache.v1alpha1.ListCachesRequest
* @instance
*/
ListCachesRequest.prototype.onlyLatestRevision = false;
/**
* Creates a new ListCachesRequest inst