forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhook_index_request.go
More file actions
37 lines (32 loc) · 921 Bytes
/
webhook_index_request.go
File metadata and controls
37 lines (32 loc) · 921 Bytes
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
package requests
import (
"strings"
"github.com/NdoleStudio/httpsms/pkg/repositories"
)
// WebhookIndex is the payload for fetching entities.Webhook of a user
type WebhookIndex struct {
request
Skip string `json:"skip" query:"skip"`
Query string `json:"query" query:"query"`
Limit string `json:"limit" query:"limit"`
}
// Sanitize sets defaults to MessageOutstanding
func (input *WebhookIndex) Sanitize() WebhookIndex {
if strings.TrimSpace(input.Limit) == "" {
input.Limit = "1"
}
input.Query = strings.TrimSpace(input.Query)
input.Skip = strings.TrimSpace(input.Skip)
if input.Skip == "" {
input.Skip = "0"
}
return *input
}
// ToIndexParams converts HeartbeatIndex to repositories.IndexParams
func (input *WebhookIndex) ToIndexParams() repositories.IndexParams {
return repositories.IndexParams{
Skip: input.getInt(input.Skip),
Query: input.Query,
Limit: input.getInt(input.Limit),
}
}