Пример #1
0
 /// <summary>
 /// Get a URL from the API that can be used to download an attachment.
 /// </summary>
 public Task <string> GenerateGetPresignedUrlAsync(ITimelineService api)
 {
     return(api.GetJsonAsync("TimelineEventAttachment/GenerateGetPresignedUrl", new NameValueCollection
     {
         { "AttachmentId", Id }
     }));
 }
Пример #2
0
        /// <summary>
        /// Gets all events for the timeline with the specified ID from the API.
        /// </summary>
        public static async Task <IList <LinkedEvent> > GetEventsAsync(ITimelineService api, string timelineId)
        {
            string json = await api.GetJsonAsync("Timeline/GetEvents", new NameValueCollection
            {
                { "TimelineId", timelineId }
            });

            return(JsonConvert.DeserializeObject <List <LinkedEvent> >(json));
        }
Пример #3
0
        /// <summary>
        /// Gets the event with the specified ID from the API.
        /// </summary>
        public static async Task <TimelineEvent> GetEventAsync(ITimelineService api, string timelineEventId)
        {
            string json = await api.GetJsonAsync("TimelineEvent/GetTimelineEvent", new NameValueCollection
            {
                { "TimelineEventId", timelineEventId }
            });

            return(JsonConvert.DeserializeObject <TimelineEvent>(json));
        }
Пример #4
0
        /// <summary>
        /// Gets all timelines, events, and attachments from the API in one go.
        /// </summary>
        public static async Task <List <Timeline> > GetAllTimelinesAndEventsAsync(ITimelineService api)
        {
            string json = await api.GetJsonAsync("Timeline/GetAllTimelinesAndEvent");

            var timelines = JsonConvert.DeserializeObject <TimelineCollection>(json);

            if (timelines != null)
            {
                foreach (var timeline in timelines.Timelines)
                {
                    timeline.UpdateCalculatedColumns();
                }
                return(timelines.Timelines);
            }
            return(null);
        }
Пример #5
0
        /// <summary>
        /// A synchronous version of GetAllTimelinesAndEventsAsync() that will block the calling thread.
        /// </summary>
        public static List <Timeline> GetAllTimelinesAndEvents(ITimelineService api)
        {
            var task = api.GetJsonAsync("Timeline/GetAllTimelinesAndEvent");

            task.Wait();
            string json      = task.Result;
            var    timelines = JsonConvert.DeserializeObject <TimelineCollection>(json);

            if (timelines != null)
            {
                foreach (var timeline in timelines.Timelines)
                {
                    timeline.UpdateCalculatedColumns();
                }
                return(timelines.Timelines);
            }
            return(null);
        }
Пример #6
0
        /// <summary>
        /// Gets all events from the API.
        /// </summary>
        /// <param name="api"></param>
        /// <returns></returns>
        public static async Task <IList <TimelineEvent> > GetAllEventsAsync(ITimelineService api)
        {
            string json = await api.GetJsonAsync("TimelineEvent/GetAllEvents");

            return(JsonConvert.DeserializeObject <List <TimelineEvent> >(json));
        }