@anitrack/patreon-wrapper 1.1.5 → 1.2.0

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.
package/README.md CHANGED
@@ -71,6 +71,7 @@ Clean Response Example
71
71
  note: '',
72
72
  currentEntitled: {
73
73
  status: 'active_patron',
74
+ tierId: '12345678',
74
75
  cents: 500, // 5 USD
75
76
  willPayCents: 500,
76
77
  lifetimeCents: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anitrack/patreon-wrapper",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "description": "Discord Patreon wrapper for AniTrack",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",
package/src/index.ts CHANGED
@@ -5,6 +5,36 @@ type Auth = {
5
5
  CampaignID: string
6
6
  }
7
7
 
8
+ type PatronType = {
9
+ displayId: string
10
+ displayName: string
11
+ emailAddress: string
12
+ isFollower: boolean
13
+ subscription: {
14
+ note: string
15
+ currentEntitled: {
16
+ status: string
17
+ tierId: number
18
+ cents: number
19
+ willPayCents: number
20
+ lifetimeCents: number
21
+ firstCharge: Date
22
+ nextCharge: Date
23
+ lastCharge: Date
24
+ }
25
+ }
26
+ mediaConnection: {
27
+ patreon: {
28
+ id: string
29
+ url: string
30
+ }
31
+ discord: {
32
+ id: string
33
+ url: string
34
+ }
35
+ }
36
+ }
37
+
8
38
  export class Patreon {
9
39
  private static _URL: string = 'https://www.patreon.com/api/oauth2/v2/'
10
40
 
@@ -49,7 +79,7 @@ export class Patreon {
49
79
  )
50
80
  )
51
81
 
52
- const Patrons: any[] = []
82
+ const Patrons: Array<PatronType> = []
53
83
 
54
84
  res.data.data.forEach((Patron: any) => {
55
85
  var include = res.data.included.find(
@@ -66,6 +96,8 @@ export class Patreon {
66
96
  note: Patron.attributes.note,
67
97
  currentEntitled: {
68
98
  status: Patron.attributes.patron_status,
99
+ tierId: Patron.relationships.currently_entitled_tiers
100
+ ?.data[0]?.id,
69
101
  cents: Patron.attributes
70
102
  .currently_entitled_amount_cents,
71
103
  willPayCents: Patron.attributes.will_pay_amount_cents,