forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhook_update_request.go
More file actions
31 lines (27 loc) · 919 Bytes
/
webhook_update_request.go
File metadata and controls
31 lines (27 loc) · 919 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
package requests
import (
"github.com/NdoleStudio/httpsms/pkg/entities"
"github.com/NdoleStudio/httpsms/pkg/services"
"github.com/google/uuid"
)
// WebhookUpdate is the payload for updating an entities.Webhook
type WebhookUpdate struct {
WebhookStore
WebhookID string `json:"webhookID" swaggerignore:"true"` // used internally for validation
}
// Sanitize sets defaults to WebhookUpdate
func (input *WebhookUpdate) Sanitize() WebhookUpdate {
input.WebhookStore.Sanitize()
return *input
}
// ToUpdateParams converts WebhookUpdate to services.WebhookUpdateParams
func (input *WebhookUpdate) ToUpdateParams(user entities.AuthContext) *services.WebhookUpdateParams {
return &services.WebhookUpdateParams{
UserID: user.ID,
WebhookID: uuid.MustParse(input.WebhookID),
SigningKey: input.SigningKey,
URL: input.URL,
PhoneNumbers: input.PhoneNumbers,
Events: input.Events,
}
}