public async Task <IActionResult> SearchVideos(string keyword)
        {
            AzureVideoIndexerHelper helper = new AzureVideoIndexerHelper(this.AzureConfiguration,
                                                                         this.CreateAuthorizedHttpClient());
            var accountAccesstoken = await helper.GetAccountAccessTokenString(false);

            string requestUrl = $"https://api.videoindexer.ai/" +
                                $"{this.AzureConfiguration.VideoIndexerConfiguration.Location}" +
                                $"/Accounts/{this.AzureConfiguration.VideoIndexerConfiguration.AccountId}" +
                                $"/Videos/Search?" +
                                //$"[?sourceLanguage]" +
                                //$"[&isBase]" +
                                //$"[&hasSourceVideoFile]" +
                                //$"[&sourceVideoId]" +
                                //$"[&state]" +
                                //$"[&privacy]" +
                                //$"[&id]" +
                                //$"[&partition]" +
                                //$"[&externalId]" +
                                //$"[&owner]" +
                                //$"[&face]" +
                                //$"[&animatedcharacter]" +
                                $"query={keyword}" +
                                //$"[&textScope]" +
                                //$"[&language]" +
                                //$"[&createdAfter]" +
                                //$"[&createdBefore]" +
                                //$"[&pageSize]" +
                                //$"[&skip]" +
                                $"&accessToken={accountAccesstoken}";
            HttpClient client = new HttpClient();
            var        result = await client.GetFromJsonAsync <SearchVideosResponse>(requestUrl);

            return(Ok(result));
        }
        public async Task <IActionResult> GetAccountAccessToken(bool allowEdit = false)
        {
            AzureVideoIndexerHelper helper = new AzureVideoIndexerHelper(this.AzureConfiguration,
                                                                         this.CreateAuthorizedHttpClient());
            string result = await helper.GetAccountAccessTokenString(allowEdit);

            return(Ok(result));
        }
        private async Task <HttpResponseMessage> AnalyzeVideo(UploadVideoModel model)
        {
            AzureVideoIndexerHelper helper = new AzureVideoIndexerHelper(this.AzureConfiguration,
                                                                         this.CreateAuthorizedHttpClient());
            string accountAccesstoken = await helper.GetAccountAccessTokenString(true);

            string requestUrl = $"https://api.videoindexer.ai/" +
                                $"{this.AzureConfiguration.VideoIndexerConfiguration.Location}" +
                                $"/Accounts/{this.AzureConfiguration.VideoIndexerConfiguration.AccountId}" +
                                $"/Videos" +
                                $"?name={EncodeUrl(model.Name)}" +
                                //$"[&privacy]" +
                                //$"[&priority]" +
                                //$"[&description]" +
                                //$"[&partition]" +
                                //$"[&externalId]" +
                                //$"[&externalUrl]" +
                                //$"[&metadata]" +
                                //$"[&language]" +
                                $"&videoUrl={EncodeUrl(model.VideoUrl)}" +
                                //$"[&fileName]" +
                                //$"[&indexingPreset]" +
                                //$"[&streamingPreset]" +
                                //$"[&linguisticModelId]" +
                                //$"[&personModelId]" +
                                //$"[&animationModelId]" +
                                $"&sendSuccessEmail={model.SendSuccessEmail}" +
                                //$"[&assetId]" +
                                //$"[&brandsCategories]" +
                                $"&accessToken={accountAccesstoken}";

            if (!string.IsNullOrWhiteSpace(model.CallbackUrl))
            {
                requestUrl +=
                    $"&callbackUrl={EncodeUrl(model.CallbackUrl)}";
            }
            var client = this.CreateAuthorizedHttpClient();
            var result = await client.PostAsync(requestUrl, null);

            return(result);
        }