Files
gorush/vendor/github.com/appleboy/go-fcm/option.go
Bo-Yi Wu 14dc899b02 feat: check unused package (#232)
* feat: check unused package

update edganiukov/fcm to appleboy/go-fcm

* update readme

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* update comment

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-06-01 02:52:01 -05:00

29 lines
562 B
Go

package fcm
import (
"errors"
"net/http"
)
// Option configurates Client with defined option.
type Option func(*Client) error
// WithEndpoint returns Option to configure FCM Endpoint.
func WithEndpoint(endpoint string) Option {
return func(c *Client) error {
if endpoint == "" {
return errors.New("invalid endpoint")
}
c.endpoint = endpoint
return nil
}
}
// WithHTTPClient returns Option to configure HTTP Client.
func WithHTTPClient(httpClient *http.Client) Option {
return func(c *Client) error {
c.client = httpClient
return nil
}
}