@anitrack/patreon-wrapper 1.5.2 → 1.5.3

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/lib/index.d.ts CHANGED
@@ -1,80 +1,80 @@
1
- export type PatronStatus = 'active_patron' | 'declined_patron' | 'former_patron';
2
- export type PatronAPIAuth = {
3
- AccessToken: string;
4
- CampaignID: string;
5
- };
6
- export type PatronType = {
7
- displayId: string;
8
- displayName: string;
9
- emailAddress: string;
10
- isFollower: boolean;
11
- subscription: {
12
- note: string;
13
- currentEntitled: {
14
- status: PatronStatus;
15
- tier: {
16
- id: string;
17
- title: string;
18
- };
19
- cents: number;
20
- willPayCents: number;
21
- lifetimeCents: number;
22
- firstCharge: string;
23
- nextCharge: string;
24
- lastCharge: string;
25
- };
26
- };
27
- mediaConnection: {
28
- patreon: {
29
- id: string;
30
- url: string;
31
- };
32
- discord: {
33
- id: string | null;
34
- url: string | null;
35
- };
36
- };
37
- };
38
- export type SandboxOptions = {
39
- displayId: string;
40
- displayName: string;
41
- emailAddress: string;
42
- tier: {
43
- id: string;
44
- title: string;
45
- };
46
- cents: number;
47
- willPayCents: number;
48
- lifetimeCents: number;
49
- patronStatus: PatronStatus;
50
- firstCharge: string;
51
- nextCharge: string;
52
- lastCharge: string;
53
- mediaConnection: {
54
- patreon: {
55
- id: string;
56
- url: string;
57
- };
58
- discord: {
59
- id: string | null;
60
- url: string | null;
61
- };
62
- };
63
- };
64
- export declare class Patreon {
65
- private static _URL;
66
- private static _AccessToken;
67
- private static _CampaignID;
68
- private static _SandboxPatrons;
69
- static Authorization(AuthCredentials: PatronAPIAuth): void;
70
- private static FetchAPI;
71
- private static CleanURL;
72
- static FetchPatrons(filters?: Array<PatronStatus>, pageSize?: number, showSandboxPatrons?: boolean): Promise<PatronType[]>;
73
- protected static _SandboxAddPatron(Patron: SandboxOptions): void;
74
- protected static _SandboxGetPatron(): SandboxOptions[];
75
- }
76
- export declare class Sandbox extends Patreon {
77
- static GetPatrons(): SandboxOptions[];
78
- static AddPatron(Patron: SandboxOptions): void;
79
- }
1
+ export type PatronStatus = 'active_patron' | 'declined_patron' | 'former_patron';
2
+ export type PatronAPIAuth = {
3
+ AccessToken: string;
4
+ CampaignID: string;
5
+ };
6
+ export type PatronType = {
7
+ displayId: string;
8
+ displayName: string;
9
+ emailAddress: string;
10
+ isFollower: boolean;
11
+ subscription: {
12
+ note: string;
13
+ currentEntitled: {
14
+ status: PatronStatus;
15
+ tier: {
16
+ id: string;
17
+ title: string;
18
+ };
19
+ cents: number;
20
+ willPayCents: number;
21
+ lifetimeCents: number;
22
+ firstCharge: string;
23
+ nextCharge: string;
24
+ lastCharge: string;
25
+ };
26
+ };
27
+ mediaConnection: {
28
+ patreon: {
29
+ id: string;
30
+ url: string;
31
+ };
32
+ discord: {
33
+ id: string | null;
34
+ url: string | null;
35
+ };
36
+ };
37
+ };
38
+ export type SandboxOptions = {
39
+ displayId: string;
40
+ displayName: string;
41
+ emailAddress: string;
42
+ tier: {
43
+ id: string;
44
+ title: string;
45
+ };
46
+ cents: number;
47
+ willPayCents: number;
48
+ lifetimeCents: number;
49
+ patronStatus: PatronStatus;
50
+ firstCharge: string;
51
+ nextCharge: string;
52
+ lastCharge: string;
53
+ mediaConnection: {
54
+ patreon: {
55
+ id: string;
56
+ url: string;
57
+ };
58
+ discord: {
59
+ id: string | null;
60
+ url: string | null;
61
+ };
62
+ };
63
+ };
64
+ export declare class Patreon {
65
+ private static _URL;
66
+ private static _AccessToken;
67
+ private static _CampaignID;
68
+ private static _SandboxPatrons;
69
+ static Authorization(AuthCredentials: PatronAPIAuth): void;
70
+ private static FetchAPI;
71
+ private static CleanURL;
72
+ static FetchPatrons(filters?: Array<PatronStatus>, pageSize?: number, showSandboxPatrons?: boolean): Promise<PatronType[]>;
73
+ protected static _SandboxAddPatron(Patron: SandboxOptions): void;
74
+ protected static _SandboxGetPatron(): SandboxOptions[];
75
+ }
76
+ export declare class Sandbox extends Patreon {
77
+ static GetPatrons(): SandboxOptions[];
78
+ static AddPatron(Patron: SandboxOptions): void;
79
+ }
80
80
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,157 +1,157 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Sandbox = exports.Patreon = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- class Patreon {
9
- static Authorization(AuthCredentials) {
10
- if (!AuthCredentials.AccessToken || !AuthCredentials.CampaignID) {
11
- throw new Error('AccessToken and CampaignID are required on Authorization');
12
- }
13
- this._AccessToken = AuthCredentials.AccessToken;
14
- this._CampaignID = AuthCredentials.CampaignID;
15
- }
16
- static async FetchAPI(URI) {
17
- if (!this._AccessToken || !this._CampaignID) {
18
- throw new Error('AccessToken and CampaignID are required on Authorization');
19
- }
20
- return await (0, axios_1.default)(this._URL + URI, {
21
- method: 'GET',
22
- headers: { Authorization: 'Bearer ' + this._AccessToken },
23
- }).catch((err) => {
24
- throw new Error('Fetch API Failed...' + err);
25
- });
26
- }
27
- static CleanURL(query) {
28
- query = query.replaceAll('[', '%5B').replaceAll(']', '%5D');
29
- query = query.replaceAll(' ', '');
30
- return query;
31
- }
32
- static async FetchPatrons(filters = ['active_patron'], pageSize = 450, showSandboxPatrons = false) {
33
- const { data } = await this.FetchAPI(this.CleanURL(`campaigns/${this._CampaignID}/` +
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`));
35
- const Patrons = [];
36
- const PatreonAPIPatrons = data?.data || [];
37
- if (PatreonAPIPatrons.length == 0)
38
- return [];
39
- // Format Real Patrons
40
- for (let x = 0; x < PatreonAPIPatrons.length; x++) {
41
- const Relationships = PatreonAPIPatrons[x].relationships;
42
- const Attributes = PatreonAPIPatrons[x].attributes;
43
- if (!filters.includes(Attributes.patron_status))
44
- continue;
45
- const socialInfo = data.included.find((patron) => patron.id == Relationships.user.data.id &&
46
- patron.type === 'user');
47
- const tierInfo = data.included.find((patron) => patron.id ==
48
- Relationships.currently_entitled_tiers?.data[0]?.id &&
49
- patron.type === 'tier');
50
- Patrons.push({
51
- displayId: Relationships.user.data.id,
52
- displayName: Attributes.full_name,
53
- emailAddress: Attributes.email,
54
- isFollower: Attributes.is_follower,
55
- subscription: {
56
- note: Attributes.note,
57
- currentEntitled: {
58
- status: Attributes.patron_status,
59
- tier: {
60
- id: tierInfo ? tierInfo.id : null,
61
- title: tierInfo ? tierInfo.Attributes.title : null,
62
- },
63
- cents: Attributes.currently_entitled_amount_cents != 0
64
- ? Attributes.currently_entitled_amount_cents
65
- : null,
66
- willPayCents: Attributes.will_pay_amount_cents,
67
- lifetimeCents: Attributes.lifetime_support_cents,
68
- firstCharge: Attributes.pledge_relationship_start,
69
- nextCharge: Attributes.next_charge_date,
70
- lastCharge: Attributes.last_charge_date,
71
- },
72
- },
73
- mediaConnection: {
74
- patreon: {
75
- id: Relationships.user.data.id,
76
- url: Relationships.user.links.related,
77
- },
78
- discord: {
79
- id: socialInfo?.attributes?.social_connections?.discord
80
- ?.user_id
81
- ? socialInfo?.attributes?.social_connections
82
- ?.discord?.user_id
83
- : null,
84
- url: 'https://discordapp.com/users/' +
85
- socialInfo?.attributes?.social_connections?.discord
86
- ?.user_id
87
- ? socialInfo?.attributes?.social_connections
88
- ?.discord?.user_id
89
- : null,
90
- },
91
- },
92
- });
93
- }
94
- if (showSandboxPatrons) {
95
- // Format Sandbox Patrons
96
- for (let x = 0; x < this._SandboxPatrons.length; x++) {
97
- const Patron = this._SandboxPatrons[x];
98
- Patrons.push({
99
- displayId: Patron.displayId,
100
- displayName: Patron.displayName,
101
- emailAddress: Patron.emailAddress,
102
- isFollower: false,
103
- subscription: {
104
- note: 'Sandbox',
105
- currentEntitled: {
106
- status: Patron.patronStatus,
107
- tier: {
108
- id: Patron.tier.id,
109
- title: Patron.tier.title,
110
- },
111
- cents: Patron.cents,
112
- willPayCents: Patron.willPayCents,
113
- lifetimeCents: Patron.lifetimeCents,
114
- firstCharge: Patron.firstCharge,
115
- nextCharge: Patron.nextCharge,
116
- lastCharge: Patron.lastCharge,
117
- },
118
- },
119
- mediaConnection: {
120
- patreon: {
121
- id: Patron.mediaConnection.patreon.id,
122
- url: Patron.mediaConnection.patreon.url,
123
- },
124
- discord: {
125
- id: Patron?.mediaConnection?.discord?.id
126
- ? Patron?.mediaConnection?.discord?.id
127
- : null,
128
- url: Patron?.mediaConnection?.discord?.url
129
- ? Patron?.mediaConnection?.discord?.id
130
- : null,
131
- },
132
- },
133
- });
134
- }
135
- }
136
- return Patrons;
137
- }
138
- static _SandboxAddPatron(Patron) {
139
- this._SandboxPatrons.push(Patron);
140
- }
141
- static _SandboxGetPatron() {
142
- return this._SandboxPatrons;
143
- }
144
- }
145
- exports.Patreon = Patreon;
146
- Patreon._URL = 'https://www.patreon.com/api/oauth2/v2/';
147
- Patreon._SandboxPatrons = [];
148
- class Sandbox extends Patreon {
149
- static GetPatrons() {
150
- return super._SandboxGetPatron();
151
- }
152
- static AddPatron(Patron) {
153
- super._SandboxAddPatron(Patron);
154
- }
155
- }
156
- exports.Sandbox = Sandbox;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Sandbox = exports.Patreon = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ class Patreon {
9
+ static Authorization(AuthCredentials) {
10
+ if (!AuthCredentials.AccessToken || !AuthCredentials.CampaignID) {
11
+ throw new Error('AccessToken and CampaignID are required on Authorization');
12
+ }
13
+ this._AccessToken = AuthCredentials.AccessToken;
14
+ this._CampaignID = AuthCredentials.CampaignID;
15
+ }
16
+ static async FetchAPI(URI) {
17
+ if (!this._AccessToken || !this._CampaignID) {
18
+ throw new Error('AccessToken and CampaignID are required on Authorization');
19
+ }
20
+ return await (0, axios_1.default)(this._URL + URI, {
21
+ method: 'GET',
22
+ headers: { Authorization: 'Bearer ' + this._AccessToken },
23
+ }).catch((err) => {
24
+ throw new Error('Fetch API Failed...' + err);
25
+ });
26
+ }
27
+ static CleanURL(query) {
28
+ query = query.replaceAll('[', '%5B').replaceAll(']', '%5D');
29
+ query = query.replaceAll(' ', '');
30
+ return query;
31
+ }
32
+ static async FetchPatrons(filters = ['active_patron'], pageSize = 450, showSandboxPatrons = false) {
33
+ const { data } = await this.FetchAPI(this.CleanURL(`campaigns/${this._CampaignID}/` +
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`));
35
+ const Patrons = [];
36
+ const PatreonAPIPatrons = data?.data || [];
37
+ if (PatreonAPIPatrons.length == 0)
38
+ return [];
39
+ // Format Real Patrons
40
+ for (let x = 0; x < PatreonAPIPatrons.length; x++) {
41
+ const Relationships = PatreonAPIPatrons[x].relationships;
42
+ const Attributes = PatreonAPIPatrons[x].attributes;
43
+ if (!filters.includes(Attributes.patron_status))
44
+ continue;
45
+ const socialInfo = data.included.find((patron) => patron.id == Relationships.user.data.id &&
46
+ patron.type === 'user');
47
+ const tierInfo = data.included.find((patron) => patron.id ==
48
+ Relationships.currently_entitled_tiers?.data[0]?.id &&
49
+ patron.type === 'tier');
50
+ Patrons.push({
51
+ displayId: Relationships.user.data.id,
52
+ displayName: Attributes.full_name,
53
+ emailAddress: Attributes.email,
54
+ isFollower: Attributes.is_follower,
55
+ subscription: {
56
+ note: Attributes.note,
57
+ currentEntitled: {
58
+ status: Attributes.patron_status,
59
+ tier: {
60
+ id: tierInfo ? tierInfo.id : null,
61
+ title: tierInfo ? tierInfo.attributes.title : null,
62
+ },
63
+ cents: Attributes.currently_entitled_amount_cents != 0
64
+ ? Attributes.currently_entitled_amount_cents
65
+ : null,
66
+ willPayCents: Attributes.will_pay_amount_cents,
67
+ lifetimeCents: Attributes.lifetime_support_cents,
68
+ firstCharge: Attributes.pledge_relationship_start,
69
+ nextCharge: Attributes.next_charge_date,
70
+ lastCharge: Attributes.last_charge_date,
71
+ },
72
+ },
73
+ mediaConnection: {
74
+ patreon: {
75
+ id: Relationships.user.data.id,
76
+ url: Relationships.user.links.related,
77
+ },
78
+ discord: {
79
+ id: socialInfo?.attributes?.social_connections?.discord
80
+ ?.user_id
81
+ ? socialInfo?.attributes?.social_connections
82
+ ?.discord?.user_id
83
+ : null,
84
+ url: 'https://discordapp.com/users/' +
85
+ socialInfo?.attributes?.social_connections?.discord
86
+ ?.user_id
87
+ ? socialInfo?.attributes?.social_connections
88
+ ?.discord?.user_id
89
+ : null,
90
+ },
91
+ },
92
+ });
93
+ }
94
+ if (showSandboxPatrons) {
95
+ // Format Sandbox Patrons
96
+ for (let x = 0; x < this._SandboxPatrons.length; x++) {
97
+ const Patron = this._SandboxPatrons[x];
98
+ Patrons.push({
99
+ displayId: Patron.displayId,
100
+ displayName: Patron.displayName,
101
+ emailAddress: Patron.emailAddress,
102
+ isFollower: false,
103
+ subscription: {
104
+ note: 'Sandbox',
105
+ currentEntitled: {
106
+ status: Patron.patronStatus,
107
+ tier: {
108
+ id: Patron.tier.id,
109
+ title: Patron.tier.title,
110
+ },
111
+ cents: Patron.cents,
112
+ willPayCents: Patron.willPayCents,
113
+ lifetimeCents: Patron.lifetimeCents,
114
+ firstCharge: Patron.firstCharge,
115
+ nextCharge: Patron.nextCharge,
116
+ lastCharge: Patron.lastCharge,
117
+ },
118
+ },
119
+ mediaConnection: {
120
+ patreon: {
121
+ id: Patron.mediaConnection.patreon.id,
122
+ url: Patron.mediaConnection.patreon.url,
123
+ },
124
+ discord: {
125
+ id: Patron?.mediaConnection?.discord?.id
126
+ ? Patron?.mediaConnection?.discord?.id
127
+ : null,
128
+ url: Patron?.mediaConnection?.discord?.url
129
+ ? Patron?.mediaConnection?.discord?.id
130
+ : null,
131
+ },
132
+ },
133
+ });
134
+ }
135
+ }
136
+ return Patrons;
137
+ }
138
+ static _SandboxAddPatron(Patron) {
139
+ this._SandboxPatrons.push(Patron);
140
+ }
141
+ static _SandboxGetPatron() {
142
+ return this._SandboxPatrons;
143
+ }
144
+ }
145
+ exports.Patreon = Patreon;
146
+ Patreon._URL = 'https://www.patreon.com/api/oauth2/v2/';
147
+ Patreon._SandboxPatrons = [];
148
+ class Sandbox extends Patreon {
149
+ static GetPatrons() {
150
+ return super._SandboxGetPatron();
151
+ }
152
+ static AddPatron(Patron) {
153
+ super._SandboxAddPatron(Patron);
154
+ }
155
+ }
156
+ exports.Sandbox = Sandbox;
157
157
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
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,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rack/patreon-wrapper",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Universal Patron API v2 wrapper that simplifies their API usage in JavaScript",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "homepage": "https://github.com/AniTrack/patreon-wrapper#readme",
26
26
  "dependencies": {
27
- "axios": "^0.27.2"
27
+ "axios": "^1.6.8"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
@@ -33,4 +33,4 @@
33
33
  "ts-node": "^10.7.0",
34
34
  "typescript": "^4.6.4"
35
35
  }
36
- }
36
+ }
package/src/index.ts CHANGED
@@ -158,7 +158,7 @@ export class Patreon {
158
158
  status: Attributes.patron_status,
159
159
  tier: {
160
160
  id: tierInfo ? tierInfo.id : null,
161
- title: tierInfo ? tierInfo.Attributes.title : null,
161
+ title: tierInfo ? tierInfo.attributes.title : null,
162
162
  },
163
163
  cents:
164
164
  Attributes.currently_entitled_amount_cents != 0