/// <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 } })); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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); }
/// <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)); }