ref: b19a327ceef4e79820f68d25e23aca97edf8e1c1
parent: b7cd6da8cf141c4f5e21ffef8dcbe5f118244b87
author: penny <penny@limitedideas.org>
date: Sat Sep 27 14:47:31 EDT 2025
convert more API calls to use the dispatcher
--- a/main.go
+++ b/main.go
@@ -373,7 +373,10 @@
return
}
}
- relationship, err := hc.client.AccountUnfollow(context.Background(), account.ID)
+ var relationship *mastodon.Relationship
+ unfollowfunc := func(job *GenericJob){ relationship, err = hc.client.AccountUnfollow(context.Background(), account.ID) }+ unfollowjob := hc.dispatchFunc(unfollowfunc)
+ unfollowjob.Wait()
if err != nil { fmt.Printf("Error unfollowing account\n", err)return
@@ -395,7 +398,10 @@
return
}
}
- relationship, err := hc.client.AccountFollow(context.Background(), account.ID)
+ var relationship *mastodon.Relationship
+ followfunc := func(job *GenericJob){ relationship, err = hc.client.AccountFollow(context.Background(), account.ID) }+ followjob := hc.dispatchFunc(followfunc)
+ followjob.Wait()
if err != nil { fmt.Printf("Error requesting follow: %s\n", err)return
--- a/mastodon.go
+++ b/mastodon.go
@@ -508,7 +508,11 @@
}
func (hc *Hellclient) resolveAccount(lookup string) *mastodon.Account {- accounts, err := hc.client.AccountsSearchResolve(context.Background(), lookup, 1, true)
+ var accounts []*mastodon.Account
+ var err error
+ searchfunc := func(job *GenericJob){accounts, err = hc.client.AccountsSearchResolve(context.Background(), lookup, 1, true)}+ searchjob := hc.dispatchFunc(searchfunc)
+ searchjob.Wait()
if err != nil { fmt.Printf("Error resolving account %s: %v\n", lookup, err)return nil
--- a/pages.go
+++ b/pages.go
@@ -17,6 +17,11 @@
Get(int) ([]*mastodon.Status, error)
}
+type ProfileLoader struct {+ client *mastodon.Client
+
+}
+
type BasicStatusGetter struct {getter func(ctx context.Context, pg *mastodon.Pagination) ([]*mastodon.Status, error)
page *mastodon.Pagination
--
⑨