(ctx context.Context, include func(r *management.ResourceServer) bool)
| 708 | } |
| 709 | |
| 710 | func (c *cli) filteredAPIPickerOptions(ctx context.Context, include func(r *management.ResourceServer) bool) (pickerOptions, error) { |
| 711 | list, err := c.api.ResourceServer.List(ctx) |
| 712 | if err != nil { |
| 713 | return nil, fmt.Errorf("failed to list APIs: %w", err) |
| 714 | } |
| 715 | |
| 716 | // NOTE: because client names are not unique, we'll just number these |
| 717 | // labels. |
| 718 | var opts pickerOptions |
| 719 | for _, r := range list.ResourceServers { |
| 720 | if !include(r) { |
| 721 | continue |
| 722 | } |
| 723 | label := fmt.Sprintf("%s %s", r.GetName(), ansi.Faint("("+r.GetIdentifier()+")")) |
| 724 | |
| 725 | opts = append(opts, pickerOption{value: r.GetID(), label: label}) |
| 726 | } |
| 727 | |
| 728 | if len(opts) == 0 { |
| 729 | return nil, errors.New("there are currently no APIs to choose from. Create one by running: `auth0 apis create`") |
| 730 | } |
| 731 | |
| 732 | return opts, nil |
| 733 | } |
no test coverage detected