lucidiot/HabitSharp
lucidiot
/
HabitSharp
Archived
1
0
Fork 0

Implement all notification types

This commit is contained in:
Lucidiot 2018-10-07 18:21:05 +02:00
parent 70d1b79a14
commit cedeb6fbbb
No known key found for this signature in database
GPG Key ID: AE3F7205692FA205
18 changed files with 295 additions and 0 deletions

View File

@ -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<CardReceivedNotificationData> { }
}

View File

@ -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<CronNotificationData> { }
}

View File

@ -0,0 +1,17 @@
using System;
namespace HabitSharp.Notifications {
public class DataNotification<T> : 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; }
}
}

View File

@ -0,0 +1,13 @@
namespace HabitSharp.Notifications {
public class GroupInviteAcceptedNotificationData {
public string HeaderText { get; set; }
public string BodyText { get; set; }
}
/// <summary>
/// A notification sent to a user when they invited another user to join a guild, group, etc. and the other user accepted the invitation.
/// </summary>
[NotificationType("GROUP_INVITE_ACCEPTED")]
public class GroupInviteAcceptedNotification :
DataNotification<GroupInviteAcceptedNotificationData> { }
}

View File

@ -0,0 +1,25 @@
using System;
namespace HabitSharp.Notifications {
public class GroupTaskApprovalNotificationData {
public string Message { get; set; }
public Guid GroupId { get; set; }
/// <summary>
/// ID of the task in the user's own view.
/// </summary>
/// <value></value>
public Guid TaskId { get; set; }
public Guid UserId { get; set; }
/// <summary>
/// The original task ID in the group.
/// </summary>
public Guid GroupTaskId { get; set; }
}
[NotificationType("GROUP_TASK_APPROVAL")]
public class GroupTaskApprovalNotification : DataNotification<GroupTaskApprovalNotificationData> { }
}

View File

@ -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<GroupTaskApprovedNotificationData> { }
}

View File

@ -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<GroupTaskNeedsWorkNotificationData> { }
}

View File

@ -0,0 +1,8 @@
namespace HabitSharp.Notifications {
public class GuildPromptNotificationData {
public int TextVariant { get; set; }
}
[NotificationType("GUILD_PROMPT")]
public class GuildPromptNotification : DataNotification<GuildPromptNotificationData> { }
}

View File

@ -0,0 +1,16 @@
namespace HabitSharp.Notifications {
public class LoginIncentiveNotificationData {
public string Message { get; set; }
// TODO: Rewards
// [DeserializeAs(Name="reward")]
// public List<Rewards> 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<LoginIncentiveNotificationData> { }
}

View File

@ -0,0 +1,8 @@
namespace HabitSharp.Notifications {
public class NewChatMessageNotificationData {
public NotificationGroupData Group { get; set; }
}
[NotificationType("NEW_CHAT_MESSAGE")]
public class NewChatMessageNotification : DataNotification<NewChatMessageNotificationData> { }
}

View File

@ -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<NewInboxMessageNotificationData> { }
}

View File

@ -0,0 +1,8 @@
namespace HabitSharp.Notifications {
public class NewMysteryItemsNotificationData {
public string[] Items { get; set; }
}
[NotificationType("NEW_MYSTERY_ITEMS")]
public class NewMysteryItemsNotification : DataNotification<NewMysteryItemsNotificationData> { }
}

View File

@ -0,0 +1,12 @@
namespace HabitSharp.Notifications {
public class NewStuffNotificationData {
public string Title { get; set; }
}
/// <summary>
/// A notification added whenever the user chooses the "Tell Me Later" option on Bailey announcements.
/// New announcements do not systematically trigger this notification.
/// </summary>
[NotificationType("NEW_STUFF")]
public class NewStuffNotification : DataNotification<NewStuffNotificationData> { }
}

View File

@ -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<QuestInvitationNotificationData> { }
}

View File

@ -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<ScoredTaskNotificationData> { }
}

View File

@ -0,0 +1,70 @@
namespace HabitSharp.Notifications {
/// <summary>
/// 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.
/// </summary>
[NotificationType("DROPS_ENABLED")]
public class DropsEnabledNotification : Notification { }
/// <summary>
/// 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).
/// </summary>
[NotificationType("REBIRTH_ENABLED")]
public class RebirthEnabledNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("ULTIMATE_GEAR_ACHIEVEMENT")]
public class UltimateGearAchievementNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("REBIRTH_ACHIEVEMENT")]
public class RebirthAchievementNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("CHALLENGE_JOINED_ACHIEVEMENT")]
public class ChallengeJoinedAchievementNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("STREAK_ACHIEVEMENT")]
public class StreakAchievementNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("NEW_CONTRIBUTOR_LEVEL")]
public class NewContributorLevelNotification : Notification { }
/// <summary>
/// A notification that shows a modal window on the web client to tell the user they won a challenge.
/// </summary>
[NotificationType("WON_CHALLENGE")]
public class WonChallengeNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("GUILD_JOINED_ACHIEVEMENT")]
public class GuildJoinedAchievementNotification : Notification { }
/// <summary>
/// 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.
/// </summary>
[NotificationType("INVITED_FRIEND_ACHIEVEMENT")]
public class InvitedFriendAchievementNotification : Notification { }
}

View File

@ -0,0 +1,10 @@
namespace HabitSharp.Notifications {
public class UnallocatedStatsPointsNotificationData {
public int Points { get; set; }
}
[NotificationType("UNALLOCATED_STATS_POINTS")]
public class UnallocatedStatsPointsNotification :
DataNotification<UnallocatedStatsPointsNotificationData> { }
}

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using RestSharp.Deserializers;
using HabitSharp.Notifications;
namespace HabitSharp {
public class Result<T> {