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/discord/client_option.go from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/discord/client_option.go
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway/api/pkg/discord/client_option.go
-
curl -L -o client_option.go https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/api/pkg/discord/client_option.go
1.19 kB
| package discord | |
| import ( | |
| "net/http" | |
| "strings" | |
| ) | |
| // Option is options for constructing a client | |
| type Option interface { | |
| apply(config *clientConfig) | |
| } | |
| type clientOptionFunc func(config *clientConfig) | |
| func (fn clientOptionFunc) apply(config *clientConfig) { | |
| fn(config) | |
| } | |
| // WithHTTPClient sets the underlying HTTP client used for API requests. | |
| // By default, http.DefaultClient is used. | |
| func WithHTTPClient(httpClient *http.Client) Option { | |
| return clientOptionFunc(func(config *clientConfig) { | |
| if httpClient != nil { | |
| config.httpClient = httpClient | |
| } | |
| }) | |
| } | |
| // WithBaseURL set's the base url for the discord API | |
| func WithBaseURL(baseURL string) Option { | |
| return clientOptionFunc(func(config *clientConfig) { | |
| if baseURL != "" { | |
| config.baseURL = strings.TrimRight(baseURL, "/") | |
| } | |
| }) | |
| } | |
| // WithApplicationID sets the discord bot application ID | |
| func WithApplicationID(applicationID string) Option { | |
| return clientOptionFunc(func(config *clientConfig) { | |
| config.applicationID = applicationID | |
| }) | |
| } | |
| // WithBotToken sets the discord bot token | |
| func WithBotToken(botToken string) Option { | |
| return clientOptionFunc(func(config *clientConfig) { | |
| config.botToken = botToken | |
| }) | |
| } | |