func (api *API) ListFunctions(c *common.Context) (interface{}, error) {
	res, err := api.Func.List(c.GetUser().ID, c.Param("source"))
	if err != nil {
		return nil, err
	}
	runtimes, err := api.Func.ListRuntimes()
	if err != nil {
		return nil, err
	}
	var filter []models.Function
	for _, v := range res {
		for runtime := range runtimes {
			if strings.ToLower(v.Runtime) == runtime {
				filter = append(filter, v)
				break
			}
		}
	}
	return &models.FunctionView{Functions: filter}, nil
}
ListFunctions list functions
package api
import (
	"encoding/base64"
	"encoding/hex"
	"fmt"
	"strings"
	"github.com/baetyl/baetyl-go/v2/errors"
	"github.com/baetyl/baetyl-cloud/v2/common"
	"github.com/baetyl/baetyl-cloud/v2/models"
)
func (api *API) ListFunctionSources(c *common.Context) (interface{}, error) {
	runtimes, err := api.Func.ListRuntimes()
	if err != nil {
		return nil, errors.Trace(err)
	}
	res := api.Func.ListSources()
	return &models.FunctionSourceView{Sources: res, Runtimes: runtimes}, nil
}