MCPcopy Create free account
hub / github.com/davecheney/pub / Run

Method Run

fetchactor.go:17–42  ·  view source on GitHub ↗
(ctx *Context)

Source from the content-addressed store, hash-verified

15
16type FetchActorCmd struct {
17 Account string `required:"" help:"The account to sign the request with."`
18 Actor string `required:"" help:"The actor to fetch."`
19}
20
21func (f *FetchActorCmd) Run(ctx *Context) error {
22 db, err := gorm.Open(ctx.Dialector, &ctx.Config)
23 if err != nil {
24 return err
25 }
26
27 signAs, err := models.NewActors(db).FindByURI(f.Account)
28 if err != nil {
29 return fmt.Errorf("failed to find actor: %w", err)
30 }
31 account, err := models.NewAccounts(db).AccountForActor(signAs)
32 if err != nil {
33 return fmt.Errorf("failed to find account: %w", err)
34 }
35
36 orig, err := models.NewActors(db).FindByURI(f.Actor)
37 if err != nil {
38 return fmt.Errorf("failed to find actor: %w", err)
39 }
40
41 updated, err := activitypub.NewRemoteActorFetcher(account).Fetch(context.Background(), f.Actor)
42 if err != nil {
43 return fmt.Errorf("failed to fetch actor: %w", err)
44 }
45

Callers

nothing calls this directly

Calls 7

FetchMethod · 0.95
NewActorsFunction · 0.92
NewAccountsFunction · 0.92
NewClientFunction · 0.92
AccountForActorMethod · 0.80
FindByURIMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected