func appList(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	filter := &app.Filter{}
	if name := r.URL.Query().Get("name"); name != "" {
		filter.NameMatches = name
	}
	if platform := r.URL.Query().Get("platform"); platform != "" {
		filter.Platform = platform
	}
	if teamOwner := r.URL.Query().Get("teamOwner"); teamOwner != "" {
		filter.TeamOwner = teamOwner
	}
	if owner := r.URL.Query().Get("owner"); owner != "" {
		filter.UserOwner = owner
	}
	if pool := r.URL.Query().Get("pool"); pool != "" {
		filter.Pool = pool
	}
	locked, _ := strconv.ParseBool(r.URL.Query().Get("locked"))
	if locked {
		filter.Locked = true
	}
	if status, ok := r.URL.Query()["status"]; ok {
		filter.Statuses = status
	}
	if tags, ok := r.URL.Query()["tag"]; ok {
		filter.Tags = tags
	}
	contexts := permission.ContextsForPermission(t, permission.PermAppRead)
	if len(contexts) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	apps, err := app.List(appFilterByContext(contexts, filter))
	if err != nil {
		return err
	}
	if len(apps) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	simple, _ := strconv.ParseBool(r.URL.Query().Get("simplified"))
	w.Header().Set("Content-Type", "application/json")
	miniApps := make([]miniApp, len(apps))
	if simple {
		for i, ap := range apps {
			ur := app.AppUnitsResponse{Units: nil, Err: nil}
			miniApps[i], err = minifyApp(ap, ur)
			if err != nil {
				return err
			}
		}
		return json.NewEncoder(w).Encode(miniApps)
	}
	appUnits, err := app.Units(apps)
	if err != nil {
		return err
	}
	for i, app := range apps {
		miniApps[i], err = minifyApp(app, appUnits[app.Name])
		if err != nil {
			return err
		}
	}
	return json.NewEncoder(w).Encode(miniApps)
}
func appList(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	filter := &app.Filter{}
	if name := r.URL.Query().Get("name"); name != "" {
		filter.NameMatches = name
	}
	if platform := r.URL.Query().Get("platform"); platform != "" {
		filter.Platform = platform
	}
	if teamOwner := r.URL.Query().Get("teamOwner"); teamOwner != "" {
		filter.TeamOwner = teamOwner
	}
	if owner := r.URL.Query().Get("owner"); owner != "" {
		filter.UserOwner = owner
	}
	if pool := r.URL.Query().Get("pool"); pool != "" {
		filter.Pool = pool
	}
	locked, _ := strconv.ParseBool(r.URL.Query().Get("locked"))
	if locked {
		filter.Locked = true
	}
	if status, ok := r.URL.Query()["status"]; ok {
		filter.Statuses = status
	}
	if tags, ok := r.URL.Query()["tag"]; ok {
		filter.Tags = tags
	}
	contexts := permission.ContextsForPermission(t, permission.PermAppRead)
	if len(contexts) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	apps, err := app.List(appFilterByContext(contexts, filter))
	if err != nil {
		return err
	}
	if len(apps) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	simple, _ := strconv.ParseBool(r.URL.Query().Get("simplified"))
	w.Header().Set("Content-Type", "application/json")
	miniApps := make([]miniApp, len(apps))
	if simple {
		for i, ap := range apps {
			ur := app.AppUnitsResponse{Units: nil, Err: nil}
			miniApps[i], err = minifyApp(ap, ur)
			if err != nil {
				return err
			}
		}
		return json.NewEncoder(w).Encode(miniApps)
	}
	appUnits, err := app.Units(apps)
	if err != nil {
		return err
	}
	for i, app := range apps {
		miniApps[i], err = minifyApp(app, appUnits[app.Name])
		if err != nil {
			return err
		}
	}
	return json.NewEncoder(w).Encode(miniApps)
}
func appList ( w http . ResponseWriter , r * http . Request , t auth . Token ) error { filter := & app . Filter { } if name := r . URL . Query ( ) . Get ( " " ) ; name != " " { filter . NameMatches = name } if platform := r . URL . Query ( ) . Get ( " " ) ; platform != " " { filter . Platform = platform } if teamOwner := r . URL . Query ( ) . Get ( " " ) ; teamOwner != " " { filter . TeamOwner = teamOwner } if owner := r . URL . Query ( ) . Get ( " " ) ; owner != " " { filter . UserOwner = owner } if pool := r . URL . Query ( ) . Get ( " " ) ; pool != " " { filter . Pool = pool } locked , _ := strconv . ParseBool ( r . URL . Query ( ) . Get ( " " ) ) if locked { filter . Locked = true } if status , ok := r . URL . Query ( ) [ " " ] ; ok { filter . Statuses = status } if tags , ok := r . URL . Query ( ) [ " " ] ; ok { filter . Tags = tags } contexts := permission . ContextsForPermission ( t , permission . PermAppRead ) if len ( contexts ) == 0 { w . WriteHeader ( http . StatusNoContent ) return nil } apps , err := app . List ( appFilterByContext ( contexts , filter ) ) if err != nil { return err } if len ( apps ) == 0 { w . WriteHeader ( http . StatusNoContent ) return nil } simple , _ := strconv . ParseBool ( r . URL . Query ( ) . Get ( " " ) ) w . Header ( ) . Set ( " " , " " ) miniApps := make ( [ ] miniApp , len ( apps ) ) if simple { for i , ap := range apps { ur := app . AppUnitsResponse { Units : nil , Err : nil } miniApps [ i ] , err = minifyApp ( ap , ur ) if err != nil { return err } } return json . NewEncoder ( w ) . Encode ( miniApps ) } appUnits , err := app . Units ( apps ) if err != nil { return err } for i , app := range apps { miniApps [ i ] , err = minifyApp ( app , appUnits [ app . Name ] ) if err != nil { return err } } return json . NewEncoder ( w ) . Encode ( miniApps ) }
// title: app list
// path: /apps
// method: GET
// produce: application/json
// responses:
//   200: List apps
//   204: No content
//   401: Unauthorized
title : app list path : / apps method : GET produce : application / json responses : 200 : List apps 204 : No content 401 : Unauthorized