[−][src]Module twitch_api2::eventsub
eventsub
only.Holds serializable EventSub stuff
Use CreateEventSubSubscription
to subscribe to an event according to the EventSub guide.
Parse the response payload text with Payload::parse
or the .
Example
You've used CreateEventSubSubscription
to create a subscription for user.authorization.revoke
, after verifying your callback accordingly you will then get events sent to the callback
To parse these, use Payload::parse
use twitch_api2::eventsub::Payload; let payload = r#"{ "subscription": { "id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4", "type": "user.authorization.revoke", "version": "1", "condition": { "client_id": "crq72vsaoijkc83xx42hz6i37" }, "transport": { "method": "webhook", "callback": "https://example.com/webhooks/callback" }, "created_at": "2019-11-16T10:11:12.123Z" }, "event": { "client_id": "crq72vsaoijkc83xx42hz6i37", "user_id": "1337", "user_name": "cool_user" } }"#; let payload = Payload::parse(payload).unwrap(); match payload { Payload::UserAuthorizationRevokeV1(p) => { println!("User with id `{}` has revoked access to client `{}`", p.event.user_id, p.event.client_id ) } _ => { panic!() } }
Modules
channel | Subscription types regarding channels |
stream | Subscription types regarding streams |
user | Subscription types regarding users |
Structs
EventSubSubscription | General information about an EventSub subscription. |
EventSubscriptionInformation | Metadata about the subscription. |
NotificationPayload | Notification received |
Transport | Transport setting for event notification |
TransportResponse | Transport response on event notification |
VerificationRequest | Verification Request |
Enums
EventType | Event name |
Payload | Subscription payload. Received on events. Enumerates all possible |
PayloadParseError | Errors that can happen when parsing payload |
Status | Subscription request status |
TransportMethod | Transport method |
Traits
EventSubscription | An EventSub subscription. |