From 948e5a4baf6380088ae0417535335a45865817d1 Mon Sep 17 00:00:00 2001 From: Foysal Ahamed Date: Fri, 3 Jan 2025 23:17:07 +0000 Subject: [PATCH 1/2] :sparkles: Add new typedefs from ozone api changes --- api/ozone/moderationdefs.go | 165 ++++++++++++++++++++++++++- api/ozone/moderationemitEvent.go | 24 ++++ api/ozone/moderationqueryEvents.go | 5 +- api/ozone/moderationqueryStatuses.go | 18 ++- api/ozone/settingdefs.go | 23 ++++ api/ozone/settinglistOptions.go | 38 ++++++ api/ozone/settingremoveOptions.go | 31 +++++ api/ozone/settingupsertOption.go | 36 ++++++ 8 files changed, 331 insertions(+), 9 deletions(-) create mode 100644 api/ozone/settingdefs.go create mode 100644 api/ozone/settinglistOptions.go create mode 100644 api/ozone/settingremoveOptions.go create mode 100644 api/ozone/settingupsertOption.go diff --git a/api/ozone/moderationdefs.go b/api/ozone/moderationdefs.go index f419676ec..b7d864497 100644 --- a/api/ozone/moderationdefs.go +++ b/api/ozone/moderationdefs.go @@ -13,6 +13,33 @@ import ( "github.com/bluesky-social/indigo/lex/util" ) +// ModerationDefs_AccountEvent is a "accountEvent" in the tools.ozone.moderation.defs schema. +// +// Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. +// +// RECORDTYPE: ModerationDefs_AccountEvent +type ModerationDefs_AccountEvent struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#accountEvent" cborgen:"$type,const=tools.ozone.moderation.defs#accountEvent"` + // active: Indicates that the account has a repository which can be fetched from the host that emitted this event. + Active bool `json:"active" cborgen:"active"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + Status *string `json:"status,omitempty" cborgen:"status,omitempty"` + Timestamp string `json:"timestamp" cborgen:"timestamp"` +} + +// ModerationDefs_AccountHosting is a "accountHosting" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_AccountHosting +type ModerationDefs_AccountHosting struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#accountHosting" cborgen:"$type,const=tools.ozone.moderation.defs#accountHosting"` + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` + DeactivatedAt *string `json:"deactivatedAt,omitempty" cborgen:"deactivatedAt,omitempty"` + DeletedAt *string `json:"deletedAt,omitempty" cborgen:"deletedAt,omitempty"` + ReactivatedAt *string `json:"reactivatedAt,omitempty" cborgen:"reactivatedAt,omitempty"` + Status string `json:"status" cborgen:"status"` + UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` +} + // ModerationDefs_BlobView is a "blobView" in the tools.ozone.moderation.defs schema. type ModerationDefs_BlobView struct { Cid string `json:"cid" cborgen:"cid"` @@ -58,6 +85,20 @@ func (t *ModerationDefs_BlobView_Details) UnmarshalJSON(b []byte) error { } } +// 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. +// +// RECORDTYPE: ModerationDefs_IdentityEvent +type ModerationDefs_IdentityEvent struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#identityEvent" cborgen:"$type,const=tools.ozone.moderation.defs#identityEvent"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + Handle *string `json:"handle,omitempty" cborgen:"handle,omitempty"` + PdsHost *string `json:"pdsHost,omitempty" cborgen:"pdsHost,omitempty"` + Timestamp string `json:"timestamp" cborgen:"timestamp"` + Tombstone *bool `json:"tombstone,omitempty" cborgen:"tombstone,omitempty"` +} + // ModerationDefs_ImageDetails is a "imageDetails" in the tools.ozone.moderation.defs schema. // // RECORDTYPE: ModerationDefs_ImageDetails @@ -71,8 +112,10 @@ type ModerationDefs_ImageDetails struct { // // RECORDTYPE: ModerationDefs_ModEventAcknowledge type ModerationDefs_ModEventAcknowledge struct { - LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventAcknowledge" cborgen:"$type,const=tools.ozone.moderation.defs#modEventAcknowledge"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventAcknowledge" cborgen:"$type,const=tools.ozone.moderation.defs#modEventAcknowledge"` + // acknowledgeAccountSubjects: If true, all other reports on content authored by this account will be resolved (acknowledged). + AcknowledgeAccountSubjects *bool `json:"acknowledgeAccountSubjects,omitempty" cborgen:"acknowledgeAccountSubjects,omitempty"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` } // ModerationDefs_ModEventComment is a "modEventComment" in the tools.ozone.moderation.defs schema. @@ -152,8 +195,8 @@ type ModerationDefs_ModEventMute struct { type ModerationDefs_ModEventMuteReporter struct { LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventMuteReporter" cborgen:"$type,const=tools.ozone.moderation.defs#modEventMuteReporter"` Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - // durationInHours: Indicates how long the account should remain muted. - DurationInHours int64 `json:"durationInHours" cborgen:"durationInHours"` + // durationInHours: Indicates how long the account should remain muted. Falsy value here means a permanent mute. + DurationInHours *int64 `json:"durationInHours,omitempty" cborgen:"durationInHours,omitempty"` } // ModerationDefs_ModEventReport is a "modEventReport" in the tools.ozone.moderation.defs schema. @@ -218,6 +261,8 @@ type ModerationDefs_ModEventTakedown struct { Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` // durationInHours: Indicates how long the takedown should be in effect before automatically expiring. DurationInHours *int64 `json:"durationInHours,omitempty" cborgen:"durationInHours,omitempty"` + // policies: Names/Keywords of the policies that drove the decision. + Policies []string `json:"policies,omitempty" cborgen:"policies,omitempty"` } // ModerationDefs_ModEventUnmute is a "modEventUnmute" in the tools.ozone.moderation.defs schema. @@ -280,6 +325,9 @@ type ModerationDefs_ModEventViewDetail_Event struct { ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal ModerationDefs_ModEventDivert *ModerationDefs_ModEventDivert ModerationDefs_ModEventTag *ModerationDefs_ModEventTag + ModerationDefs_AccountEvent *ModerationDefs_AccountEvent + ModerationDefs_IdentityEvent *ModerationDefs_IdentityEvent + ModerationDefs_RecordEvent *ModerationDefs_RecordEvent } func (t *ModerationDefs_ModEventViewDetail_Event) MarshalJSON() ([]byte, error) { @@ -343,6 +391,18 @@ func (t *ModerationDefs_ModEventViewDetail_Event) MarshalJSON() ([]byte, error) t.ModerationDefs_ModEventTag.LexiconTypeID = "tools.ozone.moderation.defs#modEventTag" return json.Marshal(t.ModerationDefs_ModEventTag) } + if t.ModerationDefs_AccountEvent != nil { + t.ModerationDefs_AccountEvent.LexiconTypeID = "tools.ozone.moderation.defs#accountEvent" + return json.Marshal(t.ModerationDefs_AccountEvent) + } + if t.ModerationDefs_IdentityEvent != nil { + t.ModerationDefs_IdentityEvent.LexiconTypeID = "tools.ozone.moderation.defs#identityEvent" + return json.Marshal(t.ModerationDefs_IdentityEvent) + } + if t.ModerationDefs_RecordEvent != nil { + t.ModerationDefs_RecordEvent.LexiconTypeID = "tools.ozone.moderation.defs#recordEvent" + return json.Marshal(t.ModerationDefs_RecordEvent) + } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *ModerationDefs_ModEventViewDetail_Event) UnmarshalJSON(b []byte) error { @@ -397,6 +457,15 @@ func (t *ModerationDefs_ModEventViewDetail_Event) UnmarshalJSON(b []byte) error case "tools.ozone.moderation.defs#modEventTag": t.ModerationDefs_ModEventTag = new(ModerationDefs_ModEventTag) return json.Unmarshal(b, t.ModerationDefs_ModEventTag) + case "tools.ozone.moderation.defs#accountEvent": + t.ModerationDefs_AccountEvent = new(ModerationDefs_AccountEvent) + return json.Unmarshal(b, t.ModerationDefs_AccountEvent) + case "tools.ozone.moderation.defs#identityEvent": + t.ModerationDefs_IdentityEvent = new(ModerationDefs_IdentityEvent) + return json.Unmarshal(b, t.ModerationDefs_IdentityEvent) + case "tools.ozone.moderation.defs#recordEvent": + t.ModerationDefs_RecordEvent = new(ModerationDefs_RecordEvent) + return json.Unmarshal(b, t.ModerationDefs_RecordEvent) default: return nil @@ -470,6 +539,9 @@ type ModerationDefs_ModEventView_Event struct { ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal ModerationDefs_ModEventDivert *ModerationDefs_ModEventDivert ModerationDefs_ModEventTag *ModerationDefs_ModEventTag + ModerationDefs_AccountEvent *ModerationDefs_AccountEvent + ModerationDefs_IdentityEvent *ModerationDefs_IdentityEvent + ModerationDefs_RecordEvent *ModerationDefs_RecordEvent } func (t *ModerationDefs_ModEventView_Event) MarshalJSON() ([]byte, error) { @@ -533,6 +605,18 @@ func (t *ModerationDefs_ModEventView_Event) MarshalJSON() ([]byte, error) { t.ModerationDefs_ModEventTag.LexiconTypeID = "tools.ozone.moderation.defs#modEventTag" return json.Marshal(t.ModerationDefs_ModEventTag) } + if t.ModerationDefs_AccountEvent != nil { + t.ModerationDefs_AccountEvent.LexiconTypeID = "tools.ozone.moderation.defs#accountEvent" + return json.Marshal(t.ModerationDefs_AccountEvent) + } + if t.ModerationDefs_IdentityEvent != nil { + t.ModerationDefs_IdentityEvent.LexiconTypeID = "tools.ozone.moderation.defs#identityEvent" + return json.Marshal(t.ModerationDefs_IdentityEvent) + } + if t.ModerationDefs_RecordEvent != nil { + t.ModerationDefs_RecordEvent.LexiconTypeID = "tools.ozone.moderation.defs#recordEvent" + return json.Marshal(t.ModerationDefs_RecordEvent) + } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *ModerationDefs_ModEventView_Event) UnmarshalJSON(b []byte) error { @@ -587,6 +671,15 @@ func (t *ModerationDefs_ModEventView_Event) UnmarshalJSON(b []byte) error { case "tools.ozone.moderation.defs#modEventTag": t.ModerationDefs_ModEventTag = new(ModerationDefs_ModEventTag) return json.Unmarshal(b, t.ModerationDefs_ModEventTag) + case "tools.ozone.moderation.defs#accountEvent": + t.ModerationDefs_AccountEvent = new(ModerationDefs_AccountEvent) + return json.Unmarshal(b, t.ModerationDefs_AccountEvent) + case "tools.ozone.moderation.defs#identityEvent": + t.ModerationDefs_IdentityEvent = new(ModerationDefs_IdentityEvent) + return json.Unmarshal(b, t.ModerationDefs_IdentityEvent) + case "tools.ozone.moderation.defs#recordEvent": + t.ModerationDefs_RecordEvent = new(ModerationDefs_RecordEvent) + return json.Unmarshal(b, t.ModerationDefs_RecordEvent) default: return nil @@ -646,6 +739,30 @@ type ModerationDefs_ModerationDetail struct { SubjectStatus *ModerationDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` } +// ModerationDefs_RecordEvent is a "recordEvent" in the tools.ozone.moderation.defs schema. +// +// Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking. +// +// RECORDTYPE: ModerationDefs_RecordEvent +type ModerationDefs_RecordEvent struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#recordEvent" cborgen:"$type,const=tools.ozone.moderation.defs#recordEvent"` + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + Op string `json:"op" cborgen:"op"` + Timestamp string `json:"timestamp" cborgen:"timestamp"` +} + +// ModerationDefs_RecordHosting is a "recordHosting" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_RecordHosting +type ModerationDefs_RecordHosting struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#recordHosting" cborgen:"$type,const=tools.ozone.moderation.defs#recordHosting"` + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` + DeletedAt *string `json:"deletedAt,omitempty" cborgen:"deletedAt,omitempty"` + Status string `json:"status" cborgen:"status"` + UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` +} + // ModerationDefs_RecordView is a "recordView" in the tools.ozone.moderation.defs schema. // // RECORDTYPE: ModerationDefs_RecordView @@ -737,8 +854,9 @@ type ModerationDefs_SubjectStatusView struct { // comment: Sticky comment on the subject. Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` // createdAt: Timestamp referencing the first moderation status impacting event was emitted on the subject - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Id int64 `json:"id" cborgen:"id"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Hosting *ModerationDefs_SubjectStatusView_Hosting `json:"hosting,omitempty" cborgen:"hosting,omitempty"` + Id int64 `json:"id" cborgen:"id"` // lastAppealedAt: Timestamp referencing when the author of the subject appealed a moderation action LastAppealedAt *string `json:"lastAppealedAt,omitempty" cborgen:"lastAppealedAt,omitempty"` LastReportedAt *string `json:"lastReportedAt,omitempty" cborgen:"lastReportedAt,omitempty"` @@ -757,6 +875,41 @@ type ModerationDefs_SubjectStatusView struct { UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` } +type ModerationDefs_SubjectStatusView_Hosting struct { + ModerationDefs_AccountHosting *ModerationDefs_AccountHosting + ModerationDefs_RecordHosting *ModerationDefs_RecordHosting +} + +func (t *ModerationDefs_SubjectStatusView_Hosting) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_AccountHosting != nil { + t.ModerationDefs_AccountHosting.LexiconTypeID = "tools.ozone.moderation.defs#accountHosting" + return json.Marshal(t.ModerationDefs_AccountHosting) + } + if t.ModerationDefs_RecordHosting != nil { + t.ModerationDefs_RecordHosting.LexiconTypeID = "tools.ozone.moderation.defs#recordHosting" + return json.Marshal(t.ModerationDefs_RecordHosting) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_SubjectStatusView_Hosting) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.moderation.defs#accountHosting": + t.ModerationDefs_AccountHosting = new(ModerationDefs_AccountHosting) + return json.Unmarshal(b, t.ModerationDefs_AccountHosting) + case "tools.ozone.moderation.defs#recordHosting": + t.ModerationDefs_RecordHosting = new(ModerationDefs_RecordHosting) + return json.Unmarshal(b, t.ModerationDefs_RecordHosting) + + default: + return nil + } +} + type ModerationDefs_SubjectStatusView_Subject struct { AdminDefs_RepoRef *comatprototypes.AdminDefs_RepoRef RepoStrongRef *comatprototypes.RepoStrongRef diff --git a/api/ozone/moderationemitEvent.go b/api/ozone/moderationemitEvent.go index 064eef3a6..09f8f3497 100644 --- a/api/ozone/moderationemitEvent.go +++ b/api/ozone/moderationemitEvent.go @@ -37,6 +37,9 @@ type ModerationEmitEvent_Input_Event struct { ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal ModerationDefs_ModEventEmail *ModerationDefs_ModEventEmail ModerationDefs_ModEventTag *ModerationDefs_ModEventTag + ModerationDefs_AccountEvent *ModerationDefs_AccountEvent + ModerationDefs_IdentityEvent *ModerationDefs_IdentityEvent + ModerationDefs_RecordEvent *ModerationDefs_RecordEvent } func (t *ModerationEmitEvent_Input_Event) MarshalJSON() ([]byte, error) { @@ -96,6 +99,18 @@ func (t *ModerationEmitEvent_Input_Event) MarshalJSON() ([]byte, error) { t.ModerationDefs_ModEventTag.LexiconTypeID = "tools.ozone.moderation.defs#modEventTag" return json.Marshal(t.ModerationDefs_ModEventTag) } + if t.ModerationDefs_AccountEvent != nil { + t.ModerationDefs_AccountEvent.LexiconTypeID = "tools.ozone.moderation.defs#accountEvent" + return json.Marshal(t.ModerationDefs_AccountEvent) + } + if t.ModerationDefs_IdentityEvent != nil { + t.ModerationDefs_IdentityEvent.LexiconTypeID = "tools.ozone.moderation.defs#identityEvent" + return json.Marshal(t.ModerationDefs_IdentityEvent) + } + if t.ModerationDefs_RecordEvent != nil { + t.ModerationDefs_RecordEvent.LexiconTypeID = "tools.ozone.moderation.defs#recordEvent" + return json.Marshal(t.ModerationDefs_RecordEvent) + } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *ModerationEmitEvent_Input_Event) UnmarshalJSON(b []byte) error { @@ -147,6 +162,15 @@ func (t *ModerationEmitEvent_Input_Event) UnmarshalJSON(b []byte) error { case "tools.ozone.moderation.defs#modEventTag": t.ModerationDefs_ModEventTag = new(ModerationDefs_ModEventTag) return json.Unmarshal(b, t.ModerationDefs_ModEventTag) + case "tools.ozone.moderation.defs#accountEvent": + t.ModerationDefs_AccountEvent = new(ModerationDefs_AccountEvent) + return json.Unmarshal(b, t.ModerationDefs_AccountEvent) + case "tools.ozone.moderation.defs#identityEvent": + t.ModerationDefs_IdentityEvent = new(ModerationDefs_IdentityEvent) + return json.Unmarshal(b, t.ModerationDefs_IdentityEvent) + case "tools.ozone.moderation.defs#recordEvent": + t.ModerationDefs_RecordEvent = new(ModerationDefs_RecordEvent) + return json.Unmarshal(b, t.ModerationDefs_RecordEvent) default: return nil diff --git a/api/ozone/moderationqueryEvents.go b/api/ozone/moderationqueryEvents.go index 1be68412f..351f5eb7e 100644 --- a/api/ozone/moderationqueryEvents.go +++ b/api/ozone/moderationqueryEvents.go @@ -21,7 +21,7 @@ type ModerationQueryEvents_Output struct { // addedLabels: If specified, only events where all of these labels were added are returned // addedTags: If specified, only events where all of these tags were added are returned // collections: If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored. -// comment: If specified, only events with comments containing the keyword are returned +// comment: If specified, only events with comments containing the keyword are returned. Apply || separator to use multiple keywords and match using OR condition. // createdAfter: Retrieve events created after a given timestamp // createdBefore: Retrieve events created before a given timestamp // hasComment: If true, only events with comments are returned @@ -31,7 +31,7 @@ type ModerationQueryEvents_Output struct { // 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. // 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. -func ModerationQueryEvents(ctx context.Context, c *xrpc.Client, addedLabels []string, addedTags []string, collections []string, comment string, createdAfter string, createdBefore string, createdBy string, cursor string, hasComment bool, includeAllUserRecords bool, limit int64, removedLabels []string, removedTags []string, reportTypes []string, sortDirection string, subject string, subjectType string, types []string) (*ModerationQueryEvents_Output, error) { +func ModerationQueryEvents(ctx context.Context, c *xrpc.Client, addedLabels []string, addedTags []string, collections []string, comment string, createdAfter string, createdBefore string, createdBy string, cursor string, hasComment bool, includeAllUserRecords bool, limit int64, policies []string, removedLabels []string, removedTags []string, reportTypes []string, sortDirection string, subject string, subjectType string, types []string) (*ModerationQueryEvents_Output, error) { var out ModerationQueryEvents_Output params := map[string]interface{}{ @@ -46,6 +46,7 @@ func ModerationQueryEvents(ctx context.Context, c *xrpc.Client, addedLabels []st "hasComment": hasComment, "includeAllUserRecords": includeAllUserRecords, "limit": limit, + "policies": policies, "removedLabels": removedLabels, "removedTags": removedTags, "reportTypes": reportTypes, diff --git a/api/ozone/moderationqueryStatuses.go b/api/ozone/moderationqueryStatuses.go index 969d77e9d..65e99d33d 100644 --- a/api/ozone/moderationqueryStatuses.go +++ b/api/ozone/moderationqueryStatuses.go @@ -21,10 +21,18 @@ type ModerationQueryStatuses_Output struct { // appealed: Get subjects in unresolved appealed status // collections: If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored. // comment: Search subjects by keyword from comments +// hostingDeletedAfter: Search subjects where the associated record/account was deleted after a given timestamp +// hostingDeletedBefore: Search subjects where the associated record/account was deleted before a given timestamp +// hostingStatuses: Search subjects by the status of the associated record/account +// hostingUpdatedAfter: Search subjects where the associated record/account was updated after a given timestamp +// hostingUpdatedBefore: Search subjects where the associated record/account was updated before a given timestamp // includeAllUserRecords: All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned. // includeMuted: By default, we don't include muted subjects in the results. Set this to true to include them. // lastReviewedBy: Get all subject statuses that were reviewed by a specific moderator // onlyMuted: When set to true, only muted subjects and reporters will be returned. +// queueCount: Number of queues being used by moderators. Subjects will be split among all queues. +// queueIndex: Index of the queue to fetch subjects from. Works only when queueCount value is specified. +// queueSeed: A seeder to shuffle/balance the queue items. // reportedAfter: Search subjects reported after a given timestamp // reportedBefore: Search subjects reported before a given timestamp // reviewState: Specify when fetching subjects in a certain state @@ -33,7 +41,7 @@ type ModerationQueryStatuses_Output struct { // 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. // takendown: Get subjects that were taken down -func ModerationQueryStatuses(ctx context.Context, c *xrpc.Client, appealed bool, collections []string, comment string, cursor string, excludeTags []string, ignoreSubjects []string, includeAllUserRecords bool, includeMuted bool, lastReviewedBy string, limit int64, onlyMuted bool, 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) { +func ModerationQueryStatuses(ctx context.Context, c *xrpc.Client, 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, 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 params := map[string]interface{}{ @@ -42,12 +50,20 @@ func ModerationQueryStatuses(ctx context.Context, c *xrpc.Client, appealed bool, "comment": comment, "cursor": cursor, "excludeTags": excludeTags, + "hostingDeletedAfter": hostingDeletedAfter, + "hostingDeletedBefore": hostingDeletedBefore, + "hostingStatuses": hostingStatuses, + "hostingUpdatedAfter": hostingUpdatedAfter, + "hostingUpdatedBefore": hostingUpdatedBefore, "ignoreSubjects": ignoreSubjects, "includeAllUserRecords": includeAllUserRecords, "includeMuted": includeMuted, "lastReviewedBy": lastReviewedBy, "limit": limit, "onlyMuted": onlyMuted, + "queueCount": queueCount, + "queueIndex": queueIndex, + "queueSeed": queueSeed, "reportedAfter": reportedAfter, "reportedBefore": reportedBefore, "reviewState": reviewState, diff --git a/api/ozone/settingdefs.go b/api/ozone/settingdefs.go new file mode 100644 index 000000000..ccf334413 --- /dev/null +++ b/api/ozone/settingdefs.go @@ -0,0 +1,23 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.setting.defs + +import ( + "github.com/bluesky-social/indigo/lex/util" +) + +// SettingDefs_Option is a "option" in the tools.ozone.setting.defs schema. +type SettingDefs_Option struct { + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` + CreatedBy string `json:"createdBy" cborgen:"createdBy"` + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Did string `json:"did" cborgen:"did"` + Key string `json:"key" cborgen:"key"` + LastUpdatedBy string `json:"lastUpdatedBy" cborgen:"lastUpdatedBy"` + ManagerRole *string `json:"managerRole,omitempty" cborgen:"managerRole,omitempty"` + Scope string `json:"scope" cborgen:"scope"` + UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} diff --git a/api/ozone/settinglistOptions.go b/api/ozone/settinglistOptions.go new file mode 100644 index 000000000..8fbdadeca --- /dev/null +++ b/api/ozone/settinglistOptions.go @@ -0,0 +1,38 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.setting.listOptions + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// SettingListOptions_Output is the output of a tools.ozone.setting.listOptions call. +type SettingListOptions_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Options []*SettingDefs_Option `json:"options" cborgen:"options"` +} + +// SettingListOptions calls the XRPC method "tools.ozone.setting.listOptions". +// +// keys: Filter for only the specified keys. Ignored if prefix is provided +// prefix: Filter keys by prefix +func SettingListOptions(ctx context.Context, c *xrpc.Client, cursor string, keys []string, limit int64, prefix string, scope string) (*SettingListOptions_Output, error) { + var out SettingListOptions_Output + + params := map[string]interface{}{ + "cursor": cursor, + "keys": keys, + "limit": limit, + "prefix": prefix, + "scope": scope, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.setting.listOptions", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/settingremoveOptions.go b/api/ozone/settingremoveOptions.go new file mode 100644 index 000000000..5171bb617 --- /dev/null +++ b/api/ozone/settingremoveOptions.go @@ -0,0 +1,31 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.setting.removeOptions + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// SettingRemoveOptions_Input is the input argument to a tools.ozone.setting.removeOptions call. +type SettingRemoveOptions_Input struct { + Keys []string `json:"keys" cborgen:"keys"` + Scope string `json:"scope" cborgen:"scope"` +} + +// SettingRemoveOptions_Output is the output of a tools.ozone.setting.removeOptions call. +type SettingRemoveOptions_Output struct { +} + +// SettingRemoveOptions calls the XRPC method "tools.ozone.setting.removeOptions". +func SettingRemoveOptions(ctx context.Context, c *xrpc.Client, input *SettingRemoveOptions_Input) (*SettingRemoveOptions_Output, error) { + var out SettingRemoveOptions_Output + if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.setting.removeOptions", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/settingupsertOption.go b/api/ozone/settingupsertOption.go new file mode 100644 index 000000000..c7d12cffb --- /dev/null +++ b/api/ozone/settingupsertOption.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.setting.upsertOption + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/xrpc" +) + +// SettingUpsertOption_Input is the input argument to a tools.ozone.setting.upsertOption call. +type SettingUpsertOption_Input struct { + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Key string `json:"key" cborgen:"key"` + ManagerRole *string `json:"managerRole,omitempty" cborgen:"managerRole,omitempty"` + Scope string `json:"scope" cborgen:"scope"` + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// SettingUpsertOption_Output is the output of a tools.ozone.setting.upsertOption call. +type SettingUpsertOption_Output struct { + Option *SettingDefs_Option `json:"option" cborgen:"option"` +} + +// SettingUpsertOption calls the XRPC method "tools.ozone.setting.upsertOption". +func SettingUpsertOption(ctx context.Context, c *xrpc.Client, input *SettingUpsertOption_Input) (*SettingUpsertOption_Output, error) { + var out SettingUpsertOption_Output + if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.setting.upsertOption", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} From 1eb38db78170b52d8cc72553d7829cfbac91543e Mon Sep 17 00:00:00 2001 From: Foysal Ahamed Date: Fri, 3 Jan 2025 23:27:20 +0000 Subject: [PATCH 2/2] :sparkles: Adjust query events calls to reflect api change --- automod/consumer/ozone.go | 1 + automod/engine/persisthelpers.go | 2 ++ cmd/beemo/notify_reports.go | 1 + cmd/gosky/admin.go | 2 ++ 4 files changed, 6 insertions(+) diff --git a/automod/consumer/ozone.go b/automod/consumer/ozone.go index 2211cf21a..60ccdef6a 100644 --- a/automod/consumer/ozone.go +++ b/automod/consumer/ozone.go @@ -69,6 +69,7 @@ func (oc *OzoneConsumer) Run(ctx context.Context) error { false, // hasComment bool true, // includeAllUserRecords bool limit, // limit int64 + nil, // policies []string nil, // removedLabels []string nil, // removedTags []string nil, // reportTypes []string diff --git a/automod/engine/persisthelpers.go b/automod/engine/persisthelpers.go index 906422ab9..29a341b7e 100644 --- a/automod/engine/persisthelpers.go +++ b/automod/engine/persisthelpers.go @@ -182,6 +182,7 @@ func (eng *Engine) createReportIfFresh(ctx context.Context, xrpcc *xrpc.Client, false, // hasComment bool false, // includeAllUserRecords bool 5, // limit int64 + nil, // policies []string nil, // removedLabels []string nil, // removedTags []string nil, // reportTypes []string @@ -263,6 +264,7 @@ func (eng *Engine) createRecordReportIfFresh(ctx context.Context, xrpcc *xrpc.Cl false, // hasComment bool false, // includeAllUserRecords bool 5, // limit int64 + nil, // policies []string nil, // removedLabels []string nil, // removedTags []string nil, // reportTypes []string diff --git a/cmd/beemo/notify_reports.go b/cmd/beemo/notify_reports.go index 7593bd87c..f5ca11b7a 100644 --- a/cmd/beemo/notify_reports.go +++ b/cmd/beemo/notify_reports.go @@ -83,6 +83,7 @@ func pollNewReports(cctx *cli.Context) error { false, // hasComment bool true, // includeAllUserRecords bool limit, // limit int64 + nil, // policies []string nil, // removedLabels []string nil, // removedTags []string nil, // reportTypes []string diff --git a/cmd/gosky/admin.go b/cmd/gosky/admin.go index 9467975da..a4f92f398 100644 --- a/cmd/gosky/admin.go +++ b/cmd/gosky/admin.go @@ -403,6 +403,7 @@ var listReportsCmd = &cli.Command{ false, // hasComment bool false, // includeAllUserRecords bool 100, // limit int64 + nil, // policies []string nil, // removedLabels []string nil, // removedTags []string nil, // reportTypes []string @@ -717,6 +718,7 @@ var queryModerationStatusesCmd = &cli.Command{ false, // hasComment bool false, // includeAllUserRecords bool 100, // limit int64 + nil, // policies []string nil, // removedLabels []string nil, // removedTags []string nil, // reportTypes []string