From a7bfec9fec412a78f632caf728922465cd18da46 Mon Sep 17 00:00:00 2001 From: rafaeleyng Date: Fri, 29 May 2026 15:25:29 -0300 Subject: [PATCH] codegen --- api/atproto/lexiconresolveLexicon.go | 36 ++++ api/atproto/servergetServiceAuth.go | 2 +- api/atproto/serverrefreshSession.go | 15 +- api/bsky/embedexternal.go | 6 +- api/bsky/embedgetEmbedExternalView.go | 2 +- api/chat/cbor_gen.go | 130 +++++++++++ api/chat/convodefs.go | 58 ++++- api/chat/convogetLog.go | 78 ++++--- api/chat/embedjoinLink.go | 26 +++ api/chat/groupupdateJoinRequestsRead.go | 30 +++ api/chat/groupwithdrawJoinRequest.go | 30 +++ api/chat/moderationdefs.go | 84 ++++++++ api/chat/moderationgetConvo.go | 29 +++ api/chat/moderationgetConvoMembers.go | 36 ++++ api/chat/moderationsubscribeModEvents.go | 12 ++ api/ozone/moderationdefs.go | 33 +++ api/ozone/moderationemitEvent.go | 20 +- api/ozone/moderationqueryEvents.go | 2 +- api/ozone/moderationqueryStatuses.go | 2 +- api/ozone/queueassignModerator.go | 29 +++ api/ozone/queuecreateQueue.go | 40 ++++ api/ozone/queuedefs.go | 60 ++++++ api/ozone/queuedeleteQueue.go | 36 ++++ api/ozone/queuegetAssignments.go | 48 +++++ api/ozone/queuelistQueues.go | 52 +++++ api/ozone/queuerouteReports.go | 37 ++++ api/ozone/queueunassignModerator.go | 28 +++ api/ozone/queueupdateQueue.go | 38 ++++ api/ozone/reportassignModerator.go | 33 +++ api/ozone/reportcreateActivity.go | 110 ++++++++++ api/ozone/reportdefs.go | 261 +++++++++++++++++++++++ api/ozone/reportgetAssignments.go | 48 +++++ api/ozone/reportgetHistoricalStats.go | 58 +++++ api/ozone/reportgetLatestReport.go | 28 +++ api/ozone/reportgetLiveStats.go | 42 ++++ api/ozone/reportgetReport.go | 26 +++ api/ozone/reportlistActivities.go | 38 ++++ api/ozone/reportqueryReports.go | 84 ++++++++ api/ozone/reportreassignQueue.go | 36 ++++ api/ozone/reportrefreshStats.go | 35 +++ api/ozone/reportunassignModerator.go | 27 +++ gen/main.go | 1 + 42 files changed, 1780 insertions(+), 46 deletions(-) create mode 100644 api/atproto/lexiconresolveLexicon.go create mode 100644 api/chat/embedjoinLink.go create mode 100644 api/chat/groupupdateJoinRequestsRead.go create mode 100644 api/chat/groupwithdrawJoinRequest.go create mode 100644 api/chat/moderationdefs.go create mode 100644 api/chat/moderationgetConvo.go create mode 100644 api/chat/moderationgetConvoMembers.go create mode 100644 api/ozone/queueassignModerator.go create mode 100644 api/ozone/queuecreateQueue.go create mode 100644 api/ozone/queuedefs.go create mode 100644 api/ozone/queuedeleteQueue.go create mode 100644 api/ozone/queuegetAssignments.go create mode 100644 api/ozone/queuelistQueues.go create mode 100644 api/ozone/queuerouteReports.go create mode 100644 api/ozone/queueunassignModerator.go create mode 100644 api/ozone/queueupdateQueue.go create mode 100644 api/ozone/reportassignModerator.go create mode 100644 api/ozone/reportcreateActivity.go create mode 100644 api/ozone/reportgetAssignments.go create mode 100644 api/ozone/reportgetHistoricalStats.go create mode 100644 api/ozone/reportgetLatestReport.go create mode 100644 api/ozone/reportgetLiveStats.go create mode 100644 api/ozone/reportgetReport.go create mode 100644 api/ozone/reportlistActivities.go create mode 100644 api/ozone/reportqueryReports.go create mode 100644 api/ozone/reportreassignQueue.go create mode 100644 api/ozone/reportrefreshStats.go create mode 100644 api/ozone/reportunassignModerator.go diff --git a/api/atproto/lexiconresolveLexicon.go b/api/atproto/lexiconresolveLexicon.go new file mode 100644 index 00000000..f6dac29e --- /dev/null +++ b/api/atproto/lexiconresolveLexicon.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: com.atproto.lexicon.resolveLexicon + +package atproto + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// LexiconResolveLexicon_Output is the output of a com.atproto.lexicon.resolveLexicon call. +type LexiconResolveLexicon_Output struct { + // cid: The CID of the lexicon schema record. + Cid string `json:"cid" cborgen:"cid"` + // schema: The resolved lexicon schema record. + Schema *LexiconSchema `json:"schema" cborgen:"schema"` + // uri: The AT-URI of the lexicon schema record. + Uri string `json:"uri" cborgen:"uri"` +} + +// LexiconResolveLexicon calls the XRPC method "com.atproto.lexicon.resolveLexicon". +// +// nsid: The lexicon NSID to resolve. +func LexiconResolveLexicon(ctx context.Context, c lexutil.LexClient, nsid string) (*LexiconResolveLexicon_Output, error) { + var out LexiconResolveLexicon_Output + + params := map[string]interface{}{} + params["nsid"] = nsid + if err := c.LexDo(ctx, lexutil.Query, "", "com.atproto.lexicon.resolveLexicon", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/atproto/servergetServiceAuth.go b/api/atproto/servergetServiceAuth.go index 052744da..048471f3 100644 --- a/api/atproto/servergetServiceAuth.go +++ b/api/atproto/servergetServiceAuth.go @@ -17,7 +17,7 @@ type ServerGetServiceAuth_Output struct { // ServerGetServiceAuth calls the XRPC method "com.atproto.server.getServiceAuth". // -// aud: The DID of the service that the token will be used to authenticate with +// aud: The DID or `did#serviceId` reference of the service that the token will be used to authenticate with. // exp: The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope. // lxm: Lexicon (XRPC) method to bind the requested token to func ServerGetServiceAuth(ctx context.Context, c lexutil.LexClient, aud string, exp int64, lxm string) (*ServerGetServiceAuth_Output, error) { diff --git a/api/atproto/serverrefreshSession.go b/api/atproto/serverrefreshSession.go index a0a7d91a..c06066c2 100644 --- a/api/atproto/serverrefreshSession.go +++ b/api/atproto/serverrefreshSession.go @@ -12,12 +12,15 @@ import ( // ServerRefreshSession_Output is the output of a com.atproto.server.refreshSession call. type ServerRefreshSession_Output struct { - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` - Active *bool `json:"active,omitempty" cborgen:"active,omitempty"` - Did string `json:"did" cborgen:"did"` - DidDoc *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` - Handle string `json:"handle" cborgen:"handle"` - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` + AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` + Active *bool `json:"active,omitempty" cborgen:"active,omitempty"` + Did string `json:"did" cborgen:"did"` + DidDoc *interface{} `json:"didDoc,omitempty" cborgen:"didDoc,omitempty"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + EmailAuthFactor *bool `json:"emailAuthFactor,omitempty" cborgen:"emailAuthFactor,omitempty"` + EmailConfirmed *bool `json:"emailConfirmed,omitempty" cborgen:"emailConfirmed,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` // status: Hosting status of the account. If not specified, then assume 'active'. Status *string `json:"status,omitempty" cborgen:"status,omitempty"` } diff --git a/api/bsky/embedexternal.go b/api/bsky/embedexternal.go index 4939806e..68aaa385 100644 --- a/api/bsky/embedexternal.go +++ b/api/bsky/embedexternal.go @@ -48,6 +48,8 @@ type EmbedExternal_View struct { // EmbedExternal_ViewExternal is a "viewExternal" in the app.bsky.embed.external schema. type EmbedExternal_ViewExternal struct { + // associatedProfiles: Profiles of the owners of the Atmosphere records that backed this view. + AssociatedProfiles []*ActorDefs_ProfileViewBasic `json:"associatedProfiles,omitempty" cborgen:"associatedProfiles,omitempty"` // associatedRefs: StrongRefs (uri+cid) of the Atmosphere records that backed this view. AssociatedRefs []*comatproto.RepoStrongRef `json:"associatedRefs,omitempty" cborgen:"associatedRefs,omitempty"` // createdAt: When the external content was created, if available. Example: a publication date, for an article. @@ -72,9 +74,9 @@ type EmbedExternal_ViewExternalSource struct { // icon: Fully-qualified URL where an icon representing the source can be fetched. For example, CDN location provided by the App View. Icon *string `json:"icon,omitempty" cborgen:"icon,omitempty"` Theme *EmbedExternal_ViewExternalSourceTheme `json:"theme,omitempty" cborgen:"theme,omitempty"` - Title *string `json:"title,omitempty" cborgen:"title,omitempty"` + Title string `json:"title" cborgen:"title"` // uri: URI of the source, if available. Example: the https:// URL of a site.standard.publication record. - Uri *string `json:"uri,omitempty" cborgen:"uri,omitempty"` + Uri string `json:"uri" cborgen:"uri"` } // EmbedExternal_ViewExternalSourceTheme is a "viewExternalSourceTheme" in the app.bsky.embed.external schema. diff --git a/api/bsky/embedgetEmbedExternalView.go b/api/bsky/embedgetEmbedExternalView.go index e7a74df6..aadede0b 100644 --- a/api/bsky/embedgetEmbedExternalView.go +++ b/api/bsky/embedgetEmbedExternalView.go @@ -16,7 +16,7 @@ type EmbedGetEmbedExternalView_Output struct { AssociatedRecords []*lexutil.LexiconTypeDecoder `json:"associatedRecords,omitempty" cborgen:"associatedRecords,omitempty"` // associatedRefs: StrongRefs (URI+CID) of the Atmosphere records that backed this view, suitable for embedding into a post's external.associatedRefs. AssociatedRefs []*comatproto.RepoStrongRef `json:"associatedRefs,omitempty" cborgen:"associatedRefs,omitempty"` - // view: Hydrated view of the embed. Present whenever at least one record was hydrated. `view.external.title` and `view.external.description` may be empty strings when the resolved records didn't supply them; clients should treat that as 'no enrichment for this field.' + // view: Hydrated view of the embed. Present only when the resolved records back the requested URL and supply enough information to populate the required `viewExternal` fields. Omitted alongside the rest of the response when no records resolved or validation failed. View *EmbedExternal_View `json:"view,omitempty" cborgen:"view,omitempty"` } diff --git a/api/chat/cbor_gen.go b/api/chat/cbor_gen.go index 61c4c041..a63517dc 100644 --- a/api/chat/cbor_gen.go +++ b/api/chat/cbor_gen.go @@ -206,3 +206,133 @@ func (t *ActorDeclaration) UnmarshalCBOR(r io.Reader) (err error) { return nil } +func (t *EmbedJoinLink) 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.Code (string) (string) + if len("code") > 1000000 { + return xerrors.Errorf("Value in field \"code\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("code"))); err != nil { + return err + } + if _, err := cw.WriteString(string("code")); err != nil { + return err + } + + if len(t.Code) > 1000000 { + return xerrors.Errorf("Value in field t.Code was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Code))); err != nil { + return err + } + if _, err := cw.WriteString(string(t.Code)); err != nil { + return err + } + + // t.LexiconTypeID (string) (string) + if len("$type") > 1000000 { + 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("chat.bsky.embed.joinLink"))); err != nil { + return err + } + if _, err := cw.WriteString(string("chat.bsky.embed.joinLink")); err != nil { + return err + } + return nil +} + +func (t *EmbedJoinLink) UnmarshalCBOR(r io.Reader) (err error) { + *t = EmbedJoinLink{} + + 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("EmbedJoinLink: map struct too large (%d)", extra) + } + + n := extra + + nameBuf := make([]byte, 5) + for i := uint64(0); i < n; i++ { + nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000) + if err != nil { + return err + } + + if !ok { + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil { + return err + } + continue + } + + switch string(nameBuf[:nameLen]) { + // t.Code (string) (string) + case "code": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.Code = string(sval) + } + // t.LexiconTypeID (string) (string) + case "$type": + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.LexiconTypeID = string(sval) + } + + default: + // Field doesn't exist on this type, so ignore it + if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil { + return err + } + } + } + + return nil +} diff --git a/api/chat/convodefs.go b/api/chat/convodefs.go index 0f5c5414..a8edf06b 100644 --- a/api/chat/convodefs.go +++ b/api/chat/convodefs.go @@ -14,8 +14,9 @@ import ( // ConvoDefs_ConvoRef is a "convoRef" in the chat.bsky.convo.defs schema. type ConvoDefs_ConvoRef struct { - ConvoId string `json:"convoId" cborgen:"convoId"` - Did string `json:"did" cborgen:"did"` + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#convoRef"` + ConvoId string `json:"convoId" cborgen:"convoId"` + Did string `json:"did" cborgen:"did"` } // ConvoDefs_ConvoView is a "convoView" in the chat.bsky.convo.defs schema. @@ -174,6 +175,8 @@ type ConvoDefs_GroupConvo struct { MemberLimit int64 `json:"memberLimit" cborgen:"memberLimit"` // name: The display name of the group conversation. Name string `json:"name" cborgen:"name"` + // unreadJoinRequestCount: The number of unread join requests for the group conversation. Only present for the owner. + UnreadJoinRequestCount *int64 `json:"unreadJoinRequestCount,omitempty" cborgen:"unreadJoinRequestCount,omitempty"` } // ConvoDefs_LogAcceptConvo is a "logAcceptConvo" in the chat.bsky.convo.defs schema. @@ -496,7 +499,7 @@ type ConvoDefs_LogMuteConvo struct { // ConvoDefs_LogOutgoingJoinRequest is a "logOutgoingJoinRequest" in the chat.bsky.convo.defs schema. // -// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was made by the viewer. +// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a join request was made by the requester. Only requester actor gets this. type ConvoDefs_LogOutgoingJoinRequest struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logOutgoingJoinRequest"` ConvoId string `json:"convoId" cborgen:"convoId"` @@ -556,6 +559,15 @@ func (t *ConvoDefs_LogReadConvo_Message) UnmarshalJSON(b []byte) error { } } +// ConvoDefs_LogReadJoinRequests is a "logReadJoinRequests" in the chat.bsky.convo.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating the group owner marked join requests as read. Only the owner gets this. +type ConvoDefs_LogReadJoinRequests struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logReadJoinRequests"` + ConvoId string `json:"convoId" cborgen:"convoId"` + Rev string `json:"rev" cborgen:"rev"` +} + // ConvoDefs_LogReadMessage is a "logReadMessage" in the chat.bsky.convo.defs schema. // // DEPRECATED: use logReadConvo instead. Event indicating a convo was read up to a certain message. @@ -703,6 +715,26 @@ type ConvoDefs_LogUnmuteConvo struct { Rev string `json:"rev" cborgen:"rev"` } +// ConvoDefs_LogWithdrawIncomingJoinRequest is a "logWithdrawIncomingJoinRequest" in the chat.bsky.convo.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating a prospective member withdrew their join request. Only the owner gets this. +type ConvoDefs_LogWithdrawIncomingJoinRequest struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logWithdrawIncomingJoinRequest"` + ConvoId string `json:"convoId" cborgen:"convoId"` + // member: Prospective member who withdrew their join request. + Member *ActorDefs_ProfileViewBasic `json:"member" cborgen:"member"` + Rev string `json:"rev" cborgen:"rev"` +} + +// ConvoDefs_LogWithdrawOutgoingJoinRequest is a "logWithdrawOutgoingJoinRequest" in the chat.bsky.convo.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. Event indicating the viewer withdrew their own join request. Only requester actor gets this. +type ConvoDefs_LogWithdrawOutgoingJoinRequest struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#logWithdrawOutgoingJoinRequest"` + ConvoId string `json:"convoId" cborgen:"convoId"` + Rev string `json:"rev" cborgen:"rev"` +} + // ConvoDefs_MessageAndReactionView is a "messageAndReactionView" in the chat.bsky.convo.defs schema. type ConvoDefs_MessageAndReactionView struct { LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.convo.defs#messageAndReactionView"` @@ -719,7 +751,8 @@ type ConvoDefs_MessageInput struct { } type ConvoDefs_MessageInput_Embed struct { - EmbedRecord *appbsky.EmbedRecord + EmbedRecord *appbsky.EmbedRecord + EmbedJoinLink *EmbedJoinLink } func (t *ConvoDefs_MessageInput_Embed) MarshalJSON() ([]byte, error) { @@ -727,6 +760,10 @@ func (t *ConvoDefs_MessageInput_Embed) MarshalJSON() ([]byte, error) { t.EmbedRecord.LexiconTypeID = "app.bsky.embed.record" return json.Marshal(t.EmbedRecord) } + if t.EmbedJoinLink != nil { + t.EmbedJoinLink.LexiconTypeID = "chat.bsky.embed.joinLink" + return json.Marshal(t.EmbedJoinLink) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -740,6 +777,9 @@ func (t *ConvoDefs_MessageInput_Embed) UnmarshalJSON(b []byte) error { case "app.bsky.embed.record": t.EmbedRecord = new(appbsky.EmbedRecord) return json.Unmarshal(b, t.EmbedRecord) + case "chat.bsky.embed.joinLink": + t.EmbedJoinLink = new(EmbedJoinLink) + return json.Unmarshal(b, t.EmbedJoinLink) default: return nil } @@ -774,7 +814,8 @@ type ConvoDefs_MessageViewSender struct { } type ConvoDefs_MessageView_Embed struct { - EmbedRecord_View *appbsky.EmbedRecord_View + EmbedRecord_View *appbsky.EmbedRecord_View + EmbedJoinLink_View *EmbedJoinLink_View } func (t *ConvoDefs_MessageView_Embed) MarshalJSON() ([]byte, error) { @@ -782,6 +823,10 @@ func (t *ConvoDefs_MessageView_Embed) MarshalJSON() ([]byte, error) { t.EmbedRecord_View.LexiconTypeID = "app.bsky.embed.record#view" return json.Marshal(t.EmbedRecord_View) } + if t.EmbedJoinLink_View != nil { + t.EmbedJoinLink_View.LexiconTypeID = "chat.bsky.embed.joinLink#view" + return json.Marshal(t.EmbedJoinLink_View) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -795,6 +840,9 @@ func (t *ConvoDefs_MessageView_Embed) UnmarshalJSON(b []byte) error { case "app.bsky.embed.record#view": t.EmbedRecord_View = new(appbsky.EmbedRecord_View) return json.Unmarshal(b, t.EmbedRecord_View) + case "chat.bsky.embed.joinLink#view": + t.EmbedJoinLink_View = new(EmbedJoinLink_View) + return json.Unmarshal(b, t.EmbedJoinLink_View) default: return nil } diff --git a/api/chat/convogetLog.go b/api/chat/convogetLog.go index 08a83e37..c2446bc0 100644 --- a/api/chat/convogetLog.go +++ b/api/chat/convogetLog.go @@ -19,33 +19,36 @@ type ConvoGetLog_Output struct { } type ConvoGetLog_Output_Logs_Elem struct { - ConvoDefs_LogBeginConvo *ConvoDefs_LogBeginConvo - ConvoDefs_LogAcceptConvo *ConvoDefs_LogAcceptConvo - ConvoDefs_LogLeaveConvo *ConvoDefs_LogLeaveConvo - ConvoDefs_LogMuteConvo *ConvoDefs_LogMuteConvo - ConvoDefs_LogUnmuteConvo *ConvoDefs_LogUnmuteConvo - ConvoDefs_LogCreateMessage *ConvoDefs_LogCreateMessage - ConvoDefs_LogDeleteMessage *ConvoDefs_LogDeleteMessage - ConvoDefs_LogReadMessage *ConvoDefs_LogReadMessage - ConvoDefs_LogAddReaction *ConvoDefs_LogAddReaction - ConvoDefs_LogRemoveReaction *ConvoDefs_LogRemoveReaction - ConvoDefs_LogReadConvo *ConvoDefs_LogReadConvo - ConvoDefs_LogAddMember *ConvoDefs_LogAddMember - ConvoDefs_LogRemoveMember *ConvoDefs_LogRemoveMember - ConvoDefs_LogMemberJoin *ConvoDefs_LogMemberJoin - ConvoDefs_LogMemberLeave *ConvoDefs_LogMemberLeave - ConvoDefs_LogLockConvo *ConvoDefs_LogLockConvo - ConvoDefs_LogUnlockConvo *ConvoDefs_LogUnlockConvo - ConvoDefs_LogLockConvoPermanently *ConvoDefs_LogLockConvoPermanently - ConvoDefs_LogEditGroup *ConvoDefs_LogEditGroup - ConvoDefs_LogCreateJoinLink *ConvoDefs_LogCreateJoinLink - ConvoDefs_LogEditJoinLink *ConvoDefs_LogEditJoinLink - ConvoDefs_LogEnableJoinLink *ConvoDefs_LogEnableJoinLink - ConvoDefs_LogDisableJoinLink *ConvoDefs_LogDisableJoinLink - ConvoDefs_LogIncomingJoinRequest *ConvoDefs_LogIncomingJoinRequest - ConvoDefs_LogApproveJoinRequest *ConvoDefs_LogApproveJoinRequest - ConvoDefs_LogRejectJoinRequest *ConvoDefs_LogRejectJoinRequest - ConvoDefs_LogOutgoingJoinRequest *ConvoDefs_LogOutgoingJoinRequest + ConvoDefs_LogBeginConvo *ConvoDefs_LogBeginConvo + ConvoDefs_LogAcceptConvo *ConvoDefs_LogAcceptConvo + ConvoDefs_LogLeaveConvo *ConvoDefs_LogLeaveConvo + ConvoDefs_LogMuteConvo *ConvoDefs_LogMuteConvo + ConvoDefs_LogUnmuteConvo *ConvoDefs_LogUnmuteConvo + ConvoDefs_LogCreateMessage *ConvoDefs_LogCreateMessage + ConvoDefs_LogDeleteMessage *ConvoDefs_LogDeleteMessage + ConvoDefs_LogReadMessage *ConvoDefs_LogReadMessage + ConvoDefs_LogAddReaction *ConvoDefs_LogAddReaction + ConvoDefs_LogRemoveReaction *ConvoDefs_LogRemoveReaction + ConvoDefs_LogReadConvo *ConvoDefs_LogReadConvo + ConvoDefs_LogAddMember *ConvoDefs_LogAddMember + ConvoDefs_LogRemoveMember *ConvoDefs_LogRemoveMember + ConvoDefs_LogMemberJoin *ConvoDefs_LogMemberJoin + ConvoDefs_LogMemberLeave *ConvoDefs_LogMemberLeave + ConvoDefs_LogLockConvo *ConvoDefs_LogLockConvo + ConvoDefs_LogUnlockConvo *ConvoDefs_LogUnlockConvo + ConvoDefs_LogLockConvoPermanently *ConvoDefs_LogLockConvoPermanently + ConvoDefs_LogEditGroup *ConvoDefs_LogEditGroup + ConvoDefs_LogCreateJoinLink *ConvoDefs_LogCreateJoinLink + ConvoDefs_LogEditJoinLink *ConvoDefs_LogEditJoinLink + ConvoDefs_LogEnableJoinLink *ConvoDefs_LogEnableJoinLink + ConvoDefs_LogDisableJoinLink *ConvoDefs_LogDisableJoinLink + ConvoDefs_LogIncomingJoinRequest *ConvoDefs_LogIncomingJoinRequest + ConvoDefs_LogApproveJoinRequest *ConvoDefs_LogApproveJoinRequest + ConvoDefs_LogRejectJoinRequest *ConvoDefs_LogRejectJoinRequest + ConvoDefs_LogOutgoingJoinRequest *ConvoDefs_LogOutgoingJoinRequest + ConvoDefs_LogWithdrawIncomingJoinRequest *ConvoDefs_LogWithdrawIncomingJoinRequest + ConvoDefs_LogWithdrawOutgoingJoinRequest *ConvoDefs_LogWithdrawOutgoingJoinRequest + ConvoDefs_LogReadJoinRequests *ConvoDefs_LogReadJoinRequests } func (t *ConvoGetLog_Output_Logs_Elem) MarshalJSON() ([]byte, error) { @@ -157,6 +160,18 @@ func (t *ConvoGetLog_Output_Logs_Elem) MarshalJSON() ([]byte, error) { t.ConvoDefs_LogOutgoingJoinRequest.LexiconTypeID = "chat.bsky.convo.defs#logOutgoingJoinRequest" return json.Marshal(t.ConvoDefs_LogOutgoingJoinRequest) } + if t.ConvoDefs_LogWithdrawIncomingJoinRequest != nil { + t.ConvoDefs_LogWithdrawIncomingJoinRequest.LexiconTypeID = "chat.bsky.convo.defs#logWithdrawIncomingJoinRequest" + return json.Marshal(t.ConvoDefs_LogWithdrawIncomingJoinRequest) + } + if t.ConvoDefs_LogWithdrawOutgoingJoinRequest != nil { + t.ConvoDefs_LogWithdrawOutgoingJoinRequest.LexiconTypeID = "chat.bsky.convo.defs#logWithdrawOutgoingJoinRequest" + return json.Marshal(t.ConvoDefs_LogWithdrawOutgoingJoinRequest) + } + if t.ConvoDefs_LogReadJoinRequests != nil { + t.ConvoDefs_LogReadJoinRequests.LexiconTypeID = "chat.bsky.convo.defs#logReadJoinRequests" + return json.Marshal(t.ConvoDefs_LogReadJoinRequests) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -248,6 +263,15 @@ func (t *ConvoGetLog_Output_Logs_Elem) UnmarshalJSON(b []byte) error { case "chat.bsky.convo.defs#logOutgoingJoinRequest": t.ConvoDefs_LogOutgoingJoinRequest = new(ConvoDefs_LogOutgoingJoinRequest) return json.Unmarshal(b, t.ConvoDefs_LogOutgoingJoinRequest) + case "chat.bsky.convo.defs#logWithdrawIncomingJoinRequest": + t.ConvoDefs_LogWithdrawIncomingJoinRequest = new(ConvoDefs_LogWithdrawIncomingJoinRequest) + return json.Unmarshal(b, t.ConvoDefs_LogWithdrawIncomingJoinRequest) + case "chat.bsky.convo.defs#logWithdrawOutgoingJoinRequest": + t.ConvoDefs_LogWithdrawOutgoingJoinRequest = new(ConvoDefs_LogWithdrawOutgoingJoinRequest) + return json.Unmarshal(b, t.ConvoDefs_LogWithdrawOutgoingJoinRequest) + case "chat.bsky.convo.defs#logReadJoinRequests": + t.ConvoDefs_LogReadJoinRequests = new(ConvoDefs_LogReadJoinRequests) + return json.Unmarshal(b, t.ConvoDefs_LogReadJoinRequests) default: return nil } diff --git a/api/chat/embedjoinLink.go b/api/chat/embedjoinLink.go new file mode 100644 index 00000000..f2581711 --- /dev/null +++ b/api/chat/embedjoinLink.go @@ -0,0 +1,26 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.embed.joinLink + +package chat + +import ( + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +func init() { + lexutil.RegisterType("chat.bsky.embed.joinLink#main", &EmbedJoinLink{}) +} + +// EmbedJoinLink is a "main" in the chat.bsky.embed.joinLink schema. +type EmbedJoinLink struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.embed.joinLink"` + // code: The join link code. + Code string `json:"code" cborgen:"code"` +} + +// EmbedJoinLink_View is a "view" in the chat.bsky.embed.joinLink schema. +type EmbedJoinLink_View struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.embed.joinLink#view"` + JoinLinkPreview *GroupDefs_JoinLinkPreviewView `json:"joinLinkPreview" cborgen:"joinLinkPreview"` +} diff --git a/api/chat/groupupdateJoinRequestsRead.go b/api/chat/groupupdateJoinRequestsRead.go new file mode 100644 index 00000000..f55c3183 --- /dev/null +++ b/api/chat/groupupdateJoinRequestsRead.go @@ -0,0 +1,30 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.group.updateJoinRequestsRead + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// GroupUpdateJoinRequestsRead_Input is the input argument to a chat.bsky.group.updateJoinRequestsRead call. +type GroupUpdateJoinRequestsRead_Input struct { + ConvoId string `json:"convoId" cborgen:"convoId"` +} + +// GroupUpdateJoinRequestsRead_Output is the output of a chat.bsky.group.updateJoinRequestsRead call. +type GroupUpdateJoinRequestsRead_Output struct { +} + +// GroupUpdateJoinRequestsRead calls the XRPC method "chat.bsky.group.updateJoinRequestsRead". +func GroupUpdateJoinRequestsRead(ctx context.Context, c lexutil.LexClient, input *GroupUpdateJoinRequestsRead_Input) (*GroupUpdateJoinRequestsRead_Output, error) { + var out GroupUpdateJoinRequestsRead_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "chat.bsky.group.updateJoinRequestsRead", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/groupwithdrawJoinRequest.go b/api/chat/groupwithdrawJoinRequest.go new file mode 100644 index 00000000..5c029a15 --- /dev/null +++ b/api/chat/groupwithdrawJoinRequest.go @@ -0,0 +1,30 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.group.withdrawJoinRequest + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// GroupWithdrawJoinRequest_Input is the input argument to a chat.bsky.group.withdrawJoinRequest call. +type GroupWithdrawJoinRequest_Input struct { + ConvoId string `json:"convoId" cborgen:"convoId"` +} + +// GroupWithdrawJoinRequest_Output is the output of a chat.bsky.group.withdrawJoinRequest call. +type GroupWithdrawJoinRequest_Output struct { +} + +// GroupWithdrawJoinRequest calls the XRPC method "chat.bsky.group.withdrawJoinRequest". +func GroupWithdrawJoinRequest(ctx context.Context, c lexutil.LexClient, input *GroupWithdrawJoinRequest_Input) (*GroupWithdrawJoinRequest_Output, error) { + var out GroupWithdrawJoinRequest_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "chat.bsky.group.withdrawJoinRequest", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/moderationdefs.go b/api/chat/moderationdefs.go new file mode 100644 index 00000000..23deaf84 --- /dev/null +++ b/api/chat/moderationdefs.go @@ -0,0 +1,84 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.moderation.defs + +package chat + +import ( + "encoding/json" + "fmt" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ModerationDefs_ConvoView is a "convoView" in the chat.bsky.moderation.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. A view of a conversation for moderation purposes. Unlike chat.bsky.convo.defs#convoView, it does not include viewer-specific data (such as muted, unreadCount, status, lastMessage, lastReaction), since the requester is a moderator and not a member of the conversation. The member list is not included; use chat.bsky.moderation.getConvoMembers to list members. +type ModerationDefs_ConvoView struct { + Id string `json:"id" cborgen:"id"` + // kind: Union field that has data specific to different kinds of convos. + Kind *ModerationDefs_ConvoView_Kind `json:"kind,omitempty" cborgen:"kind,omitempty"` + Rev string `json:"rev" cborgen:"rev"` +} + +// Union field that has data specific to different kinds of convos. +type ModerationDefs_ConvoView_Kind struct { + ModerationDefs_DirectConvo *ModerationDefs_DirectConvo + ModerationDefs_GroupConvo *ModerationDefs_GroupConvo +} + +func (t *ModerationDefs_ConvoView_Kind) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_DirectConvo != nil { + t.ModerationDefs_DirectConvo.LexiconTypeID = "chat.bsky.moderation.defs#directConvo" + return json.Marshal(t.ModerationDefs_DirectConvo) + } + if t.ModerationDefs_GroupConvo != nil { + t.ModerationDefs_GroupConvo.LexiconTypeID = "chat.bsky.moderation.defs#groupConvo" + return json.Marshal(t.ModerationDefs_GroupConvo) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ModerationDefs_ConvoView_Kind) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "chat.bsky.moderation.defs#directConvo": + t.ModerationDefs_DirectConvo = new(ModerationDefs_DirectConvo) + return json.Unmarshal(b, t.ModerationDefs_DirectConvo) + case "chat.bsky.moderation.defs#groupConvo": + t.ModerationDefs_GroupConvo = new(ModerationDefs_GroupConvo) + return json.Unmarshal(b, t.ModerationDefs_GroupConvo) + default: + return nil + } +} + +// ModerationDefs_DirectConvo is a "directConvo" in the chat.bsky.moderation.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. Data specific to a direct conversation, for moderation purposes. +type ModerationDefs_DirectConvo struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.moderation.defs#directConvo"` +} + +// ModerationDefs_GroupConvo is a "groupConvo" in the chat.bsky.moderation.defs schema. +// +// [NOTE: This is under active development and should be considered unstable while this note is here]. Data specific to a group conversation, for moderation purposes. Unlike chat.bsky.convo.defs#groupConvo, it does not include viewer-specific data (such as unreadJoinRequestCount), since the requester is a moderator and not a member of the conversation. +type ModerationDefs_GroupConvo struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=chat.bsky.moderation.defs#groupConvo"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + JoinLink *GroupDefs_JoinLinkView `json:"joinLink,omitempty" cborgen:"joinLink,omitempty"` + // joinRequestCount: The total number of pending join requests for the group conversation. This information is only visible to the owner and to moderators. Capped at 21. + JoinRequestCount int64 `json:"joinRequestCount" cborgen:"joinRequestCount"` + // lockStatus: The lock status of the conversation. + LockStatus *string `json:"lockStatus" cborgen:"lockStatus"` + // memberCount: The total number of members in the group conversation. + MemberCount int64 `json:"memberCount" cborgen:"memberCount"` + // memberLimit: The maximum number of members allowed in the group conversation. + MemberLimit int64 `json:"memberLimit" cborgen:"memberLimit"` + // name: The display name of the group conversation. + Name string `json:"name" cborgen:"name"` +} diff --git a/api/chat/moderationgetConvo.go b/api/chat/moderationgetConvo.go new file mode 100644 index 00000000..63dd11a7 --- /dev/null +++ b/api/chat/moderationgetConvo.go @@ -0,0 +1,29 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.moderation.getConvo + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ModerationGetConvo_Output is the output of a chat.bsky.moderation.getConvo call. +type ModerationGetConvo_Output struct { + Convo *ModerationDefs_ConvoView `json:"convo" cborgen:"convo"` +} + +// ModerationGetConvo calls the XRPC method "chat.bsky.moderation.getConvo". +func ModerationGetConvo(ctx context.Context, c lexutil.LexClient, convoId string) (*ModerationGetConvo_Output, error) { + var out ModerationGetConvo_Output + + params := map[string]interface{}{} + params["convoId"] = convoId + if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.moderation.getConvo", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/moderationgetConvoMembers.go b/api/chat/moderationgetConvoMembers.go new file mode 100644 index 00000000..0c1f897e --- /dev/null +++ b/api/chat/moderationgetConvoMembers.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: chat.bsky.moderation.getConvoMembers + +package chat + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ModerationGetConvoMembers_Output is the output of a chat.bsky.moderation.getConvoMembers call. +type ModerationGetConvoMembers_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Members []*ActorDefs_ProfileViewBasic `json:"members" cborgen:"members"` +} + +// ModerationGetConvoMembers calls the XRPC method "chat.bsky.moderation.getConvoMembers". +func ModerationGetConvoMembers(ctx context.Context, c lexutil.LexClient, convoId string, cursor string, limit int64) (*ModerationGetConvoMembers_Output, error) { + var out ModerationGetConvoMembers_Output + + params := map[string]interface{}{} + params["convoId"] = convoId + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + if err := c.LexDo(ctx, lexutil.Query, "", "chat.bsky.moderation.getConvoMembers", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/chat/moderationsubscribeModEvents.go b/api/chat/moderationsubscribeModEvents.go index 6f52e49a..5cae3ce7 100644 --- a/api/chat/moderationsubscribeModEvents.go +++ b/api/chat/moderationsubscribeModEvents.go @@ -222,3 +222,15 @@ type ModerationSubscribeModEvents_EventGroupChatUpdated struct { // updateType: What changed. UpdateType string `json:"updateType" cborgen:"updateType"` } + +// ModerationSubscribeModEvents_EventRateLimitExceeded is a "eventRateLimitExceeded" in the chat.bsky.moderation.subscribeModEvents schema. +// +// Fired when a user exceeds a rate limit. +type ModerationSubscribeModEvents_EventRateLimitExceeded struct { + // actorDid: The DID of the user who hit the rate limit. + ActorDid string `json:"actorDid" cborgen:"actorDid"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // endpoint: The NSID of the endpoint that was rate limited. + Endpoint string `json:"endpoint" cborgen:"endpoint"` + Rev string `json:"rev" cborgen:"rev"` +} diff --git a/api/ozone/moderationdefs.go b/api/ozone/moderationdefs.go index 659760cf..b1103c32 100644 --- a/api/ozone/moderationdefs.go +++ b/api/ozone/moderationdefs.go @@ -166,6 +166,13 @@ type ModerationDefs_CancelScheduledTakedownEvent struct { Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` } +// ModerationDefs_ConvoView is a "convoView" in the tools.ozone.moderation.defs schema. +type ModerationDefs_ConvoView struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.moderation.defs#convoView"` + ConvoId string `json:"convoId" cborgen:"convoId"` + Did string `json:"did" cborgen:"did"` +} + // ModerationDefs_IdentityEvent is a "identityEvent" in the tools.ozone.moderation.defs schema. // // Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. @@ -325,6 +332,8 @@ type ModerationDefs_ModEventTag struct { Add []string `json:"add" cborgen:"add"` // comment: Additional comment about added/removed tags. Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + // durationInHours: Indicates how long the tags being added should remain before automatically being removed. Only applies to tags being added. + DurationInHours *int64 `json:"durationInHours,omitempty" cborgen:"durationInHours,omitempty"` // remove: Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated. Remove []string `json:"remove" cborgen:"remove"` } @@ -617,6 +626,7 @@ type ModerationDefs_ModEventViewDetail_Subject struct { ModerationDefs_RepoViewNotFound *ModerationDefs_RepoViewNotFound ModerationDefs_RecordView *ModerationDefs_RecordView ModerationDefs_RecordViewNotFound *ModerationDefs_RecordViewNotFound + ModerationDefs_ConvoView *ModerationDefs_ConvoView } func (t *ModerationDefs_ModEventViewDetail_Subject) MarshalJSON() ([]byte, error) { @@ -636,6 +646,10 @@ func (t *ModerationDefs_ModEventViewDetail_Subject) MarshalJSON() ([]byte, error t.ModerationDefs_RecordViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#recordViewNotFound" return json.Marshal(t.ModerationDefs_RecordViewNotFound) } + if t.ModerationDefs_ConvoView != nil { + t.ModerationDefs_ConvoView.LexiconTypeID = "tools.ozone.moderation.defs#convoView" + return json.Marshal(t.ModerationDefs_ConvoView) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -658,6 +672,9 @@ func (t *ModerationDefs_ModEventViewDetail_Subject) UnmarshalJSON(b []byte) erro case "tools.ozone.moderation.defs#recordViewNotFound": t.ModerationDefs_RecordViewNotFound = new(ModerationDefs_RecordViewNotFound) return json.Unmarshal(b, t.ModerationDefs_RecordViewNotFound) + case "tools.ozone.moderation.defs#convoView": + t.ModerationDefs_ConvoView = new(ModerationDefs_ConvoView) + return json.Unmarshal(b, t.ModerationDefs_ConvoView) default: return nil } @@ -886,6 +903,7 @@ type ModerationDefs_ModEventView_Subject struct { AdminDefs_RepoRef *comatproto.AdminDefs_RepoRef RepoStrongRef *comatproto.RepoStrongRef ConvoDefs_MessageRef *chatbsky.ConvoDefs_MessageRef + ConvoDefs_ConvoRef *chatbsky.ConvoDefs_ConvoRef } func (t *ModerationDefs_ModEventView_Subject) MarshalJSON() ([]byte, error) { @@ -901,6 +919,10 @@ func (t *ModerationDefs_ModEventView_Subject) MarshalJSON() ([]byte, error) { t.ConvoDefs_MessageRef.LexiconTypeID = "chat.bsky.convo.defs#messageRef" return json.Marshal(t.ConvoDefs_MessageRef) } + if t.ConvoDefs_ConvoRef != nil { + t.ConvoDefs_ConvoRef.LexiconTypeID = "chat.bsky.convo.defs#convoRef" + return json.Marshal(t.ConvoDefs_ConvoRef) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -920,6 +942,9 @@ func (t *ModerationDefs_ModEventView_Subject) UnmarshalJSON(b []byte) error { case "chat.bsky.convo.defs#messageRef": t.ConvoDefs_MessageRef = new(chatbsky.ConvoDefs_MessageRef) return json.Unmarshal(b, t.ConvoDefs_MessageRef) + case "chat.bsky.convo.defs#convoRef": + t.ConvoDefs_ConvoRef = new(chatbsky.ConvoDefs_ConvoRef) + return json.Unmarshal(b, t.ConvoDefs_ConvoRef) default: return nil } @@ -1215,6 +1240,7 @@ type ModerationDefs_SubjectStatusView_Subject struct { AdminDefs_RepoRef *comatproto.AdminDefs_RepoRef RepoStrongRef *comatproto.RepoStrongRef ConvoDefs_MessageRef *chatbsky.ConvoDefs_MessageRef + ConvoDefs_ConvoRef *chatbsky.ConvoDefs_ConvoRef } func (t *ModerationDefs_SubjectStatusView_Subject) MarshalJSON() ([]byte, error) { @@ -1230,6 +1256,10 @@ func (t *ModerationDefs_SubjectStatusView_Subject) MarshalJSON() ([]byte, error) t.ConvoDefs_MessageRef.LexiconTypeID = "chat.bsky.convo.defs#messageRef" return json.Marshal(t.ConvoDefs_MessageRef) } + if t.ConvoDefs_ConvoRef != nil { + t.ConvoDefs_ConvoRef.LexiconTypeID = "chat.bsky.convo.defs#convoRef" + return json.Marshal(t.ConvoDefs_ConvoRef) + } return nil, fmt.Errorf("can not marshal empty union as JSON") } @@ -1249,6 +1279,9 @@ func (t *ModerationDefs_SubjectStatusView_Subject) UnmarshalJSON(b []byte) error case "chat.bsky.convo.defs#messageRef": t.ConvoDefs_MessageRef = new(chatbsky.ConvoDefs_MessageRef) return json.Unmarshal(b, t.ConvoDefs_MessageRef) + case "chat.bsky.convo.defs#convoRef": + t.ConvoDefs_ConvoRef = new(chatbsky.ConvoDefs_ConvoRef) + return json.Unmarshal(b, t.ConvoDefs_ConvoRef) default: return nil } diff --git a/api/ozone/moderationemitEvent.go b/api/ozone/moderationemitEvent.go index d557b9fa..5b66703a 100644 --- a/api/ozone/moderationemitEvent.go +++ b/api/ozone/moderationemitEvent.go @@ -18,8 +18,10 @@ type ModerationEmitEvent_Input struct { CreatedBy string `json:"createdBy" cborgen:"createdBy"` Event *ModerationEmitEvent_Input_Event `json:"event" cborgen:"event"` // externalId: An optional external ID for the event, used to deduplicate events from external systems. Fails when an event of same type with the same external ID exists for the same subject. - ExternalId *string `json:"externalId,omitempty" cborgen:"externalId,omitempty"` - ModTool *ModerationDefs_ModTool `json:"modTool,omitempty" cborgen:"modTool,omitempty"` + ExternalId *string `json:"externalId,omitempty" cborgen:"externalId,omitempty"` + ModTool *ModerationDefs_ModTool `json:"modTool,omitempty" cborgen:"modTool,omitempty"` + // reportAction: Optional report-level targeting. If provided, this event will be linked to specific reports and reporters may be notified. + ReportAction *ModerationEmitEvent_ReportAction `json:"reportAction,omitempty" cborgen:"reportAction,omitempty"` Subject *ModerationEmitEvent_Input_Subject `json:"subject" cborgen:"subject"` SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"` } @@ -278,6 +280,20 @@ func (t *ModerationEmitEvent_Input_Subject) UnmarshalJSON(b []byte) error { } } +// ModerationEmitEvent_ReportAction is a "reportAction" in the tools.ozone.moderation.emitEvent schema. +// +// Target specific reports when emitting a moderation event +type ModerationEmitEvent_ReportAction struct { + // all: Target ALL reports on the subject + All *bool `json:"all,omitempty" cborgen:"all,omitempty"` + // ids: Target specific report IDs + Ids []int64 `json:"ids,omitempty" cborgen:"ids,omitempty"` + // note: Note to send to reporter(s) when actioning their report + Note *string `json:"note,omitempty" cborgen:"note,omitempty"` + // types: Target reports matching these report types on the subject (fully qualified NSIDs) + Types []string `json:"types,omitempty" cborgen:"types,omitempty"` +} + // ModerationEmitEvent calls the XRPC method "tools.ozone.moderation.emitEvent". func ModerationEmitEvent(ctx context.Context, c lexutil.LexClient, input *ModerationEmitEvent_Input) (*ModerationDefs_ModEventView, error) { var out ModerationDefs_ModEventView diff --git a/api/ozone/moderationqueryEvents.go b/api/ozone/moderationqueryEvents.go index bfd6bc31..04bb5951 100644 --- a/api/ozone/moderationqueryEvents.go +++ b/api/ozone/moderationqueryEvents.go @@ -32,7 +32,7 @@ type ModerationQueryEvents_Output struct { // removedLabels: If specified, only events where all of these labels were removed are returned // removedTags: If specified, only events where all of these tags were removed are returned // sortDirection: Sort direction for the events. Defaults to descending order of created at timestamp. -// subjectType: If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. +// subjectType: If specified, only events where the subject is of the given type (account, record, or conversation) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. // types: The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent) to filter by. If not specified, all events are returned. // withStrike: If specified, only events where strikeCount value is set are returned. func ModerationQueryEvents(ctx context.Context, c lexutil.LexClient, addedLabels []string, addedTags []string, ageAssuranceState string, batchId string, collections []string, comment string, createdAfter string, createdBefore string, createdBy string, cursor string, hasComment bool, includeAllUserRecords bool, limit int64, modTool []string, policies []string, removedLabels []string, removedTags []string, reportTypes []string, sortDirection string, subject string, subjectType string, types []string, withStrike bool) (*ModerationQueryEvents_Output, error) { diff --git a/api/ozone/moderationqueryStatuses.go b/api/ozone/moderationqueryStatuses.go index b455f3f3..ce3979c4 100644 --- a/api/ozone/moderationqueryStatuses.go +++ b/api/ozone/moderationqueryStatuses.go @@ -45,7 +45,7 @@ type ModerationQueryStatuses_Output struct { // reviewedAfter: Search subjects reviewed after a given timestamp // reviewedBefore: Search subjects reviewed before a given timestamp // subject: The subject to get the status for. -// subjectType: If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. +// subjectType: If specified, subjects of the given type (account, record, or conversation) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored. // takendown: Get subjects that were taken down func ModerationQueryStatuses(ctx context.Context, c lexutil.LexClient, ageAssuranceState string, appealed bool, collections []string, comment string, cursor string, excludeTags []string, hostingDeletedAfter string, hostingDeletedBefore string, hostingStatuses []string, hostingUpdatedAfter string, hostingUpdatedBefore string, ignoreSubjects []string, includeAllUserRecords bool, includeMuted bool, lastReviewedBy string, limit int64, minAccountSuspendCount int64, minPriorityScore int64, minReportedRecordsCount int64, minStrikeCount int64, minTakendownRecordsCount int64, onlyMuted bool, queueCount int64, queueIndex int64, queueSeed string, reportedAfter string, reportedBefore string, reviewState string, reviewedAfter string, reviewedBefore string, sortDirection string, sortField string, subject string, subjectType string, tags []string, takendown bool) (*ModerationQueryStatuses_Output, error) { var out ModerationQueryStatuses_Output diff --git a/api/ozone/queueassignModerator.go b/api/ozone/queueassignModerator.go new file mode 100644 index 00000000..7e8d82bb --- /dev/null +++ b/api/ozone/queueassignModerator.go @@ -0,0 +1,29 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.assignModerator + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueAssignModerator_Input is the input argument to a tools.ozone.queue.assignModerator call. +type QueueAssignModerator_Input struct { + // did: DID to be assigned. + Did string `json:"did" cborgen:"did"` + // queueId: The ID of the queue to assign the user to. + QueueId int64 `json:"queueId" cborgen:"queueId"` +} + +// QueueAssignModerator calls the XRPC method "tools.ozone.queue.assignModerator". +func QueueAssignModerator(ctx context.Context, c lexutil.LexClient, input *QueueAssignModerator_Input) (*QueueDefs_AssignmentView, error) { + var out QueueDefs_AssignmentView + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.queue.assignModerator", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/queuecreateQueue.go b/api/ozone/queuecreateQueue.go new file mode 100644 index 00000000..51de507d --- /dev/null +++ b/api/ozone/queuecreateQueue.go @@ -0,0 +1,40 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.createQueue + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueCreateQueue_Input is the input argument to a tools.ozone.queue.createQueue call. +type QueueCreateQueue_Input struct { + // collection: Collection name for record subjects. Required if subjectTypes includes 'record'. + Collection *string `json:"collection,omitempty" cborgen:"collection,omitempty"` + // description: Optional description of the queue + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + // name: Display name for the queue (must be unique) + Name string `json:"name" cborgen:"name"` + // reportTypes: Report reason types (fully qualified NSIDs) + ReportTypes []string `json:"reportTypes" cborgen:"reportTypes"` + // subjectTypes: Subject types this queue accepts + SubjectTypes []string `json:"subjectTypes" cborgen:"subjectTypes"` +} + +// QueueCreateQueue_Output is the output of a tools.ozone.queue.createQueue call. +type QueueCreateQueue_Output struct { + Queue *QueueDefs_QueueView `json:"queue" cborgen:"queue"` +} + +// QueueCreateQueue calls the XRPC method "tools.ozone.queue.createQueue". +func QueueCreateQueue(ctx context.Context, c lexutil.LexClient, input *QueueCreateQueue_Input) (*QueueCreateQueue_Output, error) { + var out QueueCreateQueue_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.queue.createQueue", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/queuedefs.go b/api/ozone/queuedefs.go new file mode 100644 index 00000000..3ebbc685 --- /dev/null +++ b/api/ozone/queuedefs.go @@ -0,0 +1,60 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.defs + +package ozone + +// QueueDefs_AssignmentView is a "assignmentView" in the tools.ozone.queue.defs schema. +type QueueDefs_AssignmentView struct { + Did string `json:"did" cborgen:"did"` + EndAt *string `json:"endAt,omitempty" cborgen:"endAt,omitempty"` + Id int64 `json:"id" cborgen:"id"` + // moderator: The moderator assigned to this queue + Moderator *TeamDefs_Member `json:"moderator,omitempty" cborgen:"moderator,omitempty"` + Queue *QueueDefs_QueueView `json:"queue" cborgen:"queue"` + StartAt string `json:"startAt" cborgen:"startAt"` +} + +// QueueDefs_QueueStats is a "queueStats" in the tools.ozone.queue.defs schema. +type QueueDefs_QueueStats struct { + // actionRate: Percentage of reports actioned (actionedCount / inboundCount * 100), rounded to nearest integer. Absent when inboundCount is 0. + ActionRate *int64 `json:"actionRate,omitempty" cborgen:"actionRate,omitempty"` + // actionedCount: Number of reports in 'closed' status + ActionedCount *int64 `json:"actionedCount,omitempty" cborgen:"actionedCount,omitempty"` + // avgHandlingTimeSec: Average time in seconds from report creation to close, for reports closed in this period. + AvgHandlingTimeSec *int64 `json:"avgHandlingTimeSec,omitempty" cborgen:"avgHandlingTimeSec,omitempty"` + // escalatedCount: Number of reports in 'escalated' status + EscalatedCount *int64 `json:"escalatedCount,omitempty" cborgen:"escalatedCount,omitempty"` + // inboundCount: Reports received in this queue in the last 24 hours. + InboundCount *int64 `json:"inboundCount,omitempty" cborgen:"inboundCount,omitempty"` + // lastUpdated: When these statistics were last computed + LastUpdated *string `json:"lastUpdated,omitempty" cborgen:"lastUpdated,omitempty"` + // pendingCount: Number of reports in 'open' status + PendingCount *int64 `json:"pendingCount,omitempty" cborgen:"pendingCount,omitempty"` +} + +// QueueDefs_QueueView is a "queueView" in the tools.ozone.queue.defs schema. +type QueueDefs_QueueView struct { + // collection: Collection name for record subjects (e.g., 'app.bsky.feed.post') + Collection *string `json:"collection,omitempty" cborgen:"collection,omitempty"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // createdBy: DID of moderator who created this queue + CreatedBy string `json:"createdBy" cborgen:"createdBy"` + // deletedAt: When the queue was deleted, if applicable + DeletedAt *string `json:"deletedAt,omitempty" cborgen:"deletedAt,omitempty"` + // description: Optional description of the queue + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + // enabled: Whether this queue is currently active + Enabled bool `json:"enabled" cborgen:"enabled"` + // id: Queue ID + Id int64 `json:"id" cborgen:"id"` + // name: Display name of the queue + Name string `json:"name" cborgen:"name"` + // reportTypes: Report reason types this queue accepts (fully qualified NSIDs) + ReportTypes []string `json:"reportTypes" cborgen:"reportTypes"` + // stats: Statistics about this queue + Stats *QueueDefs_QueueStats `json:"stats" cborgen:"stats"` + // subjectTypes: Subject types this queue accepts. + SubjectTypes []string `json:"subjectTypes" cborgen:"subjectTypes"` + UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` +} diff --git a/api/ozone/queuedeleteQueue.go b/api/ozone/queuedeleteQueue.go new file mode 100644 index 00000000..6775d9e5 --- /dev/null +++ b/api/ozone/queuedeleteQueue.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.deleteQueue + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueDeleteQueue_Input is the input argument to a tools.ozone.queue.deleteQueue call. +type QueueDeleteQueue_Input struct { + // migrateToQueueId: Optional: migrate all reports to this queue. If not specified, reports will be set to unassigned (-1). + MigrateToQueueId *int64 `json:"migrateToQueueId,omitempty" cborgen:"migrateToQueueId,omitempty"` + // queueId: ID of the queue to delete + QueueId int64 `json:"queueId" cborgen:"queueId"` +} + +// QueueDeleteQueue_Output is the output of a tools.ozone.queue.deleteQueue call. +type QueueDeleteQueue_Output struct { + Deleted bool `json:"deleted" cborgen:"deleted"` + // reportsMigrated: Number of reports that were migrated (if migration occurred) + ReportsMigrated *int64 `json:"reportsMigrated,omitempty" cborgen:"reportsMigrated,omitempty"` +} + +// QueueDeleteQueue calls the XRPC method "tools.ozone.queue.deleteQueue". +func QueueDeleteQueue(ctx context.Context, c lexutil.LexClient, input *QueueDeleteQueue_Input) (*QueueDeleteQueue_Output, error) { + var out QueueDeleteQueue_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.queue.deleteQueue", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/queuegetAssignments.go b/api/ozone/queuegetAssignments.go new file mode 100644 index 00000000..107d0360 --- /dev/null +++ b/api/ozone/queuegetAssignments.go @@ -0,0 +1,48 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.getAssignments + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueGetAssignments_Output is the output of a tools.ozone.queue.getAssignments call. +type QueueGetAssignments_Output struct { + Assignments []*QueueDefs_AssignmentView `json:"assignments" cborgen:"assignments"` + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` +} + +// QueueGetAssignments calls the XRPC method "tools.ozone.queue.getAssignments". +// +// dids: If specified, returns assignments for these moderators only. +// onlyActive: When true, only returns active assignments. +// queueIds: If specified, returns assignments for these queues only. +func QueueGetAssignments(ctx context.Context, c lexutil.LexClient, cursor string, dids []string, limit int64, onlyActive bool, queueIds []int64) (*QueueGetAssignments_Output, error) { + var out QueueGetAssignments_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if len(dids) != 0 { + params["dids"] = dids + } + if limit != 0 { + params["limit"] = limit + } + if onlyActive { + params["onlyActive"] = onlyActive + } + if len(queueIds) != 0 { + params["queueIds"] = queueIds + } + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.queue.getAssignments", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/queuelistQueues.go b/api/ozone/queuelistQueues.go new file mode 100644 index 00000000..77cb2199 --- /dev/null +++ b/api/ozone/queuelistQueues.go @@ -0,0 +1,52 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.listQueues + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueListQueues_Output is the output of a tools.ozone.queue.listQueues call. +type QueueListQueues_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Queues []*QueueDefs_QueueView `json:"queues" cborgen:"queues"` +} + +// QueueListQueues calls the XRPC method "tools.ozone.queue.listQueues". +// +// collection: Filter queues by collection name (e.g. 'app.bsky.feed.post'). +// enabled: Filter by enabled status. If not specified, returns all queues. +// reportTypes: Filter queues that handle any of these report reason types. +// subjectType: Filter queues that handle this subject type ('account' or 'record'). +func QueueListQueues(ctx context.Context, c lexutil.LexClient, collection string, cursor string, enabled bool, limit int64, reportTypes []string, subjectType string) (*QueueListQueues_Output, error) { + var out QueueListQueues_Output + + params := map[string]interface{}{} + if collection != "" { + params["collection"] = collection + } + if cursor != "" { + params["cursor"] = cursor + } + if enabled { + params["enabled"] = enabled + } + if limit != 0 { + params["limit"] = limit + } + if len(reportTypes) != 0 { + params["reportTypes"] = reportTypes + } + if subjectType != "" { + params["subjectType"] = subjectType + } + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.queue.listQueues", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/queuerouteReports.go b/api/ozone/queuerouteReports.go new file mode 100644 index 00000000..95d84737 --- /dev/null +++ b/api/ozone/queuerouteReports.go @@ -0,0 +1,37 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.routeReports + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueRouteReports_Input is the input argument to a tools.ozone.queue.routeReports call. +type QueueRouteReports_Input struct { + // endReportId: End of report ID range (inclusive). Difference between start and end must be less than 5,000. + EndReportId int64 `json:"endReportId" cborgen:"endReportId"` + // startReportId: Start of report ID range (inclusive). + StartReportId int64 `json:"startReportId" cborgen:"startReportId"` +} + +// QueueRouteReports_Output is the output of a tools.ozone.queue.routeReports call. +type QueueRouteReports_Output struct { + // assigned: The number of reports assigned to a queue. + Assigned int64 `json:"assigned" cborgen:"assigned"` + // unmatched: The number of reports with no matching queue. + Unmatched int64 `json:"unmatched" cborgen:"unmatched"` +} + +// QueueRouteReports calls the XRPC method "tools.ozone.queue.routeReports". +func QueueRouteReports(ctx context.Context, c lexutil.LexClient, input *QueueRouteReports_Input) (*QueueRouteReports_Output, error) { + var out QueueRouteReports_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.queue.routeReports", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/queueunassignModerator.go b/api/ozone/queueunassignModerator.go new file mode 100644 index 00000000..5202001c --- /dev/null +++ b/api/ozone/queueunassignModerator.go @@ -0,0 +1,28 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.unassignModerator + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueUnassignModerator_Input is the input argument to a tools.ozone.queue.unassignModerator call. +type QueueUnassignModerator_Input struct { + // did: DID to be unassigned. + Did string `json:"did" cborgen:"did"` + // queueId: The ID of the queue to unassign the user from. + QueueId int64 `json:"queueId" cborgen:"queueId"` +} + +// QueueUnassignModerator calls the XRPC method "tools.ozone.queue.unassignModerator". +func QueueUnassignModerator(ctx context.Context, c lexutil.LexClient, input *QueueUnassignModerator_Input) error { + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.queue.unassignModerator", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/ozone/queueupdateQueue.go b/api/ozone/queueupdateQueue.go new file mode 100644 index 00000000..985e4843 --- /dev/null +++ b/api/ozone/queueupdateQueue.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.queue.updateQueue + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// QueueUpdateQueue_Input is the input argument to a tools.ozone.queue.updateQueue call. +type QueueUpdateQueue_Input struct { + // description: Optional description of the queue + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + // enabled: Enable or disable the queue + Enabled *bool `json:"enabled,omitempty" cborgen:"enabled,omitempty"` + // name: New display name for the queue + Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + // queueId: ID of the queue to update + QueueId int64 `json:"queueId" cborgen:"queueId"` +} + +// QueueUpdateQueue_Output is the output of a tools.ozone.queue.updateQueue call. +type QueueUpdateQueue_Output struct { + Queue *QueueDefs_QueueView `json:"queue" cborgen:"queue"` +} + +// QueueUpdateQueue calls the XRPC method "tools.ozone.queue.updateQueue". +func QueueUpdateQueue(ctx context.Context, c lexutil.LexClient, input *QueueUpdateQueue_Input) (*QueueUpdateQueue_Output, error) { + var out QueueUpdateQueue_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.queue.updateQueue", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportassignModerator.go b/api/ozone/reportassignModerator.go new file mode 100644 index 00000000..1ce65800 --- /dev/null +++ b/api/ozone/reportassignModerator.go @@ -0,0 +1,33 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.assignModerator + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportAssignModerator_Input is the input argument to a tools.ozone.report.assignModerator call. +type ReportAssignModerator_Input struct { + // did: DID to be assigned. Defaults to the caller's DID. Admins may assign to any moderator. + Did *string `json:"did,omitempty" cborgen:"did,omitempty"` + // isPermanent: When true, the assignment has no expiry (endAt is null). Throws AlreadyAssigned if another user already has a permanent assignment on this report. + IsPermanent *bool `json:"isPermanent,omitempty" cborgen:"isPermanent,omitempty"` + // queueId: Optional queue ID to associate the assignment with. If not provided and the report has been assigned on a queue before, it will stay on that queue. + QueueId *int64 `json:"queueId,omitempty" cborgen:"queueId,omitempty"` + // reportId: The ID of the report to assign. + ReportId int64 `json:"reportId" cborgen:"reportId"` +} + +// ReportAssignModerator calls the XRPC method "tools.ozone.report.assignModerator". +func ReportAssignModerator(ctx context.Context, c lexutil.LexClient, input *ReportAssignModerator_Input) (*ReportDefs_AssignmentView, error) { + var out ReportDefs_AssignmentView + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.report.assignModerator", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportcreateActivity.go b/api/ozone/reportcreateActivity.go new file mode 100644 index 00000000..dc08d3ef --- /dev/null +++ b/api/ozone/reportcreateActivity.go @@ -0,0 +1,110 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.createActivity + +package ozone + +import ( + "context" + "encoding/json" + "fmt" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportCreateActivity_Input is the input argument to a tools.ozone.report.createActivity call. +type ReportCreateActivity_Input struct { + // activity: The type of activity to record. + Activity *ReportCreateActivity_Input_Activity `json:"activity" cborgen:"activity"` + // internalNote: Optional moderator-only note. Not visible to reporters. + InternalNote *string `json:"internalNote,omitempty" cborgen:"internalNote,omitempty"` + // isAutomated: Set true when this activity is triggered by an automated process. Defaults to false. + IsAutomated *bool `json:"isAutomated,omitempty" cborgen:"isAutomated,omitempty"` + // publicNote: Optional public-facing note, potentially visible to the reporter. + PublicNote *string `json:"publicNote,omitempty" cborgen:"publicNote,omitempty"` + // reportId: ID of the report to record activity on + ReportId int64 `json:"reportId" cborgen:"reportId"` +} + +// The type of activity to record. +type ReportCreateActivity_Input_Activity struct { + ReportDefs_QueueActivity *ReportDefs_QueueActivity + ReportDefs_AssignmentActivity *ReportDefs_AssignmentActivity + ReportDefs_EscalationActivity *ReportDefs_EscalationActivity + ReportDefs_CloseActivity *ReportDefs_CloseActivity + ReportDefs_ReopenActivity *ReportDefs_ReopenActivity + ReportDefs_NoteActivity *ReportDefs_NoteActivity +} + +func (t *ReportCreateActivity_Input_Activity) MarshalJSON() ([]byte, error) { + if t.ReportDefs_QueueActivity != nil { + t.ReportDefs_QueueActivity.LexiconTypeID = "tools.ozone.report.defs#queueActivity" + return json.Marshal(t.ReportDefs_QueueActivity) + } + if t.ReportDefs_AssignmentActivity != nil { + t.ReportDefs_AssignmentActivity.LexiconTypeID = "tools.ozone.report.defs#assignmentActivity" + return json.Marshal(t.ReportDefs_AssignmentActivity) + } + if t.ReportDefs_EscalationActivity != nil { + t.ReportDefs_EscalationActivity.LexiconTypeID = "tools.ozone.report.defs#escalationActivity" + return json.Marshal(t.ReportDefs_EscalationActivity) + } + if t.ReportDefs_CloseActivity != nil { + t.ReportDefs_CloseActivity.LexiconTypeID = "tools.ozone.report.defs#closeActivity" + return json.Marshal(t.ReportDefs_CloseActivity) + } + if t.ReportDefs_ReopenActivity != nil { + t.ReportDefs_ReopenActivity.LexiconTypeID = "tools.ozone.report.defs#reopenActivity" + return json.Marshal(t.ReportDefs_ReopenActivity) + } + if t.ReportDefs_NoteActivity != nil { + t.ReportDefs_NoteActivity.LexiconTypeID = "tools.ozone.report.defs#noteActivity" + return json.Marshal(t.ReportDefs_NoteActivity) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ReportCreateActivity_Input_Activity) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.report.defs#queueActivity": + t.ReportDefs_QueueActivity = new(ReportDefs_QueueActivity) + return json.Unmarshal(b, t.ReportDefs_QueueActivity) + case "tools.ozone.report.defs#assignmentActivity": + t.ReportDefs_AssignmentActivity = new(ReportDefs_AssignmentActivity) + return json.Unmarshal(b, t.ReportDefs_AssignmentActivity) + case "tools.ozone.report.defs#escalationActivity": + t.ReportDefs_EscalationActivity = new(ReportDefs_EscalationActivity) + return json.Unmarshal(b, t.ReportDefs_EscalationActivity) + case "tools.ozone.report.defs#closeActivity": + t.ReportDefs_CloseActivity = new(ReportDefs_CloseActivity) + return json.Unmarshal(b, t.ReportDefs_CloseActivity) + case "tools.ozone.report.defs#reopenActivity": + t.ReportDefs_ReopenActivity = new(ReportDefs_ReopenActivity) + return json.Unmarshal(b, t.ReportDefs_ReopenActivity) + case "tools.ozone.report.defs#noteActivity": + t.ReportDefs_NoteActivity = new(ReportDefs_NoteActivity) + return json.Unmarshal(b, t.ReportDefs_NoteActivity) + default: + return nil + } +} + +// ReportCreateActivity_Output is the output of a tools.ozone.report.createActivity call. +type ReportCreateActivity_Output struct { + Activity *ReportDefs_ReportActivityView `json:"activity" cborgen:"activity"` +} + +// ReportCreateActivity calls the XRPC method "tools.ozone.report.createActivity". +func ReportCreateActivity(ctx context.Context, c lexutil.LexClient, input *ReportCreateActivity_Input) (*ReportCreateActivity_Output, error) { + var out ReportCreateActivity_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.report.createActivity", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportdefs.go b/api/ozone/reportdefs.go index 4faad21e..39abeedb 100644 --- a/api/ozone/reportdefs.go +++ b/api/ozone/reportdefs.go @@ -3,3 +3,264 @@ // Lexicon schema: tools.ozone.report.defs package ozone + +import ( + "encoding/json" + "fmt" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportDefs_AssignmentActivity is a "assignmentActivity" in the tools.ozone.report.defs schema. +// +// Activity recording a moderator being assigned to a report. +type ReportDefs_AssignmentActivity struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.report.defs#assignmentActivity"` + // previousStatus: The report's status before this activity. Populated automatically from the report row; not required in input. + PreviousStatus *string `json:"previousStatus,omitempty" cborgen:"previousStatus,omitempty"` +} + +// ReportDefs_AssignmentView is a "assignmentView" in the tools.ozone.report.defs schema. +type ReportDefs_AssignmentView struct { + Did string `json:"did" cborgen:"did"` + EndAt *string `json:"endAt,omitempty" cborgen:"endAt,omitempty"` + Id int64 `json:"id" cborgen:"id"` + // moderator: The moderator assigned to this report + Moderator *TeamDefs_Member `json:"moderator,omitempty" cborgen:"moderator,omitempty"` + Queue *QueueDefs_QueueView `json:"queue,omitempty" cborgen:"queue,omitempty"` + ReportId int64 `json:"reportId" cborgen:"reportId"` + StartAt string `json:"startAt" cborgen:"startAt"` +} + +// ReportDefs_CloseActivity is a "closeActivity" in the tools.ozone.report.defs schema. +// +// Activity recording a report being closed. +type ReportDefs_CloseActivity struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.report.defs#closeActivity"` + // previousStatus: The report's status before this activity. Populated automatically from the report row; not required in input. + PreviousStatus *string `json:"previousStatus,omitempty" cborgen:"previousStatus,omitempty"` +} + +// ReportDefs_EscalationActivity is a "escalationActivity" in the tools.ozone.report.defs schema. +// +// Activity recording a report being escalated. +type ReportDefs_EscalationActivity struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.report.defs#escalationActivity"` + // previousStatus: The report's status before this activity. Populated automatically from the report row; not required in input. + PreviousStatus *string `json:"previousStatus,omitempty" cborgen:"previousStatus,omitempty"` +} + +// ReportDefs_HistoricalStats is a "historicalStats" in the tools.ozone.report.defs schema. +// +// A single daily snapshot of report statistics for a calendar date. +type ReportDefs_HistoricalStats struct { + // actionRate: Percentage of reports actioned (actionedCount / inboundCount * 100), rounded to nearest integer. + ActionRate *int64 `json:"actionRate,omitempty" cborgen:"actionRate,omitempty"` + // actionedCount: Number of reports closed during this day. + ActionedCount *int64 `json:"actionedCount,omitempty" cborgen:"actionedCount,omitempty"` + // avgHandlingTimeSec: Average time in seconds from report creation (or moderator assignment) to close. + AvgHandlingTimeSec *int64 `json:"avgHandlingTimeSec,omitempty" cborgen:"avgHandlingTimeSec,omitempty"` + // computedAt: When this snapshot was last computed. + ComputedAt *string `json:"computedAt,omitempty" cborgen:"computedAt,omitempty"` + // date: The calendar date this snapshot covers (YYYY-MM-DD). + Date string `json:"date" cborgen:"date"` + // escalatedCount: Number of reports escalated during this day. + EscalatedCount *int64 `json:"escalatedCount,omitempty" cborgen:"escalatedCount,omitempty"` + // inboundCount: Reports received during this day. + InboundCount *int64 `json:"inboundCount,omitempty" cborgen:"inboundCount,omitempty"` + // pendingCount: Number of reports not closed at time of computation. + PendingCount *int64 `json:"pendingCount,omitempty" cborgen:"pendingCount,omitempty"` +} + +// ReportDefs_LiveStats is a "liveStats" in the tools.ozone.report.defs schema. +// +// Live statistics for reports for the current calendar day, filterable by queue, moderator, or report type. +type ReportDefs_LiveStats struct { + // actionRate: Percentage of reports actioned (actionedCount / inboundCount * 100), rounded to nearest integer. + ActionRate *int64 `json:"actionRate,omitempty" cborgen:"actionRate,omitempty"` + // actionedCount: Number of reports closed today. + ActionedCount *int64 `json:"actionedCount,omitempty" cborgen:"actionedCount,omitempty"` + // avgHandlingTimeSec: Average time in seconds from report creation (or moderator assignment) to close. + AvgHandlingTimeSec *int64 `json:"avgHandlingTimeSec,omitempty" cborgen:"avgHandlingTimeSec,omitempty"` + // escalatedCount: Number of reports escalated today. + EscalatedCount *int64 `json:"escalatedCount,omitempty" cborgen:"escalatedCount,omitempty"` + // inboundCount: Reports received today. + InboundCount *int64 `json:"inboundCount,omitempty" cborgen:"inboundCount,omitempty"` + // lastUpdated: When these statistics were last computed. + LastUpdated *string `json:"lastUpdated,omitempty" cborgen:"lastUpdated,omitempty"` + // pendingCount: Number of reports currently not closed. + PendingCount *int64 `json:"pendingCount,omitempty" cborgen:"pendingCount,omitempty"` +} + +// ReportDefs_NoteActivity is a "noteActivity" in the tools.ozone.report.defs schema. +// +// Activity recording a note on a report. Use internalNote for moderator-only notes or publicNote for reporter-visible notes (or both). +type ReportDefs_NoteActivity struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.report.defs#noteActivity"` +} + +// ReportDefs_QueueActivity is a "queueActivity" in the tools.ozone.report.defs schema. +// +// Activity recording a report being routed to a queue. +type ReportDefs_QueueActivity struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.report.defs#queueActivity"` + // previousStatus: The report's status before this activity. Populated automatically from the report row; not required in input. + PreviousStatus *string `json:"previousStatus,omitempty" cborgen:"previousStatus,omitempty"` +} + +// ReportDefs_ReopenActivity is a "reopenActivity" in the tools.ozone.report.defs schema. +// +// Activity recording a closed report being reopened. Only valid when the report is in 'closed' status. +type ReportDefs_ReopenActivity struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=tools.ozone.report.defs#reopenActivity"` + // previousStatus: The report's status before this activity. Populated automatically from the report row; not required in input. + PreviousStatus *string `json:"previousStatus,omitempty" cborgen:"previousStatus,omitempty"` +} + +// ReportDefs_ReportActivityView is a "reportActivityView" in the tools.ozone.report.defs schema. +// +// A single activity entry on a report. +type ReportDefs_ReportActivityView struct { + // activity: The typed activity object describing what occurred. + Activity *ReportDefs_ReportActivityView_Activity `json:"activity" cborgen:"activity"` + // createdAt: When this activity was created + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // createdBy: DID of the actor who created this activity, or the service DID for automated activities. + CreatedBy string `json:"createdBy" cborgen:"createdBy"` + // id: Activity ID + Id int64 `json:"id" cborgen:"id"` + // internalNote: Optional moderator-only note. Not visible to reporters. + InternalNote *string `json:"internalNote,omitempty" cborgen:"internalNote,omitempty"` + // isAutomated: True if this activity was created by an automated process (e.g. queue router) rather than a direct human action. + IsAutomated bool `json:"isAutomated" cborgen:"isAutomated"` + // meta: Extensible JSON payload for loose activity-specific metadata (e.g. assignmentId). + Meta *interface{} `json:"meta,omitempty" cborgen:"meta,omitempty"` + // moderator: Full member record of the moderator who created this activity + Moderator *TeamDefs_Member `json:"moderator,omitempty" cborgen:"moderator,omitempty"` + // publicNote: Optional public note, potentially visible to the reporter. + PublicNote *string `json:"publicNote,omitempty" cborgen:"publicNote,omitempty"` + // reportId: ID of the report this activity belongs to + ReportId int64 `json:"reportId" cborgen:"reportId"` +} + +// The typed activity object describing what occurred. +type ReportDefs_ReportActivityView_Activity struct { + ReportDefs_QueueActivity *ReportDefs_QueueActivity + ReportDefs_AssignmentActivity *ReportDefs_AssignmentActivity + ReportDefs_EscalationActivity *ReportDefs_EscalationActivity + ReportDefs_CloseActivity *ReportDefs_CloseActivity + ReportDefs_ReopenActivity *ReportDefs_ReopenActivity + ReportDefs_NoteActivity *ReportDefs_NoteActivity +} + +func (t *ReportDefs_ReportActivityView_Activity) MarshalJSON() ([]byte, error) { + if t.ReportDefs_QueueActivity != nil { + t.ReportDefs_QueueActivity.LexiconTypeID = "tools.ozone.report.defs#queueActivity" + return json.Marshal(t.ReportDefs_QueueActivity) + } + if t.ReportDefs_AssignmentActivity != nil { + t.ReportDefs_AssignmentActivity.LexiconTypeID = "tools.ozone.report.defs#assignmentActivity" + return json.Marshal(t.ReportDefs_AssignmentActivity) + } + if t.ReportDefs_EscalationActivity != nil { + t.ReportDefs_EscalationActivity.LexiconTypeID = "tools.ozone.report.defs#escalationActivity" + return json.Marshal(t.ReportDefs_EscalationActivity) + } + if t.ReportDefs_CloseActivity != nil { + t.ReportDefs_CloseActivity.LexiconTypeID = "tools.ozone.report.defs#closeActivity" + return json.Marshal(t.ReportDefs_CloseActivity) + } + if t.ReportDefs_ReopenActivity != nil { + t.ReportDefs_ReopenActivity.LexiconTypeID = "tools.ozone.report.defs#reopenActivity" + return json.Marshal(t.ReportDefs_ReopenActivity) + } + if t.ReportDefs_NoteActivity != nil { + t.ReportDefs_NoteActivity.LexiconTypeID = "tools.ozone.report.defs#noteActivity" + return json.Marshal(t.ReportDefs_NoteActivity) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ReportDefs_ReportActivityView_Activity) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.report.defs#queueActivity": + t.ReportDefs_QueueActivity = new(ReportDefs_QueueActivity) + return json.Unmarshal(b, t.ReportDefs_QueueActivity) + case "tools.ozone.report.defs#assignmentActivity": + t.ReportDefs_AssignmentActivity = new(ReportDefs_AssignmentActivity) + return json.Unmarshal(b, t.ReportDefs_AssignmentActivity) + case "tools.ozone.report.defs#escalationActivity": + t.ReportDefs_EscalationActivity = new(ReportDefs_EscalationActivity) + return json.Unmarshal(b, t.ReportDefs_EscalationActivity) + case "tools.ozone.report.defs#closeActivity": + t.ReportDefs_CloseActivity = new(ReportDefs_CloseActivity) + return json.Unmarshal(b, t.ReportDefs_CloseActivity) + case "tools.ozone.report.defs#reopenActivity": + t.ReportDefs_ReopenActivity = new(ReportDefs_ReopenActivity) + return json.Unmarshal(b, t.ReportDefs_ReopenActivity) + case "tools.ozone.report.defs#noteActivity": + t.ReportDefs_NoteActivity = new(ReportDefs_NoteActivity) + return json.Unmarshal(b, t.ReportDefs_NoteActivity) + default: + return nil + } +} + +// ReportDefs_ReportAssignment is a "reportAssignment" in the tools.ozone.report.defs schema. +// +// Information about the moderator currently assigned to a report. +type ReportDefs_ReportAssignment struct { + // assignedAt: When the report was assigned + AssignedAt string `json:"assignedAt" cborgen:"assignedAt"` + // did: DID of the assigned moderator + Did string `json:"did" cborgen:"did"` + // moderator: Full member record of the assigned moderator + Moderator *TeamDefs_Member `json:"moderator,omitempty" cborgen:"moderator,omitempty"` +} + +// ReportDefs_ReportView is a "reportView" in the tools.ozone.report.defs schema. +type ReportDefs_ReportView struct { + // actionEventIds: Array of moderation event IDs representing actions taken on this report (sorted DESC, most recent first) + ActionEventIds []int64 `json:"actionEventIds,omitempty" cborgen:"actionEventIds,omitempty"` + // actionNote: Note sent to reporter when report was actioned + ActionNote *string `json:"actionNote,omitempty" cborgen:"actionNote,omitempty"` + // actions: Optional: expanded action events + Actions []*ModerationDefs_ModEventView `json:"actions,omitempty" cborgen:"actions,omitempty"` + // assignment: Information about moderator currently assigned to this report (if any) + Assignment *ReportDefs_ReportAssignment `json:"assignment,omitempty" cborgen:"assignment,omitempty"` + // comment: Comment provided by the reporter + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + // createdAt: When the report was created + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // eventId: ID of the moderation event that created this report + EventId int64 `json:"eventId" cborgen:"eventId"` + // id: Report ID + Id int64 `json:"id" cborgen:"id"` + // isMuted: Whether this report is muted. A report is muted if the reporter was muted or the subject was muted at the time the report was created. + IsMuted *bool `json:"isMuted,omitempty" cborgen:"isMuted,omitempty"` + // queue: The queue this report is assigned to (if any) + Queue *QueueDefs_QueueView `json:"queue,omitempty" cborgen:"queue,omitempty"` + // queuedAt: When the report was assigned to its current queue + QueuedAt *string `json:"queuedAt,omitempty" cborgen:"queuedAt,omitempty"` + // relatedReportCount: Number of other pending reports on the same subject + RelatedReportCount *int64 `json:"relatedReportCount,omitempty" cborgen:"relatedReportCount,omitempty"` + // reportType: Type of report + ReportType *string `json:"reportType" cborgen:"reportType"` + // reportedBy: DID of the user who made the report + ReportedBy string `json:"reportedBy" cborgen:"reportedBy"` + // reporter: Full subject view of the reporter account + Reporter *ModerationDefs_SubjectView `json:"reporter" cborgen:"reporter"` + // status: Current status of the report + Status string `json:"status" cborgen:"status"` + // subject: The subject that was reported with full details + Subject *ModerationDefs_SubjectView `json:"subject" cborgen:"subject"` + // subjectStatus: Current status of the reported subject + SubjectStatus *ModerationDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` + // updatedAt: When the report was last updated + UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` +} diff --git a/api/ozone/reportgetAssignments.go b/api/ozone/reportgetAssignments.go new file mode 100644 index 00000000..482235ec --- /dev/null +++ b/api/ozone/reportgetAssignments.go @@ -0,0 +1,48 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.getAssignments + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportGetAssignments_Output is the output of a tools.ozone.report.getAssignments call. +type ReportGetAssignments_Output struct { + Assignments []*ReportDefs_AssignmentView `json:"assignments" cborgen:"assignments"` + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` +} + +// ReportGetAssignments calls the XRPC method "tools.ozone.report.getAssignments". +// +// dids: If specified, returns assignments for these moderators only. +// onlyActive: When true, only returns active assignments. +// reportIds: If specified, returns assignments for these reports only. +func ReportGetAssignments(ctx context.Context, c lexutil.LexClient, cursor string, dids []string, limit int64, onlyActive bool, reportIds []int64) (*ReportGetAssignments_Output, error) { + var out ReportGetAssignments_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if len(dids) != 0 { + params["dids"] = dids + } + if limit != 0 { + params["limit"] = limit + } + if onlyActive { + params["onlyActive"] = onlyActive + } + if len(reportIds) != 0 { + params["reportIds"] = reportIds + } + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.getAssignments", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportgetHistoricalStats.go b/api/ozone/reportgetHistoricalStats.go new file mode 100644 index 00000000..1d17410c --- /dev/null +++ b/api/ozone/reportgetHistoricalStats.go @@ -0,0 +1,58 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.getHistoricalStats + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportGetHistoricalStats_Output is the output of a tools.ozone.report.getHistoricalStats call. +type ReportGetHistoricalStats_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Stats []*ReportDefs_HistoricalStats `json:"stats" cborgen:"stats"` +} + +// ReportGetHistoricalStats calls the XRPC method "tools.ozone.report.getHistoricalStats". +// +// cursor: Pagination cursor. +// endDate: Latest date to include (inclusive). +// limit: Maximum number of entries to return. +// moderatorDid: Filter stats by moderator DID. +// queueId: Filter stats by queue. Use -1 for unqueued reports. +// reportTypes: Filter stats by report types. +// startDate: Earliest date to include (inclusive). +func ReportGetHistoricalStats(ctx context.Context, c lexutil.LexClient, cursor string, endDate string, limit int64, moderatorDid string, queueId int64, reportTypes []string, startDate string) (*ReportGetHistoricalStats_Output, error) { + var out ReportGetHistoricalStats_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if endDate != "" { + params["endDate"] = endDate + } + if limit != 0 { + params["limit"] = limit + } + if moderatorDid != "" { + params["moderatorDid"] = moderatorDid + } + if queueId != 0 { + params["queueId"] = queueId + } + if len(reportTypes) != 0 { + params["reportTypes"] = reportTypes + } + if startDate != "" { + params["startDate"] = startDate + } + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.getHistoricalStats", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportgetLatestReport.go b/api/ozone/reportgetLatestReport.go new file mode 100644 index 00000000..b6b7cd4b --- /dev/null +++ b/api/ozone/reportgetLatestReport.go @@ -0,0 +1,28 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.getLatestReport + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportGetLatestReport_Output is the output of a tools.ozone.report.getLatestReport call. +type ReportGetLatestReport_Output struct { + Report *ReportDefs_ReportView `json:"report" cborgen:"report"` +} + +// ReportGetLatestReport calls the XRPC method "tools.ozone.report.getLatestReport". +func ReportGetLatestReport(ctx context.Context, c lexutil.LexClient) (*ReportGetLatestReport_Output, error) { + var out ReportGetLatestReport_Output + + params := map[string]interface{}{} + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.getLatestReport", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportgetLiveStats.go b/api/ozone/reportgetLiveStats.go new file mode 100644 index 00000000..8e42dbed --- /dev/null +++ b/api/ozone/reportgetLiveStats.go @@ -0,0 +1,42 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.getLiveStats + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportGetLiveStats_Output is the output of a tools.ozone.report.getLiveStats call. +type ReportGetLiveStats_Output struct { + // stats: Statistics for the requested filter. + Stats *ReportDefs_LiveStats `json:"stats" cborgen:"stats"` +} + +// ReportGetLiveStats calls the XRPC method "tools.ozone.report.getLiveStats". +// +// moderatorDid: Filter stats by moderator DID. +// queueId: Filter stats by queue. Use -1 for unqueued reports. +// reportTypes: Filter stats by report types. +func ReportGetLiveStats(ctx context.Context, c lexutil.LexClient, moderatorDid string, queueId int64, reportTypes []string) (*ReportGetLiveStats_Output, error) { + var out ReportGetLiveStats_Output + + params := map[string]interface{}{} + if moderatorDid != "" { + params["moderatorDid"] = moderatorDid + } + if queueId != 0 { + params["queueId"] = queueId + } + if len(reportTypes) != 0 { + params["reportTypes"] = reportTypes + } + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.getLiveStats", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportgetReport.go b/api/ozone/reportgetReport.go new file mode 100644 index 00000000..0240c8ef --- /dev/null +++ b/api/ozone/reportgetReport.go @@ -0,0 +1,26 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.getReport + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportGetReport calls the XRPC method "tools.ozone.report.getReport". +// +// id: The ID of the report to retrieve. +func ReportGetReport(ctx context.Context, c lexutil.LexClient, id int64) (*ReportDefs_ReportView, error) { + var out ReportDefs_ReportView + + params := map[string]interface{}{} + params["id"] = id + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.getReport", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportlistActivities.go b/api/ozone/reportlistActivities.go new file mode 100644 index 00000000..2e539aa1 --- /dev/null +++ b/api/ozone/reportlistActivities.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.listActivities + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportListActivities_Output is the output of a tools.ozone.report.listActivities call. +type ReportListActivities_Output struct { + Activities []*ReportDefs_ReportActivityView `json:"activities" cborgen:"activities"` + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` +} + +// ReportListActivities calls the XRPC method "tools.ozone.report.listActivities". +// +// reportId: ID of the report whose activities to list +func ReportListActivities(ctx context.Context, c lexutil.LexClient, cursor string, limit int64, reportId int64) (*ReportListActivities_Output, error) { + var out ReportListActivities_Output + + params := map[string]interface{}{} + if cursor != "" { + params["cursor"] = cursor + } + if limit != 0 { + params["limit"] = limit + } + params["reportId"] = reportId + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.listActivities", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportqueryReports.go b/api/ozone/reportqueryReports.go new file mode 100644 index 00000000..a87ce2b5 --- /dev/null +++ b/api/ozone/reportqueryReports.go @@ -0,0 +1,84 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.queryReports + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportQueryReports_Output is the output of a tools.ozone.report.queryReports call. +type ReportQueryReports_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Reports []*ReportDefs_ReportView `json:"reports" cborgen:"reports"` +} + +// ReportQueryReports calls the XRPC method "tools.ozone.report.queryReports". +// +// assignedTo: Filter by the DID of the moderator permanently assigned to the report. +// collections: If specified, reports where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. +// did: Filter to reports where the subject is this DID or any record owned by this DID. Unlike `subject` (which scopes to a specific account or record), this returns all reports tied to the DID across both account-level and record-level subjects. +// isMuted: Filter by muted status. true returns only muted reports, false returns only unmuted reports. Defaults to false. +// queueId: Filter by queue ID. Use -1 for unassigned reports. +// reportTypes: Filter by report types (fully qualified string in the format of com.atproto.moderation.defs#reason). +// reportedAfter: Retrieve reports created after a given timestamp +// reportedBefore: Retrieve reports created before a given timestamp +// status: Filter by report status. +// subject: Filter by subject DID or AT-URI. +// subjectType: If specified, reports of the given type (account or record) will be returned. +func ReportQueryReports(ctx context.Context, c lexutil.LexClient, assignedTo string, collections []string, cursor string, did string, isMuted bool, limit int64, queueId int64, reportTypes []string, reportedAfter string, reportedBefore string, sortDirection string, sortField string, status string, subject string, subjectType string) (*ReportQueryReports_Output, error) { + var out ReportQueryReports_Output + + params := map[string]interface{}{} + if assignedTo != "" { + params["assignedTo"] = assignedTo + } + if len(collections) != 0 { + params["collections"] = collections + } + if cursor != "" { + params["cursor"] = cursor + } + if did != "" { + params["did"] = did + } + if isMuted { + params["isMuted"] = isMuted + } + if limit != 0 { + params["limit"] = limit + } + if queueId != 0 { + params["queueId"] = queueId + } + if len(reportTypes) != 0 { + params["reportTypes"] = reportTypes + } + if reportedAfter != "" { + params["reportedAfter"] = reportedAfter + } + if reportedBefore != "" { + params["reportedBefore"] = reportedBefore + } + if sortDirection != "" { + params["sortDirection"] = sortDirection + } + if sortField != "" { + params["sortField"] = sortField + } + params["status"] = status + if subject != "" { + params["subject"] = subject + } + if subjectType != "" { + params["subjectType"] = subjectType + } + if err := c.LexDo(ctx, lexutil.Query, "", "tools.ozone.report.queryReports", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportreassignQueue.go b/api/ozone/reportreassignQueue.go new file mode 100644 index 00000000..aefa252e --- /dev/null +++ b/api/ozone/reportreassignQueue.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.reassignQueue + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportReassignQueue_Input is the input argument to a tools.ozone.report.reassignQueue call. +type ReportReassignQueue_Input struct { + // comment: Optional moderator-only note recorded on the resulting queueActivity as internalNote. + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + // queueId: Target queue ID. Use -1 to unassign from any queue. + QueueId int64 `json:"queueId" cborgen:"queueId"` + // reportId: ID of the report to reassign + ReportId int64 `json:"reportId" cborgen:"reportId"` +} + +// ReportReassignQueue_Output is the output of a tools.ozone.report.reassignQueue call. +type ReportReassignQueue_Output struct { + Report *ReportDefs_ReportView `json:"report" cborgen:"report"` +} + +// ReportReassignQueue calls the XRPC method "tools.ozone.report.reassignQueue". +func ReportReassignQueue(ctx context.Context, c lexutil.LexClient, input *ReportReassignQueue_Input) (*ReportReassignQueue_Output, error) { + var out ReportReassignQueue_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.report.reassignQueue", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportrefreshStats.go b/api/ozone/reportrefreshStats.go new file mode 100644 index 00000000..6751a858 --- /dev/null +++ b/api/ozone/reportrefreshStats.go @@ -0,0 +1,35 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.refreshStats + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportRefreshStats_Input is the input argument to a tools.ozone.report.refreshStats call. +type ReportRefreshStats_Input struct { + // endDate: End date for recomputation, inclusive (YYYY-MM-DD). + EndDate string `json:"endDate" cborgen:"endDate"` + // queueIds: Optional list of queue IDs to recompute. Omit to recompute all groups. + QueueIds []int64 `json:"queueIds,omitempty" cborgen:"queueIds,omitempty"` + // startDate: Start date for recomputation, inclusive (YYYY-MM-DD). + StartDate string `json:"startDate" cborgen:"startDate"` +} + +// ReportRefreshStats_Output is the output of a tools.ozone.report.refreshStats call. +type ReportRefreshStats_Output struct { +} + +// ReportRefreshStats calls the XRPC method "tools.ozone.report.refreshStats". +func ReportRefreshStats(ctx context.Context, c lexutil.LexClient, input *ReportRefreshStats_Input) (*ReportRefreshStats_Output, error) { + var out ReportRefreshStats_Output + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.report.refreshStats", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/reportunassignModerator.go b/api/ozone/reportunassignModerator.go new file mode 100644 index 00000000..03c47363 --- /dev/null +++ b/api/ozone/reportunassignModerator.go @@ -0,0 +1,27 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: tools.ozone.report.unassignModerator + +package ozone + +import ( + "context" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// ReportUnassignModerator_Input is the input argument to a tools.ozone.report.unassignModerator call. +type ReportUnassignModerator_Input struct { + // reportId: The ID of the report to unassign. + ReportId int64 `json:"reportId" cborgen:"reportId"` +} + +// ReportUnassignModerator calls the XRPC method "tools.ozone.report.unassignModerator". +func ReportUnassignModerator(ctx context.Context, c lexutil.LexClient, input *ReportUnassignModerator_Input) (*ReportDefs_AssignmentView, error) { + var out ReportDefs_AssignmentView + if err := c.LexDo(ctx, lexutil.Procedure, "application/json", "tools.ozone.report.unassignModerator", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/gen/main.go b/gen/main.go index 9d7e24c6..c2eb1c84 100644 --- a/gen/main.go +++ b/gen/main.go @@ -86,6 +86,7 @@ func main() { if err := genCfg.WriteMapEncodersToFile("api/chat/cbor_gen.go", "chat", chat.ActorDeclaration{}, + chat.EmbedJoinLink{}, ); err != nil { panic(err) } -- 2.51.2