Exemple #1
0
        public async Task DeleteClip(int id)
        {
            Logger.Log("DeleteClip: Creating client...");
            using (var c = WebRequestHelper.GetClient())
            {
                try
                {
                    Logger.Log("GetClips: Requesting delete...");
                    var response = await c.DeleteAsync(URLs.GetClip(id));

                    response.EnsureSuccessStatusCode();
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    throw;
                }
            }
        }
Exemple #2
0
        public async Task <ClipInfo> GetClipInfo(int id)
        {
            Logger.Log("GetClipInfo: Creating client...");
            using (var c = WebRequestHelper.GetClient())
            {
                try
                {
                    Logger.Log("GetClipInfo: Making request...");
                    var response = await c.GetAsync(URLs.GetClip(id));

                    response.EnsureSuccessStatusCode();
                    var responseBody = await response.Content.ReadAsStringAsync();

                    Logger.Log("GetClipInfo: Deserializing...");
                    var item = JsonConvert.DeserializeObject <ClipInfo[]>(responseBody);
                    return(item.FirstOrDefault());
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    throw;
                }
            }
        }