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/user_update_request.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/6917738ca6db1603dee9e07994b4e42d5e1ae9b2/api/pkg/requests/user_update_request.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway@6917738ca6db1603dee9e07994b4e42d5e1ae9b2/api/pkg/requests/user_update_request.go
-
curl -L -o user_update_request.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/6917738ca6db1603dee9e07994b4e42d5e1ae9b2/api/pkg/requests/user_update_request.go
1.07 kB
| package requests | |
| import ( | |
| "strings" | |
| "time" | |
| "github.com/google/uuid" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| ) | |
| // UserUpdate is the payload for updating a phone | |
| type UserUpdate struct { | |
| request | |
| Timezone string `json:"timezone" example:"Europe/Helsinki"` | |
| ActivePhoneID string `json:"active_phone_id" example:"32343a19-da5e-4b1b-a767-3298a73703cb"` | |
| } | |
| // Sanitize sets defaults to MessageOutstanding | |
| func (input *UserUpdate) Sanitize() UserUpdate { | |
| input.ActivePhoneID = strings.TrimSpace(input.ActivePhoneID) | |
| input.Timezone = strings.TrimSpace(input.Timezone) | |
| return *input | |
| } | |
| // ToUpdateParams converts UserUpdate to services.UserUpdateParams | |
| func (input *UserUpdate) ToUpdateParams() services.UserUpdateParams { | |
| location, err := time.LoadLocation(input.Timezone) | |
| if err != nil { | |
| location = time.UTC | |
| } | |
| var activePhoneID *uuid.UUID | |
| if input.ActivePhoneID != "" { | |
| val := uuid.MustParse(input.ActivePhoneID) | |
| activePhoneID = &val | |
| } | |
| return services.UserUpdateParams{ | |
| ActivePhoneID: activePhoneID, | |
| Timezone: location, | |
| } | |
| } | |