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/heartbeat_store_request.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/requests/heartbeat_store_request.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway/api/pkg/requests/heartbeat_store_request.go
-
curl -L -o heartbeat_store_request.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/requests/heartbeat_store_request.go
1.28 kB
| package requests | |
| import ( | |
| "time" | |
| "github.com/NdoleStudio/httpsms/pkg/entities" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| ) | |
| // HeartbeatStore is the payload for fetching entities.Heartbeat of a phone number | |
| type HeartbeatStore struct { | |
| request | |
| Owner string `json:"owner" swaggerignore:"true"` | |
| Charging bool `json:"charging"` | |
| PhoneNumbers []string `json:"phone_numbers"` | |
| } | |
| // Sanitize sets defaults to MessageOutstanding | |
| func (input *HeartbeatStore) Sanitize() HeartbeatStore { | |
| input.Owner = input.sanitizeAddress(input.Owner) | |
| input.PhoneNumbers = input.sanitizeAddresses(input.PhoneNumbers) | |
| if len(input.PhoneNumbers) == 0 { | |
| input.PhoneNumbers = append(input.PhoneNumbers, input.Owner) | |
| } | |
| return *input | |
| } | |
| // ToStoreParams converts HeartbeatIndex to repositories.IndexParams | |
| func (input *HeartbeatStore) ToStoreParams(user entities.AuthContext, source string, version string) []services.HeartbeatStoreParams { | |
| var params []services.HeartbeatStoreParams | |
| for _, phoneNumber := range input.PhoneNumbers { | |
| params = append(params, services.HeartbeatStoreParams{ | |
| Owner: phoneNumber, | |
| Charging: input.Charging, | |
| Source: source, | |
| Version: version, | |
| UserID: user.ID, | |
| Timestamp: time.Now(), | |
| }) | |
| } | |
| return params | |
| } | |