示例#1
0
        static public NotificationClass_new[] getNotifications(HttpConnectionClass token)
        {
            List <NotificationClass_new> notifications = new List <NotificationClass_new>();
            Task <HttpResponseMessage>   message       = token.client.GetAsync("https://" + token.auth.server + "/api/v1/notifications");

            message.Wait();
            HttpResponseMessage msg = message.Result;
            String json             = (msg.Content).ReadAsStringAsync().Result;

            NotificationClass_new[] obj = JsonConvert.DeserializeObject <NotificationClass_new[]>(json);
            return(obj);
        }
示例#2
0
        static public StatusClass_new GetStatus(HttpConnectionClass token, StatusClass_new ogstatus)
        {
            Task <HttpResponseMessage> message = token.client.GetAsync("https://" + token.auth.server + "/api/v1/statuses/" + ogstatus.id);

            message.Wait();
            HttpResponseMessage msg = message.Result;

            if (!msg.IsSuccessStatusCode)
            {
                return(new StatusClass_new());
            }
            String json = (msg.Content).ReadAsStringAsync().Result;

            return(parseToot(json));
        }
示例#3
0
        static public StatusClass_new[] GetPublicLocalTimeline(HttpConnectionClass token)
        {
            Task <HttpResponseMessage> message = token.client.GetAsync("https://" + token.auth.server + "/api/v1/timelines/public");

            message.Wait();
            HttpResponseMessage msg = message.Result;
            String json             = (msg.Content).ReadAsStringAsync().Result;

            if (!msg.IsSuccessStatusCode)
            {
                return(new StatusClass_new[0]);
            }
            StatusClass_new[] obj = JsonConvert.DeserializeObject <StatusClass_new[]>(json);
            return(obj);
        }
示例#4
0
        static public StatusContext GetStatusContext(HttpConnectionClass token, StatusClass_new ogstatus)
        {
            Task <HttpResponseMessage> message = token.client.GetAsync("https://" + token.auth.server + "/api/v1/statuses/" + ogstatus.id + "/context");

            message.Wait();
            HttpResponseMessage msg = message.Result;

            if (!msg.IsSuccessStatusCode)
            {
                return(new StatusContext
                {
                    ancestors = new StatusClass_new[0],
                    descendants = new StatusClass_new[0]
                });
            }
            String        json = (msg.Content).ReadAsStringAsync().Result;
            StatusContext obj  = JsonConvert.DeserializeObject <StatusContext>(json);

            return(obj);
        }