Example #1
0
func (c *Client) GetListener(lk engine.ListenerKey) (*engine.Listener, error) {
	data, err := c.Get(c.endpoint("listeners", lk.Id), url.Values{})
	if err != nil {
		return nil, err
	}
	return engine.ListenerFromJSON(data)
}
Example #2
0
func parseListenerPack(v []byte) (*engine.Listener, error) {
	var lp listenerReadPack
	if err := json.Unmarshal(v, &lp); err != nil {
		return nil, err
	}
	if len(lp.Listener) == 0 {
		return nil, &scroll.MissingFieldError{Field: "Listener"}
	}
	return engine.ListenerFromJSON(lp.Listener)
}
Example #3
0
func (n *ng) GetListener(key engine.ListenerKey) (*engine.Listener, error) {
	bytes, err := n.getVal(n.path("listeners", key.Id))
	if err != nil {
		return nil, err
	}
	l, err := engine.ListenerFromJSON([]byte(bytes), key.Id)
	if err != nil {
		return nil, err
	}
	return l, nil
}