Skip to content

Commit

Permalink
[messages] add messages export request
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed Jan 2, 2025
1 parent 9719fc5 commit 64912d4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
File renamed without changes.
4 changes: 3 additions & 1 deletion smsgateway/domain_upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ const (
PushMessageEnqueued PushEventType = "MessageEnqueued"
// Webhooks are updated.
PushWebhooksUpdated PushEventType = "WebhooksUpdated"
// Messages export is requested.
PushMessagesExportRequested PushEventType = "MessagesExportRequested"
)

// A push notification.
type PushNotification struct {
// The token of the device that receives the notification.
Token string `json:"token" validate:"required" example:"PyDmBQZZXYmyxMwED8Fzy"`
// The type of event.
Event PushEventType `json:"event" validate:"omitempty,oneof=MessageEnqueued WebhooksUpdated" default:"MessageEnqueued" example:"MessageEnqueued"`
Event PushEventType `json:"event" validate:"omitempty,oneof=MessageEnqueued WebhooksUpdated MessagesExportRequested" default:"MessageEnqueued" example:"MessageEnqueued"`
// The additional data associated with the event.
Data map[string]string `json:"data"`
}
12 changes: 12 additions & 0 deletions smsgateway/requests.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
package smsgateway

import "time"

// Push request
type UpstreamPushRequest = []PushNotification

// Messages export request
type MessagesExportRequest struct {
// DeviceID is the ID of the device to export messages for.
DeviceID string `json:"deviceId" example:"PyDmBQZZXYmyxMwED8Fzy" validate:"required,max=21"`
// Since is the start of the time range to export.
Since time.Time `json:"since" example:"2024-01-01T00:00:00Z" validate:"required,ltefield=Until"`
// Until is the end of the time range to export.
Until time.Time `json:"until" example:"2024-01-01T23:59:59Z" validate:"required,gtefield=Since"`
}

0 comments on commit 64912d4

Please sign in to comment.