public async Task <T> Delete <T>(string url)
            where T : class
        {
            var response = await Delete(url).ConfigureAwait(false);

            return(MastodonJsonConverter.TryDeserialize <T>(response));
        }
        public async Task <T> PostWithMedia <T>(string url, byte[] image)
            where T : class
        {
            var response = await PostWithMedia(url, image).ConfigureAwait(false);

            return(MastodonJsonConverter.TryDeserialize <T>(response));
        }
        public async Task <T> Patch <T>(string url, IEnumerable <KeyValuePair <string, string> > body = null)
            where T : class
        {
            var response = await Patch(url, body).ConfigureAwait(false);

            return(MastodonJsonConverter.TryDeserialize <T>(response));
        }
        private IStreamEntity ConvertStreamEntity(StreamEvent ev, string entityBody)
        {
            switch (ev)
            {
            case StreamEvent.Update:
                return(MastodonJsonConverter.TryDeserialize <Status>(entityBody));

            case StreamEvent.Notification:
                return(MastodonJsonConverter.TryDeserialize <Notification>(entityBody));

            case StreamEvent.Delete:
                return(new DeletedStream
                {
                    StatusId = int.Parse(entityBody)
                });

            default:
                throw new Exception();
            }
        }
        public async Task <ResponseCollection <T> > GetCollection <T>(string url)
            where T : IBaseMastodonEntity
        {
            var response = await GetEntirely(url).ConfigureAwait(false);

            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var entity = MastodonJsonConverter.TryDeserialize <IEnumerable <T> >(content);
            var result = new ResponseCollection <T>(entity);

            result.RawJson = content;

            IEnumerable <string> link;

            if (response.Headers.TryGetValues("Link", out link))
            {
                result.Links = LinkHeaderParser.GetHeader(link.First());
            }

            return(result);
        }