diff --git a/Notifications/CardReceivedNotification.cs b/Notifications/CardReceivedNotification.cs new file mode 100644 index 0000000..cc8fd55 --- /dev/null +++ b/Notifications/CardReceivedNotification.cs @@ -0,0 +1,17 @@ +using System; +using RestSharp.Deserializers; + +namespace HabitSharp.Notifications { + + public class CardReceivedNotificationData { + + [DeserializeAs(Name="card")] + public string CardType { get; set; } + + [DeserializeAs(Name="from")] + public NotificationUserData Sender { get; set; } + } + + [NotificationType("CARD_RECEIVED")] + public class CardReceivedNotification : DataNotification { } +} diff --git a/Notifications/CronNotification.cs b/Notifications/CronNotification.cs new file mode 100644 index 0000000..351a74a --- /dev/null +++ b/Notifications/CronNotification.cs @@ -0,0 +1,14 @@ +using RestSharp.Deserializers; + +namespace HabitSharp.Notifications { + public class CronNotificationData { + [DeserializeAs(Name="hp")] + public double HealthPoints { get; set; } + + [DeserializeAs(Name="mp")] + public double ManaPoints { get; set; } + } + + [NotificationType("CRON")] + public class CronNotification : DataNotification { } +} diff --git a/Notifications/DataNotification.cs b/Notifications/DataNotification.cs new file mode 100644 index 0000000..949390c --- /dev/null +++ b/Notifications/DataNotification.cs @@ -0,0 +1,17 @@ +using System; + +namespace HabitSharp.Notifications { + public class DataNotification : Notification where T : new() { + public T Data { get; set; } + } + + public class NotificationUserData { + public Guid Id { get; set; } + public string Name { get; set; } + } + + public class NotificationGroupData { + public Guid Id { get; set; } + public string Name { get; set; } + } +} diff --git a/Notifications/GroupInviteAcceptedNotification.cs b/Notifications/GroupInviteAcceptedNotification.cs new file mode 100644 index 0000000..3571c76 --- /dev/null +++ b/Notifications/GroupInviteAcceptedNotification.cs @@ -0,0 +1,13 @@ +namespace HabitSharp.Notifications { + public class GroupInviteAcceptedNotificationData { + public string HeaderText { get; set; } + public string BodyText { get; set; } + } + + /// + /// A notification sent to a user when they invited another user to join a guild, group, etc. and the other user accepted the invitation. + /// + [NotificationType("GROUP_INVITE_ACCEPTED")] + public class GroupInviteAcceptedNotification : + DataNotification { } +} diff --git a/Notifications/GroupTaskApprovalNotification.cs b/Notifications/GroupTaskApprovalNotification.cs new file mode 100644 index 0000000..c373f1f --- /dev/null +++ b/Notifications/GroupTaskApprovalNotification.cs @@ -0,0 +1,25 @@ +using System; + +namespace HabitSharp.Notifications { + public class GroupTaskApprovalNotificationData { + public string Message { get; set; } + + public Guid GroupId { get; set; } + + /// + /// ID of the task in the user's own view. + /// + /// + public Guid TaskId { get; set; } + + public Guid UserId { get; set; } + + /// + /// The original task ID in the group. + /// + public Guid GroupTaskId { get; set; } + } + + [NotificationType("GROUP_TASK_APPROVAL")] + public class GroupTaskApprovalNotification : DataNotification { } +} diff --git a/Notifications/GroupTaskApprovedNotification.cs b/Notifications/GroupTaskApprovedNotification.cs new file mode 100644 index 0000000..f538b1f --- /dev/null +++ b/Notifications/GroupTaskApprovedNotification.cs @@ -0,0 +1,11 @@ +using System; + +namespace HabitSharp.Notifications { + public class GroupTaskApprovedNotificationData { + public string Message { get; set; } + public Guid GroupId { get; set; } + } + + [NotificationType("GROUP_TASK_APPROVED")] + public class GroupTaskApprovedNotification : DataNotification { } +} diff --git a/Notifications/GroupTaskNeedsWorkNotification.cs b/Notifications/GroupTaskNeedsWorkNotification.cs new file mode 100644 index 0000000..ff5cb0d --- /dev/null +++ b/Notifications/GroupTaskNeedsWorkNotification.cs @@ -0,0 +1,24 @@ +using System; +using RestSharp.Deserializers; + +namespace HabitSharp.Notifications { + public class GroupTaskNeedsWorkNotificationTaskData { + public Guid Id { get; set; } + public string Text { get; set; } + } + + public class GroupTaskNeedsWorkNotificationData { + public string Message { get; set; } + + [DeserializeAs(Name="task")] + public GroupTaskNeedsWorkNotificationTaskData TaskInfo { get; set; } + [DeserializeAs(Name="manager")] + public NotificationUserData ManagerInfo { get; set; } + [DeserializeAs(Name="group")] + public NotificationGroupData GroupInfo { get; set; } + } + + [NotificationType("GROUP_TASK_NEEDS_WORK")] + public class GroupTaskNeedsWorkNotification : + DataNotification { } +} diff --git a/Notifications/GuildPromptNotification.cs b/Notifications/GuildPromptNotification.cs new file mode 100644 index 0000000..0198b83 --- /dev/null +++ b/Notifications/GuildPromptNotification.cs @@ -0,0 +1,8 @@ +namespace HabitSharp.Notifications { + public class GuildPromptNotificationData { + public int TextVariant { get; set; } + } + + [NotificationType("GUILD_PROMPT")] + public class GuildPromptNotification : DataNotification { } +} diff --git a/Notifications/LoginIncentiveNotification.cs b/Notifications/LoginIncentiveNotification.cs new file mode 100644 index 0000000..d14ec61 --- /dev/null +++ b/Notifications/LoginIncentiveNotification.cs @@ -0,0 +1,16 @@ +namespace HabitSharp.Notifications { + public class LoginIncentiveNotificationData { + public string Message { get; set; } + + // TODO: Rewards + // [DeserializeAs(Name="reward")] + // public List Rewards { get; set; } + + public string RewardKey { get; set; } + public string RewardText { get; set; } + public string NextRewardAt { get; set; } + } + + [NotificationType("LOGIN_INCENTIVE")] + public class LoginIncentiveNotification : DataNotification { } +} diff --git a/Notifications/NewChatMessageNotification.cs b/Notifications/NewChatMessageNotification.cs new file mode 100644 index 0000000..559eac9 --- /dev/null +++ b/Notifications/NewChatMessageNotification.cs @@ -0,0 +1,8 @@ +namespace HabitSharp.Notifications { + public class NewChatMessageNotificationData { + public NotificationGroupData Group { get; set; } + } + + [NotificationType("NEW_CHAT_MESSAGE")] + public class NewChatMessageNotification : DataNotification { } +} diff --git a/Notifications/NewInboxMessageNotification.cs b/Notifications/NewInboxMessageNotification.cs new file mode 100644 index 0000000..fa7a796 --- /dev/null +++ b/Notifications/NewInboxMessageNotification.cs @@ -0,0 +1,12 @@ +using System; + +namespace HabitSharp.Notifications { + public class NewInboxMessageNotificationData { + public NotificationUserData Sender { get; set; } + public string Excerpt { get; set; } + public Guid MessageId { get; set; } + } + + [NotificationType("NEW_INBOX_MESSAGE")] + public class NewInboxMessageNotification : DataNotification { } +} diff --git a/Notifications/NewMysteryItemsNotification.cs b/Notifications/NewMysteryItemsNotification.cs new file mode 100644 index 0000000..5416223 --- /dev/null +++ b/Notifications/NewMysteryItemsNotification.cs @@ -0,0 +1,8 @@ +namespace HabitSharp.Notifications { + public class NewMysteryItemsNotificationData { + public string[] Items { get; set; } + } + + [NotificationType("NEW_MYSTERY_ITEMS")] + public class NewMysteryItemsNotification : DataNotification { } +} diff --git a/Notifications/NewStuffNotification.cs b/Notifications/NewStuffNotification.cs new file mode 100644 index 0000000..7bd2e73 --- /dev/null +++ b/Notifications/NewStuffNotification.cs @@ -0,0 +1,12 @@ +namespace HabitSharp.Notifications { + public class NewStuffNotificationData { + public string Title { get; set; } + } + + /// + /// A notification added whenever the user chooses the "Tell Me Later" option on Bailey announcements. + /// New announcements do not systematically trigger this notification. + /// + [NotificationType("NEW_STUFF")] + public class NewStuffNotification : DataNotification { } +} diff --git a/Notifications/QuestInvitationNotification.cs b/Notifications/QuestInvitationNotification.cs new file mode 100644 index 0000000..91f18dc --- /dev/null +++ b/Notifications/QuestInvitationNotification.cs @@ -0,0 +1,15 @@ +using System; +using RestSharp.Deserializers; + +namespace HabitSharp.Notifications { + public class QuestInvitationNotificationData { + public Guid PartyId { get; set; } + + [DeserializeAs(Name="quest")] + public string QuestId { get; set; } + } + + [NotificationType("QUEST_INVITATION")] + public class QuestInvitationNotification : + DataNotification { } +} diff --git a/Notifications/ScoredTaskNotification.cs b/Notifications/ScoredTaskNotification.cs new file mode 100644 index 0000000..33d466b --- /dev/null +++ b/Notifications/ScoredTaskNotification.cs @@ -0,0 +1,14 @@ +namespace HabitSharp.Notifications { + public class ScoredTaskNotificationData { + public string Message { get; set; } + + // TODO: Task class! + // [DeserializeAs(Name="scoreTask")] + // public Task Task { get; set; } + + public string Direction { get; set; } + } + + [NotificationType("SCORED_TASK")] + public class ScoredTaskNotification : DataNotification { } +} diff --git a/Notifications/SimpleNotifications.cs b/Notifications/SimpleNotifications.cs new file mode 100644 index 0000000..6ab3c12 --- /dev/null +++ b/Notifications/SimpleNotifications.cs @@ -0,0 +1,70 @@ +namespace HabitSharp.Notifications { + /// + /// A notification that shows a modal window on the web client to tell the user that item drops are now available. + /// Item drops are unlocked starting from level 3. + /// + [NotificationType("DROPS_ENABLED")] + public class DropsEnabledNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user that the Rebirth Orb is now available. + /// Rebirths are unlocked at level 50 (but become free at level 100). + /// + [NotificationType("REBIRTH_ENABLED")] + public class RebirthEnabledNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they achieved a Ultimate Gear achievement. + /// Ultimate Gear means the user bought every single piece of basic equipment (that can be bought with gold) for their character's class. + /// + [NotificationType("ULTIMATE_GEAR_ACHIEVEMENT")] + public class UltimateGearAchievementNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they achieved a Rebirth achievement. + /// Rebirth achivements are obtained anytime the user uses a Rebirth Orb to start their character over from scratch. + /// + [NotificationType("REBIRTH_ACHIEVEMENT")] + public class RebirthAchievementNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they achieved a Challenge Joined achievement. + /// The Challenge Joined achievement is unlocked whenever the users joins any challenge. + /// + [NotificationType("CHALLENGE_JOINED_ACHIEVEMENT")] + public class ChallengeJoinedAchievementNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they achieved a Streak achievement. + /// Streak achievements are unlocked when completing a Daily 21 times. + /// + [NotificationType("STREAK_ACHIEVEMENT")] + public class StreakAchievementNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they achieved a new Habitica contributor level. + /// The user is then called a "hero". It unlocks a colored name tag, a place in the Habitica Heroes page and an achievement. + /// + [NotificationType("NEW_CONTRIBUTOR_LEVEL")] + public class NewContributorLevelNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they won a challenge. + /// + [NotificationType("WON_CHALLENGE")] + public class WonChallengeNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they unlocked a Guild Joined achievement. + /// This achievement is unlocked whenever the user joins any guild. + /// + [NotificationType("GUILD_JOINED_ACHIEVEMENT")] + public class GuildJoinedAchievementNotification : Notification { } + + /// + /// A notification that shows a modal window on the web client to tell the user they unlocked an Invited Friend achievement. + /// This achievement is unlocked whenever the user invites someone else by email and they register on Habitica. + /// + [NotificationType("INVITED_FRIEND_ACHIEVEMENT")] + public class InvitedFriendAchievementNotification : Notification { } +} diff --git a/Notifications/UnallocatedStatsPointsNotification.cs b/Notifications/UnallocatedStatsPointsNotification.cs new file mode 100644 index 0000000..756a2d3 --- /dev/null +++ b/Notifications/UnallocatedStatsPointsNotification.cs @@ -0,0 +1,10 @@ +namespace HabitSharp.Notifications { + public class UnallocatedStatsPointsNotificationData { + public int Points { get; set; } + } + + [NotificationType("UNALLOCATED_STATS_POINTS")] + public class UnallocatedStatsPointsNotification : + DataNotification { } + +} diff --git a/Result.cs b/Result.cs index 621855d..d7fd86e 100644 --- a/Result.cs +++ b/Result.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using RestSharp.Deserializers; +using HabitSharp.Notifications; namespace HabitSharp { public class Result {