/
EventSubChannelCharityCampaignProgressEvent.ts
96 lines (83 loc) · 2.66 KB
/
EventSubChannelCharityCampaignProgressEvent.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { Enumerable } from '@d-fischer/shared-utils';
import type { ApiClient, HelixUser } from '@twurple/api';
import { checkRelationAssertion, DataObject, rawDataSymbol, rtfm } from '@twurple/common';
import { EventSubChannelCharityAmount } from './common/EventSubChannelCharityAmount';
import { type EventSubChannelCharityCampaignProgressEventData } from './EventSubChannelCharityCampaignProgressEvent.external';
/**
* An EventSub event representing progress of a charity campaign in a channel.
*/
@rtfm<EventSubChannelCharityCampaignProgressEvent>('eventsub-base', 'EventSubChannelCharityCampaignProgressEvent', 'id')
export class EventSubChannelCharityCampaignProgressEvent extends DataObject<EventSubChannelCharityCampaignProgressEventData> {
/** @internal */ @Enumerable(false) private readonly _client: ApiClient;
/** @internal */
constructor(data: EventSubChannelCharityCampaignProgressEventData, client: ApiClient) {
super(data);
this._client = client;
}
/**
* An ID that identifies the charity campaign.
*/
get id(): string {
return this[rawDataSymbol].id;
}
/**
* The ID of the broadcaster.
*/
get broadcasterId(): string {
return this[rawDataSymbol].broadcaster_id;
}
/**
* The name of the broadcaster.
*/
get broadcasterName(): string {
return this[rawDataSymbol].broadcaster_login;
}
/**
* The display name of the broadcaster.
*/
get broadcasterDisplayName(): string {
return this[rawDataSymbol].broadcaster_name;
}
/**
* Gets more information about the broadcaster.
*/
async getBroadcaster(): Promise<HelixUser> {
return checkRelationAssertion(await this._client.users.getUserById(this[rawDataSymbol].broadcaster_id));
}
/**
* The name of the charity.
*/
get charityName(): string {
return this[rawDataSymbol].charity_name;
}
/**
* A description of the charity.
*/
get charityDescription(): string {
return this[rawDataSymbol].charity_description;
}
/**
* A URL to an image of the of the charity;s logo. The image’s type is PNG and its size is 100px X 100px.
*/
get charityLogo(): string {
return this[rawDataSymbol].charity_logo;
}
/**
* A URL to the charity’s website.
*/
get charityWebsite(): string {
return this[rawDataSymbol].charity_website;
}
/**
* An object that contains the current amount of donations that the campaign has received.
*/
get currentAmount(): EventSubChannelCharityAmount {
return new EventSubChannelCharityAmount(this[rawDataSymbol].current_amount);
}
/**
* An object that contains the campaign’s target fundraising goal.
*/
get targetAmount(): EventSubChannelCharityAmount {
return new EventSubChannelCharityAmount(this[rawDataSymbol].target_amount);
}
}