From 027b00df73b3c502f2d8da948d489ea688d23e61 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Tue, 29 May 2018 12:51:38 +0300 Subject: [PATCH 1/2] add webhook structs --- v1/types.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/v1/types.go b/v1/types.go index 44c2ca3..edd1ee9 100644 --- a/v1/types.go +++ b/v1/types.go @@ -93,3 +93,24 @@ type MessagesResponse struct { MessageID int `json:"message_id"` Time time.Time `json:"time"` } + +// Webhook request +type WebhookRequest struct { + Type string `json:"type"` + Meta transportRequestMeta `json:"meta"` + Data WebhookData `json:"data"` +} + +// WebhookData request data +type WebhookData struct { + ExternalUserID string `json:"external_user_id"` + ExternalMessageID string `json:"external_message_id,omitempty"` + ChannelID uint64 `json:"channel_id"` + Content string `json:"content"` + QuoteMessageExternalID string `json:"quote_message_external_id,omitempty"` +} + +type transportRequestMeta struct { + ID uint64 `json:"id"` + Timestamp int64 `json:"timestamp"` +} From 226ea79b323d8a438d8e31ee54cb03aa060a79f4 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Tue, 29 May 2018 13:44:33 +0300 Subject: [PATCH 2/2] update WebhookRequest --- v1/types.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v1/types.go b/v1/types.go index edd1ee9..57f7961 100644 --- a/v1/types.go +++ b/v1/types.go @@ -97,7 +97,7 @@ type MessagesResponse struct { // Webhook request type WebhookRequest struct { Type string `json:"type"` - Meta transportRequestMeta `json:"meta"` + Meta TransportRequestMeta `json:"meta"` Data WebhookData `json:"data"` } @@ -106,11 +106,12 @@ type WebhookData struct { ExternalUserID string `json:"external_user_id"` ExternalMessageID string `json:"external_message_id,omitempty"` ChannelID uint64 `json:"channel_id"` + ChatID int64 `json:"channel_id"` // TODO: add to webhook request Content string `json:"content"` QuoteMessageExternalID string `json:"quote_message_external_id,omitempty"` } -type transportRequestMeta struct { +type TransportRequestMeta struct { ID uint64 `json:"id"` Timestamp int64 `json:"timestamp"` }