this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

api: remove deprecated 'CreateAccount'

Was only being used in 'cmd/stress'

+17 -46
-33
api/atproto.go
··· 1 1 package api 2 2 3 3 import ( 4 - "context" 5 - 6 4 "github.com/bluesky-social/indigo/xrpc" 7 5 ) 8 6 9 7 type ATProto struct { 10 8 C *xrpc.Client 11 9 } 12 - 13 - const ( 14 - encJson = "application/json" 15 - ) 16 - 17 - type CreateAccountResp struct { 18 - AccessJwt string `json:"accessJwt"` 19 - RefreshJwt string `json:"refreshJwt"` 20 - Handle string `json:"handle"` 21 - Did string `json:"did"` 22 - DeclarationCid string `json:"declarationCid"` 23 - } 24 - 25 - func (atp *ATProto) CreateAccount(ctx context.Context, email, handle, password string, invite *string) (*CreateAccountResp, error) { 26 - body := map[string]string{ 27 - "email": email, 28 - "handle": handle, 29 - "password": password, 30 - } 31 - 32 - if invite != nil { 33 - body["inviteCode"] = *invite 34 - } 35 - 36 - var resp CreateAccountResp 37 - if err := atp.C.Do(ctx, xrpc.Procedure, encJson, "com.atproto.account.create", nil, body, &resp); err != nil { 38 - return nil, err 39 - } 40 - 41 - return &resp, nil 42 - }
+17 -13
cmd/stress/main.go
··· 79 79 }, 80 80 }, 81 81 Action: func(cctx *cli.Context) error { 82 - atp, err := cliutil.GetATPClient(cctx, false) 82 + xrpcc, err := cliutil.GetXrpcClient(cctx, false) 83 83 if err != nil { 84 84 return err 85 85 } 86 86 87 + count := cctx.Int("count") 88 + concurrent := cctx.Int("concurrent") 89 + quiet := cctx.Bool("quiet") 87 90 ctx := context.TODO() 88 91 89 92 buf := make([]byte, 6) ··· 91 94 id := hex.EncodeToString(buf) 92 95 93 96 var invite *string 94 - acc, err := atp.CreateAccount(ctx, fmt.Sprintf("user-%s@test.com", id), "user-"+id+".test", "password", invite) 97 + resp, err := comatproto.AccountCreate(ctx, xrpcc, &comatproto.AccountCreate_Input{ 98 + Email: fmt.Sprintf("user-%s@test.com", id), 99 + Handle: "user-" + id + ".test", 100 + Password: "password", 101 + InviteCode: invite, 102 + }) 95 103 if err != nil { 96 104 return err 97 105 } 98 106 99 - quiet := cctx.Bool("quiet") 100 - 101 - atp.C.Auth = &xrpc.AuthInfo{ 102 - Did: acc.Did, 103 - AccessJwt: acc.AccessJwt, 104 - Handle: acc.Handle, 107 + xrpcc.Auth = &xrpc.AuthInfo{ 108 + AccessJwt: resp.AccessJwt, 109 + RefreshJwt: resp.RefreshJwt, 110 + Handle: resp.Handle, 111 + Did: resp.Did, 105 112 } 106 - 107 - count := cctx.Int("count") 108 - concurrent := cctx.Int("concurrent") 109 113 110 114 var wg sync.WaitGroup 111 115 for con := 0; con < concurrent; con++ { ··· 116 120 buf := make([]byte, 100) 117 121 rand.Read(buf) 118 122 119 - res, err := comatproto.RepoCreateRecord(context.TODO(), atp.C, &comatproto.RepoCreateRecord_Input{ 123 + res, err := comatproto.RepoCreateRecord(context.TODO(), xrpcc, &comatproto.RepoCreateRecord_Input{ 120 124 Collection: "app.bsky.feed.post", 121 - Did: acc.Did, 125 + Did: xrpcc.Auth.Did, 122 126 Record: lexutil.LexiconTypeDecoder{&appbsky.FeedPost{ 123 127 Text: hex.EncodeToString(buf), 124 128 CreatedAt: time.Now().Format(time.RFC3339),