Beispiel #1
0
        /// <summary>
        /// Read video property info by the property name.
        /// </summary>
        /// <param name="request">Request. <see cref="GetVideoPropertyRequest" /></param>
        /// <returns><see cref="VideoPropertyResponse"/></returns>
        public VideoPropertyResponse GetVideoProperty(GetVideoPropertyRequest request)
        {
            // verify the required parameter 'name' is set
            if (request.Name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling GetVideoProperty");
            }

            // verify the required parameter 'propertyName' is set
            if (request.PropertyName == null)
            {
                throw new ApiException(400, "Missing required parameter 'propertyName' when calling GetVideoProperty");
            }

            // create path and map variables
            var resourcePath = "/video/{name}/videoProperties/{propertyName}?appSid={appSid}&amp;folder=[folder]&amp;storage=[storage]";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            resourcePath = this.AddPathParameter(resourcePath, "name", request.Name);
            resourcePath = this.AddPathParameter(resourcePath, "propertyName", request.PropertyName);
            resourcePath = this.AddQueryParameter(resourcePath, "folder", request.Folder);
            resourcePath = this.AddQueryParameter(resourcePath, "storage", request.Storage);

            try
            {
                var response = this.apiInvoker.InvokeApi(
                    resourcePath,
                    "GET",
                    null,
                    null,
                    null);
                if (response != null)
                {
                    return((VideoPropertyResponse)SerializationHelper.Deserialize(response, typeof(VideoPropertyResponse)));
                }

                return(null);
            }
            catch (ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }

                throw;
            }
        }
Beispiel #2
0
        public void TestGetVideoProperty()
        {
            var localName  = "sample.avi";
            var remoteName = "TestGetVideoProperty.avi";
            var fullName   = Path.Combine(this.dataFolder, remoteName);

            this.StorageApi.PutCreate(fullName, null, null, File.ReadAllBytes(BaseTestContext.GetDataDir() + localName));


            var request = new GetVideoPropertyRequest(remoteName, "duration", this.dataFolder);
            var actual  = this.VideoApi.GetVideoProperty(request);

            Assert.AreEqual(200, System.Convert.ToInt32(actual.Code.ToString()));
            Assert.AreEqual("5000", actual.VideoProperty);
        }