コード例 #1
0
        public async Task <Status[]> GetPublicTimelineAsync(bool?local = null, bool?onlyMedia = null, string maxId = null, string sinceId = null, string minId = null, int limit = 20)
        {
            var query = new QueryItemCollection();

            query.Add("local", local);
            query.Add("onlyMedia", onlyMedia);
            query.Add("max_id", maxId);
            query.Add("since_id", sinceId);
            query.Add("min_id", minId);
            query.Add("limit", limit);

            return(await GetHttpAsync <Status[]>("/api/v1/timelines/public", query));
        }
コード例 #2
0
        private async Task <T> GetHttpAsync <T>(string requestUri, QueryItemCollection query)
        {
            var uri = new Uri(BaseUrl, requestUri + query.ToQuery());

            var response = await Client.GetAsync(uri);

            if (!response.IsSuccessStatusCode)
            {
                return(default(T));
            }
            var jsonString = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <T>(jsonString, new IsoDateTimeConverter()));
        }