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/message_thread_index_request.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/requests/message_thread_index_request.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway/api/pkg/requests/message_thread_index_request.go
-
curl -L -o message_thread_index_request.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/requests/message_thread_index_request.go
2.17 kB
| package requests | |
| import ( | |
| "strings" | |
| "github.com/NdoleStudio/httpsms/pkg/entities" | |
| "github.com/NdoleStudio/httpsms/pkg/repositories" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| ) | |
| // MessageThreadIndex is the payload fetching entities.MessageThread sent between 2 numbers | |
| type MessageThreadIndex struct { | |
| request | |
| IsArchived string `json:"is_archived" query:"is_archived" example:"false"` | |
| UnreadOnly string `json:"unread_only" query:"unread_only" example:"false"` | |
| Skip string `json:"skip" query:"skip"` | |
| Query string `json:"query" query:"query"` | |
| Limit string `json:"limit" query:"limit"` | |
| Owner string `json:"owner" query:"owner"` | |
| Contacts string `json:"contacts" query:"contacts" example:"false"` | |
| } | |
| // Sanitize sets defaults to MessageOutstanding | |
| func (input *MessageThreadIndex) Sanitize() MessageThreadIndex { | |
| if strings.TrimSpace(input.Limit) == "" { | |
| input.Limit = "20" | |
| } | |
| if strings.TrimSpace(input.IsArchived) == "" { | |
| input.IsArchived = "false" | |
| } | |
| if strings.TrimSpace(input.Contacts) == "" { | |
| input.Contacts = "false" | |
| } | |
| input.IsArchived = input.sanitizeBool(input.IsArchived) | |
| input.UnreadOnly = input.sanitizeBool(input.UnreadOnly) | |
| if input.UnreadOnly == "" { | |
| input.UnreadOnly = "false" | |
| } | |
| input.Contacts = input.sanitizeBool(input.Contacts) | |
| if input.Contacts != "true" && input.Contacts != "false" { | |
| input.Contacts = "false" | |
| } | |
| input.Query = strings.TrimSpace(input.Query) | |
| input.Owner = input.sanitizeAddress(input.Owner) | |
| input.Skip = strings.TrimSpace(input.Skip) | |
| if input.Skip == "" { | |
| input.Skip = "0" | |
| } | |
| return *input | |
| } | |
| // ToGetParams converts MessageThreadIndex into services.MessageThreadGetParams | |
| func (input *MessageThreadIndex) ToGetParams(userID entities.UserID) services.MessageThreadGetParams { | |
| return services.MessageThreadGetParams{ | |
| IndexParams: repositories.IndexParams{ | |
| Skip: input.getInt(input.Skip), | |
| Query: input.Query, | |
| Limit: input.getInt(input.Limit), | |
| }, | |
| UserID: userID, | |
| IsArchived: input.getBool(input.IsArchived), | |
| UnreadOnly: input.getBool(input.UnreadOnly), | |
| WithContacts: input.getBool(input.Contacts), | |
| Owner: input.Owner, | |
| } | |
| } | |