checkpoint: add a model for list of lists
This commit is contained in:
parent
5e52119158
commit
605df92b37
5 changed files with 24 additions and 5 deletions
|
@ -68,5 +68,8 @@ func (c *addCommand) addAccountsToList(gtsClient *client.Client) error {
|
|||
return fmt.Errorf("unable to add the accounts to the list; %w", err)
|
||||
}
|
||||
|
||||
fmt.Println("Successfully added the account(s) to the list.")
|
||||
// TODO: ...then print the list with the accounts in them.
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -68,5 +68,8 @@ func (c *removeCommand) removeAccountsFromList(gtsClient *client.Client) error {
|
|||
return fmt.Errorf("unable to remove the accounts from the list; %w", err)
|
||||
}
|
||||
|
||||
fmt.Println("Successfully removed the account(s) to the list.")
|
||||
// TODO: ...then print the list with the accounts in them.
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -176,10 +176,7 @@ func (c *showCommand) showLists(gts *client.Client) error {
|
|||
}
|
||||
|
||||
fmt.Println(utilities.HeaderFormat("LISTS"))
|
||||
|
||||
for i := range lists {
|
||||
fmt.Printf("\n%s\n", lists[i])
|
||||
}
|
||||
fmt.Println(lists)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ const (
|
|||
listPath string = "/api/v1/lists"
|
||||
)
|
||||
|
||||
func (g *Client) GetAllLists() ([]model.List, error) {
|
||||
func (g *Client) GetAllLists() (model.Lists, error) {
|
||||
url := g.Authentication.Instance + listPath
|
||||
|
||||
var lists []model.List
|
||||
|
|
|
@ -87,3 +87,19 @@ func (l List) String() string {
|
|||
utilities.FieldFormat("Replies Policy:"), l.RepliesPolicy,
|
||||
)
|
||||
}
|
||||
|
||||
type Lists []List
|
||||
|
||||
func (l Lists) String() string {
|
||||
output := ""
|
||||
|
||||
for i := range l {
|
||||
output += fmt.Sprintf(
|
||||
"\n%s (%s)",
|
||||
l[i].Title,
|
||||
l[i].ID,
|
||||
)
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue