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/emails/factory.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 884 Bytes
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/6917738ca6db1603dee9e07994b4e42d5e1ae9b2/api/pkg/emails/factory.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway@6917738ca6db1603dee9e07994b4e42d5e1ae9b2/api/pkg/emails/factory.go
-
curl -L -o factory.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/6917738ca6db1603dee9e07994b4e42d5e1ae9b2/api/pkg/emails/factory.go
884 Bytes
| package emails | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "strconv" | |
| "github.com/nyaruka/phonenumbers" | |
| ) | |
| type factory struct{} | |
| func (factory *factory) formatPhoneNumber(number string) string { | |
| value, _ := phonenumbers.Parse(number, phonenumbers.UNKNOWN_REGION) | |
| return phonenumbers.Format(value, phonenumbers.INTERNATIONAL) | |
| } | |
| func (factory *factory) formatBool(value bool) string { | |
| if value == true { | |
| return "Yes" | |
| } | |
| return "No" | |
| } | |
| func (factory *factory) formatQuantity(value uint) string { | |
| formatted := strconv.FormatUint(uint64(value), 10) | |
| for index := len(formatted) - 3; index > 0; index -= 3 { | |
| formatted = formatted[:index] + "," + formatted[index:] | |
| } | |
| return formatted | |
| } | |
| func (factory *factory) formatHTTPResponseCode(code *int) string { | |
| responseCode := "-" | |
| if code != nil { | |
| responseCode = fmt.Sprintf("%d - %s", *code, http.StatusText(*code)) | |
| } | |
| return responseCode | |
| } | |