From b387b2f499cb37253849d683720959e77e62f6eb Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Thu, 16 Nov 2023 14:12:22 -0800 Subject: [PATCH] update to latest lexicons --- api/atproto/admindefs.go | 52 +++- api/atproto/admingetAccountInfo.go | 25 ++ api/atproto/admingetSubjectStatus.go | 79 +++++ api/atproto/adminsearchRepos.go | 11 +- api/atproto/adminupdateSubjectStatus.go | 122 ++++++++ api/atproto/servercreateAccount.go | 23 +- api/atproto/servercreateSession.go | 14 +- api/atproto/servergetSession.go | 10 +- api/atproto/serverrefreshSession.go | 10 +- api/atproto/serverreserveSigningKey.go | 33 ++ api/atproto/tempfetchLabels.go | 31 ++ api/bsky/actordefs.go | 13 +- api/bsky/cbor_gen.go | 362 +++++++++++++++++++++- api/bsky/embedimages.go | 20 +- api/bsky/graphlistblock.go | 19 ++ cmd/gosky/account.go | 4 +- cmd/stress/main.go | 6 +- fakedata/generators.go | 4 +- gen/main.go | 2 + pds/handlers.go | 74 ++++- pds/handlers_test.go | 12 +- pds/stubs.go | 389 +++++++++++++++++++++--- testing/utils.go | 6 +- 23 files changed, 1214 insertions(+), 107 deletions(-) create mode 100644 api/atproto/admingetAccountInfo.go create mode 100644 api/atproto/admingetSubjectStatus.go create mode 100644 api/atproto/adminupdateSubjectStatus.go create mode 100644 api/atproto/serverreserveSigningKey.go create mode 100644 api/atproto/tempfetchLabels.go create mode 100644 api/bsky/graphlistblock.go diff --git a/api/atproto/admindefs.go b/api/atproto/admindefs.go index f001a40cc..eaf3c6f99 100644 --- a/api/atproto/admindefs.go +++ b/api/atproto/admindefs.go @@ -11,6 +11,19 @@ import ( "github.com/bluesky-social/indigo/lex/util" ) +// AdminDefs_AccountView is a "accountView" in the com.atproto.admin.defs schema. +type AdminDefs_AccountView struct { + Did string `json:"did" cborgen:"did"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + EmailConfirmedAt *string `json:"emailConfirmedAt,omitempty" cborgen:"emailConfirmedAt,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` + InvitedBy *ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` + Invites []*ServerDefs_InviteCode `json:"invites,omitempty" cborgen:"invites,omitempty"` + InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` +} + // AdminDefs_ActionReversal is a "actionReversal" in the com.atproto.admin.defs schema. type AdminDefs_ActionReversal struct { CreatedAt string `json:"createdAt" cborgen:"createdAt"` @@ -246,6 +259,16 @@ type AdminDefs_RecordViewNotFound struct { Uri string `json:"uri" cborgen:"uri"` } +// AdminDefs_RepoBlobRef is a "repoBlobRef" in the com.atproto.admin.defs schema. +// +// RECORDTYPE: AdminDefs_RepoBlobRef +type AdminDefs_RepoBlobRef struct { + LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#repoBlobRef" cborgen:"$type,const=com.atproto.admin.defs#repoBlobRef"` + Cid string `json:"cid" cborgen:"cid"` + Did string `json:"did" cborgen:"did"` + RecordUri *string `json:"recordUri,omitempty" cborgen:"recordUri,omitempty"` +} + // AdminDefs_RepoRef is a "repoRef" in the com.atproto.admin.defs schema. // // RECORDTYPE: AdminDefs_RepoRef @@ -272,17 +295,18 @@ type AdminDefs_RepoView struct { // AdminDefs_RepoViewDetail is a "repoViewDetail" in the com.atproto.admin.defs schema. type AdminDefs_RepoViewDetail struct { - Did string `json:"did" cborgen:"did"` - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` - Handle string `json:"handle" cborgen:"handle"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` - InvitedBy *ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` - Invites []*ServerDefs_InviteCode `json:"invites,omitempty" cborgen:"invites,omitempty"` - InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` - Labels []*LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` - Moderation *AdminDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` - RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords" cborgen:"relatedRecords"` + Did string `json:"did" cborgen:"did"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + EmailConfirmedAt *string `json:"emailConfirmedAt,omitempty" cborgen:"emailConfirmedAt,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` + InvitedBy *ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` + Invites []*ServerDefs_InviteCode `json:"invites,omitempty" cborgen:"invites,omitempty"` + InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` + Labels []*LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` + Moderation *AdminDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` + RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords" cborgen:"relatedRecords"` } // AdminDefs_RepoViewNotFound is a "repoViewNotFound" in the com.atproto.admin.defs schema. @@ -402,6 +426,12 @@ func (t *AdminDefs_ReportView_Subject) UnmarshalJSON(b []byte) error { } } +// AdminDefs_StatusAttr is a "statusAttr" in the com.atproto.admin.defs schema. +type AdminDefs_StatusAttr struct { + Applied bool `json:"applied" cborgen:"applied"` + Ref *string `json:"ref,omitempty" cborgen:"ref,omitempty"` +} + // AdminDefs_VideoDetails is a "videoDetails" in the com.atproto.admin.defs schema. // // RECORDTYPE: AdminDefs_VideoDetails diff --git a/api/atproto/admingetAccountInfo.go b/api/atproto/admingetAccountInfo.go new file mode 100644 index 000000000..95dfa0384 --- /dev/null +++ b/api/atproto/admingetAccountInfo.go @@ -0,0 +1,25 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package atproto + +// schema: com.atproto.admin.getAccountInfo + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// AdminGetAccountInfo calls the XRPC method "com.atproto.admin.getAccountInfo". +func AdminGetAccountInfo(ctx context.Context, c *xrpc.Client, did string) (*AdminDefs_AccountView, error) { + var out AdminDefs_AccountView + + params := map[string]interface{}{ + "did": did, + } + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.getAccountInfo", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/atproto/admingetSubjectStatus.go b/api/atproto/admingetSubjectStatus.go new file mode 100644 index 000000000..c27375882 --- /dev/null +++ b/api/atproto/admingetSubjectStatus.go @@ -0,0 +1,79 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package atproto + +// schema: com.atproto.admin.getSubjectStatus + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/xrpc" +) + +// AdminGetSubjectStatus_Output is the output of a com.atproto.admin.getSubjectStatus call. +type AdminGetSubjectStatus_Output struct { + Subject *AdminGetSubjectStatus_Output_Subject `json:"subject" cborgen:"subject"` + Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty" cborgen:"takedown,omitempty"` +} + +type AdminGetSubjectStatus_Output_Subject struct { + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef + AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef +} + +func (t *AdminGetSubjectStatus_Output_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + if t.AdminDefs_RepoBlobRef != nil { + t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef" + return json.Marshal(t.AdminDefs_RepoBlobRef) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *AdminGetSubjectStatus_Output_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return json.Unmarshal(b, t.AdminDefs_RepoBlobRef) + + default: + return nil + } +} + +// AdminGetSubjectStatus calls the XRPC method "com.atproto.admin.getSubjectStatus". +func AdminGetSubjectStatus(ctx context.Context, c *xrpc.Client, blob string, did string, uri string) (*AdminGetSubjectStatus_Output, error) { + var out AdminGetSubjectStatus_Output + + params := map[string]interface{}{ + "blob": blob, + "did": did, + "uri": uri, + } + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.getSubjectStatus", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/atproto/adminsearchRepos.go b/api/atproto/adminsearchRepos.go index 5f3e38a88..023af9df3 100644 --- a/api/atproto/adminsearchRepos.go +++ b/api/atproto/adminsearchRepos.go @@ -19,15 +19,14 @@ type AdminSearchRepos_Output struct { // AdminSearchRepos calls the XRPC method "com.atproto.admin.searchRepos". // // term: DEPRECATED: use 'q' instead -func AdminSearchRepos(ctx context.Context, c *xrpc.Client, cursor string, invitedBy string, limit int64, q string, term string) (*AdminSearchRepos_Output, error) { +func AdminSearchRepos(ctx context.Context, c *xrpc.Client, cursor string, limit int64, q string, term string) (*AdminSearchRepos_Output, error) { var out AdminSearchRepos_Output params := map[string]interface{}{ - "cursor": cursor, - "invitedBy": invitedBy, - "limit": limit, - "q": q, - "term": term, + "cursor": cursor, + "limit": limit, + "q": q, + "term": term, } if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.searchRepos", params, nil, &out); err != nil { return nil, err diff --git a/api/atproto/adminupdateSubjectStatus.go b/api/atproto/adminupdateSubjectStatus.go new file mode 100644 index 000000000..90de068e1 --- /dev/null +++ b/api/atproto/adminupdateSubjectStatus.go @@ -0,0 +1,122 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package atproto + +// schema: com.atproto.admin.updateSubjectStatus + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/xrpc" +) + +// AdminUpdateSubjectStatus_Input is the input argument to a com.atproto.admin.updateSubjectStatus call. +type AdminUpdateSubjectStatus_Input struct { + Subject *AdminUpdateSubjectStatus_Input_Subject `json:"subject" cborgen:"subject"` + Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty" cborgen:"takedown,omitempty"` +} + +type AdminUpdateSubjectStatus_Input_Subject struct { + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef + AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef +} + +func (t *AdminUpdateSubjectStatus_Input_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + if t.AdminDefs_RepoBlobRef != nil { + t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef" + return json.Marshal(t.AdminDefs_RepoBlobRef) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *AdminUpdateSubjectStatus_Input_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return json.Unmarshal(b, t.AdminDefs_RepoBlobRef) + + default: + return nil + } +} + +// AdminUpdateSubjectStatus_Output is the output of a com.atproto.admin.updateSubjectStatus call. +type AdminUpdateSubjectStatus_Output struct { + Subject *AdminUpdateSubjectStatus_Output_Subject `json:"subject" cborgen:"subject"` + Takedown *AdminDefs_StatusAttr `json:"takedown,omitempty" cborgen:"takedown,omitempty"` +} + +type AdminUpdateSubjectStatus_Output_Subject struct { + AdminDefs_RepoRef *AdminDefs_RepoRef + RepoStrongRef *RepoStrongRef + AdminDefs_RepoBlobRef *AdminDefs_RepoBlobRef +} + +func (t *AdminUpdateSubjectStatus_Output_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + if t.AdminDefs_RepoBlobRef != nil { + t.AdminDefs_RepoBlobRef.LexiconTypeID = "com.atproto.admin.defs#repoBlobRef" + return json.Marshal(t.AdminDefs_RepoBlobRef) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *AdminUpdateSubjectStatus_Output_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + case "com.atproto.admin.defs#repoBlobRef": + t.AdminDefs_RepoBlobRef = new(AdminDefs_RepoBlobRef) + return json.Unmarshal(b, t.AdminDefs_RepoBlobRef) + + default: + return nil + } +} + +// AdminUpdateSubjectStatus calls the XRPC method "com.atproto.admin.updateSubjectStatus". +func AdminUpdateSubjectStatus(ctx context.Context, c *xrpc.Client, input *AdminUpdateSubjectStatus_Input) (*AdminUpdateSubjectStatus_Output, error) { + var out AdminUpdateSubjectStatus_Output + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.admin.updateSubjectStatus", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/atproto/servercreateAccount.go b/api/atproto/servercreateAccount.go index c5b54f9f0..5f12573c8 100644 --- a/api/atproto/servercreateAccount.go +++ b/api/atproto/servercreateAccount.go @@ -7,25 +7,28 @@ package atproto import ( "context" + "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/xrpc" ) // ServerCreateAccount_Input is the input argument to a com.atproto.server.createAccount call. type ServerCreateAccount_Input struct { - Did *string `json:"did,omitempty" cborgen:"did,omitempty"` - Email string `json:"email" cborgen:"email"` - Handle string `json:"handle" cborgen:"handle"` - InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"` - Password string `json:"password" cborgen:"password"` - RecoveryKey *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"` + Did *string `json:"did,omitempty" cborgen:"did,omitempty"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + InviteCode *string `json:"inviteCode,omitempty" cborgen:"inviteCode,omitempty"` + Password *string `json:"password,omitempty" cborgen:"password,omitempty"` + PlcOp *util.LexiconTypeDecoder `json:"plcOp,omitempty" cborgen:"plcOp,omitempty"` + RecoveryKey *string `json:"recoveryKey,omitempty" cborgen:"recoveryKey,omitempty"` } // ServerCreateAccount_Output is the output of a com.atproto.server.createAccount call. type ServerCreateAccount_Output struct { - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` - Did string `json:"did" cborgen:"did"` - Handle string `json:"handle" cborgen:"handle"` - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` + Did string `json:"did" cborgen:"did"` + DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` } // ServerCreateAccount calls the XRPC method "com.atproto.server.createAccount". diff --git a/api/atproto/servercreateSession.go b/api/atproto/servercreateSession.go index 269108a04..ac197250c 100644 --- a/api/atproto/servercreateSession.go +++ b/api/atproto/servercreateSession.go @@ -7,6 +7,7 @@ package atproto import ( "context" + "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/xrpc" ) @@ -19,12 +20,13 @@ type ServerCreateSession_Input struct { // ServerCreateSession_Output is the output of a com.atproto.server.createSession call. type ServerCreateSession_Output struct { - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` - Did string `json:"did" cborgen:"did"` - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` - EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` - Handle string `json:"handle" cborgen:"handle"` - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` + Did string `json:"did" cborgen:"did"` + DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` } // ServerCreateSession calls the XRPC method "com.atproto.server.createSession". diff --git a/api/atproto/servergetSession.go b/api/atproto/servergetSession.go index c9cd5b28b..0c2704897 100644 --- a/api/atproto/servergetSession.go +++ b/api/atproto/servergetSession.go @@ -7,15 +7,17 @@ package atproto import ( "context" + "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/xrpc" ) // ServerGetSession_Output is the output of a com.atproto.server.getSession call. type ServerGetSession_Output struct { - Did string `json:"did" cborgen:"did"` - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` - EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` - Handle string `json:"handle" cborgen:"handle"` + Did string `json:"did" cborgen:"did"` + DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` + Handle string `json:"handle" cborgen:"handle"` } // ServerGetSession calls the XRPC method "com.atproto.server.getSession". diff --git a/api/atproto/serverrefreshSession.go b/api/atproto/serverrefreshSession.go index 44a7682cd..4c500538d 100644 --- a/api/atproto/serverrefreshSession.go +++ b/api/atproto/serverrefreshSession.go @@ -7,15 +7,17 @@ package atproto import ( "context" + "github.com/bluesky-social/indigo/lex/util" "github.com/bluesky-social/indigo/xrpc" ) // ServerRefreshSession_Output is the output of a com.atproto.server.refreshSession call. type ServerRefreshSession_Output struct { - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` - Did string `json:"did" cborgen:"did"` - Handle string `json:"handle" cborgen:"handle"` - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` + Did string `json:"did" cborgen:"did"` + DidDoc *util.LexiconTypeDecoder `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` } // ServerRefreshSession calls the XRPC method "com.atproto.server.refreshSession". diff --git a/api/atproto/serverreserveSigningKey.go b/api/atproto/serverreserveSigningKey.go new file mode 100644 index 000000000..8f1836b60 --- /dev/null +++ b/api/atproto/serverreserveSigningKey.go @@ -0,0 +1,33 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package atproto + +// schema: com.atproto.server.reserveSigningKey + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ServerReserveSigningKey_Input is the input argument to a com.atproto.server.reserveSigningKey call. +type ServerReserveSigningKey_Input struct { + // did: The did to reserve a new did:key for + Did *string `json:"did,omitempty" cborgen:"did,omitempty"` +} + +// ServerReserveSigningKey_Output is the output of a com.atproto.server.reserveSigningKey call. +type ServerReserveSigningKey_Output struct { + // signingKey: Public signing key in the form of a did:key. + SigningKey string `json:"signingKey" cborgen:"signingKey"` +} + +// ServerReserveSigningKey calls the XRPC method "com.atproto.server.reserveSigningKey". +func ServerReserveSigningKey(ctx context.Context, c *xrpc.Client, input *ServerReserveSigningKey_Input) (*ServerReserveSigningKey_Output, error) { + var out ServerReserveSigningKey_Output + if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.server.reserveSigningKey", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/atproto/tempfetchLabels.go b/api/atproto/tempfetchLabels.go new file mode 100644 index 000000000..7363b1808 --- /dev/null +++ b/api/atproto/tempfetchLabels.go @@ -0,0 +1,31 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package atproto + +// schema: com.atproto.temp.fetchLabels + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// TempFetchLabels_Output is the output of a com.atproto.temp.fetchLabels call. +type TempFetchLabels_Output struct { + Labels []*LabelDefs_Label `json:"labels" cborgen:"labels"` +} + +// TempFetchLabels calls the XRPC method "com.atproto.temp.fetchLabels". +func TempFetchLabels(ctx context.Context, c *xrpc.Client, limit int64, since int64) (*TempFetchLabels_Output, error) { + var out TempFetchLabels_Output + + params := map[string]interface{}{ + "limit": limit, + "since": since, + } + if err := c.Do(ctx, xrpc.Query, "", "com.atproto.temp.fetchLabels", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/bsky/actordefs.go b/api/bsky/actordefs.go index 357048c0f..caea0b35c 100644 --- a/api/bsky/actordefs.go +++ b/api/bsky/actordefs.go @@ -184,10 +184,11 @@ type ActorDefs_ThreadViewPref struct { // ActorDefs_ViewerState is a "viewerState" in the app.bsky.actor.defs schema. type ActorDefs_ViewerState struct { - BlockedBy *bool `json:"blockedBy,omitempty" cborgen:"blockedBy,omitempty"` - Blocking *string `json:"blocking,omitempty" cborgen:"blocking,omitempty"` - FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` - Following *string `json:"following,omitempty" cborgen:"following,omitempty"` - Muted *bool `json:"muted,omitempty" cborgen:"muted,omitempty"` - MutedByList *GraphDefs_ListViewBasic `json:"mutedByList,omitempty" cborgen:"mutedByList,omitempty"` + BlockedBy *bool `json:"blockedBy,omitempty" cborgen:"blockedBy,omitempty"` + Blocking *string `json:"blocking,omitempty" cborgen:"blocking,omitempty"` + BlockingByList *GraphDefs_ListViewBasic `json:"blockingByList,omitempty" cborgen:"blockingByList,omitempty"` + FollowedBy *string `json:"followedBy,omitempty" cborgen:"followedBy,omitempty"` + Following *string `json:"following,omitempty" cborgen:"following,omitempty"` + Muted *bool `json:"muted,omitempty" cborgen:"muted,omitempty"` + MutedByList *GraphDefs_ListViewBasic `json:"mutedByList,omitempty" cborgen:"mutedByList,omitempty"` } diff --git a/api/bsky/cbor_gen.go b/api/bsky/cbor_gen.go index d59d7f41d..0542bcec2 100644 --- a/api/bsky/cbor_gen.go +++ b/api/bsky/cbor_gen.go @@ -1677,8 +1677,13 @@ func (t *EmbedImages_Image) MarshalCBOR(w io.Writer) error { } cw := cbg.NewCborWriter(w) + fieldCount := 3 - if _, err := cw.Write([]byte{162}); err != nil { + if t.AspectRatio == nil { + fieldCount-- + } + + if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil { return err } @@ -1720,6 +1725,25 @@ func (t *EmbedImages_Image) MarshalCBOR(w io.Writer) error { if err := t.Image.MarshalCBOR(cw); err != nil { return err } + + // t.AspectRatio (bsky.EmbedImages_AspectRatio) (struct) + if t.AspectRatio != nil { + + if len("aspectRatio") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"aspectRatio\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("aspectRatio"))); err != nil { + return err + } + if _, err := cw.WriteString(string("aspectRatio")); err != nil { + return err + } + + if err := t.AspectRatio.MarshalCBOR(cw); err != nil { + return err + } + } return nil } @@ -1792,6 +1816,26 @@ func (t *EmbedImages_Image) UnmarshalCBOR(r io.Reader) (err error) { } } + // t.AspectRatio (bsky.EmbedImages_AspectRatio) (struct) + case "aspectRatio": + + { + + b, err := cr.ReadByte() + if err != nil { + return err + } + if b != cbg.CborNull[0] { + if err := cr.UnreadByte(); err != nil { + return err + } + t.AspectRatio = new(EmbedImages_AspectRatio) + if err := t.AspectRatio.UnmarshalCBOR(cr); err != nil { + return xerrors.Errorf("unmarshaling t.AspectRatio pointer: %w", err) + } + } + + } default: // Field doesn't exist on this type, so ignore it @@ -4752,3 +4796,319 @@ func (t *FeedGenerator) UnmarshalCBOR(r io.Reader) (err error) { return nil } +func (t *GraphListblock) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write([]byte{163}); err != nil { + return err + } + + // t.LexiconTypeID (string) (string) + if len("$type") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"$type\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("$type"))); err != nil { + return err + } + if _, err := cw.WriteString(string("$type")); err != nil { + return err + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("app.bsky.graph.listblock"))); err != nil { + return err + } + if _, err := cw.WriteString(string("app.bsky.graph.listblock")); err != nil { + return err + } + + // t.Subject (string) (string) + if len("subject") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"subject\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("subject"))); err != nil { + return err + } + if _, err := cw.WriteString(string("subject")); err != nil { + return err + } + + if len(t.Subject) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.Subject was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Subject))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Subject)); err != nil { + return err + } + + // t.CreatedAt (string) (string) + if len("createdAt") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"createdAt\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("createdAt"))); err != nil { + return err + } + if _, err := cw.WriteString(string("createdAt")); err != nil { + return err + } + + if len(t.CreatedAt) > cbg.MaxLength { + return xerrors.Errorf("Value in field t.CreatedAt was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.CreatedAt))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.CreatedAt)); err != nil { + return err + } + return nil +} + +func (t *GraphListblock) UnmarshalCBOR(r io.Reader) (err error) { + *t = GraphListblock{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") + } + + if extra > cbg.MaxLength { + return fmt.Errorf("GraphListblock: map struct too large (%d)", extra) + } + + var name string + n := extra + + for i := uint64(0); i < n; i++ { + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + name = string(sval) + } + + switch name { + // t.LexiconTypeID (string) (string) + case "$type": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.LexiconTypeID = string(sval) + } + // t.Subject (string) (string) + case "subject": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.Subject = string(sval) + } + // t.CreatedAt (string) (string) + case "createdAt": + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + t.CreatedAt = string(sval) + } + + default: + // Field doesn't exist on this type, so ignore it + cbg.ScanForLinks(r, func(cid.Cid) {}) + } + } + + return nil +} +func (t *EmbedImages_AspectRatio) MarshalCBOR(w io.Writer) error { + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + + cw := cbg.NewCborWriter(w) + + if _, err := cw.Write([]byte{162}); err != nil { + return err + } + + // t.Width (int64) (int64) + if len("width") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"width\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("width"))); err != nil { + return err + } + if _, err := cw.WriteString(string("width")); err != nil { + return err + } + + if t.Width >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Width)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Width-1)); err != nil { + return err + } + } + + // t.Height (int64) (int64) + if len("height") > cbg.MaxLength { + return xerrors.Errorf("Value in field \"height\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("height"))); err != nil { + return err + } + if _, err := cw.WriteString(string("height")); err != nil { + return err + } + + if t.Height >= 0 { + if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Height)); err != nil { + return err + } + } else { + if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Height-1)); err != nil { + return err + } + } + return nil +} + +func (t *EmbedImages_AspectRatio) UnmarshalCBOR(r io.Reader) (err error) { + *t = EmbedImages_AspectRatio{} + + cr := cbg.NewCborReader(r) + + maj, extra, err := cr.ReadHeader() + if err != nil { + return err + } + defer func() { + if err == io.EOF { + err = io.ErrUnexpectedEOF + } + }() + + if maj != cbg.MajMap { + return fmt.Errorf("cbor input should be of type map") + } + + if extra > cbg.MaxLength { + return fmt.Errorf("EmbedImages_AspectRatio: map struct too large (%d)", extra) + } + + var name string + n := extra + + for i := uint64(0); i < n; i++ { + + { + sval, err := cbg.ReadString(cr) + if err != nil { + return err + } + + name = string(sval) + } + + switch name { + // t.Width (int64) (int64) + case "width": + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.Width = int64(extraI) + } + // t.Height (int64) (int64) + case "height": + { + maj, extra, err := cr.ReadHeader() + var extraI int64 + if err != nil { + return err + } + switch maj { + case cbg.MajUnsignedInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 positive overflow") + } + case cbg.MajNegativeInt: + extraI = int64(extra) + if extraI < 0 { + return fmt.Errorf("int64 negative overflow") + } + extraI = -1 - extraI + default: + return fmt.Errorf("wrong type for int64 field: %d", maj) + } + + t.Height = int64(extraI) + } + + default: + // Field doesn't exist on this type, so ignore it + cbg.ScanForLinks(r, func(cid.Cid) {}) + } + } + + return nil +} diff --git a/api/bsky/embedimages.go b/api/bsky/embedimages.go index 927f3ff7c..06a6ca6fc 100644 --- a/api/bsky/embedimages.go +++ b/api/bsky/embedimages.go @@ -17,10 +17,19 @@ type EmbedImages struct { Images []*EmbedImages_Image `json:"images" cborgen:"images"` } +// EmbedImages_AspectRatio is a "aspectRatio" in the app.bsky.embed.images schema. +// +// width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. +type EmbedImages_AspectRatio struct { + Height int64 `json:"height" cborgen:"height"` + Width int64 `json:"width" cborgen:"width"` +} + // EmbedImages_Image is a "image" in the app.bsky.embed.images schema. type EmbedImages_Image struct { - Alt string `json:"alt" cborgen:"alt"` - Image *util.LexBlob `json:"image" cborgen:"image"` + Alt string `json:"alt" cborgen:"alt"` + AspectRatio *EmbedImages_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` + Image *util.LexBlob `json:"image" cborgen:"image"` } // EmbedImages_View is a "view" in the app.bsky.embed.images schema. @@ -33,7 +42,8 @@ type EmbedImages_View struct { // EmbedImages_ViewImage is a "viewImage" in the app.bsky.embed.images schema. type EmbedImages_ViewImage struct { - Alt string `json:"alt" cborgen:"alt"` - Fullsize string `json:"fullsize" cborgen:"fullsize"` - Thumb string `json:"thumb" cborgen:"thumb"` + Alt string `json:"alt" cborgen:"alt"` + AspectRatio *EmbedImages_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` + Fullsize string `json:"fullsize" cborgen:"fullsize"` + Thumb string `json:"thumb" cborgen:"thumb"` } diff --git a/api/bsky/graphlistblock.go b/api/bsky/graphlistblock.go new file mode 100644 index 000000000..ee743007c --- /dev/null +++ b/api/bsky/graphlistblock.go @@ -0,0 +1,19 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package bsky + +// schema: app.bsky.graph.listblock + +import ( + "github.com/bluesky-social/indigo/lex/util" +) + +func init() { + util.RegisterType("app.bsky.graph.listblock", &GraphListblock{}) +} // +// RECORDTYPE: GraphListblock +type GraphListblock struct { + LexiconTypeID string `json:"$type,const=app.bsky.graph.listblock" cborgen:"$type,const=app.bsky.graph.listblock"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Subject string `json:"subject" cborgen:"subject"` +} diff --git a/cmd/gosky/account.go b/cmd/gosky/account.go index 1b88c7dba..70b8d2ff0 100644 --- a/cmd/gosky/account.go +++ b/cmd/gosky/account.go @@ -79,10 +79,10 @@ var newAccountCmd = &cli.Command{ } acc, err := comatproto.ServerCreateAccount(context.TODO(), xrpcc, &comatproto.ServerCreateAccount_Input{ - Email: email, + Email: &email, Handle: handle, InviteCode: invite, - Password: password, + Password: &password, }) if err != nil { return err diff --git a/cmd/stress/main.go b/cmd/stress/main.go index eebfdb478..9e492ffac 100644 --- a/cmd/stress/main.go +++ b/cmd/stress/main.go @@ -104,10 +104,12 @@ var postingCmd = &cli.Command{ domain := cfg.AvailableUserDomains[0] fmt.Println("domain: ", domain) + email := fmt.Sprintf("user-%s@test.com", id) + pass := "password" resp, err := comatproto.ServerCreateAccount(ctx, xrpcc, &comatproto.ServerCreateAccount_Input{ - Email: fmt.Sprintf("user-%s@test.com", id), + Email: &email, Handle: "user-" + id + domain, - Password: "password", + Password: &pass, InviteCode: invite, }) if err != nil { diff --git a/fakedata/generators.go b/fakedata/generators.go index d1b2a1f64..3fdcaf47d 100644 --- a/fakedata/generators.go +++ b/fakedata/generators.go @@ -51,10 +51,10 @@ func GenAccount(xrpcc *xrpc.Client, index int, accountType, domainSuffix string, password := gofakeit.Password(true, true, true, true, true, 24) ctx := context.TODO() resp, err := comatproto.ServerCreateAccount(ctx, xrpcc, &comatproto.ServerCreateAccount_Input{ - Email: email, + Email: &email, Handle: handle, InviteCode: inviteCode, - Password: password, + Password: &password, }) if err != nil { return nil, err diff --git a/gen/main.go b/gen/main.go index 0fcfc991f..aefbdfb26 100644 --- a/gen/main.go +++ b/gen/main.go @@ -45,6 +45,8 @@ func main() { bsky.GraphList{}, bsky.GraphListitem{}, bsky.FeedGenerator{}, + bsky.GraphListblock{}, + bsky.EmbedImages_AspectRatio{}, /*bsky.EmbedImages_View{}, bsky.EmbedRecord_View{}, bsky.EmbedRecordWithMedia_View{}, bsky.EmbedExternal_View{}, bsky.EmbedImages_ViewImage{}, diff --git a/pds/handlers.go b/pds/handlers.go index 46a584543..6d7f3592b 100644 --- a/pds/handlers.go +++ b/pds/handlers.go @@ -276,8 +276,15 @@ func (s *Server) handleAppBskyNotificationUpdateSeen(ctx context.Context, input } func (s *Server) handleComAtprotoServerCreateAccount(ctx context.Context, body *comatprototypes.ServerCreateAccount_Input) (*comatprototypes.ServerCreateAccount_Output, error) { + if body.Email == nil { + return nil, fmt.Errorf("email is required") + } + + if body.Password == nil { + return nil, fmt.Errorf("password is required") + } - if err := validateEmail(body.Email); err != nil { + if err := validateEmail(*body.Email); err != nil { return nil, err } @@ -302,9 +309,9 @@ func (s *Server) handleComAtprotoServerCreateAccount(ctx context.Context, body * u := User{ Handle: body.Handle, - Password: body.Password, + Password: *body.Password, RecoveryKey: recoveryKey, - Email: body.Email, + Email: *body.Email, } if err := s.db.Create(&u).Error; err != nil { return nil, err @@ -639,7 +646,7 @@ func (s *Server) handleComAtprotoAdminResolveModerationReports(ctx context.Conte func (s *Server) handleComAtprotoAdminReverseModerationAction(ctx context.Context, body *comatprototypes.AdminReverseModerationAction_Input) (*comatprototypes.AdminDefs_ActionView, error) { panic("nyi") } -func (s *Server) handleComAtprotoAdminSearchRepos(ctx context.Context, cursor string, invitedBy string, limit int, term string) (*comatprototypes.AdminSearchRepos_Output, error) { +func (s *Server) handleComAtprotoAdminSearchRepos(ctx context.Context, cursor string, limit int, q string, term string) (*comatprototypes.AdminSearchRepos_Output, error) { panic("nyi") } func (s *Server) handleComAtprotoAdminTakeModerationAction(ctx context.Context, body *comatprototypes.AdminTakeModerationAction_Input) (*comatprototypes.AdminDefs_ActionView, error) { @@ -666,11 +673,11 @@ func (s *Server) handleComAtprotoSyncListBlobs(ctx context.Context, cursor strin panic("nyi") } -func (s *Server) handleAppBskyActorSearchActors(ctx context.Context, cursor string, limit int, term string) (*appbskytypes.ActorSearchActors_Output, error) { +func (s *Server) handleAppBskyActorSearchActors(ctx context.Context, cursor string, limit int, q string, term string) (*appbskytypes.ActorSearchActors_Output, error) { panic("nyi") } -func (s *Server) handleAppBskyActorSearchActorsTypeahead(ctx context.Context, limit int, term string) (*appbskytypes.ActorSearchActorsTypeahead_Output, error) { +func (s *Server) handleAppBskyActorSearchActorsTypeahead(ctx context.Context, limit int, q string, term string) (*appbskytypes.ActorSearchActorsTypeahead_Output, error) { panic("nyi") } @@ -831,3 +838,58 @@ func (s *Server) handleComAtprotoSyncGetLatestCommit(ctx context.Context, did st func (s *Server) handleComAtprotoTempUpgradeRepoVersion(ctx context.Context, body *comatprototypes.TempUpgradeRepoVersion_Input) error { panic("nyi") } + +func (s *Server) handleAppBskyFeedGetListFeed(ctx context.Context, cursor string, limit int, list string) (*appbskytypes.FeedGetListFeed_Output, error) { + panic("nyi") +} + +func (s *Server) handleAppBskyFeedGetSuggestedFeeds(ctx context.Context, cursor string, limit int) (*appbskytypes.FeedGetSuggestedFeeds_Output, error) { + panic("nyi") +} + +func (s *Server) handleAppBskyFeedSearchPosts(ctx context.Context, cursor string, limit int, q string) (*appbskytypes.FeedSearchPosts_Output, error) { + panic("nyi") +} + +func (s *Server) handleAppBskyGraphGetListBlocks(ctx context.Context, cursor string, limit int) (*appbskytypes.GraphGetListBlocks_Output, error) { + panic("nyi") +} + +func (s *Server) handleAppBskyGraphGetSuggestedFollowsByActor(ctx context.Context, actor string) (*appbskytypes.GraphGetSuggestedFollowsByActor_Output, error) { + panic("nyi") +} + +func (s *Server) handleAppBskyUnspeccedSearchActorsSkeleton(ctx context.Context, cursor string, limit int, q string, typeahead *bool) (*appbskytypes.UnspeccedSearchActorsSkeleton_Output, error) { + panic("nyi") +} +func (s *Server) handleAppBskyUnspeccedSearchPostsSkeleton(ctx context.Context, cursor string, limit int, q string) (*appbskytypes.UnspeccedSearchPostsSkeleton_Output, error) { + panic("nyi") +} +func (s *Server) handleComAtprotoAdminGetAccountInfo(ctx context.Context, did string) (*comatprototypes.AdminDefs_AccountView, error) { + panic("nyi") +} +func (s *Server) handleComAtprotoAdminGetSubjectStatus(ctx context.Context, blob string, did string, uri string) (*comatprototypes.AdminGetSubjectStatus_Output, error) { + panic("nyi") +} + +func (s *Server) handleComAtprotoAdminUpdateSubjectStatus(ctx context.Context, body *comatprototypes.AdminUpdateSubjectStatus_Input) (*comatprototypes.AdminUpdateSubjectStatus_Output, error) { + panic("nyi") +} +func (s *Server) handleComAtprotoServerConfirmEmail(ctx context.Context, body *comatprototypes.ServerConfirmEmail_Input) error { + panic("nyi") +} +func (s *Server) handleComAtprotoServerRequestEmailConfirmation(ctx context.Context) error { + panic("nyi") +} +func (s *Server) handleComAtprotoServerRequestEmailUpdate(ctx context.Context) (*comatprototypes.ServerRequestEmailUpdate_Output, error) { + panic("nyi") +} +func (s *Server) handleComAtprotoServerReserveSigningKey(ctx context.Context, body *comatprototypes.ServerReserveSigningKey_Input) (*comatprototypes.ServerReserveSigningKey_Output, error) { + panic("nyi") +} +func (s *Server) handleComAtprotoServerUpdateEmail(ctx context.Context, body *comatprototypes.ServerUpdateEmail_Input) error { + panic("nyi") +} +func (s *Server) handleComAtprotoTempFetchLabels(ctx context.Context, limit int, since *int) (*comatprototypes.TempFetchLabels_Output, error) { + panic("nyi") +} diff --git a/pds/handlers_test.go b/pds/handlers_test.go index d4a9ba209..d83c23fb4 100644 --- a/pds/handlers_test.go +++ b/pds/handlers_test.go @@ -75,9 +75,11 @@ func TestHandleComAtprotoAccountCreate(t *testing.T) { s, cleanup := newTestServer(t) defer cleanup() + e := "test@foo.com" + p := "password" o, err := s.handleComAtprotoServerCreateAccount(context.Background(), &atproto.ServerCreateAccount_Input{ - Email: "test@foo.com", - Password: "password", + Email: &e, + Password: &p, Handle: "testman.test", }) if err != nil { @@ -97,9 +99,11 @@ func TestHandleComAtprotoSessionCreate(t *testing.T) { s, cleanup := newTestServer(t) defer cleanup() + e := "test@foo.com" + p := "password" o, err := s.handleComAtprotoServerCreateAccount(context.Background(), &atproto.ServerCreateAccount_Input{ - Email: "test@foo.com", - Password: "password", + Email: &e, + Password: &p, Handle: "testman.test", }) if err != nil { diff --git a/pds/stubs.go b/pds/stubs.go index a8431f264..a99bc31f1 100644 --- a/pds/stubs.go +++ b/pds/stubs.go @@ -27,17 +27,22 @@ func (s *Server) RegisterHandlersAppBsky(e *echo.Echo) error { e.GET("/xrpc/app.bsky.feed.getFeedGenerators", s.HandleAppBskyFeedGetFeedGenerators) e.GET("/xrpc/app.bsky.feed.getFeedSkeleton", s.HandleAppBskyFeedGetFeedSkeleton) e.GET("/xrpc/app.bsky.feed.getLikes", s.HandleAppBskyFeedGetLikes) + e.GET("/xrpc/app.bsky.feed.getListFeed", s.HandleAppBskyFeedGetListFeed) e.GET("/xrpc/app.bsky.feed.getPostThread", s.HandleAppBskyFeedGetPostThread) e.GET("/xrpc/app.bsky.feed.getPosts", s.HandleAppBskyFeedGetPosts) e.GET("/xrpc/app.bsky.feed.getRepostedBy", s.HandleAppBskyFeedGetRepostedBy) + e.GET("/xrpc/app.bsky.feed.getSuggestedFeeds", s.HandleAppBskyFeedGetSuggestedFeeds) e.GET("/xrpc/app.bsky.feed.getTimeline", s.HandleAppBskyFeedGetTimeline) + e.GET("/xrpc/app.bsky.feed.searchPosts", s.HandleAppBskyFeedSearchPosts) e.GET("/xrpc/app.bsky.graph.getBlocks", s.HandleAppBskyGraphGetBlocks) e.GET("/xrpc/app.bsky.graph.getFollowers", s.HandleAppBskyGraphGetFollowers) e.GET("/xrpc/app.bsky.graph.getFollows", s.HandleAppBskyGraphGetFollows) e.GET("/xrpc/app.bsky.graph.getList", s.HandleAppBskyGraphGetList) + e.GET("/xrpc/app.bsky.graph.getListBlocks", s.HandleAppBskyGraphGetListBlocks) e.GET("/xrpc/app.bsky.graph.getListMutes", s.HandleAppBskyGraphGetListMutes) e.GET("/xrpc/app.bsky.graph.getLists", s.HandleAppBskyGraphGetLists) e.GET("/xrpc/app.bsky.graph.getMutes", s.HandleAppBskyGraphGetMutes) + e.GET("/xrpc/app.bsky.graph.getSuggestedFollowsByActor", s.HandleAppBskyGraphGetSuggestedFollowsByActor) e.POST("/xrpc/app.bsky.graph.muteActor", s.HandleAppBskyGraphMuteActor) e.POST("/xrpc/app.bsky.graph.muteActorList", s.HandleAppBskyGraphMuteActorList) e.POST("/xrpc/app.bsky.graph.unmuteActor", s.HandleAppBskyGraphUnmuteActor) @@ -46,10 +51,11 @@ func (s *Server) RegisterHandlersAppBsky(e *echo.Echo) error { e.GET("/xrpc/app.bsky.notification.listNotifications", s.HandleAppBskyNotificationListNotifications) e.POST("/xrpc/app.bsky.notification.registerPush", s.HandleAppBskyNotificationRegisterPush) e.POST("/xrpc/app.bsky.notification.updateSeen", s.HandleAppBskyNotificationUpdateSeen) - e.POST("/xrpc/app.bsky.unspecced.applyLabels", s.HandleAppBskyUnspeccedApplyLabels) e.GET("/xrpc/app.bsky.unspecced.getPopular", s.HandleAppBskyUnspeccedGetPopular) e.GET("/xrpc/app.bsky.unspecced.getPopularFeedGenerators", s.HandleAppBskyUnspeccedGetPopularFeedGenerators) e.GET("/xrpc/app.bsky.unspecced.getTimelineSkeleton", s.HandleAppBskyUnspeccedGetTimelineSkeleton) + e.GET("/xrpc/app.bsky.unspecced.searchActorsSkeleton", s.HandleAppBskyUnspeccedSearchActorsSkeleton) + e.GET("/xrpc/app.bsky.unspecced.searchPostsSkeleton", s.HandleAppBskyUnspeccedSearchPostsSkeleton) return nil } @@ -150,13 +156,14 @@ func (s *Server) HandleAppBskyActorSearchActors(c echo.Context) error { return err } } else { - limit = 50 + limit = 25 } + q := c.QueryParam("q") term := c.QueryParam("term") var out *appbskytypes.ActorSearchActors_Output var handleErr error - // func (s *Server) handleAppBskyActorSearchActors(ctx context.Context,cursor string,limit int,term string) (*appbskytypes.ActorSearchActors_Output, error) - out, handleErr = s.handleAppBskyActorSearchActors(ctx, cursor, limit, term) + // func (s *Server) handleAppBskyActorSearchActors(ctx context.Context,cursor string,limit int,q string,term string) (*appbskytypes.ActorSearchActors_Output, error) + out, handleErr = s.handleAppBskyActorSearchActors(ctx, cursor, limit, q, term) if handleErr != nil { return handleErr } @@ -175,13 +182,14 @@ func (s *Server) HandleAppBskyActorSearchActorsTypeahead(c echo.Context) error { return err } } else { - limit = 50 + limit = 10 } + q := c.QueryParam("q") term := c.QueryParam("term") var out *appbskytypes.ActorSearchActorsTypeahead_Output var handleErr error - // func (s *Server) handleAppBskyActorSearchActorsTypeahead(ctx context.Context,limit int,term string) (*appbskytypes.ActorSearchActorsTypeahead_Output, error) - out, handleErr = s.handleAppBskyActorSearchActorsTypeahead(ctx, limit, term) + // func (s *Server) handleAppBskyActorSearchActorsTypeahead(ctx context.Context,limit int,q string,term string) (*appbskytypes.ActorSearchActorsTypeahead_Output, error) + out, handleErr = s.handleAppBskyActorSearchActorsTypeahead(ctx, limit, q, term) if handleErr != nil { return handleErr } @@ -388,6 +396,32 @@ func (s *Server) HandleAppBskyFeedGetLikes(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleAppBskyFeedGetListFeed(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetListFeed") + defer span.End() + cursor := c.QueryParam("cursor") + + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 50 + } + list := c.QueryParam("list") + var out *appbskytypes.FeedGetListFeed_Output + var handleErr error + // func (s *Server) handleAppBskyFeedGetListFeed(ctx context.Context,cursor string,limit int,list string) (*appbskytypes.FeedGetListFeed_Output, error) + out, handleErr = s.handleAppBskyFeedGetListFeed(ctx, cursor, limit, list) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleAppBskyFeedGetPostThread(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetPostThread") defer span.End() @@ -466,6 +500,31 @@ func (s *Server) HandleAppBskyFeedGetRepostedBy(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleAppBskyFeedGetSuggestedFeeds(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetSuggestedFeeds") + defer span.End() + cursor := c.QueryParam("cursor") + + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 50 + } + var out *appbskytypes.FeedGetSuggestedFeeds_Output + var handleErr error + // func (s *Server) handleAppBskyFeedGetSuggestedFeeds(ctx context.Context,cursor string,limit int) (*appbskytypes.FeedGetSuggestedFeeds_Output, error) + out, handleErr = s.handleAppBskyFeedGetSuggestedFeeds(ctx, cursor, limit) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleAppBskyFeedGetTimeline(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedGetTimeline") defer span.End() @@ -492,6 +551,32 @@ func (s *Server) HandleAppBskyFeedGetTimeline(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleAppBskyFeedSearchPosts(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyFeedSearchPosts") + defer span.End() + cursor := c.QueryParam("cursor") + + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 25 + } + q := c.QueryParam("q") + var out *appbskytypes.FeedSearchPosts_Output + var handleErr error + // func (s *Server) handleAppBskyFeedSearchPosts(ctx context.Context,cursor string,limit int,q string) (*appbskytypes.FeedSearchPosts_Output, error) + out, handleErr = s.handleAppBskyFeedSearchPosts(ctx, cursor, limit, q) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleAppBskyGraphGetBlocks(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetBlocks") defer span.End() @@ -595,6 +680,31 @@ func (s *Server) HandleAppBskyGraphGetList(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleAppBskyGraphGetListBlocks(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetListBlocks") + defer span.End() + cursor := c.QueryParam("cursor") + + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 50 + } + var out *appbskytypes.GraphGetListBlocks_Output + var handleErr error + // func (s *Server) handleAppBskyGraphGetListBlocks(ctx context.Context,cursor string,limit int) (*appbskytypes.GraphGetListBlocks_Output, error) + out, handleErr = s.handleAppBskyGraphGetListBlocks(ctx, cursor, limit) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleAppBskyGraphGetListMutes(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetListMutes") defer span.End() @@ -671,6 +781,20 @@ func (s *Server) HandleAppBskyGraphGetMutes(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleAppBskyGraphGetSuggestedFollowsByActor(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphGetSuggestedFollowsByActor") + defer span.End() + actor := c.QueryParam("actor") + var out *appbskytypes.GraphGetSuggestedFollowsByActor_Output + var handleErr error + // func (s *Server) handleAppBskyGraphGetSuggestedFollowsByActor(ctx context.Context,actor string) (*appbskytypes.GraphGetSuggestedFollowsByActor_Output, error) + out, handleErr = s.handleAppBskyGraphGetSuggestedFollowsByActor(ctx, actor) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleAppBskyGraphMuteActor(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyGraphMuteActor") defer span.End() @@ -813,23 +937,6 @@ func (s *Server) HandleAppBskyNotificationUpdateSeen(c echo.Context) error { return nil } -func (s *Server) HandleAppBskyUnspeccedApplyLabels(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyUnspeccedApplyLabels") - defer span.End() - - var body appbskytypes.UnspeccedApplyLabels_Input - if err := c.Bind(&body); err != nil { - return err - } - var handleErr error - // func (s *Server) handleAppBskyUnspeccedApplyLabels(ctx context.Context,body *appbskytypes.UnspeccedApplyLabels_Input) error - handleErr = s.handleAppBskyUnspeccedApplyLabels(ctx, &body) - if handleErr != nil { - return handleErr - } - return nil -} - func (s *Server) HandleAppBskyUnspeccedGetPopular(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyUnspeccedGetPopular") defer span.End() @@ -917,10 +1024,72 @@ func (s *Server) HandleAppBskyUnspeccedGetTimelineSkeleton(c echo.Context) error return c.JSON(200, out) } +func (s *Server) HandleAppBskyUnspeccedSearchActorsSkeleton(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyUnspeccedSearchActorsSkeleton") + defer span.End() + cursor := c.QueryParam("cursor") + + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 25 + } + q := c.QueryParam("q") + + var typeahead *bool + if p := c.QueryParam("typeahead"); p != "" { + typeahead_val, err := strconv.ParseBool(p) + if err != nil { + return err + } + typeahead = &typeahead_val + } + var out *appbskytypes.UnspeccedSearchActorsSkeleton_Output + var handleErr error + // func (s *Server) handleAppBskyUnspeccedSearchActorsSkeleton(ctx context.Context,cursor string,limit int,q string,typeahead *bool) (*appbskytypes.UnspeccedSearchActorsSkeleton_Output, error) + out, handleErr = s.handleAppBskyUnspeccedSearchActorsSkeleton(ctx, cursor, limit, q, typeahead) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + +func (s *Server) HandleAppBskyUnspeccedSearchPostsSkeleton(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleAppBskyUnspeccedSearchPostsSkeleton") + defer span.End() + cursor := c.QueryParam("cursor") + + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 25 + } + q := c.QueryParam("q") + var out *appbskytypes.UnspeccedSearchPostsSkeleton_Output + var handleErr error + // func (s *Server) handleAppBskyUnspeccedSearchPostsSkeleton(ctx context.Context,cursor string,limit int,q string) (*appbskytypes.UnspeccedSearchPostsSkeleton_Output, error) + out, handleErr = s.handleAppBskyUnspeccedSearchPostsSkeleton(ctx, cursor, limit, q) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.POST("/xrpc/com.atproto.admin.disableAccountInvites", s.HandleComAtprotoAdminDisableAccountInvites) e.POST("/xrpc/com.atproto.admin.disableInviteCodes", s.HandleComAtprotoAdminDisableInviteCodes) e.POST("/xrpc/com.atproto.admin.enableAccountInvites", s.HandleComAtprotoAdminEnableAccountInvites) + e.GET("/xrpc/com.atproto.admin.getAccountInfo", s.HandleComAtprotoAdminGetAccountInfo) e.GET("/xrpc/com.atproto.admin.getInviteCodes", s.HandleComAtprotoAdminGetInviteCodes) e.GET("/xrpc/com.atproto.admin.getModerationAction", s.HandleComAtprotoAdminGetModerationAction) e.GET("/xrpc/com.atproto.admin.getModerationActions", s.HandleComAtprotoAdminGetModerationActions) @@ -928,6 +1097,7 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.GET("/xrpc/com.atproto.admin.getModerationReports", s.HandleComAtprotoAdminGetModerationReports) e.GET("/xrpc/com.atproto.admin.getRecord", s.HandleComAtprotoAdminGetRecord) e.GET("/xrpc/com.atproto.admin.getRepo", s.HandleComAtprotoAdminGetRepo) + e.GET("/xrpc/com.atproto.admin.getSubjectStatus", s.HandleComAtprotoAdminGetSubjectStatus) e.POST("/xrpc/com.atproto.admin.resolveModerationReports", s.HandleComAtprotoAdminResolveModerationReports) e.POST("/xrpc/com.atproto.admin.reverseModerationAction", s.HandleComAtprotoAdminReverseModerationAction) e.GET("/xrpc/com.atproto.admin.searchRepos", s.HandleComAtprotoAdminSearchRepos) @@ -935,6 +1105,7 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.POST("/xrpc/com.atproto.admin.takeModerationAction", s.HandleComAtprotoAdminTakeModerationAction) e.POST("/xrpc/com.atproto.admin.updateAccountEmail", s.HandleComAtprotoAdminUpdateAccountEmail) e.POST("/xrpc/com.atproto.admin.updateAccountHandle", s.HandleComAtprotoAdminUpdateAccountHandle) + e.POST("/xrpc/com.atproto.admin.updateSubjectStatus", s.HandleComAtprotoAdminUpdateSubjectStatus) e.GET("/xrpc/com.atproto.identity.resolveHandle", s.HandleComAtprotoIdentityResolveHandle) e.POST("/xrpc/com.atproto.identity.updateHandle", s.HandleComAtprotoIdentityUpdateHandle) e.GET("/xrpc/com.atproto.label.queryLabels", s.HandleComAtprotoLabelQueryLabels) @@ -947,6 +1118,7 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.GET("/xrpc/com.atproto.repo.listRecords", s.HandleComAtprotoRepoListRecords) e.POST("/xrpc/com.atproto.repo.putRecord", s.HandleComAtprotoRepoPutRecord) e.POST("/xrpc/com.atproto.repo.uploadBlob", s.HandleComAtprotoRepoUploadBlob) + e.POST("/xrpc/com.atproto.server.confirmEmail", s.HandleComAtprotoServerConfirmEmail) e.POST("/xrpc/com.atproto.server.createAccount", s.HandleComAtprotoServerCreateAccount) e.POST("/xrpc/com.atproto.server.createAppPassword", s.HandleComAtprotoServerCreateAppPassword) e.POST("/xrpc/com.atproto.server.createInviteCode", s.HandleComAtprotoServerCreateInviteCode) @@ -960,9 +1132,13 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.GET("/xrpc/com.atproto.server.listAppPasswords", s.HandleComAtprotoServerListAppPasswords) e.POST("/xrpc/com.atproto.server.refreshSession", s.HandleComAtprotoServerRefreshSession) e.POST("/xrpc/com.atproto.server.requestAccountDelete", s.HandleComAtprotoServerRequestAccountDelete) + e.POST("/xrpc/com.atproto.server.requestEmailConfirmation", s.HandleComAtprotoServerRequestEmailConfirmation) + e.POST("/xrpc/com.atproto.server.requestEmailUpdate", s.HandleComAtprotoServerRequestEmailUpdate) e.POST("/xrpc/com.atproto.server.requestPasswordReset", s.HandleComAtprotoServerRequestPasswordReset) + e.POST("/xrpc/com.atproto.server.reserveSigningKey", s.HandleComAtprotoServerReserveSigningKey) e.POST("/xrpc/com.atproto.server.resetPassword", s.HandleComAtprotoServerResetPassword) e.POST("/xrpc/com.atproto.server.revokeAppPassword", s.HandleComAtprotoServerRevokeAppPassword) + e.POST("/xrpc/com.atproto.server.updateEmail", s.HandleComAtprotoServerUpdateEmail) e.GET("/xrpc/com.atproto.sync.getBlob", s.HandleComAtprotoSyncGetBlob) e.GET("/xrpc/com.atproto.sync.getBlocks", s.HandleComAtprotoSyncGetBlocks) e.GET("/xrpc/com.atproto.sync.getCheckout", s.HandleComAtprotoSyncGetCheckout) @@ -974,7 +1150,7 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.GET("/xrpc/com.atproto.sync.listRepos", s.HandleComAtprotoSyncListRepos) e.POST("/xrpc/com.atproto.sync.notifyOfUpdate", s.HandleComAtprotoSyncNotifyOfUpdate) e.POST("/xrpc/com.atproto.sync.requestCrawl", s.HandleComAtprotoSyncRequestCrawl) - e.POST("/xrpc/com.atproto.temp.upgradeRepoVersion", s.HandleComAtprotoTempUpgradeRepoVersion) + e.GET("/xrpc/com.atproto.temp.fetchLabels", s.HandleComAtprotoTempFetchLabels) return nil } @@ -1029,6 +1205,20 @@ func (s *Server) HandleComAtprotoAdminEnableAccountInvites(c echo.Context) error return nil } +func (s *Server) HandleComAtprotoAdminGetAccountInfo(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetAccountInfo") + defer span.End() + did := c.QueryParam("did") + var out *comatprototypes.AdminDefs_AccountView + var handleErr error + // func (s *Server) handleComAtprotoAdminGetAccountInfo(ctx context.Context,did string) (*comatprototypes.AdminDefs_AccountView, error) + out, handleErr = s.handleComAtprotoAdminGetAccountInfo(ctx, did) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleComAtprotoAdminGetInviteCodes(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetInviteCodes") defer span.End() @@ -1196,6 +1386,22 @@ func (s *Server) HandleComAtprotoAdminGetRepo(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleComAtprotoAdminGetSubjectStatus(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetSubjectStatus") + defer span.End() + blob := c.QueryParam("blob") + did := c.QueryParam("did") + uri := c.QueryParam("uri") + var out *comatprototypes.AdminGetSubjectStatus_Output + var handleErr error + // func (s *Server) handleComAtprotoAdminGetSubjectStatus(ctx context.Context,blob string,did string,uri string) (*comatprototypes.AdminGetSubjectStatus_Output, error) + out, handleErr = s.handleComAtprotoAdminGetSubjectStatus(ctx, blob, did, uri) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleComAtprotoAdminResolveModerationReports(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminResolveModerationReports") defer span.End() @@ -1236,7 +1442,6 @@ func (s *Server) HandleComAtprotoAdminSearchRepos(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminSearchRepos") defer span.End() cursor := c.QueryParam("cursor") - invitedBy := c.QueryParam("invitedBy") var limit int if p := c.QueryParam("limit"); p != "" { @@ -1248,11 +1453,12 @@ func (s *Server) HandleComAtprotoAdminSearchRepos(c echo.Context) error { } else { limit = 50 } + q := c.QueryParam("q") term := c.QueryParam("term") var out *comatprototypes.AdminSearchRepos_Output var handleErr error - // func (s *Server) handleComAtprotoAdminSearchRepos(ctx context.Context,cursor string,invitedBy string,limit int,term string) (*comatprototypes.AdminSearchRepos_Output, error) - out, handleErr = s.handleComAtprotoAdminSearchRepos(ctx, cursor, invitedBy, limit, term) + // func (s *Server) handleComAtprotoAdminSearchRepos(ctx context.Context,cursor string,limit int,q string,term string) (*comatprototypes.AdminSearchRepos_Output, error) + out, handleErr = s.handleComAtprotoAdminSearchRepos(ctx, cursor, limit, q, term) if handleErr != nil { return handleErr } @@ -1329,6 +1535,24 @@ func (s *Server) HandleComAtprotoAdminUpdateAccountHandle(c echo.Context) error return nil } +func (s *Server) HandleComAtprotoAdminUpdateSubjectStatus(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminUpdateSubjectStatus") + defer span.End() + + var body comatprototypes.AdminUpdateSubjectStatus_Input + if err := c.Bind(&body); err != nil { + return err + } + var out *comatprototypes.AdminUpdateSubjectStatus_Output + var handleErr error + // func (s *Server) handleComAtprotoAdminUpdateSubjectStatus(ctx context.Context,body *comatprototypes.AdminUpdateSubjectStatus_Input) (*comatprototypes.AdminUpdateSubjectStatus_Output, error) + out, handleErr = s.handleComAtprotoAdminUpdateSubjectStatus(ctx, &body) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleComAtprotoIdentityResolveHandle(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoIdentityResolveHandle") defer span.End() @@ -1561,6 +1785,23 @@ func (s *Server) HandleComAtprotoRepoUploadBlob(c echo.Context) error { return c.JSON(200, out) } +func (s *Server) HandleComAtprotoServerConfirmEmail(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerConfirmEmail") + defer span.End() + + var body comatprototypes.ServerConfirmEmail_Input + if err := c.Bind(&body); err != nil { + return err + } + var handleErr error + // func (s *Server) handleComAtprotoServerConfirmEmail(ctx context.Context,body *comatprototypes.ServerConfirmEmail_Input) error + handleErr = s.handleComAtprotoServerConfirmEmail(ctx, &body) + if handleErr != nil { + return handleErr + } + return nil +} + func (s *Server) HandleComAtprotoServerCreateAccount(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerCreateAccount") defer span.End() @@ -1779,6 +2020,31 @@ func (s *Server) HandleComAtprotoServerRequestAccountDelete(c echo.Context) erro return nil } +func (s *Server) HandleComAtprotoServerRequestEmailConfirmation(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestEmailConfirmation") + defer span.End() + var handleErr error + // func (s *Server) handleComAtprotoServerRequestEmailConfirmation(ctx context.Context) error + handleErr = s.handleComAtprotoServerRequestEmailConfirmation(ctx) + if handleErr != nil { + return handleErr + } + return nil +} + +func (s *Server) HandleComAtprotoServerRequestEmailUpdate(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestEmailUpdate") + defer span.End() + var out *comatprototypes.ServerRequestEmailUpdate_Output + var handleErr error + // func (s *Server) handleComAtprotoServerRequestEmailUpdate(ctx context.Context) (*comatprototypes.ServerRequestEmailUpdate_Output, error) + out, handleErr = s.handleComAtprotoServerRequestEmailUpdate(ctx) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleComAtprotoServerRequestPasswordReset(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerRequestPasswordReset") defer span.End() @@ -1796,6 +2062,24 @@ func (s *Server) HandleComAtprotoServerRequestPasswordReset(c echo.Context) erro return nil } +func (s *Server) HandleComAtprotoServerReserveSigningKey(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerReserveSigningKey") + defer span.End() + + var body comatprototypes.ServerReserveSigningKey_Input + if err := c.Bind(&body); err != nil { + return err + } + var out *comatprototypes.ServerReserveSigningKey_Output + var handleErr error + // func (s *Server) handleComAtprotoServerReserveSigningKey(ctx context.Context,body *comatprototypes.ServerReserveSigningKey_Input) (*comatprototypes.ServerReserveSigningKey_Output, error) + out, handleErr = s.handleComAtprotoServerReserveSigningKey(ctx, &body) + if handleErr != nil { + return handleErr + } + return c.JSON(200, out) +} + func (s *Server) HandleComAtprotoServerResetPassword(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerResetPassword") defer span.End() @@ -1830,6 +2114,23 @@ func (s *Server) HandleComAtprotoServerRevokeAppPassword(c echo.Context) error { return nil } +func (s *Server) HandleComAtprotoServerUpdateEmail(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoServerUpdateEmail") + defer span.End() + + var body comatprototypes.ServerUpdateEmail_Input + if err := c.Bind(&body); err != nil { + return err + } + var handleErr error + // func (s *Server) handleComAtprotoServerUpdateEmail(ctx context.Context,body *comatprototypes.ServerUpdateEmail_Input) error + handleErr = s.handleComAtprotoServerUpdateEmail(ctx, &body) + if handleErr != nil { + return handleErr + } + return nil +} + func (s *Server) HandleComAtprotoSyncGetBlob(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoSyncGetBlob") defer span.End() @@ -2021,19 +2322,35 @@ func (s *Server) HandleComAtprotoSyncRequestCrawl(c echo.Context) error { return nil } -func (s *Server) HandleComAtprotoTempUpgradeRepoVersion(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoTempUpgradeRepoVersion") +func (s *Server) HandleComAtprotoTempFetchLabels(c echo.Context) error { + ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoTempFetchLabels") defer span.End() - var body comatprototypes.TempUpgradeRepoVersion_Input - if err := c.Bind(&body); err != nil { - return err + var limit int + if p := c.QueryParam("limit"); p != "" { + var err error + limit, err = strconv.Atoi(p) + if err != nil { + return err + } + } else { + limit = 50 } + + var since *int + if p := c.QueryParam("since"); p != "" { + since_val, err := strconv.Atoi(p) + if err != nil { + return err + } + since = &since_val + } + var out *comatprototypes.TempFetchLabels_Output var handleErr error - // func (s *Server) handleComAtprotoTempUpgradeRepoVersion(ctx context.Context,body *comatprototypes.TempUpgradeRepoVersion_Input) error - handleErr = s.handleComAtprotoTempUpgradeRepoVersion(ctx, &body) + // func (s *Server) handleComAtprotoTempFetchLabels(ctx context.Context,limit int,since *int) (*comatprototypes.TempFetchLabels_Output, error) + out, handleErr = s.handleComAtprotoTempFetchLabels(ctx, limit, since) if handleErr != nil { return handleErr } - return nil + return c.JSON(200, out) } diff --git a/testing/utils.go b/testing/utils.go index a59a7c62c..ee515979e 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -198,10 +198,12 @@ func (tp *TestPDS) NewUser(handle string) (*TestUser, error) { } fmt.Println("HOST: ", c.Host) + email := handle + "@fake.com" + pass := "password" out, err := atproto.ServerCreateAccount(ctx, c, &atproto.ServerCreateAccount_Input{ - Email: handle + "@fake.com", + Email: &email, Handle: handle, - Password: "password", + Password: &pass, }) if err != nil { return nil, err