Documentation ¶
Index ¶
- Variables
- func CallerFromRequest(r *http.Request) (string, error)
- func LogEventHandler(w http.ResponseWriter, r *http.Request)
- func NewRouter(c *Client, s Storage, origin string) *mux.Router
- type Client
- func (c *Client) Call(p ContactsProvider, recName string)
- func (c *Client) Do(method, url string, body io.Reader) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, url string) (*http.Response, error)
- func (c *Client) Post(ctx context.Context, url string, body io.Reader) (*http.Response, error)
- func (c *Client) Token() (string, error)
- type Contact
- type ContactsProvider
- type Limiter
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CallLimiter = NewLimiter(3) GetLimiter = NewLimiter(15) )
View Source
var ErrCorruptedContacts = errors.New("contacts file read contains corrupted data, thus the result could be partial")
Functions ¶
func LogEventHandler ¶
func LogEventHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type Client ¶
type Client struct { AppID string Number string Origin string // contains filtered or unexported fields }
func (*Client) Call ¶
func (c *Client) Call(p ContactsProvider, recName string)
type Contact ¶
type Contact struct { Name string `json:"-"` Type string `json:"type"` Number string `json:"number"` }
func NewContact ¶
type ContactsProvider ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
func NewLimiter ¶
NewLimiter creates a new Limiter intance that allows `r` events per second to happen. It is a wrapper around rate.Limiter, configured with an burst of 1 and Limit of `r`.
Click to show internal directories.
Click to hide internal directories.