Spaces:
Paused
Paused
ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca Download api/pkg/requests/webhook_store_request.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/api/pkg/requests/webhook_store_request.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway@83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/api/pkg/requests/webhook_store_request.go
-
curl -L -o webhook_store_request.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/api/pkg/requests/webhook_store_request.go
1.23 kB
| package requests | |
| import ( | |
| "strings" | |
| "github.com/NdoleStudio/httpsms/pkg/entities" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| ) | |
| // WebhookStore is the payload for creating a new entities.Webhook | |
| type WebhookStore struct { | |
| request | |
| SigningKey string `json:"signing_key"` | |
| URL string `json:"url"` | |
| PhoneNumbers []string `json:"phone_numbers" example:"+18005550100,+18005550100"` | |
| Events []string `json:"events"` | |
| } | |
| // Sanitize sets defaults to WebhookStore | |
| func (input *WebhookStore) Sanitize() WebhookStore { | |
| input.URL = input.sanitizeURL(input.URL) | |
| input.SigningKey = strings.TrimSpace(input.SigningKey) | |
| input.Events = input.removeStringDuplicates(input.Events) | |
| var phoneNumbers []string | |
| for _, address := range input.PhoneNumbers { | |
| phoneNumbers = append(phoneNumbers, input.sanitizeAddress(address)) | |
| } | |
| return *input | |
| } | |
| // ToStoreParams converts WebhookStore to services.WebhookStoreParams | |
| func (input *WebhookStore) ToStoreParams(user entities.AuthContext) *services.WebhookStoreParams { | |
| return &services.WebhookStoreParams{ | |
| UserID: user.ID, | |
| SigningKey: input.SigningKey, | |
| URL: input.URL, | |
| PhoneNumbers: input.PhoneNumbers, | |
| Events: input.Events, | |
| } | |
| } | |