func (h *Handler) GetEndpoints(
	tkn, channel, template string) ([]data.Endpoint, error) {
	logger := h.logger.Add("method", "GetEndpoints",
		"channel", channel, "template", template)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	tail, args := h.getEndpointsConditions(channel, template)

	result, err := h.selectAllFrom(
		logger, data.EndpointTable, tail, args...)
	if err != nil {
		return nil, err
	}

	endpoints := make([]data.Endpoint, len(result))
	for i, item := range result {
		endpoints[i] = *item.(*data.Endpoint)
	}

	return endpoints, nil
}
func (h *Handler) GetEndpoints(
	tkn, channel, template string) ([]data.Endpoint, error) {
	logger := h.logger.Add("method", "GetEndpoints",
		"channel", channel, "template", template)

	if !h.token.Check(tkn) {
		logger.Warn("access denied")
		return nil, ErrAccessDenied
	}

	tail, args := h.getEndpointsConditions(channel, template)

	result, err := h.selectAllFrom(
		logger, data.EndpointTable, tail, args...)
	if err != nil {
		return nil, err
	}

	endpoints := make([]data.Endpoint, len(result))
	for i, item := range result {
		endpoints[i] = *item.(*data.Endpoint)
	}

	return endpoints, nil
}
// GetEndpoints returns endpoints.