@anitrack/patreon-wrapper 1.4.6 → 1.5.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 -1
- package/lib/index.d.ts +13 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +80 -82
- package/lib/index.js.map +1 -1
- package/package.json +36 -36
- package/src/index.ts +132 -130
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
🌄 You can also simulates sandbox of fake Patrons for development and code testing purposes
|
|
6
6
|
|
|
7
|
-
🍊 This package was
|
|
7
|
+
🍊 This package was previously used in [AniTrack](https://anitrack.co) before switching to a real payment gateway
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
10
10
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
export type PatronStatus = 'active_patron' | 'declined_patron' | 'former_patron';
|
|
2
|
+
export type PatronAPIAuth = {
|
|
2
3
|
AccessToken: string;
|
|
3
4
|
CampaignID: string;
|
|
4
5
|
};
|
|
5
|
-
|
|
6
|
+
export type PatronType = {
|
|
6
7
|
displayId: string;
|
|
7
8
|
displayName: string;
|
|
8
9
|
emailAddress: string;
|
|
@@ -10,7 +11,7 @@ declare type PatronType = {
|
|
|
10
11
|
subscription: {
|
|
11
12
|
note: string;
|
|
12
13
|
currentEntitled: {
|
|
13
|
-
status:
|
|
14
|
+
status: PatronStatus;
|
|
14
15
|
tier: {
|
|
15
16
|
id: string;
|
|
16
17
|
title: string;
|
|
@@ -34,7 +35,7 @@ declare type PatronType = {
|
|
|
34
35
|
};
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
+
export type SandboxOptions = {
|
|
38
39
|
displayId: string;
|
|
39
40
|
displayName: string;
|
|
40
41
|
emailAddress: string;
|
|
@@ -45,7 +46,7 @@ declare type SandboxOptions = {
|
|
|
45
46
|
cents: number;
|
|
46
47
|
willPayCents: number;
|
|
47
48
|
lifetimeCents: number;
|
|
48
|
-
patronStatus:
|
|
49
|
+
patronStatus: PatronStatus;
|
|
49
50
|
firstCharge: string;
|
|
50
51
|
nextCharge: string;
|
|
51
52
|
lastCharge: string;
|
|
@@ -65,16 +66,15 @@ export declare class Patreon {
|
|
|
65
66
|
private static _AccessToken;
|
|
66
67
|
private static _CampaignID;
|
|
67
68
|
private static _SandboxPatrons;
|
|
68
|
-
static Authorization(
|
|
69
|
+
static Authorization(AuthCredentials: PatronAPIAuth): void;
|
|
69
70
|
private static FetchAPI;
|
|
70
|
-
private static
|
|
71
|
-
static FetchPatrons(filters?: Array<
|
|
72
|
-
protected static
|
|
73
|
-
protected static
|
|
71
|
+
private static CleanURL;
|
|
72
|
+
static FetchPatrons(filters?: Array<PatronStatus>, pageSize?: number): Promise<PatronType[]>;
|
|
73
|
+
protected static _SandboxAddPatron(Patron: SandboxOptions): void;
|
|
74
|
+
protected static _SandboxGetPatron(): SandboxOptions[];
|
|
74
75
|
}
|
|
75
76
|
export declare class Sandbox extends Patreon {
|
|
76
|
-
static
|
|
77
|
-
static
|
|
77
|
+
static GetSandboxPatrons(): SandboxOptions[];
|
|
78
|
+
static AddSandboxPatron(Patron: SandboxOptions): void;
|
|
78
79
|
}
|
|
79
|
-
export {};
|
|
80
80
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAClB,eAAe,GACf,iBAAiB,GACjB,eAAe,CAAC;AAEtB,MAAM,MAAM,aAAa,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MA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AAC;YACX,GAAG,EAAE,MAAM,CAAC;SACf,CAAC;QACF,OAAO,EAAE;YACL,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;YAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;SACtB,CAAC;KACL,CAAC;CACL,CAAC;AAEF,qBAAa,OAAO;IAChB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAoD;IAEvE,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAS;IACnC,OAAO,CAAC,MAAM,CAAC,eAAe,CAA6B;WAE7C,aAAa,CAAC,eAAe,EAAE,aAAa;mBAWrC,QAAQ;IAe7B,OAAO,CAAC,MAAM,CAAC,QAAQ;WAOH,YAAY,CAC5B,OAAO,GAAE,KAAK,CAAC,YAAY,CAAqB,EAChD,QAAQ,GAAE,MAAY;IA8H1B,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,cAAc;IAIzD,SAAS,CAAC,MAAM,CAAC,iBAAiB;CAOrC;AAED,qBAAa,OAAQ,SAAQ,OAAO;WAClB,iBAAiB;WAIjB,gBAAgB,CAAC,MAAM,EAAE,cAAc;CAGxD"}
|
package/lib/index.js
CHANGED
|
@@ -6,16 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Sandbox = exports.Patreon = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
class Patreon {
|
|
9
|
-
static Authorization(
|
|
10
|
-
if (!
|
|
9
|
+
static Authorization(AuthCredentials) {
|
|
10
|
+
if (!AuthCredentials.AccessToken || !AuthCredentials.CampaignID) {
|
|
11
11
|
throw new Error('AccessToken and CampaignID are required on Authorization');
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw new Error('Invalid input, not a type of String');
|
|
16
|
-
}
|
|
17
|
-
this._AccessToken = AuthInformation.AccessToken;
|
|
18
|
-
this._CampaignID = AuthInformation.CampaignID;
|
|
13
|
+
this._AccessToken = AuthCredentials.AccessToken;
|
|
14
|
+
this._CampaignID = AuthCredentials.CampaignID;
|
|
19
15
|
}
|
|
20
16
|
static async FetchAPI(URI) {
|
|
21
17
|
if (!this._AccessToken || !this._CampaignID) {
|
|
@@ -28,94 +24,96 @@ class Patreon {
|
|
|
28
24
|
throw new Error('Fetch API Failed...' + err);
|
|
29
25
|
});
|
|
30
26
|
}
|
|
31
|
-
static
|
|
27
|
+
static CleanURL(query) {
|
|
32
28
|
query = query.replaceAll('[', '%5B').replaceAll(']', '%5D');
|
|
33
29
|
query = query.replaceAll(' ', '');
|
|
34
30
|
return query;
|
|
35
31
|
}
|
|
36
32
|
static async FetchPatrons(filters = ['active_patron'], pageSize = 450) {
|
|
37
|
-
const
|
|
33
|
+
const { data } = await this.FetchAPI(this.CleanURL(`campaigns/${this._CampaignID}/` +
|
|
38
34
|
`members ? include = user, currently_entitled_tiers & page[count] = ${pageSize} & fields[member] = campaign_lifetime_support_cents, currently_entitled_amount_cents, email, full_name, is_follower, last_charge_date, last_charge_status, lifetime_support_cents, next_charge_date, note, patron_status, pledge_cadence, pledge_relationship_start, will_pay_amount_cents & fields[user] = social_connections & fields[tier] = title`));
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (res.data.data.length == 0)
|
|
35
|
+
const Patrons = [];
|
|
36
|
+
const PatreonAPIPatrons = data?.data || [];
|
|
37
|
+
if (PatreonAPIPatrons.length == 0)
|
|
43
38
|
return [];
|
|
44
|
-
//
|
|
45
|
-
this._SandboxPatrons.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
39
|
+
// Format Sandbox Patrons
|
|
40
|
+
for (let x = 0; x < this._SandboxPatrons.length; x++) {
|
|
41
|
+
const Patron = this._SandboxPatrons[x];
|
|
42
|
+
Patrons.push({
|
|
43
|
+
displayId: Patron.displayId,
|
|
44
|
+
displayName: Patron.displayName,
|
|
45
|
+
emailAddress: Patron.emailAddress,
|
|
46
|
+
isFollower: false,
|
|
47
|
+
subscription: {
|
|
48
|
+
note: 'Sandbox',
|
|
49
|
+
currentEntitled: {
|
|
50
|
+
status: Patron.patronStatus,
|
|
51
|
+
tier: {
|
|
52
|
+
id: Patron.tier.id,
|
|
53
|
+
title: Patron.tier.title,
|
|
54
|
+
},
|
|
55
|
+
cents: Patron.cents,
|
|
56
|
+
willPayCents: Patron.willPayCents,
|
|
57
|
+
lifetimeCents: Patron.lifetimeCents,
|
|
58
|
+
firstCharge: Patron.firstCharge,
|
|
59
|
+
nextCharge: Patron.nextCharge,
|
|
60
|
+
lastCharge: Patron.lastCharge,
|
|
57
61
|
},
|
|
58
|
-
cents: Patron.cents,
|
|
59
|
-
willPayCents: Patron.willPayCents,
|
|
60
|
-
lifetimeCents: Patron.lifetimeCents,
|
|
61
|
-
firstCharge: Patron.firstCharge,
|
|
62
|
-
nextCharge: Patron.nextCharge,
|
|
63
|
-
lastCharge: Patron.lastCharge,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
mediaConnection: {
|
|
67
|
-
patreon: {
|
|
68
|
-
id: Patron.mediaConnection.patreon.id,
|
|
69
|
-
url: Patron.mediaConnection.patreon.url,
|
|
70
62
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
:
|
|
63
|
+
mediaConnection: {
|
|
64
|
+
patreon: {
|
|
65
|
+
id: Patron.mediaConnection.patreon.id,
|
|
66
|
+
url: Patron.mediaConnection.patreon.url,
|
|
67
|
+
},
|
|
68
|
+
discord: {
|
|
69
|
+
id: Patron?.mediaConnection?.discord?.id
|
|
70
|
+
? Patron?.mediaConnection?.discord?.id
|
|
71
|
+
: null,
|
|
72
|
+
url: Patron?.mediaConnection?.discord?.url
|
|
73
|
+
? Patron?.mediaConnection?.discord?.id
|
|
74
|
+
: null,
|
|
75
|
+
},
|
|
78
76
|
},
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Format Real Patrons
|
|
80
|
+
for (let x = 0; x < PatreonAPIPatrons.length; x++) {
|
|
81
|
+
const Relationships = PatreonAPIPatrons[x].relationships;
|
|
82
|
+
const Attributes = PatreonAPIPatrons[x].attributes;
|
|
83
|
+
if (!filters.includes(Attributes.patron_status))
|
|
84
|
+
continue;
|
|
85
|
+
const socialInfo = data.included.find((patron) => patron.id == Relationships.user.data.id &&
|
|
86
|
+
patron.type === 'user');
|
|
87
|
+
const tierInfo = data.included.find((patron) => patron.id ==
|
|
88
|
+
Relationships.currently_entitled_tiers?.data[0]?.id &&
|
|
89
|
+
patron.type === 'tier');
|
|
90
90
|
Patrons.push({
|
|
91
|
-
displayId:
|
|
92
|
-
displayName:
|
|
93
|
-
emailAddress:
|
|
94
|
-
isFollower:
|
|
91
|
+
displayId: Relationships.user.data.id,
|
|
92
|
+
displayName: Attributes.full_name,
|
|
93
|
+
emailAddress: Attributes.email,
|
|
94
|
+
isFollower: Attributes.is_follower,
|
|
95
95
|
subscription: {
|
|
96
|
-
note:
|
|
96
|
+
note: Attributes.note,
|
|
97
97
|
currentEntitled: {
|
|
98
|
-
status:
|
|
98
|
+
status: Attributes.patron_status,
|
|
99
99
|
tier: {
|
|
100
100
|
id: tierInfo ? tierInfo.id : null,
|
|
101
|
-
title: tierInfo ? tierInfo.
|
|
101
|
+
title: tierInfo ? tierInfo.Attributes.title : null,
|
|
102
102
|
},
|
|
103
|
-
cents:
|
|
104
|
-
|
|
105
|
-
? Patron.attributes
|
|
106
|
-
.currently_entitled_amount_cents
|
|
103
|
+
cents: Attributes.currently_entitled_amount_cents != 0
|
|
104
|
+
? Attributes.currently_entitled_amount_cents
|
|
107
105
|
: null,
|
|
108
|
-
willPayCents:
|
|
109
|
-
lifetimeCents:
|
|
110
|
-
firstCharge:
|
|
111
|
-
nextCharge:
|
|
112
|
-
lastCharge:
|
|
106
|
+
willPayCents: Attributes.will_pay_amount_cents,
|
|
107
|
+
lifetimeCents: Attributes.lifetime_support_cents,
|
|
108
|
+
firstCharge: Attributes.pledge_relationship_start,
|
|
109
|
+
nextCharge: Attributes.next_charge_date,
|
|
110
|
+
lastCharge: Attributes.last_charge_date,
|
|
113
111
|
},
|
|
114
112
|
},
|
|
115
113
|
mediaConnection: {
|
|
116
114
|
patreon: {
|
|
117
|
-
id:
|
|
118
|
-
url:
|
|
115
|
+
id: Relationships.user.data.id,
|
|
116
|
+
url: Relationships.user.links.related,
|
|
119
117
|
},
|
|
120
118
|
discord: {
|
|
121
119
|
id: socialInfo?.attributes?.social_connections?.discord
|
|
@@ -132,13 +130,13 @@ class Patreon {
|
|
|
132
130
|
},
|
|
133
131
|
},
|
|
134
132
|
});
|
|
135
|
-
}
|
|
133
|
+
}
|
|
136
134
|
return Patrons;
|
|
137
135
|
}
|
|
138
|
-
static
|
|
136
|
+
static _SandboxAddPatron(Patron) {
|
|
139
137
|
this._SandboxPatrons.push(Patron);
|
|
140
138
|
}
|
|
141
|
-
static
|
|
139
|
+
static _SandboxGetPatron() {
|
|
142
140
|
return this._SandboxPatrons;
|
|
143
141
|
}
|
|
144
142
|
}
|
|
@@ -146,11 +144,11 @@ exports.Patreon = Patreon;
|
|
|
146
144
|
Patreon._URL = 'https://www.patreon.com/api/oauth2/v2/';
|
|
147
145
|
Patreon._SandboxPatrons = [];
|
|
148
146
|
class Sandbox extends Patreon {
|
|
149
|
-
static
|
|
150
|
-
return super.
|
|
147
|
+
static GetSandboxPatrons() {
|
|
148
|
+
return super._SandboxGetPatron();
|
|
151
149
|
}
|
|
152
|
-
static
|
|
153
|
-
super.
|
|
150
|
+
static AddSandboxPatron(Patron) {
|
|
151
|
+
super._SandboxAddPatron(Patron);
|
|
154
152
|
}
|
|
155
153
|
}
|
|
156
154
|
exports.Sandbox = Sandbox;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAwE1B,MAAa,OAAO;IAOT,MAAM,CAAC,aAAa,CAAC,eAA8B;QACtD,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE;YAC7D,MAAM,IAAI,KAAK,CACX,0DAA0D,CAC7D,CAAC;SACL;QAED,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC;IAClD,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAW;QACrC,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACzC,MAAM,IAAI,KAAK,CACX,0DAA0D,CAC7D,CAAC;SACL;QAED,OAAO,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,IAAI,GAAG,GAAG,EAAE;YAChC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAE,aAAa,EAAE,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE;SAC5D,CAAC,CAAC,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,GAAG,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,KAAa;QACjC,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,C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AAK,CAAC,OAAO;qBACxC;oBACD,OAAO,EAAE;wBACL,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO;4BACnD,EAAE,OAAO;4BACT,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,kBAAkB;gCACtC,EAAE,OAAO,EAAE,OAAO;4BACxB,CAAC,CAAC,IAAI;wBACV,GAAG,EACC,+BAA+B;4BAC/B,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO;gCAC/C,EAAE,OAAO;4BACT,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,kBAAkB;gCACtC,EAAE,OAAO,EAAE,OAAO;4BACxB,CAAC,CAAC,IAAI;qBACjB;iBACJ;aACJ,CAAC,CAAC;SACN;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAES,MAAM,CAAC,iBAAiB,CAAC,MAAsB;QACrD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAES,MAAM,CAAC,iBAAiB;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;;AA9KL,0BAmLC;AAlLkB,YAAI,GAAW,wCAAwC,CAAC;AAIxD,uBAAe,GAA0B,EAAE,CAAC;AAgL/D,MAAa,OAAQ,SAAQ,OAAO;IACzB,MAAM,CAAC,iBAAiB;QAC3B,OAAO,KAAK,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,MAAsB;QACjD,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACJ;AARD,0BAQC"}
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@anitrack/patreon-wrapper",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Universal Patron API v2 wrapper that simplifies the API's response for easier usage and lower response complexity",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc -p .",
|
|
9
|
-
"dev": "tsc-watch --onSuccess \"node lib/devTEST.js\""
|
|
10
|
-
},
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git://github.com/AniTrack/patreon-wrapper.git"
|
|
14
|
-
},
|
|
15
|
-
"author": "AniTrack",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"patreon",
|
|
18
|
-
"discord",
|
|
19
|
-
"api"
|
|
20
|
-
],
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/AniTrack/patreon-wrapper/issues"
|
|
24
|
-
},
|
|
25
|
-
"homepage": "https://github.com/AniTrack/patreon-wrapper#readme",
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"axios": "^0.27.2"
|
|
28
|
-
},
|
|
29
|
-
"publishConfig": {
|
|
30
|
-
"access": "public"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"ts-node": "^10.7.0",
|
|
34
|
-
"typescript": "^4.6.4"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@anitrack/patreon-wrapper",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Universal Patron API v2 wrapper that simplifies the API's response for easier usage and lower response complexity",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p .",
|
|
9
|
+
"dev": "tsc-watch --onSuccess \"node lib/devTEST.js\""
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git://github.com/AniTrack/patreon-wrapper.git"
|
|
14
|
+
},
|
|
15
|
+
"author": "AniTrack",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"patreon",
|
|
18
|
+
"discord",
|
|
19
|
+
"api"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/AniTrack/patreon-wrapper/issues"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/AniTrack/patreon-wrapper#readme",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"axios": "^0.27.2"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"ts-node": "^10.7.0",
|
|
34
|
+
"typescript": "^4.6.4"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,134 +1,135 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
1
|
+
import axios from 'axios';
|
|
2
2
|
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export type PatronStatus =
|
|
4
|
+
| 'active_patron'
|
|
5
|
+
| 'declined_patron'
|
|
6
|
+
| 'former_patron';
|
|
7
|
+
|
|
8
|
+
export type PatronAPIAuth = {
|
|
9
|
+
AccessToken: string;
|
|
10
|
+
CampaignID: string;
|
|
11
|
+
};
|
|
7
12
|
|
|
8
|
-
type PatronType = {
|
|
9
|
-
displayId: string
|
|
10
|
-
displayName: string
|
|
11
|
-
emailAddress: string
|
|
12
|
-
isFollower: boolean
|
|
13
|
+
export type PatronType = {
|
|
14
|
+
displayId: string;
|
|
15
|
+
displayName: string;
|
|
16
|
+
emailAddress: string;
|
|
17
|
+
isFollower: boolean;
|
|
13
18
|
subscription: {
|
|
14
|
-
note: string
|
|
19
|
+
note: string;
|
|
15
20
|
currentEntitled: {
|
|
16
|
-
status:
|
|
21
|
+
status: PatronStatus;
|
|
17
22
|
tier: {
|
|
18
|
-
id: string
|
|
19
|
-
title: string
|
|
20
|
-
}
|
|
21
|
-
cents: number
|
|
22
|
-
willPayCents: number
|
|
23
|
-
lifetimeCents: number
|
|
24
|
-
firstCharge: string
|
|
25
|
-
nextCharge: string
|
|
26
|
-
lastCharge: string
|
|
27
|
-
}
|
|
28
|
-
}
|
|
23
|
+
id: string;
|
|
24
|
+
title: string;
|
|
25
|
+
};
|
|
26
|
+
cents: number;
|
|
27
|
+
willPayCents: number;
|
|
28
|
+
lifetimeCents: number;
|
|
29
|
+
firstCharge: string;
|
|
30
|
+
nextCharge: string;
|
|
31
|
+
lastCharge: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
29
34
|
mediaConnection: {
|
|
30
35
|
patreon: {
|
|
31
|
-
id: string
|
|
32
|
-
url: string
|
|
33
|
-
}
|
|
36
|
+
id: string;
|
|
37
|
+
url: string;
|
|
38
|
+
};
|
|
34
39
|
discord: {
|
|
35
|
-
id: string | null
|
|
36
|
-
url: string | null
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
+
id: string | null;
|
|
41
|
+
url: string | null;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
40
45
|
|
|
41
|
-
type SandboxOptions = {
|
|
42
|
-
displayId: string
|
|
43
|
-
displayName: string
|
|
44
|
-
emailAddress: string
|
|
46
|
+
export type SandboxOptions = {
|
|
47
|
+
displayId: string;
|
|
48
|
+
displayName: string;
|
|
49
|
+
emailAddress: string;
|
|
45
50
|
tier: {
|
|
46
|
-
id: string
|
|
47
|
-
title: string
|
|
48
|
-
}
|
|
49
|
-
cents: number
|
|
50
|
-
willPayCents: number
|
|
51
|
-
lifetimeCents: number
|
|
52
|
-
patronStatus:
|
|
53
|
-
firstCharge: string
|
|
54
|
-
nextCharge: string
|
|
55
|
-
lastCharge: string
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
};
|
|
54
|
+
cents: number;
|
|
55
|
+
willPayCents: number;
|
|
56
|
+
lifetimeCents: number;
|
|
57
|
+
patronStatus: PatronStatus;
|
|
58
|
+
firstCharge: string;
|
|
59
|
+
nextCharge: string;
|
|
60
|
+
lastCharge: string;
|
|
56
61
|
mediaConnection: {
|
|
57
62
|
patreon: {
|
|
58
|
-
id: string
|
|
59
|
-
url: string
|
|
60
|
-
}
|
|
63
|
+
id: string;
|
|
64
|
+
url: string;
|
|
65
|
+
};
|
|
61
66
|
discord: {
|
|
62
|
-
id: string | null
|
|
63
|
-
url: string | null
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
+
id: string | null;
|
|
68
|
+
url: string | null;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
67
72
|
|
|
68
73
|
export class Patreon {
|
|
69
|
-
private static _URL: string = 'https://www.patreon.com/api/oauth2/v2/'
|
|
70
|
-
|
|
71
|
-
private static _AccessToken: string
|
|
72
|
-
private static _CampaignID: string
|
|
74
|
+
private static _URL: string = 'https://www.patreon.com/api/oauth2/v2/';
|
|
73
75
|
|
|
74
|
-
private static
|
|
76
|
+
private static _AccessToken: string;
|
|
77
|
+
private static _CampaignID: string;
|
|
78
|
+
private static _SandboxPatrons: Array<SandboxOptions> = [];
|
|
75
79
|
|
|
76
|
-
public static Authorization(
|
|
77
|
-
if (!
|
|
80
|
+
public static Authorization(AuthCredentials: PatronAPIAuth) {
|
|
81
|
+
if (!AuthCredentials.AccessToken || !AuthCredentials.CampaignID) {
|
|
78
82
|
throw new Error(
|
|
79
83
|
'AccessToken and CampaignID are required on Authorization'
|
|
80
|
-
)
|
|
81
|
-
} else if (
|
|
82
|
-
typeof AuthInformation.AccessToken != 'string' ||
|
|
83
|
-
typeof AuthInformation.CampaignID != 'string'
|
|
84
|
-
) {
|
|
85
|
-
throw new Error('Invalid input, not a type of String')
|
|
84
|
+
);
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
this._AccessToken =
|
|
89
|
-
this._CampaignID =
|
|
87
|
+
this._AccessToken = AuthCredentials.AccessToken;
|
|
88
|
+
this._CampaignID = AuthCredentials.CampaignID;
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
private static async FetchAPI(URI: string) {
|
|
93
92
|
if (!this._AccessToken || !this._CampaignID) {
|
|
94
93
|
throw new Error(
|
|
95
94
|
'AccessToken and CampaignID are required on Authorization'
|
|
96
|
-
)
|
|
95
|
+
);
|
|
97
96
|
}
|
|
98
97
|
|
|
99
98
|
return await axios(this._URL + URI, {
|
|
100
99
|
method: 'GET',
|
|
101
100
|
headers: { Authorization: 'Bearer ' + this._AccessToken },
|
|
102
101
|
}).catch((err: Error) => {
|
|
103
|
-
throw new Error('Fetch API Failed...' + err)
|
|
104
|
-
})
|
|
102
|
+
throw new Error('Fetch API Failed...' + err);
|
|
103
|
+
});
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
private static
|
|
108
|
-
query = query.replaceAll('[', '%5B').replaceAll(']', '%5D')
|
|
109
|
-
query = query.replaceAll(' ', '')
|
|
106
|
+
private static CleanURL(query: string) {
|
|
107
|
+
query = query.replaceAll('[', '%5B').replaceAll(']', '%5D');
|
|
108
|
+
query = query.replaceAll(' ', '');
|
|
110
109
|
|
|
111
|
-
return query
|
|
110
|
+
return query;
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
public static async FetchPatrons(
|
|
115
|
-
filters: Array<
|
|
114
|
+
filters: Array<PatronStatus> = ['active_patron'],
|
|
116
115
|
pageSize: number = 450
|
|
117
116
|
) {
|
|
118
|
-
const
|
|
119
|
-
this.
|
|
117
|
+
const { data } = await this.FetchAPI(
|
|
118
|
+
this.CleanURL(
|
|
120
119
|
`campaigns/${this._CampaignID}/` +
|
|
121
120
|
`members ? include = user, currently_entitled_tiers & page[count] = ${pageSize} & fields[member] = campaign_lifetime_support_cents, currently_entitled_amount_cents, email, full_name, is_follower, last_charge_date, last_charge_status, lifetime_support_cents, next_charge_date, note, patron_status, pledge_cadence, pledge_relationship_start, will_pay_amount_cents & fields[user] = social_connections & fields[tier] = title`
|
|
122
121
|
)
|
|
123
|
-
)
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const Patrons: Array<PatronType> = [];
|
|
125
|
+
const PatreonAPIPatrons = data?.data || [];
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
if (PatreonAPIPatrons.length == 0) return [];
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
+
// Format Sandbox Patrons
|
|
130
|
+
for (let x = 0; x < this._SandboxPatrons.length; x++) {
|
|
131
|
+
const Patron = this._SandboxPatrons[x];
|
|
129
132
|
|
|
130
|
-
// Processing Fake Sandbox Patrons
|
|
131
|
-
this._SandboxPatrons.forEach((Patron: SandboxOptions) =>
|
|
132
133
|
Patrons.push({
|
|
133
134
|
displayId: Patron.displayId,
|
|
134
135
|
displayName: Patron.displayName,
|
|
@@ -164,57 +165,57 @@ export class Patreon {
|
|
|
164
165
|
: null,
|
|
165
166
|
},
|
|
166
167
|
},
|
|
167
|
-
})
|
|
168
|
-
|
|
168
|
+
});
|
|
169
|
+
}
|
|
169
170
|
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
// Format Real Patrons
|
|
172
|
+
for (let x = 0; x < PatreonAPIPatrons.length; x++) {
|
|
173
|
+
const Relationships = PatreonAPIPatrons[x].relationships;
|
|
174
|
+
const Attributes = PatreonAPIPatrons[x].attributes;
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
(includePatron: any) =>
|
|
176
|
-
includePatron.id == Patron.relationships.user.data.id &&
|
|
177
|
-
includePatron.type === 'user'
|
|
178
|
-
)
|
|
176
|
+
if (!filters.includes(Attributes.patron_status)) continue;
|
|
179
177
|
|
|
180
|
-
|
|
181
|
-
(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
const socialInfo = data.included.find(
|
|
179
|
+
(patron: any) =>
|
|
180
|
+
patron.id == Relationships.user.data.id &&
|
|
181
|
+
patron.type === 'user'
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const tierInfo = data.included.find(
|
|
185
|
+
(patron: any) =>
|
|
186
|
+
patron.id ==
|
|
187
|
+
Relationships.currently_entitled_tiers?.data[0]?.id &&
|
|
188
|
+
patron.type === 'tier'
|
|
189
|
+
);
|
|
186
190
|
|
|
187
191
|
Patrons.push({
|
|
188
|
-
displayId:
|
|
189
|
-
displayName:
|
|
190
|
-
emailAddress:
|
|
191
|
-
isFollower:
|
|
192
|
+
displayId: Relationships.user.data.id,
|
|
193
|
+
displayName: Attributes.full_name,
|
|
194
|
+
emailAddress: Attributes.email,
|
|
195
|
+
isFollower: Attributes.is_follower,
|
|
192
196
|
subscription: {
|
|
193
|
-
note:
|
|
197
|
+
note: Attributes.note,
|
|
194
198
|
currentEntitled: {
|
|
195
|
-
status:
|
|
199
|
+
status: Attributes.patron_status,
|
|
196
200
|
tier: {
|
|
197
201
|
id: tierInfo ? tierInfo.id : null,
|
|
198
|
-
title: tierInfo ? tierInfo.
|
|
202
|
+
title: tierInfo ? tierInfo.Attributes.title : null,
|
|
199
203
|
},
|
|
200
204
|
cents:
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
? Patron.attributes
|
|
204
|
-
.currently_entitled_amount_cents
|
|
205
|
+
Attributes.currently_entitled_amount_cents != 0
|
|
206
|
+
? Attributes.currently_entitled_amount_cents
|
|
205
207
|
: null,
|
|
206
|
-
willPayCents:
|
|
207
|
-
lifetimeCents:
|
|
208
|
-
firstCharge:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
lastCharge: Patron.attributes.last_charge_date,
|
|
208
|
+
willPayCents: Attributes.will_pay_amount_cents,
|
|
209
|
+
lifetimeCents: Attributes.lifetime_support_cents,
|
|
210
|
+
firstCharge: Attributes.pledge_relationship_start,
|
|
211
|
+
nextCharge: Attributes.next_charge_date,
|
|
212
|
+
lastCharge: Attributes.last_charge_date,
|
|
212
213
|
},
|
|
213
214
|
},
|
|
214
215
|
mediaConnection: {
|
|
215
216
|
patreon: {
|
|
216
|
-
id:
|
|
217
|
-
url:
|
|
217
|
+
id: Relationships.user.data.id,
|
|
218
|
+
url: Relationships.user.links.related,
|
|
218
219
|
},
|
|
219
220
|
discord: {
|
|
220
221
|
id: socialInfo?.attributes?.social_connections?.discord
|
|
@@ -231,17 +232,18 @@ export class Patreon {
|
|
|
231
232
|
: null,
|
|
232
233
|
},
|
|
233
234
|
},
|
|
234
|
-
})
|
|
235
|
-
}
|
|
236
|
-
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return Patrons;
|
|
237
239
|
}
|
|
238
240
|
|
|
239
|
-
protected static
|
|
240
|
-
this._SandboxPatrons.push(Patron)
|
|
241
|
+
protected static _SandboxAddPatron(Patron: SandboxOptions) {
|
|
242
|
+
this._SandboxPatrons.push(Patron);
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
protected static
|
|
244
|
-
return this._SandboxPatrons
|
|
245
|
+
protected static _SandboxGetPatron() {
|
|
246
|
+
return this._SandboxPatrons;
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
// public static FetchPatron() {}
|
|
@@ -250,11 +252,11 @@ export class Patreon {
|
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
export class Sandbox extends Patreon {
|
|
253
|
-
public static
|
|
254
|
-
return super.
|
|
255
|
+
public static GetSandboxPatrons() {
|
|
256
|
+
return super._SandboxGetPatron();
|
|
255
257
|
}
|
|
256
258
|
|
|
257
|
-
public static
|
|
258
|
-
super.
|
|
259
|
+
public static AddSandboxPatron(Patron: SandboxOptions) {
|
|
260
|
+
super._SandboxAddPatron(Patron);
|
|
259
261
|
}
|
|
260
262
|
}
|