func genFilteredRow()

in commands/api.go [670:703]


func genFilteredRow(resultApi *whisk.RetApi, apiPath string, apiVerb string, maxActionNameSize int, maxApiNameSize int) []whisk.ApiFilteredRow {
	var orderInfo whisk.ApiFilteredRow
	var orderInfoArr []whisk.ApiFilteredRow
	baseUrl := strings.TrimSuffix(resultApi.BaseUrl, "/")
	apiName := resultApi.Swagger.Info.Title
	basePath := resultApi.Swagger.BasePath
	if resultApi.Swagger != nil && resultApi.Swagger.Paths != nil {
		for path := range resultApi.Swagger.Paths {
			whisk.Debug(whisk.DbgInfo, "genFilteredRow: comparing api relpath: '%s'\n", path)
			if len(apiPath) == 0 || path == apiPath {
				whisk.Debug(whisk.DbgInfo, "genFilteredRow: relpath matches\n")
				for op, opv := range resultApi.Swagger.Paths[path].MakeOperationMap() {
					whisk.Debug(whisk.DbgInfo, "genFilteredRow: comparing operation: '%s'\n", op)
					if len(apiVerb) == 0 || strings.ToLower(op) == strings.ToLower(apiVerb) {
						whisk.Debug(whisk.DbgInfo, "genFilteredRow: operation matches: %#v\n", opv)
						var actionName string
						if opv.XOpenWhisk == nil {
							actionName = ""
						} else if len(opv.XOpenWhisk.Package) > 0 {
							actionName = "/" + opv.XOpenWhisk.Namespace + "/" + opv.XOpenWhisk.Package + "/" + opv.XOpenWhisk.ActionName
						} else {
							actionName = "/" + opv.XOpenWhisk.Namespace + "/" + opv.XOpenWhisk.ActionName
						}
						orderInfo = AssignRowInfo(actionName[0:min(len(actionName), maxActionNameSize)], op, apiName[0:min(len(apiName), maxApiNameSize)], basePath, path, baseUrl+path)
						orderInfo.FmtString = fmtString
						whisk.Debug(whisk.DbgInfo, "Appening to orderInfoArr: %s\n", orderInfo.RelPath)
						orderInfoArr = append(orderInfoArr, orderInfo)
					}
				}
			}
		}
	}
	return orderInfoArr
}