From 2986beae755f4f2c5b075c1d3ea9dc2cd8874be9 Mon Sep 17 00:00:00 2001 From: gutmet Date: Sat, 19 Nov 2022 20:27:49 +0100 Subject: [PATCH] remove example --- example_test.go | 67 ------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 example_test.go diff --git a/example_test.go b/example_test.go deleted file mode 100644 index a25a3ca..0000000 --- a/example_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package mastodon_test - -import ( - "context" - "fmt" - "log" - "time" - - "github.com/mattn/go-mastodon" -) - -func ExampleRegisterApp() { - app, err := mastodon.RegisterApp(context.Background(), &mastodon.AppConfig{ - Server: "https://mstdn.jp", - ClientName: "client-name", - Scopes: "read write follow", - Website: "https://github.com/mattn/go-mastodon", - }) - if err != nil { - log.Fatal(err) - } - fmt.Printf("client-id : %s\n", app.ClientID) - fmt.Printf("client-secret: %s\n", app.ClientSecret) -} - -func ExampleClient() { - c := mastodon.NewClient(&mastodon.Config{ - Server: "https://mstdn.jp", - ClientID: "client-id", - ClientSecret: "client-secret", - }) - err := c.Authenticate(context.Background(), "your-email", "your-password") - if err != nil { - log.Fatal(err) - } - timeline, err := c.GetTimelineHome(context.Background(), nil) - if err != nil { - log.Fatal(err) - } - for i := len(timeline) - 1; i >= 0; i-- { - fmt.Println(timeline[i]) - } -} - -func ExamplePagination() { - c := mastodon.NewClient(&mastodon.Config{ - Server: "https://mstdn.jp", - ClientID: "client-id", - ClientSecret: "client-secret", - }) - var followers []*mastodon.Account - var pg mastodon.Pagination - for { - fs, err := c.GetAccountFollowers(context.Background(), "1", &pg) - if err != nil { - log.Fatal(err) - } - followers = append(followers, fs...) - if pg.MaxID == "" { - break - } - time.Sleep(10 * time.Second) - } - for _, f := range followers { - fmt.Println(f.Acct) - } -}