func (h *Handler) GetEndpoint(
	product, productPassword, clientKey string) (*data.Endpoint, error) {
	logger := h.logger.Add("method", "GetEndpoint",
		"product", product, "clientKey", clientKey)

	logger.Info("channel endpoint request")

	prod, err := h.checkProductPassword(logger, product, productPassword)
	if err != nil {
		return nil, err
	}

	ch, err := h.findClientChannel(logger, prod, clientKey, true)
	if err != nil {
		return nil, err
	}

	var ept data.Endpoint
	if err := h.db.FindOneTo(&ept, "channel", ch.ID); err != nil {
		logger.Error(err.Error())
		return nil, ErrEndpointNotFound
	}

	return &ept, nil
}
func (h *Handler) GetEndpoint(
	product, productPassword, clientKey string) (*data.Endpoint, error) {
	logger := h.logger.Add("method", "GetEndpoint",
		"product", product, "clientKey", clientKey)

	logger.Info("channel endpoint request")

	prod, err := h.checkProductPassword(logger, product, productPassword)
	if err != nil {
		return nil, err
	}

	ch, err := h.findClientChannel(logger, prod, clientKey, true)
	if err != nil {
		return nil, err
	}

	var ept data.Endpoint
	if err := h.db.FindOneTo(&ept, "channel", ch.ID); err != nil {
		logger.Error(err.Error())
		return nil, ErrEndpointNotFound
	}

	return &ept, nil
}
// GetEndpoint returns an endpoint for a given client key.