using System;
using System.Collections.Generic;
namespace Timeline.Models.Http
{
///
/// Info of post content.
///
public class HttpTimelinePostContent
{
public HttpTimelinePostContent() { }
public HttpTimelinePostContent(string type, string? text, string? url, string? eTag)
{
Type = type;
Text = text;
Url = url;
ETag = eTag;
}
///
/// Type of the post content.
///
public string Type { get; set; } = default!;
///
/// If post is of text type. This is the text.
///
public string? Text { get; set; }
///
/// If post is of image type. This is the image url.
///
public string? Url { get; set; }
///
/// If post has data (currently it means it's a image post), this is the data etag.
///
public string? ETag { get; set; }
}
///
/// Info of a post.
///
public class HttpTimelinePost
{
public HttpTimelinePost() { }
public HttpTimelinePost(long id, HttpTimelinePostContent? content, bool deleted, DateTime time, HttpUser? author, DateTime lastUpdated)
{
Id = id;
Content = content;
Deleted = deleted;
Time = time;
Author = author;
LastUpdated = lastUpdated;
}
///
/// Post id.
///
public long Id { get; set; }
///
/// Content of the post. May be null if post is deleted.
///
public HttpTimelinePostContent? Content { get; set; }
///
/// True if post is deleted.
///
public bool Deleted { get; set; }
///
/// Post time.
///
public DateTime Time { get; set; }
///
/// The author. May be null if the user has been deleted.
///
public HttpUser? Author { get; set; } = default!;
///
/// Last updated time.
///
public DateTime LastUpdated { get; set; } = default!;
}
///
/// Info of a timeline.
///
public class HttpTimeline
{
public HttpTimeline() { }
public HttpTimeline(string uniqueId, string title, string name, DateTime nameLastModifed, string description, HttpUser owner, TimelineVisibility visibility, List members, DateTime createTime, DateTime lastModified, HttpTimelineLinks links)
{
UniqueId = uniqueId;
Title = title;
Name = name;
NameLastModifed = nameLastModifed;
Description = description;
Owner = owner;
Visibility = visibility;
Members = members;
CreateTime = createTime;
LastModified = lastModified;
_links = links;
}
///
/// Unique id.
///
public string UniqueId { get; set; } = default!;
///
/// Title.
///
public string Title { get; set; } = default!;
///
/// Name of timeline.
///
public string Name { get; set; } = default!;
///
/// Last modified time of timeline name.
///
public DateTime NameLastModifed { get; set; } = default!;
///
/// Timeline description.
///
public string Description { get; set; } = default!;
///
/// Owner of the timeline.
///
public HttpUser Owner { get; set; } = default!;
///
/// Visibility of the timeline.
///
public TimelineVisibility Visibility { get; set; }
#pragma warning disable CA2227 // Collection properties should be read only
///
/// Members of timeline.
///
public List Members { get; set; } = default!;
#pragma warning restore CA2227 // Collection properties should be read only
///
/// Create time of timeline.
///
public DateTime CreateTime { get; set; } = default!;
///
/// Last modified time of timeline.
///
public DateTime LastModified { get; set; } = default!;
#pragma warning disable CA1707 // Identifiers should not contain underscores
///
/// Related links.
///
public HttpTimelineLinks _links { get; set; } = default!;
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
///
/// Related links for timeline.
///
public class HttpTimelineLinks
{
public HttpTimelineLinks() { }
public HttpTimelineLinks(string self, string posts)
{
Self = self;
Posts = posts;
}
///
/// Self.
///
public string Self { get; set; } = default!;
///
/// Posts url.
///
public string Posts { get; set; } = default!;
}
}