@google-cloud/video-stitcher
Version:
798 lines (735 loc) • 2.6 MB
JavaScript
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal);
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots._google_cloud_video_stitcher_protos || ($protobuf.roots._google_cloud_video_stitcher_protos = {});
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.cloud = (function() {
/**
* Namespace cloud.
* @memberof google
* @namespace
*/
var cloud = {};
cloud.video = (function() {
/**
* Namespace video.
* @memberof google.cloud
* @namespace
*/
var video = {};
video.stitcher = (function() {
/**
* Namespace stitcher.
* @memberof google.cloud.video
* @namespace
*/
var stitcher = {};
stitcher.v1 = (function() {
/**
* Namespace v1.
* @memberof google.cloud.video.stitcher
* @namespace
*/
var v1 = {};
v1.LiveAdTagDetail = (function() {
/**
* Properties of a LiveAdTagDetail.
* @memberof google.cloud.video.stitcher.v1
* @interface ILiveAdTagDetail
* @property {string|null} [name] LiveAdTagDetail name
* @property {Array.<google.cloud.video.stitcher.v1.IAdRequest>|null} [adRequests] LiveAdTagDetail adRequests
*/
/**
* Constructs a new LiveAdTagDetail.
* @memberof google.cloud.video.stitcher.v1
* @classdesc Represents a LiveAdTagDetail.
* @implements ILiveAdTagDetail
* @constructor
* @param {google.cloud.video.stitcher.v1.ILiveAdTagDetail=} [properties] Properties to set
*/
function LiveAdTagDetail(properties) {
this.adRequests = [];
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]];
}
/**
* LiveAdTagDetail name.
* @member {string} name
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @instance
*/
LiveAdTagDetail.prototype.name = "";
/**
* LiveAdTagDetail adRequests.
* @member {Array.<google.cloud.video.stitcher.v1.IAdRequest>} adRequests
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @instance
*/
LiveAdTagDetail.prototype.adRequests = $util.emptyArray;
/**
* Creates a new LiveAdTagDetail instance using the specified properties.
* @function create
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.ILiveAdTagDetail=} [properties] Properties to set
* @returns {google.cloud.video.stitcher.v1.LiveAdTagDetail} LiveAdTagDetail instance
*/
LiveAdTagDetail.create = function create(properties) {
return new LiveAdTagDetail(properties);
};
/**
* Encodes the specified LiveAdTagDetail message. Does not implicitly {@link google.cloud.video.stitcher.v1.LiveAdTagDetail.verify|verify} messages.
* @function encode
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.ILiveAdTagDetail} message LiveAdTagDetail message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LiveAdTagDetail.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.adRequests != null && message.adRequests.length)
for (var i = 0; i < message.adRequests.length; ++i)
$root.google.cloud.video.stitcher.v1.AdRequest.encode(message.adRequests[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified LiveAdTagDetail message, length delimited. Does not implicitly {@link google.cloud.video.stitcher.v1.LiveAdTagDetail.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.ILiveAdTagDetail} message LiveAdTagDetail message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LiveAdTagDetail.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a LiveAdTagDetail message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.video.stitcher.v1.LiveAdTagDetail} LiveAdTagDetail
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LiveAdTagDetail.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.video.stitcher.v1.LiveAdTagDetail();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.name = reader.string();
break;
}
case 2: {
if (!(message.adRequests && message.adRequests.length))
message.adRequests = [];
message.adRequests.push($root.google.cloud.video.stitcher.v1.AdRequest.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a LiveAdTagDetail message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.video.stitcher.v1.LiveAdTagDetail} LiveAdTagDetail
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LiveAdTagDetail.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a LiveAdTagDetail message.
* @function verify
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
LiveAdTagDetail.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.adRequests != null && message.hasOwnProperty("adRequests")) {
if (!Array.isArray(message.adRequests))
return "adRequests: array expected";
for (var i = 0; i < message.adRequests.length; ++i) {
var error = $root.google.cloud.video.stitcher.v1.AdRequest.verify(message.adRequests[i]);
if (error)
return "adRequests." + error;
}
}
return null;
};
/**
* Creates a LiveAdTagDetail message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.video.stitcher.v1.LiveAdTagDetail} LiveAdTagDetail
*/
LiveAdTagDetail.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.video.stitcher.v1.LiveAdTagDetail)
return object;
var message = new $root.google.cloud.video.stitcher.v1.LiveAdTagDetail();
if (object.name != null)
message.name = String(object.name);
if (object.adRequests) {
if (!Array.isArray(object.adRequests))
throw TypeError(".google.cloud.video.stitcher.v1.LiveAdTagDetail.adRequests: array expected");
message.adRequests = [];
for (var i = 0; i < object.adRequests.length; ++i) {
if (typeof object.adRequests[i] !== "object")
throw TypeError(".google.cloud.video.stitcher.v1.LiveAdTagDetail.adRequests: object expected");
message.adRequests[i] = $root.google.cloud.video.stitcher.v1.AdRequest.fromObject(object.adRequests[i]);
}
}
return message;
};
/**
* Creates a plain object from a LiveAdTagDetail message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.LiveAdTagDetail} message LiveAdTagDetail
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
LiveAdTagDetail.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.adRequests = [];
if (options.defaults)
object.name = "";
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.adRequests && message.adRequests.length) {
object.adRequests = [];
for (var j = 0; j < message.adRequests.length; ++j)
object.adRequests[j] = $root.google.cloud.video.stitcher.v1.AdRequest.toObject(message.adRequests[j], options);
}
return object;
};
/**
* Converts this LiveAdTagDetail to JSON.
* @function toJSON
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @instance
* @returns {Object.<string,*>} JSON object
*/
LiveAdTagDetail.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for LiveAdTagDetail
* @function getTypeUrl
* @memberof google.cloud.video.stitcher.v1.LiveAdTagDetail
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
LiveAdTagDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.video.stitcher.v1.LiveAdTagDetail";
};
return LiveAdTagDetail;
})();
v1.VodAdTagDetail = (function() {
/**
* Properties of a VodAdTagDetail.
* @memberof google.cloud.video.stitcher.v1
* @interface IVodAdTagDetail
* @property {string|null} [name] VodAdTagDetail name
* @property {Array.<google.cloud.video.stitcher.v1.IAdRequest>|null} [adRequests] VodAdTagDetail adRequests
*/
/**
* Constructs a new VodAdTagDetail.
* @memberof google.cloud.video.stitcher.v1
* @classdesc Represents a VodAdTagDetail.
* @implements IVodAdTagDetail
* @constructor
* @param {google.cloud.video.stitcher.v1.IVodAdTagDetail=} [properties] Properties to set
*/
function VodAdTagDetail(properties) {
this.adRequests = [];
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]];
}
/**
* VodAdTagDetail name.
* @member {string} name
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @instance
*/
VodAdTagDetail.prototype.name = "";
/**
* VodAdTagDetail adRequests.
* @member {Array.<google.cloud.video.stitcher.v1.IAdRequest>} adRequests
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @instance
*/
VodAdTagDetail.prototype.adRequests = $util.emptyArray;
/**
* Creates a new VodAdTagDetail instance using the specified properties.
* @function create
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.IVodAdTagDetail=} [properties] Properties to set
* @returns {google.cloud.video.stitcher.v1.VodAdTagDetail} VodAdTagDetail instance
*/
VodAdTagDetail.create = function create(properties) {
return new VodAdTagDetail(properties);
};
/**
* Encodes the specified VodAdTagDetail message. Does not implicitly {@link google.cloud.video.stitcher.v1.VodAdTagDetail.verify|verify} messages.
* @function encode
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.IVodAdTagDetail} message VodAdTagDetail message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
VodAdTagDetail.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.adRequests != null && message.adRequests.length)
for (var i = 0; i < message.adRequests.length; ++i)
$root.google.cloud.video.stitcher.v1.AdRequest.encode(message.adRequests[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified VodAdTagDetail message, length delimited. Does not implicitly {@link google.cloud.video.stitcher.v1.VodAdTagDetail.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.IVodAdTagDetail} message VodAdTagDetail message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
VodAdTagDetail.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a VodAdTagDetail message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.video.stitcher.v1.VodAdTagDetail} VodAdTagDetail
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
VodAdTagDetail.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.video.stitcher.v1.VodAdTagDetail();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.name = reader.string();
break;
}
case 2: {
if (!(message.adRequests && message.adRequests.length))
message.adRequests = [];
message.adRequests.push($root.google.cloud.video.stitcher.v1.AdRequest.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a VodAdTagDetail message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.video.stitcher.v1.VodAdTagDetail} VodAdTagDetail
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
VodAdTagDetail.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a VodAdTagDetail message.
* @function verify
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
VodAdTagDetail.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.adRequests != null && message.hasOwnProperty("adRequests")) {
if (!Array.isArray(message.adRequests))
return "adRequests: array expected";
for (var i = 0; i < message.adRequests.length; ++i) {
var error = $root.google.cloud.video.stitcher.v1.AdRequest.verify(message.adRequests[i]);
if (error)
return "adRequests." + error;
}
}
return null;
};
/**
* Creates a VodAdTagDetail message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.video.stitcher.v1.VodAdTagDetail} VodAdTagDetail
*/
VodAdTagDetail.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.video.stitcher.v1.VodAdTagDetail)
return object;
var message = new $root.google.cloud.video.stitcher.v1.VodAdTagDetail();
if (object.name != null)
message.name = String(object.name);
if (object.adRequests) {
if (!Array.isArray(object.adRequests))
throw TypeError(".google.cloud.video.stitcher.v1.VodAdTagDetail.adRequests: array expected");
message.adRequests = [];
for (var i = 0; i < object.adRequests.length; ++i) {
if (typeof object.adRequests[i] !== "object")
throw TypeError(".google.cloud.video.stitcher.v1.VodAdTagDetail.adRequests: object expected");
message.adRequests[i] = $root.google.cloud.video.stitcher.v1.AdRequest.fromObject(object.adRequests[i]);
}
}
return message;
};
/**
* Creates a plain object from a VodAdTagDetail message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {google.cloud.video.stitcher.v1.VodAdTagDetail} message VodAdTagDetail
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
VodAdTagDetail.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.adRequests = [];
if (options.defaults)
object.name = "";
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.adRequests && message.adRequests.length) {
object.adRequests = [];
for (var j = 0; j < message.adRequests.length; ++j)
object.adRequests[j] = $root.google.cloud.video.stitcher.v1.AdRequest.toObject(message.adRequests[j], options);
}
return object;
};
/**
* Converts this VodAdTagDetail to JSON.
* @function toJSON
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @instance
* @returns {Object.<string,*>} JSON object
*/
VodAdTagDetail.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for VodAdTagDetail
* @function getTypeUrl
* @memberof google.cloud.video.stitcher.v1.VodAdTagDetail
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
VodAdTagDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.video.stitcher.v1.VodAdTagDetail";
};
return VodAdTagDetail;
})();
v1.AdRequest = (function() {
/**
* Properties of an AdRequest.
* @memberof google.cloud.video.stitcher.v1
* @interface IAdRequest
* @property {string|null} [uri] AdRequest uri
* @property {google.cloud.video.stitcher.v1.IRequestMetadata|null} [requestMetadata] AdRequest requestMetadata
* @property {google.cloud.video.stitcher.v1.IResponseMetadata|null} [responseMetadata] AdRequest responseMetadata
*/
/**
* Constructs a new AdRequest.
* @memberof google.cloud.video.stitcher.v1
* @classdesc Represents an AdRequest.
* @implements IAdRequest
* @constructor
* @param {google.cloud.video.stitcher.v1.IAdRequest=} [properties] Properties to set
*/
function AdRequest(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]];
}
/**
* AdRequest uri.
* @member {string} uri
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @instance
*/
AdRequest.prototype.uri = "";
/**
* AdRequest requestMetadata.
* @member {google.cloud.video.stitcher.v1.IRequestMetadata|null|undefined} requestMetadata
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @instance
*/
AdRequest.prototype.requestMetadata = null;
/**
* AdRequest responseMetadata.
* @member {google.cloud.video.stitcher.v1.IResponseMetadata|null|undefined} responseMetadata
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @instance
*/
AdRequest.prototype.responseMetadata = null;
/**
* Creates a new AdRequest instance using the specified properties.
* @function create
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {google.cloud.video.stitcher.v1.IAdRequest=} [properties] Properties to set
* @returns {google.cloud.video.stitcher.v1.AdRequest} AdRequest instance
*/
AdRequest.create = function create(properties) {
return new AdRequest(properties);
};
/**
* Encodes the specified AdRequest message. Does not implicitly {@link google.cloud.video.stitcher.v1.AdRequest.verify|verify} messages.
* @function encode
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {google.cloud.video.stitcher.v1.IAdRequest} message AdRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AdRequest.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.uri != null && Object.hasOwnProperty.call(message, "uri"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri);
if (message.requestMetadata != null && Object.hasOwnProperty.call(message, "requestMetadata"))
$root.google.cloud.video.stitcher.v1.RequestMetadata.encode(message.requestMetadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.responseMetadata != null && Object.hasOwnProperty.call(message, "responseMetadata"))
$root.google.cloud.video.stitcher.v1.ResponseMetadata.encode(message.responseMetadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
return writer;
};
/**
* Encodes the specified AdRequest message, length delimited. Does not implicitly {@link google.cloud.video.stitcher.v1.AdRequest.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {google.cloud.video.stitcher.v1.IAdRequest} message AdRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
AdRequest.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an AdRequest message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.video.stitcher.v1.AdRequest} AdRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AdRequest.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.video.stitcher.v1.AdRequest();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.uri = reader.string();
break;
}
case 2: {
message.requestMetadata = $root.google.cloud.video.stitcher.v1.RequestMetadata.decode(reader, reader.uint32());
break;
}
case 3: {
message.responseMetadata = $root.google.cloud.video.stitcher.v1.ResponseMetadata.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an AdRequest message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.video.stitcher.v1.AdRequest} AdRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
AdRequest.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an AdRequest message.
* @function verify
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
AdRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.uri != null && message.hasOwnProperty("uri"))
if (!$util.isString(message.uri))
return "uri: string expected";
if (message.requestMetadata != null && message.hasOwnProperty("requestMetadata")) {
var error = $root.google.cloud.video.stitcher.v1.RequestMetadata.verify(message.requestMetadata);
if (error)
return "requestMetadata." + error;
}
if (message.responseMetadata != null && message.hasOwnProperty("responseMetadata")) {
var error = $root.google.cloud.video.stitcher.v1.ResponseMetadata.verify(message.responseMetadata);
if (error)
return "responseMetadata." + error;
}
return null;
};
/**
* Creates an AdRequest message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.video.stitcher.v1.AdRequest} AdRequest
*/
AdRequest.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.video.stitcher.v1.AdRequest)
return object;
var message = new $root.google.cloud.video.stitcher.v1.AdRequest();
if (object.uri != null)
message.uri = String(object.uri);
if (object.requestMetadata != null) {
if (typeof object.requestMetadata !== "object")
throw TypeError(".google.cloud.video.stitcher.v1.AdRequest.requestMetadata: object expected");
message.requestMetadata = $root.google.cloud.video.stitcher.v1.RequestMetadata.fromObject(object.requestMetadata);
}
if (object.responseMetadata != null) {
if (typeof object.responseMetadata !== "object")
throw TypeError(".google.cloud.video.stitcher.v1.AdRequest.responseMetadata: object expected");
message.responseMetadata = $root.google.cloud.video.stitcher.v1.ResponseMetadata.fromObject(object.responseMetadata);
}
return message;
};
/**
* Creates a plain object from an AdRequest message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.video.stitcher.v1.AdRequest
* @static
* @param {google.cloud.video.stitcher.v1.AdRequest} message AdRequest
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
AdRequest.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {