func webhookList(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	ctxs := permission.ContextsForPermission(t, permission.PermWebhookRead, permTypes.CtxTeam)
	var teams []string
	for _, c := range ctxs {
		if c.CtxType == permTypes.CtxGlobal {
			teams = nil
			break
		}
		teams = append(teams, c.Value)
	}
	webhooks, err := servicemanager.Webhook.List(teams)
	if err != nil {
		return err
	}
	if len(webhooks) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	w.Header().Set("Content-Type", "application/json")
	return json.NewEncoder(w).Encode(webhooks)
}
func webhookList(w http.ResponseWriter, r *http.Request, t auth.Token) error {
	ctxs := permission.ContextsForPermission(t, permission.PermWebhookRead, permTypes.CtxTeam)
	var teams []string
	for _, c := range ctxs {
		if c.CtxType == permTypes.CtxGlobal {
			teams = nil
			break
		}
		teams = append(teams, c.Value)
	}
	webhooks, err := servicemanager.Webhook.List(teams)
	if err != nil {
		return err
	}
	if len(webhooks) == 0 {
		w.WriteHeader(http.StatusNoContent)
		return nil
	}
	w.Header().Set("Content-Type", "application/json")
	return json.NewEncoder(w).Encode(webhooks)
}
func webhookList ( w http . ResponseWriter , r * http . Request , t auth . Token ) error { ctxs := permission . ContextsForPermission ( t , permission . PermWebhookRead , permTypes . CtxTeam ) var teams [ ] string for _ , c := range ctxs { if c . CtxType == permTypes . CtxGlobal { teams = nil break } teams = append ( teams , c . Value ) } webhooks , err := servicemanager . Webhook . List ( teams ) if err != nil { return err } if len ( webhooks ) == 0 { w . WriteHeader ( http . StatusNoContent ) return nil } w . Header ( ) . Set ( " " , " " ) return json . NewEncoder ( w ) . Encode ( webhooks ) }
// title: webhook list
// path: /events/webhooks
// method: GET
// produce: application/json
// responses:
//   200: List webhooks
//   204: No content
title : webhook list path : / events / webhooks method : GET produce : application / json responses : 200 : List webhooks 204 : No content