breaking compatibility changes. take context for first arguments.
This commit is contained in:
parent
32e66a3d72
commit
5e84b57bf3
18 changed files with 176 additions and 139 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/mattn/go-mastodon"
|
||||
|
@ -9,7 +10,7 @@ import (
|
|||
|
||||
func cmdAccount(c *cli.Context) error {
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
account, err := client.GetAccountCurrentUser()
|
||||
account, err := client.GetAccountCurrentUser(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/mattn/go-mastodon"
|
||||
|
@ -9,11 +10,11 @@ import (
|
|||
|
||||
func cmdFollowers(c *cli.Context) error {
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
account, err := client.GetAccountCurrentUser()
|
||||
account, err := client.GetAccountCurrentUser(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
followers, err := client.GetAccountFollowers(account.ID)
|
||||
followers, err := client.GetAccountFollowers(context.Background(), account.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/mattn/go-mastodon"
|
||||
|
@ -9,7 +10,7 @@ import (
|
|||
|
||||
func cmdInstance(c *cli.Context) error {
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
instance, err := client.GetInstance()
|
||||
instance, err := client.GetInstance(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/fatih/color"
|
||||
|
@ -10,7 +11,7 @@ import (
|
|||
|
||||
func cmdNotification(c *cli.Context) error {
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
notifications, err := client.GetNotifications()
|
||||
notifications, err := client.GetNotifications(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
|
@ -14,7 +15,7 @@ func cmdSearch(c *cli.Context) error {
|
|||
}
|
||||
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
results, err := client.Search(argstr(c), false)
|
||||
results, err := client.Search(context.Background(), argstr(c), false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/fatih/color"
|
||||
|
@ -10,7 +11,7 @@ import (
|
|||
|
||||
func cmdTimeline(c *cli.Context) error {
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
timeline, err := client.GetTimelineHome()
|
||||
timeline, err := client.GetTimelineHome(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
|
@ -24,7 +25,7 @@ func cmdToot(c *cli.Context) error {
|
|||
toot = argstr(c)
|
||||
}
|
||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||
_, err := client.PostStatus(&mastodon.Toot{
|
||||
_, err := client.PostStatus(context.Background(), &mastodon.Toot{
|
||||
Status: toot,
|
||||
})
|
||||
return err
|
||||
|
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
@ -128,7 +129,7 @@ func authenticate(client *mastodon.Client, config *mastodon.Config, file string)
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = client.Authenticate(email, password)
|
||||
err = client.Authenticate(context.Background(), email, password)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue