| 45 | } |
| 46 | |
| 47 | func (opts listQueryOptions) OrderBy() map[string]string { |
| 48 | // Set on copy to keep original intact. |
| 49 | if opts.Order == "" { |
| 50 | opts.Order = defaultOrder |
| 51 | } |
| 52 | if opts.Sort == "" { |
| 53 | opts.Sort = defaultSort |
| 54 | } |
| 55 | |
| 56 | field := strings.ToUpper(opts.Sort) |
| 57 | if opts.Sort == "created" { |
| 58 | field = "CREATED_AT" |
| 59 | } |
| 60 | return map[string]string{ |
| 61 | "direction": strings.ToUpper(opts.Order), |
| 62 | "field": field, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // listLabels lists the labels in the given repo. Pass -1 for limit to list all labels; |
| 67 | // otherwise, only that number of labels is returned for any number of pages. |