/// <summary> /// This method may not work or be useful. /// </summary> /// <param name="videoId"></param> /// <param name="languageCode"></param> /// <returns></returns> public static async Task <VideoLanguageDetail> PostNewSubtitleRequest(string videoId, string languageCode) { using (var client = new HttpClient()) { VideoLanguageDetail vld = null; client.BaseAddress = new Uri(baseAddress); client.DefaultRequestHeaders.Add("X-api-username", userName); client.DefaultRequestHeaders.Add("X-api-key", apiKey); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); SubtitleSummary ss = new SubtitleSummary() { LanguageCode = languageCode }; HttpResponseMessage response = await client.PostAsJsonAsync("videos/" + videoId + "/languages/", ss); if (response.IsSuccessStatusCode) { vld = await response.Content.ReadAsAsync <VideoLanguageDetail>(); Console.WriteLine("Post Video Success: " + vld); } else { Console.WriteLine("Post Video failure: " + response.StatusCode); } return(vld); } }
/// <summary> /// This method may not work or be useful. /// </summary> /// <param name="videoId"></param> /// <param name="languageCode"></param> /// <returns></returns> public static async Task<VideoLanguageDetail> PostNewSubtitleRequest(string videoId, string languageCode) { using (var client = new HttpClient()) { VideoLanguageDetail vld = null; client.BaseAddress = new Uri(baseAddress); client.DefaultRequestHeaders.Add("X-api-username", userName); client.DefaultRequestHeaders.Add("X-api-key", apiKey); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); SubtitleSummary ss = new SubtitleSummary() { LanguageCode = languageCode }; HttpResponseMessage response = await client.PostAsJsonAsync("videos/" + videoId + "/languages/", ss); if (response.IsSuccessStatusCode) { vld = await response.Content.ReadAsAsync<VideoLanguageDetail>(); Console.WriteLine("Post Video Success: " + vld); } else Console.WriteLine("Post Video failure: " + response.StatusCode); return vld; } }