@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 +1 -0
- package/package.json +1 -1
- package/src/index.ts +33 -1
package/README.md
CHANGED
package/package.json
CHANGED
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:
|
|
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,
|