-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathevent.go
More file actions
66 lines (57 loc) · 1.98 KB
/
event.go
File metadata and controls
66 lines (57 loc) · 1.98 KB
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
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package events
// MockEventParameters are used to craft the event; most of this data is prepopulated by lower services, such as the from/to users to avoid
// replicating logic across files
type MockEventParameters struct {
EventMessageID string
SubscriptionID string
Transport string
Trigger string
FromUserID string
FromUserName string
ToUserID string
ToUserName string
IsAnonymous bool
IsGift bool
GiftUser string
EventStatus string
SubscriptionStatus string
ItemID string
ItemName string
Cost int64
Description string
GameID string
Tier string
Timestamp string
CharityCurrentValue int
CharityTargetValue int
ClientID string
BanStartTimestamp string
BanEndTimestamp string
ModerateAction string
}
type MockEventResponse struct {
ID string
JSON []byte
FromUser string
ToUser string
Timestamp string
}
// MockEvent represents an event to be triggered using the `twitch event trigger <event>` command.
type MockEvent interface {
// Returns the Mock Response for the given transport
GenerateEvent(p MockEventParameters) (MockEventResponse, error)
// Returns the trigger for the event (e.g. cheer for cheer events, or add-reward for channel points add rewards)
ValidTrigger(trigger string) bool
// Returns whether a given event supports a supplied transport
ValidTransport(transport string) bool
// Returns
GetAllTopicsByTransport(transport string) []string
// Returns the string of the topic
GetTopic(transport string, trigger string) string
// Returns back the correct "trigger" if using the eventsub topic
GetEventSubAlias(trigger string) string
// Returns the subscription version for this event
SubscriptionVersion() string
}