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_event_request.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.59 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/api/pkg/requests/message_event_request.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway@83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/api/pkg/requests/message_event_request.go
-
curl -L -o message_event_request.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/83a59cae175e3c9a43b6f5d3f8749ca61b6b5072/api/pkg/requests/message_event_request.go
1.59 kB
| package requests | |
| import ( | |
| "time" | |
| "github.com/NdoleStudio/httpsms/pkg/entities" | |
| "github.com/google/uuid" | |
| "github.com/NdoleStudio/httpsms/pkg/services" | |
| ) | |
| // MessageEvent is the payload for sending and SMS message | |
| type MessageEvent struct { | |
| request | |
| // Timestamp is the time when the event was emitted, Please send the timestamp in UTC with as much precision as possible | |
| Timestamp time.Time `json:"timestamp" example:"2022-06-05T14:26:09.527976+03:00"` | |
| // EventName is the type of event | |
| // * SENT: is emitted when a message is sent by the mobile phone | |
| // * FAILED: is event is emitted when the message could not be sent by the mobile phone | |
| // * DELIVERED: is event is emitted when a delivery report has been received by the mobile phone | |
| EventName string `json:"event_name" example:"SENT"` | |
| // Reason is the exact error message in case the event is an error | |
| Reason *string `json:"reason"` | |
| MessageID string `json:"messageID" swaggerignore:"true"` // used internally for validation | |
| } | |
| // Sanitize the message event | |
| func (input *MessageEvent) Sanitize() MessageEvent { | |
| input.MessageID = input.sanitizeMessageID(input.MessageID) | |
| return *input | |
| } | |
| // ToMessageStoreEventParams converts MessageEvent to services.MessageStoreEventParams | |
| func (input *MessageEvent) ToMessageStoreEventParams(source string) services.MessageStoreEventParams { | |
| return services.MessageStoreEventParams{ | |
| MessageID: uuid.MustParse(input.MessageID), | |
| Source: source, | |
| ErrorMessage: input.Reason, | |
| EventName: entities.MessageEventName(input.EventName), | |
| Timestamp: input.Timestamp, | |
| } | |
| } | |