2021-12-03 03:54:59 +00:00
|
|
|
package notification
|
|
|
|
|
|
|
|
import "github.com/Selly-Modules/natsio"
|
|
|
|
|
|
|
|
// Config ...
|
|
|
|
type Config struct {
|
|
|
|
APIKey string
|
|
|
|
Nats natsio.Config
|
|
|
|
}
|
|
|
|
|
|
|
|
// PushRequest ...
|
|
|
|
type PushRequest struct {
|
2021-12-03 04:58:55 +00:00
|
|
|
Title string `json:"title"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
Data string `json:"data"`
|
|
|
|
Users []string `json:"users"`
|
2021-12-03 09:56:48 +00:00
|
|
|
Label string `json:"label,omitempty"`
|
|
|
|
Category string `json:"category,omitempty"`
|
2021-12-03 03:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// PushResponse ...
|
|
|
|
type PushResponse struct {
|
|
|
|
RequestID string `json:"requestId"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type pushRequest struct {
|
2021-12-03 04:58:55 +00:00
|
|
|
APIKey string `json:"apiKey"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
Data string `json:"data"`
|
|
|
|
SendBy string `json:"sendBy"`
|
|
|
|
Users []string `json:"users"`
|
|
|
|
Topic string `json:"topic"`
|
|
|
|
Label string `json:"label"`
|
|
|
|
Category string `json:"category"`
|
2021-12-03 03:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Query ...
|
|
|
|
type Query struct {
|
|
|
|
User string `json:"user"`
|
|
|
|
Category string `json:"category,omitempty"`
|
|
|
|
Page int64 `json:"page,omitempty"`
|
|
|
|
Limit int64 `json:"limit,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type query struct {
|
|
|
|
APIKey string `json:"apiKey"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Category string `json:"category,omitempty"`
|
|
|
|
Page int64 `json:"page,omitempty"`
|
|
|
|
Limit int64 `json:"limit,omitempty"`
|
|
|
|
}
|
|
|
|
|
2021-12-03 04:09:25 +00:00
|
|
|
// Notification ...
|
|
|
|
type Notification struct {
|
|
|
|
ID string `json:"id"`
|
|
|
|
Category string `json:"category,omitempty"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Body string `json:"body"`
|
|
|
|
IsRead bool `json:"isRead"`
|
|
|
|
Data string `json:"data,omitempty"`
|
|
|
|
CreatedAt string `json:"createdAt"`
|
|
|
|
LastPushAt string `json:"lastPushAt"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListNotificationResponse ...
|
|
|
|
type ListNotificationResponse struct {
|
|
|
|
List []Notification `json:"list"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
Limit int64 `json:"limit"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read ...
|
2021-12-03 03:54:59 +00:00
|
|
|
type Read struct {
|
2021-12-03 09:56:48 +00:00
|
|
|
ID string `json:"id"`
|
2021-12-03 03:54:59 +00:00
|
|
|
}
|
|
|
|
|
2021-12-03 04:25:50 +00:00
|
|
|
// ReadResponse ...
|
|
|
|
type ReadResponse struct {
|
|
|
|
Error string `json:"error"`
|
|
|
|
}
|
|
|
|
|
2021-12-03 03:54:59 +00:00
|
|
|
type read struct {
|
|
|
|
APIKey string `json:"apiKey"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CountUnread ...
|
|
|
|
type CountUnread struct {
|
|
|
|
User string `json:"user"`
|
2021-12-03 09:56:48 +00:00
|
|
|
Category string `json:"category,omitempty"`
|
2021-12-03 03:54:59 +00:00
|
|
|
}
|
|
|
|
|
2021-12-03 04:25:50 +00:00
|
|
|
// CountUnreadResponse ...
|
|
|
|
type CountUnreadResponse struct {
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
}
|
|
|
|
|
2021-12-03 03:54:59 +00:00
|
|
|
type countUnread struct {
|
|
|
|
APIKey string `json:"apiKey"`
|
|
|
|
User string `json:"user"`
|
|
|
|
Category string `json:"category"`
|
|
|
|
}
|