@animeapis/library
Version:
Animeshon Library API Client for Node.js
887 lines (808 loc) • 1.04 MB
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_library_protos || ($protobuf.roots._animeapis_library_protos = {});
$root.animeshon = (function() {
/**
* Namespace animeshon.
* @exports animeshon
* @namespace
*/
var animeshon = {};
animeshon.library = (function() {
/**
* Namespace library.
* @memberof animeshon
* @namespace
*/
var library = {};
library.v1alpha1 = (function() {
/**
* Namespace v1alpha1.
* @memberof animeshon.library
* @namespace
*/
var v1alpha1 = {};
v1alpha1.Library = (function() {
/**
* Constructs a new Library service.
* @memberof animeshon.library.v1alpha1
* @classdesc Represents a Library
* @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 Library(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(Library.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Library;
/**
* Creates new Library service using the specified rpc implementation.
* @function create
* @memberof animeshon.library.v1alpha1.Library
* @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 {Library} RPC service. Useful where requests and/or responses are streamed.
*/
Library.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#getPlaylist}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef GetPlaylistCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.Playlist} [response] Playlist
*/
/**
* Calls GetPlaylist.
* @function getPlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IGetPlaylistRequest} request GetPlaylistRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.GetPlaylistCallback} callback Node-style callback called with the error, if any, and Playlist
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.getPlaylist = function getPlaylist(request, callback) {
return this.rpcCall(getPlaylist, $root.animeshon.library.v1alpha1.GetPlaylistRequest, $root.animeshon.library.v1alpha1.Playlist, request, callback);
}, "name", { value: "GetPlaylist" });
/**
* Calls GetPlaylist.
* @function getPlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IGetPlaylistRequest} request GetPlaylistRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.Playlist>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#listPlaylists}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef ListPlaylistsCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.ListPlaylistsResponse} [response] ListPlaylistsResponse
*/
/**
* Calls ListPlaylists.
* @function listPlaylists
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IListPlaylistsRequest} request ListPlaylistsRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.ListPlaylistsCallback} callback Node-style callback called with the error, if any, and ListPlaylistsResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.listPlaylists = function listPlaylists(request, callback) {
return this.rpcCall(listPlaylists, $root.animeshon.library.v1alpha1.ListPlaylistsRequest, $root.animeshon.library.v1alpha1.ListPlaylistsResponse, request, callback);
}, "name", { value: "ListPlaylists" });
/**
* Calls ListPlaylists.
* @function listPlaylists
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IListPlaylistsRequest} request ListPlaylistsRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.ListPlaylistsResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#createPlaylist}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef CreatePlaylistCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.Playlist} [response] Playlist
*/
/**
* Calls CreatePlaylist.
* @function createPlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.ICreatePlaylistRequest} request CreatePlaylistRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.CreatePlaylistCallback} callback Node-style callback called with the error, if any, and Playlist
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.createPlaylist = function createPlaylist(request, callback) {
return this.rpcCall(createPlaylist, $root.animeshon.library.v1alpha1.CreatePlaylistRequest, $root.animeshon.library.v1alpha1.Playlist, request, callback);
}, "name", { value: "CreatePlaylist" });
/**
* Calls CreatePlaylist.
* @function createPlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.ICreatePlaylistRequest} request CreatePlaylistRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.Playlist>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#updatePlaylist}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef UpdatePlaylistCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.Playlist} [response] Playlist
*/
/**
* Calls UpdatePlaylist.
* @function updatePlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IUpdatePlaylistRequest} request UpdatePlaylistRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.UpdatePlaylistCallback} callback Node-style callback called with the error, if any, and Playlist
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.updatePlaylist = function updatePlaylist(request, callback) {
return this.rpcCall(updatePlaylist, $root.animeshon.library.v1alpha1.UpdatePlaylistRequest, $root.animeshon.library.v1alpha1.Playlist, request, callback);
}, "name", { value: "UpdatePlaylist" });
/**
* Calls UpdatePlaylist.
* @function updatePlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IUpdatePlaylistRequest} request UpdatePlaylistRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.Playlist>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#deletePlaylist}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef DeletePlaylistCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.protobuf.Empty} [response] Empty
*/
/**
* Calls DeletePlaylist.
* @function deletePlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IDeletePlaylistRequest} request DeletePlaylistRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.DeletePlaylistCallback} callback Node-style callback called with the error, if any, and Empty
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.deletePlaylist = function deletePlaylist(request, callback) {
return this.rpcCall(deletePlaylist, $root.animeshon.library.v1alpha1.DeletePlaylistRequest, $root.google.protobuf.Empty, request, callback);
}, "name", { value: "DeletePlaylist" });
/**
* Calls DeletePlaylist.
* @function deletePlaylist
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IDeletePlaylistRequest} request DeletePlaylistRequest message or plain object
* @returns {Promise<google.protobuf.Empty>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#listPlaylistItems}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef ListPlaylistItemsCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.ListPlaylistItemsResponse} [response] ListPlaylistItemsResponse
*/
/**
* Calls ListPlaylistItems.
* @function listPlaylistItems
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IListPlaylistItemsRequest} request ListPlaylistItemsRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.ListPlaylistItemsCallback} callback Node-style callback called with the error, if any, and ListPlaylistItemsResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.listPlaylistItems = function listPlaylistItems(request, callback) {
return this.rpcCall(listPlaylistItems, $root.animeshon.library.v1alpha1.ListPlaylistItemsRequest, $root.animeshon.library.v1alpha1.ListPlaylistItemsResponse, request, callback);
}, "name", { value: "ListPlaylistItems" });
/**
* Calls ListPlaylistItems.
* @function listPlaylistItems
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IListPlaylistItemsRequest} request ListPlaylistItemsRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.ListPlaylistItemsResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#createPlaylistItem}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef CreatePlaylistItemCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.PlaylistItem} [response] PlaylistItem
*/
/**
* Calls CreatePlaylistItem.
* @function createPlaylistItem
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.ICreatePlaylistItemRequest} request CreatePlaylistItemRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.CreatePlaylistItemCallback} callback Node-style callback called with the error, if any, and PlaylistItem
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.createPlaylistItem = function createPlaylistItem(request, callback) {
return this.rpcCall(createPlaylistItem, $root.animeshon.library.v1alpha1.CreatePlaylistItemRequest, $root.animeshon.library.v1alpha1.PlaylistItem, request, callback);
}, "name", { value: "CreatePlaylistItem" });
/**
* Calls CreatePlaylistItem.
* @function createPlaylistItem
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.ICreatePlaylistItemRequest} request CreatePlaylistItemRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.PlaylistItem>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#batchCreatePlaylistItems}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef BatchCreatePlaylistItemsCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse} [response] BatchCreatePlaylistItemsResponse
*/
/**
* Calls BatchCreatePlaylistItems.
* @function batchCreatePlaylistItems
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IBatchCreatePlaylistItemsRequest} request BatchCreatePlaylistItemsRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.BatchCreatePlaylistItemsCallback} callback Node-style callback called with the error, if any, and BatchCreatePlaylistItemsResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.batchCreatePlaylistItems = function batchCreatePlaylistItems(request, callback) {
return this.rpcCall(batchCreatePlaylistItems, $root.animeshon.library.v1alpha1.BatchCreatePlaylistItemsRequest, $root.animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse, request, callback);
}, "name", { value: "BatchCreatePlaylistItems" });
/**
* Calls BatchCreatePlaylistItems.
* @function batchCreatePlaylistItems
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IBatchCreatePlaylistItemsRequest} request BatchCreatePlaylistItemsRequest message or plain object
* @returns {Promise<animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse>} Promise
* @variation 2
*/
/**
* Callback as used by {@link animeshon.library.v1alpha1.Library#deletePlaylistItem}.
* @memberof animeshon.library.v1alpha1.Library
* @typedef DeletePlaylistItemCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.protobuf.Empty} [response] Empty
*/
/**
* Calls DeletePlaylistItem.
* @function deletePlaylistItem
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IDeletePlaylistItemRequest} request DeletePlaylistItemRequest message or plain object
* @param {animeshon.library.v1alpha1.Library.DeletePlaylistItemCallback} callback Node-style callback called with the error, if any, and Empty
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(Library.prototype.deletePlaylistItem = function deletePlaylistItem(request, callback) {
return this.rpcCall(deletePlaylistItem, $root.animeshon.library.v1alpha1.DeletePlaylistItemRequest, $root.google.protobuf.Empty, request, callback);
}, "name", { value: "DeletePlaylistItem" });
/**
* Calls DeletePlaylistItem.
* @function deletePlaylistItem
* @memberof animeshon.library.v1alpha1.Library
* @instance
* @param {animeshon.library.v1alpha1.IDeletePlaylistItemRequest} request DeletePlaylistItemRequest message or plain object
* @returns {Promise<google.protobuf.Empty>} Promise
* @variation 2
*/
return Library;
})();
/**
* Type enum.
* @name animeshon.library.v1alpha1.Type
* @enum {number}
* @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value
* @property {number} LATER=1 LATER value
* @property {number} LIKED=2 LIKED value
* @property {number} CUSTOM=3 CUSTOM value
*/
v1alpha1.Type = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0;
values[valuesById[1] = "LATER"] = 1;
values[valuesById[2] = "LIKED"] = 2;
values[valuesById[3] = "CUSTOM"] = 3;
return values;
})();
v1alpha1.Playlist = (function() {
/**
* Properties of a Playlist.
* @memberof animeshon.library.v1alpha1
* @interface IPlaylist
* @property {string|null} [name] Playlist name
* @property {string|null} [displayName] Playlist displayName
* @property {animeshon.library.v1alpha1.Type|null} [type] Playlist type
*/
/**
* Constructs a new Playlist.
* @memberof animeshon.library.v1alpha1
* @classdesc Represents a Playlist.
* @implements IPlaylist
* @constructor
* @param {animeshon.library.v1alpha1.IPlaylist=} [properties] Properties to set
*/
function Playlist(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]];
}
/**
* Playlist name.
* @member {string} name
* @memberof animeshon.library.v1alpha1.Playlist
* @instance
*/
Playlist.prototype.name = "";
/**
* Playlist displayName.
* @member {string} displayName
* @memberof animeshon.library.v1alpha1.Playlist
* @instance
*/
Playlist.prototype.displayName = "";
/**
* Playlist type.
* @member {animeshon.library.v1alpha1.Type} type
* @memberof animeshon.library.v1alpha1.Playlist
* @instance
*/
Playlist.prototype.type = 0;
/**
* Creates a new Playlist instance using the specified properties.
* @function create
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {animeshon.library.v1alpha1.IPlaylist=} [properties] Properties to set
* @returns {animeshon.library.v1alpha1.Playlist} Playlist instance
*/
Playlist.create = function create(properties) {
return new Playlist(properties);
};
/**
* Encodes the specified Playlist message. Does not implicitly {@link animeshon.library.v1alpha1.Playlist.verify|verify} messages.
* @function encode
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {animeshon.library.v1alpha1.IPlaylist} message Playlist message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Playlist.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.displayName != null && Object.hasOwnProperty.call(message, "displayName"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName);
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type);
return writer;
};
/**
* Encodes the specified Playlist message, length delimited. Does not implicitly {@link animeshon.library.v1alpha1.Playlist.verify|verify} messages.
* @function encodeDelimited
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {animeshon.library.v1alpha1.IPlaylist} message Playlist message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Playlist.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Playlist message from the specified reader or buffer.
* @function decode
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {animeshon.library.v1alpha1.Playlist} Playlist
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Playlist.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.library.v1alpha1.Playlist();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.name = reader.string();
break;
case 2:
message.displayName = reader.string();
break;
case 3:
message.type = reader.int32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Playlist message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {animeshon.library.v1alpha1.Playlist} Playlist
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Playlist.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Playlist message.
* @function verify
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Playlist.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.displayName != null && message.hasOwnProperty("displayName"))
if (!$util.isString(message.displayName))
return "displayName: string expected";
if (message.type != null && message.hasOwnProperty("type"))
switch (message.type) {
default:
return "type: enum value expected";
case 0:
case 1:
case 2:
case 3:
break;
}
return null;
};
/**
* Creates a Playlist message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {Object.<string,*>} object Plain object
* @returns {animeshon.library.v1alpha1.Playlist} Playlist
*/
Playlist.fromObject = function fromObject(object) {
if (object instanceof $root.animeshon.library.v1alpha1.Playlist)
return object;
var message = new $root.animeshon.library.v1alpha1.Playlist();
if (object.name != null)
message.name = String(object.name);
if (object.displayName != null)
message.displayName = String(object.displayName);
switch (object.type) {
case "TYPE_UNSPECIFIED":
case 0:
message.type = 0;
break;
case "LATER":
case 1:
message.type = 1;
break;
case "LIKED":
case 2:
message.type = 2;
break;
case "CUSTOM":
case 3:
message.type = 3;
break;
}
return message;
};
/**
* Creates a plain object from a Playlist message. Also converts values to other types if specified.
* @function toObject
* @memberof animeshon.library.v1alpha1.Playlist
* @static
* @param {animeshon.library.v1alpha1.Playlist} message Playlist
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Playlist.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.name = "";
object.displayName = "";
object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0;
}
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.displayName != null && message.hasOwnProperty("displayName"))
object.displayName = message.displayName;
if (message.type != null && message.hasOwnProperty("type"))
object.type = options.enums === String ? $root.animeshon.library.v1alpha1.Type[message.type] : message.type;
return object;
};
/**
* Converts this Playlist to JSON.
* @function toJSON
* @memberof animeshon.library.v1alpha1.Playlist
* @instance
* @returns {Object.<string,*>} JSON object
*/
Playlist.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return Playlist;
})();
v1alpha1.BatchCreatePlaylistItemsResponse = (function() {
/**
* Properties of a BatchCreatePlaylistItemsResponse.
* @memberof animeshon.library.v1alpha1
* @interface IBatchCreatePlaylistItemsResponse
* @property {Array.<animeshon.library.v1alpha1.IPlaylistItem>|null} [items] BatchCreatePlaylistItemsResponse items
*/
/**
* Constructs a new BatchCreatePlaylistItemsResponse.
* @memberof animeshon.library.v1alpha1
* @classdesc Represents a BatchCreatePlaylistItemsResponse.
* @implements IBatchCreatePlaylistItemsResponse
* @constructor
* @param {animeshon.library.v1alpha1.IBatchCreatePlaylistItemsResponse=} [properties] Properties to set
*/
function BatchCreatePlaylistItemsResponse(properties) {
this.items = [];
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]];
}
/**
* BatchCreatePlaylistItemsResponse items.
* @member {Array.<animeshon.library.v1alpha1.IPlaylistItem>} items
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @instance
*/
BatchCreatePlaylistItemsResponse.prototype.items = $util.emptyArray;
/**
* Creates a new BatchCreatePlaylistItemsResponse instance using the specified properties.
* @function create
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {animeshon.library.v1alpha1.IBatchCreatePlaylistItemsResponse=} [properties] Properties to set
* @returns {animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse} BatchCreatePlaylistItemsResponse instance
*/
BatchCreatePlaylistItemsResponse.create = function create(properties) {
return new BatchCreatePlaylistItemsResponse(properties);
};
/**
* Encodes the specified BatchCreatePlaylistItemsResponse message. Does not implicitly {@link animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse.verify|verify} messages.
* @function encode
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {animeshon.library.v1alpha1.IBatchCreatePlaylistItemsResponse} message BatchCreatePlaylistItemsResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
BatchCreatePlaylistItemsResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.items != null && message.items.length)
for (var i = 0; i < message.items.length; ++i)
$root.animeshon.library.v1alpha1.PlaylistItem.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified BatchCreatePlaylistItemsResponse message, length delimited. Does not implicitly {@link animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse.verify|verify} messages.
* @function encodeDelimited
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {animeshon.library.v1alpha1.IBatchCreatePlaylistItemsResponse} message BatchCreatePlaylistItemsResponse message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
BatchCreatePlaylistItemsResponse.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a BatchCreatePlaylistItemsResponse message from the specified reader or buffer.
* @function decode
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse} BatchCreatePlaylistItemsResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
BatchCreatePlaylistItemsResponse.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.library.v1alpha1.BatchCreatePlaylistItemsResponse();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (!(message.items && message.items.length))
message.items = [];
message.items.push($root.animeshon.library.v1alpha1.PlaylistItem.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a BatchCreatePlaylistItemsResponse message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse} BatchCreatePlaylistItemsResponse
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
BatchCreatePlaylistItemsResponse.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a BatchCreatePlaylistItemsResponse message.
* @function verify
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
BatchCreatePlaylistItemsResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.items != null && message.hasOwnProperty("items")) {
if (!Array.isArray(message.items))
return "items: array expected";
for (var i = 0; i < message.items.length; ++i) {
var error = $root.animeshon.library.v1alpha1.PlaylistItem.verify(message.items[i]);
if (error)
return "items." + error;
}
}
return null;
};
/**
* Creates a BatchCreatePlaylistItemsResponse message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {Object.<string,*>} object Plain object
* @returns {animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse} BatchCreatePlaylistItemsResponse
*/
BatchCreatePlaylistItemsResponse.fromObject = function fromObject(object) {
if (object instanceof $root.animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse)
return object;
var message = new $root.animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse();
if (object.items) {
if (!Array.isArray(object.items))
throw TypeError(".animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse.items: array expected");
message.items = [];
for (var i = 0; i < object.items.length; ++i) {
if (typeof object.items[i] !== "object")
throw TypeError(".animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse.items: object expected");
message.items[i] = $root.animeshon.library.v1alpha1.PlaylistItem.fromObject(object.items[i]);
}
}
return message;
};
/**
* Creates a plain object from a BatchCreatePlaylistItemsResponse message. Also converts values to other types if specified.
* @function toObject
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @static
* @param {animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse} message BatchCreatePlaylistItemsResponse
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
BatchCreatePlaylistItemsResponse.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.items = [];
if (message.items && message.items.length) {
object.items = [];
for (var j = 0; j < message.items.length; ++j)
object.items[j] = $root.animeshon.library.v1alpha1.PlaylistItem.toObject(message.items[j], options);
}
return object;
};
/**
* Converts this BatchCreatePlaylistItemsResponse to JSON.
* @function toJSON
* @memberof animeshon.library.v1alpha1.BatchCreatePlaylistItemsResponse
* @instance
* @returns {Object.<string,*>} JSON object
*/
BatchCreatePlaylistItemsResponse.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return BatchCreatePlaylistItemsResponse;
})();
v1alpha1.PlaylistItem = (function() {
/**
* Properties of a PlaylistItem.
* @memberof animeshon.library.v1alpha1
* @interface IPlaylistItem
* @property {string|null} [name] PlaylistItem name
* @property {string|null} [resource] PlaylistItem resource
* @property {google.protobuf.ITimestamp|null} [createTime] PlaylistItem createTime
*/
/**
* Constructs a new PlaylistItem.
* @memberof animeshon.library.v1alpha1