Habiticalib 0.1.0a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
habiticalib/types.py ADDED
@@ -0,0 +1,1202 @@
1
+ """Typedefs for Habiticalib."""
2
+
3
+ # pylint: disable=C0103
4
+ from __future__ import annotations
5
+
6
+ from dataclasses import dataclass, field
7
+ from datetime import UTC, datetime
8
+ from enum import StrEnum
9
+ from typing import Any
10
+ from uuid import UUID # noqa: TCH003
11
+
12
+ from mashumaro import field_options
13
+ from mashumaro.config import BaseConfig
14
+ from mashumaro.mixins.orjson import DataClassORJSONMixin
15
+
16
+
17
+ def serialize_datetime(date: str | int | None) -> datetime | None:
18
+ """Convert an iso date to a datetime.date object."""
19
+ if isinstance(date, int):
20
+ datetime.fromtimestamp(date / 1000, tz=UTC)
21
+ if isinstance(date, str):
22
+ try:
23
+ return datetime.fromisoformat(date)
24
+ except ValueError:
25
+ # sometimes nextDue dates are JavaScript datetime strings
26
+ # instead of iso: "Mon May 06 2024 00:00:00 GMT+0200"
27
+ try:
28
+ return datetime.strptime(date, "%a %b %d %Y %H:%M:%S %Z%z")
29
+ except ValueError:
30
+ return None
31
+ return None
32
+
33
+
34
+ @dataclass(kw_only=True)
35
+ class NotificationsUser:
36
+ """Notifications User data."""
37
+
38
+ Type: str = field(metadata=field_options(alias="type"))
39
+ data: dict[str, Any]
40
+ seen: bool
41
+ id: UUID
42
+
43
+
44
+ @dataclass(kw_only=True)
45
+ class HabiticaResponse(DataClassORJSONMixin):
46
+ """Representation of a base Habitica API response."""
47
+
48
+ data: Any
49
+ success: bool
50
+ notifications: list[NotificationsUser] = field(default_factory=list)
51
+ userV: int | None = None
52
+ appVersion: str | None = None
53
+
54
+
55
+ @dataclass(kw_only=True)
56
+ class LoginData:
57
+ """Login data."""
58
+
59
+ id: UUID
60
+ apiToken: str
61
+ newUser: bool
62
+ username: str
63
+
64
+
65
+ @dataclass(kw_only=True)
66
+ class HabiticaLoginResponse(HabiticaResponse):
67
+ """Representation of a login data response."""
68
+
69
+ data: LoginData
70
+
71
+
72
+ @dataclass(kw_only=True)
73
+ class LocalAuth:
74
+ """Auth local data."""
75
+
76
+ email: str
77
+ username: str
78
+ lowerCaseUsername: str
79
+ has_password: bool
80
+
81
+
82
+ @dataclass(kw_only=True)
83
+ class LocalTimestamps:
84
+ """Timestamps local data."""
85
+
86
+ created: datetime
87
+ loggedin: datetime
88
+ updated: datetime
89
+
90
+
91
+ @dataclass(kw_only=True)
92
+ class AuthUser:
93
+ """User auth data."""
94
+
95
+ local: LocalAuth | None = None
96
+ timestamps: LocalTimestamps | None = None
97
+ facebook: dict | None = None
98
+ google: dict | None = None
99
+ apple: dict | None = None
100
+
101
+
102
+ @dataclass(kw_only=True)
103
+ class UltimateGearSetsAchievments:
104
+ """Achievments ultimateGearSets data."""
105
+
106
+ healer: bool | None = None
107
+ wizard: bool | None = None
108
+ rogue: bool | None = None
109
+ warrior: bool | None = None
110
+
111
+
112
+ @dataclass(kw_only=True)
113
+ class QuestsAchievments:
114
+ """Achievments quests."""
115
+
116
+ bewilder: int | None = None
117
+ burnout: int | None = None
118
+ stressbeast: int | None = None
119
+ harpy: int | None = None
120
+ atom3: int | None = None
121
+ vice3: int | None = None
122
+ vice1: int | None = None
123
+ gryphon: int | None = None
124
+ evilsanta2: int | None = None
125
+ evilsanta: int | None = None
126
+ dilatory_derby: int | None = None
127
+ dilatory: int | None = None
128
+ atom2: int | None = None
129
+ atom1: int | None = None
130
+ dysheartener: int | None = None
131
+
132
+
133
+ @dataclass(kw_only=True)
134
+ class AchievementsUser:
135
+ """User achievments data."""
136
+
137
+ ultimateGearSets: UltimateGearSetsAchievments = field(
138
+ default_factory=UltimateGearSetsAchievments
139
+ )
140
+ streak: int | None = None
141
+ challenges: list = field(default_factory=list)
142
+ perfect: int | None = None
143
+ quests: QuestsAchievments = field(default_factory=QuestsAchievments)
144
+ backToBasics: bool | None = None
145
+ dustDevil: bool | None = None
146
+ primedForPainting: bool | None = None
147
+ completedTask: bool | None = None
148
+ createdTask: bool | None = None
149
+ fedPet: bool | None = None
150
+ hatchedPet: bool | None = None
151
+ purchasedEquipment: bool | None = None
152
+ tickledPink: bool | None = None
153
+ goodAsGold: bool | None = None
154
+ boneCollector: bool | None = None
155
+ seeingRed: bool | None = None
156
+ violetsAreBlue: bool | None = None
157
+ shadyCustomer: bool | None = None
158
+ joinedGuild: bool | None = None
159
+ joinedChallenge: bool | None = None
160
+ partyUp: None = None
161
+
162
+
163
+ @dataclass(kw_only=True)
164
+ class BackerUser:
165
+ """User backer data."""
166
+
167
+ tier: int | None = None
168
+ npc: str | None = None
169
+ tokensApplied: bool | None = None
170
+
171
+
172
+ @dataclass(kw_only=True)
173
+ class PermissionsUser:
174
+ """User permissions data."""
175
+
176
+ fullAccess: bool | None = None
177
+ news: bool | None = None
178
+ userSupport: bool | None = None
179
+ challengeAdmin: bool | None = None
180
+ moderator: bool | None = None
181
+ coupons: bool | None = None
182
+
183
+
184
+ @dataclass(kw_only=True)
185
+ class ContributorUser:
186
+ """User contributer data."""
187
+
188
+ contributions: str | None = None
189
+ level: int | None = None
190
+ text: str | None = None
191
+
192
+
193
+ @dataclass(kw_only=True)
194
+ class ConsecutivePlan:
195
+ """Plan consecutive data."""
196
+
197
+ trinkets: int | None = None
198
+ gemCapExtra: int | None = None
199
+ offset: int | None = None
200
+ count: int | None = None
201
+
202
+
203
+ @dataclass(kw_only=True)
204
+ class PlanPurchased:
205
+ """Purchased background data."""
206
+
207
+ consecutive: ConsecutivePlan = field(default_factory=ConsecutivePlan)
208
+ mysteryItems: list = field(default_factory=list)
209
+ gemsBought: int | None = None
210
+ extraMonths: int | None = None
211
+ dateUpdated: datetime | None = None
212
+ perkMonthCount: int | None = None
213
+ quantity: int | None = None
214
+
215
+
216
+ @dataclass(kw_only=True)
217
+ class PurchasedUser:
218
+ """User purchased data."""
219
+
220
+ plan: PlanPurchased = field(default_factory=PlanPurchased)
221
+ txnCount: int | None = None
222
+ background: dict[str, bool] = field(default_factory=dict)
223
+ shirt: dict[str, bool] = field(default_factory=dict)
224
+ hair: dict[str, bool] = field(default_factory=dict)
225
+ skin: dict[str, bool] = field(default_factory=dict)
226
+ ads: bool | None = None
227
+ mobileChat: bool | None = None
228
+
229
+
230
+ @dataclass(kw_only=True)
231
+ class TourFlags:
232
+ """Flags tour data."""
233
+
234
+ intro: int | None = None
235
+ classes: int | None = None
236
+ stats: int | None = None
237
+ tavern: int | None = None
238
+ party: int | None = None
239
+ guilds: int | None = None
240
+ challenges: int | None = None
241
+ market: int | None = None
242
+ pets: int | None = None
243
+ mounts: int | None = None
244
+ hall: int | None = None
245
+ equipment: int | None = None
246
+ groupPlans: int | None = None
247
+
248
+
249
+ @dataclass(kw_only=True)
250
+ class CommonTutorial:
251
+ """Tutorial common data."""
252
+
253
+ habits: bool
254
+ dailies: bool
255
+ todos: bool
256
+ rewards: bool
257
+ party: bool
258
+ pets: bool
259
+ gems: bool
260
+ skills: bool
261
+ classes: bool
262
+ tavern: bool
263
+ equipment: bool
264
+ items: bool
265
+ mounts: bool
266
+ inbox: bool
267
+ stats: bool
268
+
269
+
270
+ @dataclass(kw_only=True)
271
+ class IosTutorial:
272
+ """Tutorial ios data."""
273
+
274
+ addTask: bool
275
+ editTask: bool
276
+ deleteTask: bool
277
+ filterTask: bool
278
+ groupPets: bool
279
+ inviteParty: bool
280
+ reorderTask: bool
281
+
282
+
283
+ @dataclass(kw_only=True)
284
+ class TutorialFlags:
285
+ """Flags tutorial data."""
286
+
287
+ common: CommonTutorial | None = None
288
+ ios: IosTutorial | None = None
289
+
290
+
291
+ @dataclass(kw_only=True)
292
+ class FlagsUser:
293
+ """User flags data."""
294
+
295
+ customizationsNotification: bool | None = None
296
+ tour: TourFlags = field(default_factory=TourFlags)
297
+ showTour: bool | None = None
298
+ tutorial: TutorialFlags = field(default_factory=TutorialFlags)
299
+ dropsEnabled: bool | None = None
300
+ itemsEnabled: bool | None = None
301
+ lastNewStuffRead: str | None = None
302
+ rewrite: bool | None = None
303
+ classSelected: bool | None = None
304
+ rebirthEnabled: bool | None = None
305
+ levelDrops: dict[str, bool] = field(default_factory=dict)
306
+ recaptureEmailsPhase: int | None = None
307
+ weeklyRecapEmailsPhase: int | None = None
308
+ lastWeeklyRecap: datetime | None = None
309
+ communityGuidelinesAccepted: bool | None = None
310
+ cronCount: int | None = None
311
+ welcomed: bool | None = None
312
+ armoireEnabled: bool | None = None
313
+ armoireOpened: bool | None = None
314
+ armoireEmpty: bool | None = None
315
+ cardReceived: bool | None = None
316
+ warnedLowHealth: bool | None = None
317
+ verifiedUsername: bool | None = None
318
+ newStuff: bool | None = None
319
+ thirdPartyTools: datetime | None = None
320
+ mathUpdates: bool | None = None
321
+ lastFreeRebirth: datetime | None = None
322
+ chatRevoked: bool | None = None
323
+ chatShadowMuted: bool | None = None
324
+ lastWeeklyRecapDiscriminator: bool | None = None
325
+ onboardingEmailsPhase: str | None = None
326
+
327
+
328
+ @dataclass(kw_only=True)
329
+ class EntryHistory:
330
+ """History entry data."""
331
+
332
+ date: datetime = field(
333
+ metadata=field_options(
334
+ deserialize=serialize_datetime,
335
+ )
336
+ )
337
+ value: float
338
+ scoredUp: int | None = None
339
+ scoredDown: int | None = None
340
+ isDue: bool | None = None
341
+ completed: bool | None = None
342
+
343
+
344
+ @dataclass(kw_only=True)
345
+ class HistoryUser:
346
+ """User history data."""
347
+
348
+ todos: list[EntryHistory] = field(default_factory=list)
349
+ exp: list[EntryHistory] = field(default_factory=list)
350
+
351
+
352
+ @dataclass(kw_only=True)
353
+ class EquippedGear:
354
+ """Gear equipped data."""
355
+
356
+ weapon: str | None = None
357
+ armor: str | None = None
358
+ head: str | None = None
359
+ shield: str | None = None
360
+ back: str | None = None
361
+ headAccessory: str | None = None
362
+ eyewear: str | None = None
363
+ body: str | None = None
364
+
365
+
366
+ @dataclass(kw_only=True)
367
+ class GearItems:
368
+ """Items gear data."""
369
+
370
+ equipped: EquippedGear = field(default_factory=EquippedGear)
371
+ costume: EquippedGear = field(default_factory=EquippedGear)
372
+ owned: dict[str, bool] = field(default_factory=dict)
373
+
374
+
375
+ @dataclass(kw_only=True)
376
+ class SpecialItems:
377
+ """Items special data."""
378
+
379
+ birthdayReceived: list = field(default_factory=list)
380
+ birthday: int | None = None
381
+ thankyouReceived: list = field(default_factory=list)
382
+ thankyou: int | None = None
383
+ greetingReceived: list = field(default_factory=list)
384
+ greeting: int | None = None
385
+ nyeReceived: list = field(default_factory=list)
386
+ nye: int | None = None
387
+ valentineReceived: list = field(default_factory=list)
388
+ valentine: int | None = None
389
+ seafoam: int | None = None
390
+ shinySeed: int | None = None
391
+ spookySparkles: int | None = None
392
+ snowball: int | None = None
393
+ congrats: int | None = None
394
+ congratsReceived: list = field(default_factory=list)
395
+ getwell: int | None = None
396
+ getwellReceived: list = field(default_factory=list)
397
+ goodluck: int | None = None
398
+ goodluckReceived: list = field(default_factory=list)
399
+
400
+
401
+ @dataclass(kw_only=True)
402
+ class LastDropItems:
403
+ """LastDrop items data."""
404
+
405
+ count: int | None = None
406
+ date: datetime | None = None
407
+
408
+
409
+ @dataclass(kw_only=True)
410
+ class ItemsUser:
411
+ """User items data."""
412
+
413
+ gear: GearItems = field(default_factory=GearItems)
414
+ special: SpecialItems = field(default_factory=SpecialItems)
415
+ lastDrop: LastDropItems = field(default_factory=LastDropItems)
416
+ currentMount: str | None = None
417
+ currentPet: str | None = None
418
+ quests: dict[str, int] = field(default_factory=dict)
419
+ mounts: dict[str, bool] = field(default_factory=dict)
420
+ food: dict[str, int] = field(default_factory=dict)
421
+ hatchingPotions: dict[str, int] = field(default_factory=dict)
422
+ eggs: dict[str, int] = field(default_factory=dict)
423
+ pets: dict[str, int] = field(default_factory=dict)
424
+
425
+
426
+ @dataclass(kw_only=True)
427
+ class InvitationsUser:
428
+ """Invitations user data."""
429
+
430
+ party: dict = field(default_factory=dict)
431
+ guilds: list = field(default_factory=list)
432
+ parties: list = field(default_factory=list)
433
+
434
+
435
+ @dataclass(kw_only=True)
436
+ class ProgressQuest:
437
+ """Quest progress data."""
438
+
439
+ up: float | None = None
440
+ down: float | None = None
441
+ collect: dict = field(default_factory=dict)
442
+ collectedItems: int | None = None
443
+
444
+
445
+ @dataclass(kw_only=True)
446
+ class QuestParty:
447
+ """Party quest data."""
448
+
449
+ progress: ProgressQuest = field(default_factory=ProgressQuest)
450
+ RSVPNeeded: bool | None = None
451
+ key: str | None = None
452
+ completed: str | None = None
453
+
454
+
455
+ @dataclass(kw_only=True)
456
+ class PartyUser:
457
+ """Party user data."""
458
+
459
+ quest: QuestParty = field(default_factory=QuestParty)
460
+ order: str | None = None
461
+ orderAscending: str | None = None
462
+ _id: UUID | None = None
463
+
464
+
465
+ @dataclass(kw_only=True)
466
+ class HairPreferences:
467
+ """Hair preferences data."""
468
+
469
+ color: str | None = None
470
+ base: int | None = None
471
+ bangs: int | None = None
472
+ beard: int | None = None
473
+ mustache: int | None = None
474
+ flower: int | None = None
475
+
476
+
477
+ @dataclass(kw_only=True)
478
+ class EmailNotificationsPreferences:
479
+ """EmailNotifications preferences data."""
480
+
481
+ unsubscribeFromAll: bool | None = None
482
+ newPM: bool | None = None
483
+ kickedGroup: bool | None = None
484
+ wonChallenge: bool | None = None
485
+ giftedGems: bool | None = None
486
+ giftedSubscription: bool | None = None
487
+ invitedParty: bool | None = None
488
+ invitedGuild: bool | None = None
489
+ questStarted: bool | None = None
490
+ invitedQuest: bool | None = None
491
+ importantAnnouncements: bool | None = None
492
+ weeklyRecaps: bool | None = None
493
+ onboarding: bool | None = None
494
+ majorUpdates: bool | None = None
495
+ subscriptionReminders: bool | None = None
496
+ contentRelease: bool | None = None
497
+
498
+
499
+ @dataclass(kw_only=True)
500
+ class PushNotificationsPreferences:
501
+ """PushNotifications preferences data."""
502
+
503
+ unsubscribeFromAll: bool | None = None
504
+ newPM: bool | None = None
505
+ wonChallenge: bool | None = None
506
+ giftedGems: bool | None = None
507
+ giftedSubscription: bool | None = None
508
+ invitedParty: bool | None = None
509
+ invitedGuild: bool | None = None
510
+ questStarted: bool | None = None
511
+ invitedQuest: bool | None = None
512
+ majorUpdates: bool | None = None
513
+ mentionParty: bool | None = None
514
+ mentionJoinedGuild: bool | None = None
515
+ mentionUnjoinedGuild: bool | None = None
516
+ partyActivity: bool | None = None
517
+ contentRelease: bool | None = None
518
+
519
+
520
+ @dataclass(kw_only=True)
521
+ class SuppressModalsPreferences:
522
+ """SupressModals preferences data."""
523
+
524
+ levelUp: bool | None = None
525
+ hatchPet: bool | None = None
526
+ raisePet: bool | None = None
527
+ streak: bool | None = None
528
+
529
+
530
+ @dataclass(kw_only=True)
531
+ class ActiveFilterTask:
532
+ """ActiveFilter task data."""
533
+
534
+ habit: str | None = None
535
+ daily: str | None = None
536
+ todo: str | None = None
537
+ reward: str | None = None
538
+
539
+
540
+ @dataclass(kw_only=True)
541
+ class TasksPreferences:
542
+ """Tasks preferences data."""
543
+
544
+ activeFilter: ActiveFilterTask = field(default_factory=ActiveFilterTask)
545
+ groupByChallenge: bool | None = None
546
+ confirmScoreNotes: bool | None = None
547
+ mirrorGroupTasks: list[UUID] = field(default_factory=list)
548
+
549
+
550
+ @dataclass(kw_only=True)
551
+ class PreferencesUser:
552
+ """Preferences user data."""
553
+
554
+ hair: HairPreferences = field(default_factory=HairPreferences)
555
+ emailNotifications: EmailNotificationsPreferences = field(
556
+ default_factory=EmailNotificationsPreferences
557
+ )
558
+ pushNotifications: PushNotificationsPreferences = field(
559
+ default_factory=PushNotificationsPreferences
560
+ )
561
+ suppressModals: SuppressModalsPreferences = field(
562
+ default_factory=SuppressModalsPreferences
563
+ )
564
+ tasks: TasksPreferences = field(default_factory=TasksPreferences)
565
+ dayStart: int | None = None
566
+ size: str | None = None
567
+ hideHeader: bool | None = None
568
+ skin: str | None = None
569
+ shirt: str | None = None
570
+ timezoneOffset: int | None = None
571
+ sound: str | None = None
572
+ chair: str | None = None
573
+ allocationMode: str | None = None
574
+ autoEquip: bool | None = None
575
+ costume: bool | None = None
576
+ dateFormat: str | None = None
577
+ sleep: bool | None = None
578
+ stickyHeader: bool | None = None
579
+ disableClasses: bool | None = None
580
+ newTaskEdit: bool | None = None
581
+ dailyDueDefaultView: bool | None = None
582
+ advancedCollapsed: bool | None = None
583
+ toolbarCollapsed: bool | None = None
584
+ reverseChatOrder: bool | None = None
585
+ developerMode: bool | None = None
586
+ displayInviteToPartyWhenPartyIs1: bool | None = None
587
+ background: str | None = None
588
+ automaticAllocation: bool | None = None
589
+ webhooks: dict = field(default_factory=dict)
590
+ improvementCategories: list[str] = field(default_factory=list)
591
+ timezoneOffsetAtLastCron: int | None = None
592
+ language: str | None = None
593
+
594
+
595
+ @dataclass(kw_only=True)
596
+ class ProfileUser:
597
+ """Profile user data."""
598
+
599
+ blurb: str | None = None
600
+ imageUrl: str | None = None
601
+ name: str | None = None
602
+
603
+
604
+ @dataclass(kw_only=True)
605
+ class BuffsStats:
606
+ """Buffs stats data."""
607
+
608
+ Str: int | None = field(default=None, metadata=field_options(alias="str"))
609
+ per: int | None = None
610
+ con: int | None = None
611
+ stealth: int | None = None
612
+ streaks: bool | None = None
613
+ seafoam: bool | None = None
614
+ shinySeed: bool | None = None
615
+ snowball: bool | None = None
616
+ spookySparkles: bool | None = None
617
+ Int: int | None = field(default=None, metadata=field_options(alias="int"))
618
+
619
+
620
+ @dataclass(kw_only=True)
621
+ class TrainingStats:
622
+ """Training stats data."""
623
+
624
+ Str: float | None = field(default=None, metadata=field_options(alias="str"))
625
+ per: int | None = None
626
+ con: int | None = None
627
+ Int: int | None = field(default=None, metadata=field_options(alias="int"))
628
+
629
+
630
+ @dataclass(kw_only=True)
631
+ class StatsUser:
632
+ """Stats user data."""
633
+
634
+ buffs: BuffsStats = field(default_factory=BuffsStats)
635
+ training: TrainingStats = field(default_factory=TrainingStats)
636
+ hp: float | None = None
637
+ mp: float | None = None
638
+ exp: int | None = None
639
+ gp: float | None = None
640
+ lvl: int | None = None
641
+ Class: str = field(default="warrior", metadata=field_options(alias="class"))
642
+ points: int | None = None
643
+ Str: int | None = field(default=None, metadata=field_options(alias="str"))
644
+ con: int | None = None
645
+ per: int | None = None
646
+ toNextLevel: int | None = None
647
+ maxHealth: int | None = None
648
+ maxMP: int | None = None
649
+ Int: int | None = field(default=None, metadata=field_options(alias="int"))
650
+
651
+
652
+ @dataclass(kw_only=True)
653
+ class TagsUser:
654
+ """Tags user data."""
655
+
656
+ id: UUID | None = None
657
+ name: str | None = None
658
+ challenge: bool | None = None
659
+ group: str | None = None
660
+
661
+
662
+ @dataclass(kw_only=True)
663
+ class InboxUser:
664
+ """Inbox user data."""
665
+
666
+ newMessages: int | None = None
667
+ optOut: bool | None = None
668
+ blocks: list = field(default_factory=list)
669
+ messages: dict = field(default_factory=dict)
670
+
671
+
672
+ @dataclass(kw_only=True)
673
+ class TasksOrderUser:
674
+ """TasksOrder user data."""
675
+
676
+ habits: list[str] = field(default_factory=list)
677
+ dailys: list[str] = field(default_factory=list)
678
+ todos: list[str] = field(default_factory=list)
679
+ rewards: list[str] = field(default_factory=list)
680
+
681
+
682
+ @dataclass(kw_only=True)
683
+ class PushDevicesUser:
684
+ """PushDevices user data."""
685
+
686
+ regId: str
687
+ Type: str = field(metadata=field_options(alias="type"))
688
+ createdAt: datetime
689
+ updatedAt: datetime
690
+
691
+
692
+ @dataclass(kw_only=True)
693
+ class WebhooksUser:
694
+ """Webhooks user data."""
695
+
696
+ id: UUID
697
+ Type: str = field(metadata=field_options(alias="type"))
698
+ label: str
699
+ url: str
700
+ enabled: bool
701
+ failures: int
702
+ lastFailureAt: datetime | None
703
+
704
+
705
+ @dataclass(kw_only=True)
706
+ class PinnedItemsUser:
707
+ """PinnedItems user data."""
708
+
709
+ path: str
710
+ Type: str = field(metadata=field_options(alias="type"))
711
+
712
+
713
+ @dataclass(kw_only=True)
714
+ class UserData:
715
+ """User data."""
716
+
717
+ id: UUID | None = None
718
+ preferences: PreferencesUser = field(default_factory=PreferencesUser)
719
+ flags: FlagsUser | None = None
720
+ auth: AuthUser = field(default_factory=AuthUser)
721
+ achievements: AchievementsUser = field(default_factory=AchievementsUser)
722
+ backer: BackerUser = field(default_factory=BackerUser)
723
+ contributor: ContributorUser = field(default_factory=ContributorUser)
724
+ permissions: PermissionsUser = field(default_factory=PermissionsUser)
725
+ purchased: PurchasedUser = field(default_factory=PurchasedUser)
726
+ history: HistoryUser = field(default_factory=HistoryUser)
727
+ items: ItemsUser = field(default_factory=ItemsUser)
728
+ invitations: InvitationsUser = field(default_factory=InvitationsUser)
729
+ party: PartyUser = field(default_factory=PartyUser)
730
+ profile: ProfileUser = field(default_factory=ProfileUser)
731
+ stats: StatsUser = field(default_factory=StatsUser)
732
+ notifications: list[NotificationsUser] = field(default_factory=list)
733
+ tags: list[TagsUser] = field(default_factory=list)
734
+ inbox: InboxUser = field(default_factory=InboxUser)
735
+ tasksOrder: TasksOrderUser = field(default_factory=TasksOrderUser)
736
+ extra: dict = field(default_factory=dict)
737
+ pushDevices: list[PushDevicesUser] = field(default_factory=list)
738
+ webhooks: list[WebhooksUser] = field(default_factory=list)
739
+ loginIncentives: int | None = None
740
+ invitesSent: int | None = None
741
+ pinnedItems: list[PinnedItemsUser] = field(default_factory=list)
742
+ pinnedItemsOrder: list[str] = field(default_factory=list)
743
+ unpinnedItems: list[PinnedItemsUser] = field(default_factory=list)
744
+ secret: str | None = None
745
+ balance: float | None = None
746
+ lastCron: datetime | None = None
747
+ needsCron: bool | None = None
748
+ challenges: list[str] = field(default_factory=list)
749
+ guilds: list[str] = field(default_factory=list)
750
+ newMessages: dict[str, bool] = field(default_factory=dict)
751
+
752
+
753
+ @dataclass(kw_only=True)
754
+ class HabiticaUserResponse(HabiticaResponse):
755
+ """Representation of a user data response."""
756
+
757
+ data: UserData
758
+
759
+
760
+ @dataclass(kw_only=True)
761
+ class CompletedBy:
762
+ """Task group completedby data."""
763
+
764
+ userId: UUID | None = None
765
+ date: datetime | None = None
766
+
767
+
768
+ @dataclass(kw_only=True)
769
+ class GroupTask:
770
+ """Task group data."""
771
+
772
+ assignedUsers: list[UUID] | None = None
773
+ id: UUID | None = None
774
+ assignedDate: datetime | None = None
775
+ assigningUsername: str | None = None
776
+ assignedUsersDetail: dict[str, Any] = field(default_factory=dict)
777
+ taskId: UUID | None = None
778
+ managerNotes: str | None = None
779
+ completedBy: CompletedBy = field(default_factory=CompletedBy)
780
+
781
+
782
+ @dataclass(kw_only=True)
783
+ class Repeat:
784
+ """Task repeat data."""
785
+
786
+ m: bool = True
787
+ t: bool = True
788
+ w: bool = True
789
+ th: bool = False
790
+ f: bool = False
791
+ s: bool = False
792
+ su: bool = False
793
+
794
+
795
+ class ChallengeAbortedReason(StrEnum):
796
+ """Task challenge aborted reason data."""
797
+
798
+ CHALLENGE_DELETED = "CHALLENGE_DELETED"
799
+ TASK_DELETED = "TASK_DELETED"
800
+ UNSUBSCRIBED = "UNSUBSCRIBED"
801
+ CHALLENGE_CLOSED = "CHALLENGE_CLOSED"
802
+ CHALLENGE_TASK_NOT_FOUND = "CHALLENGE_TASK_NOT_FOUND"
803
+
804
+
805
+ @dataclass(kw_only=True)
806
+ class Challenge:
807
+ """Challenge task data."""
808
+
809
+ id: UUID | None = None
810
+ taskId: UUID | None = None
811
+ shortName: str | None = None
812
+ broken: ChallengeAbortedReason | None = None
813
+ winner: str | None = None
814
+
815
+
816
+ @dataclass(kw_only=True)
817
+ class Reminders:
818
+ """Task reminders data."""
819
+
820
+ id: UUID
821
+ time: datetime
822
+ startDate: datetime | None = None
823
+
824
+
825
+ class TaskType(StrEnum):
826
+ """Task types enum."""
827
+
828
+ DAILY = "daily"
829
+ TODO = "todo"
830
+ HABIT = "habit"
831
+ REWARD = "reward"
832
+
833
+
834
+ class Attributes(StrEnum):
835
+ """Character attributes enum."""
836
+
837
+ STR = "str"
838
+ CON = "con"
839
+ INT = "int"
840
+ PER = "per"
841
+
842
+
843
+ class Frequency(StrEnum):
844
+ """Recurrence frequency enum."""
845
+
846
+ DAILY = "daily"
847
+ WEEKLY = "weekly"
848
+ MONTHLY = "monthly"
849
+ YEARLY = "yearly"
850
+
851
+
852
+ @dataclass(kw_only=True)
853
+ class Task(DataClassORJSONMixin):
854
+ """Representation of a task."""
855
+
856
+ class Config(BaseConfig):
857
+ """Config."""
858
+
859
+ omit_none = True
860
+
861
+ text: str | None = None
862
+ attribute: Attributes | None = None
863
+ alias: str | None = None
864
+ notes: str | None = None
865
+ tags: list[UUID] | None = None
866
+ collapseChecklist: bool | None = None
867
+ date: datetime | None = None
868
+ priority: float | None = None
869
+ reminders: list[Reminders] | None = None
870
+ checklist: list[str] | None = None
871
+ task_type: TaskType | None = None
872
+ up: bool | None = None
873
+ down: bool | None = None
874
+ counterUp: int | None = None
875
+ counterDown: int | None = None
876
+ startDate: datetime | None = None
877
+ frequency: Frequency | None = None
878
+ everyX: int | None = None
879
+ repeat: Repeat | None = None
880
+ daysOfMonth: list[int] | None = None
881
+ weeksOfMonth: list[int] | None = None
882
+ completed: bool | None = None
883
+ streak: int | None = None
884
+
885
+
886
+ @dataclass(kw_only=True)
887
+ class TaskData:
888
+ """Task data."""
889
+
890
+ challenge: Challenge = field(default_factory=Challenge)
891
+ group: GroupTask = field(default_factory=GroupTask)
892
+ Type: TaskType | None = field(default=None, metadata=field_options(alias="type"))
893
+ text: str | None = None
894
+ notes: str | None = None
895
+ tags: list[UUID] | None = None
896
+ value: float | None = None
897
+ priority: float | None = None
898
+ attribute: Attributes | None = None
899
+ byHabitica: bool | None = None
900
+ createdAt: datetime | None = None
901
+ updatedAt: datetime | None = None
902
+ date: datetime | None = None
903
+ id: UUID | None = None
904
+ userId: UUID | None = None
905
+ up: bool | None = None
906
+ down: bool | None = None
907
+ counterUp: int | None = None
908
+ counterDown: int | None = None
909
+ frequency: Frequency | None = None
910
+ history: list[EntryHistory] | None = None
911
+ alias: str | None = None
912
+ everyX: int | None = None
913
+ startDate: datetime | None = None
914
+ streak: int | None = None
915
+ reminders: list[Reminders] = field(default_factory=list)
916
+ daysOfMonth: list[int] = field(default_factory=list)
917
+ weeksOfMonth: list[int] = field(default_factory=list)
918
+ nextDue: list[datetime] = field(
919
+ default_factory=list,
920
+ metadata=field_options(deserialize=lambda x: list(map(serialize_datetime, x))),
921
+ )
922
+ yesterDaily: bool | None = None
923
+ completed: bool | None = None
924
+ collapseChecklist: bool = False
925
+ checklist: list[str] = field(default_factory=list)
926
+ isDue: bool | None = None
927
+ repeat: Repeat = field(default_factory=Repeat)
928
+
929
+
930
+ @dataclass(kw_only=True)
931
+ class HabiticaTasksResponse(HabiticaResponse):
932
+ """Repesentation of a tasks data response."""
933
+
934
+ data: list[TaskData]
935
+
936
+
937
+ @dataclass(kw_only=True)
938
+ class HabiticaTaskResponse(HabiticaResponse):
939
+ """Repesentation of a single task data response."""
940
+
941
+ data: TaskData
942
+
943
+
944
+ @dataclass(kw_only=True)
945
+ class HabiticaErrorResponse(DataClassORJSONMixin):
946
+ """Base class for Habitica errors."""
947
+
948
+ success: bool
949
+ error: str
950
+ message: str
951
+
952
+
953
+ @dataclass(kw_only=True)
954
+ class TasksUserExport:
955
+ """Tasks user export data."""
956
+
957
+ todos: list[TaskData] = field(default_factory=list)
958
+ dailys: list[TaskData] = field(default_factory=list)
959
+ habits: list[TaskData] = field(default_factory=list)
960
+ rewards: list[TaskData] = field(default_factory=list)
961
+
962
+
963
+ @dataclass(kw_only=True)
964
+ class BuffsUserStyles:
965
+ """Buffs UserStyles data."""
966
+
967
+ per: int | None = None
968
+ con: int | None = None
969
+ stealth: int | None = None
970
+ seafoam: bool | None = None
971
+ shinySeed: bool | None = None
972
+ snowball: bool | None = None
973
+ spookySparkles: bool | None = None
974
+
975
+
976
+ @dataclass(kw_only=True)
977
+ class StatsUserStyles:
978
+ """Stats user styles data."""
979
+
980
+ buffs: BuffsUserStyles = field(default_factory=BuffsUserStyles)
981
+ Class: str = field(default="warrior", metadata=field_options(alias="class"))
982
+
983
+
984
+ @dataclass(kw_only=True)
985
+ class GearItemsUserStyles:
986
+ """Items gear data."""
987
+
988
+ equipped: EquippedGear = field(default_factory=EquippedGear)
989
+ costume: EquippedGear = field(default_factory=EquippedGear)
990
+
991
+
992
+ @dataclass(kw_only=True)
993
+ class ItemsUserStyles:
994
+ """Items user styles data."""
995
+
996
+ gear: GearItemsUserStyles = field(default_factory=GearItemsUserStyles)
997
+ currentMount: str | None = None
998
+ currentPet: str | None = None
999
+
1000
+
1001
+ @dataclass(kw_only=True)
1002
+ class PreferencesUserStyles:
1003
+ """Preferences user styles data."""
1004
+
1005
+ hair: HairPreferences = field(default_factory=HairPreferences)
1006
+ size: str | None = None
1007
+ skin: str | None = None
1008
+ shirt: str | None = None
1009
+ chair: str | None = None
1010
+ costume: bool | None = None
1011
+ sleep: bool | None = None
1012
+ background: str | None = None
1013
+
1014
+
1015
+ @dataclass(kw_only=True)
1016
+ class UserStyles(DataClassORJSONMixin):
1017
+ """Represents minimalistic data only containing user styles."""
1018
+
1019
+ items: ItemsUserStyles = field(default_factory=ItemsUserStyles)
1020
+ preferences: PreferencesUserStyles = field(default_factory=PreferencesUserStyles)
1021
+ stats: StatsUserStyles = field(default_factory=StatsUserStyles)
1022
+
1023
+
1024
+ @dataclass(kw_only=True)
1025
+ class HabiticaUserExport(UserData, DataClassORJSONMixin):
1026
+ """Representation of a user data export."""
1027
+
1028
+ tasks: TasksUserExport = field(default_factory=TasksUserExport)
1029
+
1030
+
1031
+ @dataclass(kw_only=True)
1032
+ class HabiticaStatsResponse(HabiticaResponse):
1033
+ """Representation of a response containing stats data."""
1034
+
1035
+ data: StatsUser
1036
+
1037
+
1038
+ @dataclass(kw_only=True)
1039
+ class QuestTmpScore:
1040
+ """Represents the quest progress details."""
1041
+
1042
+ progressDelta: float | None = None
1043
+ collection: int | None = None
1044
+
1045
+
1046
+ @dataclass(kw_only=True)
1047
+ class DropTmpScore:
1048
+ """Represents the details of an item drop."""
1049
+
1050
+ target: str | None = None
1051
+ canDrop: bool | None = None
1052
+ value: int | None = None
1053
+ key: str | None = None
1054
+ type: str | None = None
1055
+ dialog: str | None = None
1056
+
1057
+
1058
+ @dataclass(kw_only=True)
1059
+ class TmpScore:
1060
+ """Temporary quest and drop data."""
1061
+
1062
+ quest: QuestTmpScore = field(default_factory=QuestTmpScore)
1063
+ drop: DropTmpScore = field(default_factory=DropTmpScore)
1064
+
1065
+
1066
+ @dataclass(kw_only=True)
1067
+ class HabiticaScoreResponse(StatsUser, DataClassORJSONMixin):
1068
+ """Representation of a score response."""
1069
+
1070
+ delta: float | None = None
1071
+ _tmp: TmpScore = field(default_factory=TmpScore)
1072
+
1073
+
1074
+ @dataclass(kw_only=True)
1075
+ class HabiticaTagsResponse(HabiticaResponse, DataClassORJSONMixin):
1076
+ """Representation of a score response."""
1077
+
1078
+ data: list[TagsUser]
1079
+
1080
+
1081
+ @dataclass(kw_only=True)
1082
+ class HabiticaTagResponse(HabiticaResponse, DataClassORJSONMixin):
1083
+ """Representation of a score response."""
1084
+
1085
+ data: TagsUser
1086
+
1087
+
1088
+ @dataclass
1089
+ class ChangeClassData:
1090
+ """Change class data."""
1091
+
1092
+ preferences: PreferencesUser = field(default_factory=PreferencesUser)
1093
+ flags: FlagsUser = field(default_factory=FlagsUser)
1094
+ items: ItemsUser = field(default_factory=ItemsUser)
1095
+ stats: StatsUser = field(default_factory=StatsUser)
1096
+
1097
+
1098
+ @dataclass(kw_only=True)
1099
+ class HabiticaClassSystemResponse(HabiticaResponse, DataClassORJSONMixin):
1100
+ """Representation of a change-class response."""
1101
+
1102
+ data: ChangeClassData
1103
+
1104
+
1105
+ @dataclass
1106
+ class HabiticaTaskOrderResponse(HabiticaResponse):
1107
+ """Representation of a reorder task response."""
1108
+
1109
+ data: TasksOrderUser = field(default_factory=TasksOrderUser)
1110
+
1111
+
1112
+ class TaskFilter(StrEnum):
1113
+ """Enum representing the valid types of tasks for requests."""
1114
+
1115
+ HABITS = "habits"
1116
+ DAILYS = "dailys"
1117
+ TODOS = "todos"
1118
+ REWARDS = "rewards"
1119
+ COMPLETED_TODOS = "completedTodos"
1120
+
1121
+
1122
+ class Language(StrEnum):
1123
+ """Valid languages for Habitica content."""
1124
+
1125
+ BG = "bg"
1126
+ CS = "cs"
1127
+ DA = "da"
1128
+ DE = "de"
1129
+ EN = "en"
1130
+ EN_PIRATE = "en@pirate"
1131
+ EN_GB = "en_GB"
1132
+ ES = "es"
1133
+ ES_419 = "es_419"
1134
+ FR = "fr"
1135
+ HE = "he"
1136
+ HU = "hu"
1137
+ ID = "id"
1138
+ IT = "it"
1139
+ JA = "ja"
1140
+ NL = "nl"
1141
+ PL = "pl"
1142
+ PT = "pt"
1143
+ PT_BR = "pt_BR"
1144
+ RO = "ro"
1145
+ RU = "ru"
1146
+ SK = "sk"
1147
+ SR = "sr"
1148
+ SV = "sv"
1149
+ UK = "uk"
1150
+ ZH = "zh"
1151
+ ZH_TW = "zh_TW"
1152
+
1153
+
1154
+ class Skill(StrEnum):
1155
+ """Skills or spells available for casting."""
1156
+
1157
+ # Mage skills
1158
+ BURST_OF_FLAMES = "fireball"
1159
+ ETHEREAL_SURGE = "mpheal"
1160
+ EARTHQUAKE = "earth"
1161
+ CHILLING_FROST = "frost"
1162
+ # Warrior skills
1163
+ BRUTAL_SMASH = "smash"
1164
+ DEFENSIVE_STANCE = "defensiveStance"
1165
+ VALOROUS_PRESENCE = "valorousPresence"
1166
+ INTIMIDATING_GAZE = "intimidate"
1167
+ # Rogue skills
1168
+ PICKPOCKET = "Pickpocket"
1169
+ BACKSTAB = "backStab"
1170
+ TOOLS_OF_THE_TRADE = "toolsOfTrade"
1171
+ STEALTH = "stealth"
1172
+ # Healer skills
1173
+ HEALING_LIGHT = "heal"
1174
+ PROTECTIVE_AURA = "protectAura"
1175
+ SEARING_BRIGHTNESS = "brightness"
1176
+ BLESSING = "healAll"
1177
+ # Transformation buffs
1178
+ SNOWBALL = "snowball"
1179
+ SPOOKY_SPARKLES = "spookySparkles"
1180
+ SEAFOAM = "seafoam"
1181
+ SHINY_SEED = "shinySeed"
1182
+ # Debuff potions
1183
+ SALT = "salt" # removes snowball buff
1184
+ OPAQUE_POTION = "opaquePotion" # removes spooky sparkles buff
1185
+ SAND = "sand" # removes seafoam buff
1186
+ PETAL_FREE_POTION = "petalFreePotion"
1187
+
1188
+
1189
+ class Class(StrEnum):
1190
+ """Habitica's player classes."""
1191
+
1192
+ WARRIOR = "warrior"
1193
+ ROGUE = "rogue"
1194
+ MAGE = "mage"
1195
+ HEALER = "healer"
1196
+
1197
+
1198
+ class Direction(StrEnum):
1199
+ """Direction to score a task."""
1200
+
1201
+ UP = "up"
1202
+ DOWN = "down"