Select the types of activity you want to include in your feed.
lexgen 20241030 (#785)
@brianolson: there was a lexgen issue in here that I manually worked
around. we have a new lexicon which uses a ref directly for the API
endpoint "input" schema, which maybe hasn't be exercised before.
···2020//
2121// addedLabels: If specified, only events where all of these labels were added are returned
2222// addedTags: If specified, only events where all of these tags were added are returned
2323+// 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.
2324// comment: If specified, only events with comments containing the keyword are returned
2425// createdAfter: Retrieve events created after a given timestamp
2526// createdBefore: Retrieve events created before a given timestamp
2627// hasComment: If true, only events with comments are returned
2727-// includeAllUserRecords: If true, events on all record types (posts, lists, profile etc.) owned by the did are returned
2828+// includeAllUserRecords: If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned.
2829// removedLabels: If specified, only events where all of these labels were removed are returned
2930// removedTags: If specified, only events where all of these tags were removed are returned
3031// sortDirection: Sort direction for the events. Defaults to descending order of created at timestamp.
3232+// 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.
3133// types: The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent<name>) to filter by. If not specified, all events are returned.
3232-func ModerationQueryEvents(ctx context.Context, c *xrpc.Client, addedLabels []string, addedTags []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, types []string) (*ModerationQueryEvents_Output, error) {
3434+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) {
3335 var out ModerationQueryEvents_Output
34363537 params := map[string]interface{}{
3638 "addedLabels": addedLabels,
3739 "addedTags": addedTags,
4040+ "collections": collections,
3841 "comment": comment,
3942 "createdAfter": createdAfter,
4043 "createdBefore": createdBefore,
···4851 "reportTypes": reportTypes,
4952 "sortDirection": sortDirection,
5053 "subject": subject,
5454+ "subjectType": subjectType,
5155 "types": types,
5256 }
5357 if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.queryEvents", params, nil, &out); err != nil {
+6-2
api/ozone/moderationqueryStatuses.go
···1919// ModerationQueryStatuses calls the XRPC method "tools.ozone.moderation.queryStatuses".
2020//
2121// appealed: Get subjects in unresolved appealed status
2222+// collections: If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored.
2223// comment: Search subjects by keyword from comments
2323-// includeAllUserRecords: All subjects belonging to the account specified in the 'subject' param will be returned.
2424+// includeAllUserRecords: All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned.
2425// includeMuted: By default, we don't include muted subjects in the results. Set this to true to include them.
2526// lastReviewedBy: Get all subject statuses that were reviewed by a specific moderator
2627// onlyMuted: When set to true, only muted subjects and reporters will be returned.
···3031// reviewedAfter: Search subjects reviewed after a given timestamp
3132// reviewedBefore: Search subjects reviewed before a given timestamp
3233// subject: The subject to get the status for.
3434+// 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.
3335// takendown: Get subjects that were taken down
3434-func ModerationQueryStatuses(ctx context.Context, c *xrpc.Client, appealed bool, 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, tags []string, takendown bool) (*ModerationQueryStatuses_Output, error) {
3636+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) {
3537 var out ModerationQueryStatuses_Output
36383739 params := map[string]interface{}{
3840 "appealed": appealed,
4141+ "collections": collections,
3942 "comment": comment,
4043 "cursor": cursor,
4144 "excludeTags": excludeTags,
···5356 "sortDirection": sortDirection,
5457 "sortField": sortField,
5558 "subject": subject,
5959+ "subjectType": subjectType,
5660 "tags": tags,
5761 "takendown": takendown,
5862 }
+28
api/ozone/setaddValues.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.addValues
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// SetAddValues_Input is the input argument to a tools.ozone.set.addValues call.
1414+type SetAddValues_Input struct {
1515+ // name: Name of the set to add values to
1616+ Name string `json:"name" cborgen:"name"`
1717+ // values: Array of string values to add to the set
1818+ Values []string `json:"values" cborgen:"values"`
1919+}
2020+2121+// SetAddValues calls the XRPC method "tools.ozone.set.addValues".
2222+func SetAddValues(ctx context.Context, c *xrpc.Client, input *SetAddValues_Input) error {
2323+ if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.set.addValues", nil, input, nil); err != nil {
2424+ return err
2525+ }
2626+2727+ return nil
2828+}
+20
api/ozone/setdefs.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.defs
66+77+// SetDefs_Set is a "set" in the tools.ozone.set.defs schema.
88+type SetDefs_Set struct {
99+ Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
1010+ Name string `json:"name" cborgen:"name"`
1111+}
1212+1313+// SetDefs_SetView is a "setView" in the tools.ozone.set.defs schema.
1414+type SetDefs_SetView struct {
1515+ CreatedAt string `json:"createdAt" cborgen:"createdAt"`
1616+ Description *string `json:"description,omitempty" cborgen:"description,omitempty"`
1717+ Name string `json:"name" cborgen:"name"`
1818+ SetSize int64 `json:"setSize" cborgen:"setSize"`
1919+ UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"`
2020+}
+31
api/ozone/setdeleteSet.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.deleteSet
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// SetDeleteSet_Input is the input argument to a tools.ozone.set.deleteSet call.
1414+type SetDeleteSet_Input struct {
1515+ // name: Name of the set to delete
1616+ Name string `json:"name" cborgen:"name"`
1717+}
1818+1919+// SetDeleteSet_Output is the output of a tools.ozone.set.deleteSet call.
2020+type SetDeleteSet_Output struct {
2121+}
2222+2323+// SetDeleteSet calls the XRPC method "tools.ozone.set.deleteSet".
2424+func SetDeleteSet(ctx context.Context, c *xrpc.Client, input *SetDeleteSet_Input) (*SetDeleteSet_Output, error) {
2525+ var out SetDeleteSet_Output
2626+ if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.set.deleteSet", nil, input, &out); err != nil {
2727+ return nil, err
2828+ }
2929+3030+ return &out, nil
3131+}
+28
api/ozone/setdeleteValues.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.deleteValues
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// SetDeleteValues_Input is the input argument to a tools.ozone.set.deleteValues call.
1414+type SetDeleteValues_Input struct {
1515+ // name: Name of the set to delete values from
1616+ Name string `json:"name" cborgen:"name"`
1717+ // values: Array of string values to delete from the set
1818+ Values []string `json:"values" cborgen:"values"`
1919+}
2020+2121+// SetDeleteValues calls the XRPC method "tools.ozone.set.deleteValues".
2222+func SetDeleteValues(ctx context.Context, c *xrpc.Client, input *SetDeleteValues_Input) error {
2323+ if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.set.deleteValues", nil, input, nil); err != nil {
2424+ return err
2525+ }
2626+2727+ return nil
2828+}
+34
api/ozone/setgetValues.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.getValues
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// SetGetValues_Output is the output of a tools.ozone.set.getValues call.
1414+type SetGetValues_Output struct {
1515+ Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
1616+ Set *SetDefs_SetView `json:"set" cborgen:"set"`
1717+ Values []string `json:"values" cborgen:"values"`
1818+}
1919+2020+// SetGetValues calls the XRPC method "tools.ozone.set.getValues".
2121+func SetGetValues(ctx context.Context, c *xrpc.Client, cursor string, limit int64, name string) (*SetGetValues_Output, error) {
2222+ var out SetGetValues_Output
2323+2424+ params := map[string]interface{}{
2525+ "cursor": cursor,
2626+ "limit": limit,
2727+ "name": name,
2828+ }
2929+ if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.set.getValues", params, nil, &out); err != nil {
3030+ return nil, err
3131+ }
3232+3333+ return &out, nil
3434+}
+37
api/ozone/setquerySets.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.querySets
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// SetQuerySets_Output is the output of a tools.ozone.set.querySets call.
1414+type SetQuerySets_Output struct {
1515+ Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"`
1616+ Sets []*SetDefs_SetView `json:"sets" cborgen:"sets"`
1717+}
1818+1919+// SetQuerySets calls the XRPC method "tools.ozone.set.querySets".
2020+//
2121+// sortDirection: Defaults to ascending order of name field.
2222+func SetQuerySets(ctx context.Context, c *xrpc.Client, cursor string, limit int64, namePrefix string, sortBy string, sortDirection string) (*SetQuerySets_Output, error) {
2323+ var out SetQuerySets_Output
2424+2525+ params := map[string]interface{}{
2626+ "cursor": cursor,
2727+ "limit": limit,
2828+ "namePrefix": namePrefix,
2929+ "sortBy": sortBy,
3030+ "sortDirection": sortDirection,
3131+ }
3232+ if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.set.querySets", params, nil, &out); err != nil {
3333+ return nil, err
3434+ }
3535+3636+ return &out, nil
3737+}
+21
api/ozone/setupsertSet.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+package ozone
44+55+// schema: tools.ozone.set.upsertSet
66+77+import (
88+ "context"
99+1010+ "github.com/bluesky-social/indigo/xrpc"
1111+)
1212+1313+// SetUpsertSet calls the XRPC method "tools.ozone.set.upsertSet".
1414+func SetUpsertSet(ctx context.Context, c *xrpc.Client, input *SetDefs_Set) (*SetDefs_SetView, error) {
1515+ var out SetDefs_SetView
1616+ if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.set.upsertSet", nil, input, &out); err != nil {
1717+ return nil, err
1818+ }
1919+2020+ return &out, nil
2121+}
+18-17
automod/consumer/ozone.go
···5555 period := time.Second * 5
56565757 for {
5858- //func ModerationQueryEvents(ctx context.Context, c *xrpc.Client, addedLabels []string, addedTags []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, types []string) (*ModerationQueryEvents_Output, error) {
5958 me, err := toolsozone.ModerationQueryEvents(
6059 ctx,
6160 oc.OzoneClient,
6262- nil, // addedLabels: If specified, only events where all of these labels were added are returned
6363- nil, // addedTags: If specified, only events where all of these tags were added are returned
6464- "", // comment: If specified, only events with comments containing the keyword are returned
6565- since.String(), // createdAfter: Retrieve events created after a given timestamp
6666- "", // createdBefore: Retrieve events created before a given timestamp
6767- "", // createdBy
6868- "", // cursor
6969- false, // hasComment: If true, only events with comments are returned
7070- true, // includeAllUserRecords: If true, events on all record types (posts, lists, profile etc.) owned by the did are returned
7171- limit,
7272- nil, // removedLabels: If specified, only events where all of these labels were removed are returned
7373- nil, // removedTags
7474- nil, // reportTypes
7575- "asc", // sortDirection: Sort direction for the events. Defaults to descending order of created at timestamp.
7676- "", // subject
7777- nil, // types: The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent<name>) to filter by. If not specified, all events are returned.
6161+ nil, // addedLabels []string
6262+ nil, // addedTags []string
6363+ nil, // collections []string
6464+ "", // comment string
6565+ since.String(), // createdAfter string
6666+ "", // createdBefore string
6767+ "", // createdBy string
6868+ "", // cursor string
6969+ false, // hasComment bool
7070+ true, // includeAllUserRecords bool
7171+ limit, // limit int64
7272+ nil, // removedLabels []string
7373+ nil, // removedTags []string
7474+ nil, // reportTypes []string
7575+ "asc", // sortDirection string
7676+ "", // subject string
7777+ "", // subjectType string
7878+ nil, // types []string
7879 )
7980 if err != nil {
8081 oc.Logger.Warn("ozone query events failed; sleeping then will retrying", "err", err, "period", period.String())
+36-34
automod/engine/persisthelpers.go
···155155 // before creating a report, query to see if automod has already reported this account in the past week for the same reason
156156 // NOTE: this is running in an inner loop (if there are multiple reports), which is a bit inefficient, but seems acceptable
157157158158- // ModerationQueryEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, inc ludeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string)
159158 resp, err := toolsozone.ModerationQueryEvents(
160159 ctx,
161160 xrpcc,
162162- nil,
163163- nil,
164164- "",
165165- "",
166166- "",
167167- xrpcc.Auth.Did,
168168- "",
169169- false,
170170- false,
171171- 5,
172172- nil,
173173- nil,
174174- nil,
175175- "",
176176- did.String(),
177177- []string{"tools.ozone.moderation.defs#modEventReport"},
161161+ nil, // addedLabels []string
162162+ nil, // addedTags []string
163163+ nil, // collections []string
164164+ "", // comment string
165165+ "", // createdAfter string
166166+ "", // createdBefore string
167167+ xrpcc.Auth.Did, // createdBy string
168168+ "", // cursor string
169169+ false, // hasComment bool
170170+ false, // includeAllUserRecords bool
171171+ 5, // limit int64
172172+ nil, // removedLabels []string
173173+ nil, // removedTags []string
174174+ nil, // reportTypes []string
175175+ "", // sortDirection string
176176+ did.String(), // subject string
177177+ "", // subjectType string
178178+ []string{"tools.ozone.moderation.defs#modEventReport"}, // types []string
178179 )
179180180181 if err != nil {
···231232 // before creating a report, query to see if automod has already reported this account in the past week for the same reason
232233 // NOTE: this is running in an inner loop (if there are multiple reports), which is a bit inefficient, but seems acceptable
233234234234- // ModerationQueryEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, inc ludeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string)
235235 resp, err := toolsozone.ModerationQueryEvents(
236236 ctx,
237237 xrpcc,
238238- nil,
239239- nil,
240240- "",
241241- "",
242242- "",
243243- xrpcc.Auth.Did,
244244- "",
245245- false,
246246- false,
247247- 5,
248248- nil,
249249- nil,
250250- nil,
251251- "",
252252- uri.String(),
253253- []string{"tools.ozone.moderation.defs#modEventReport"},
238238+ nil, // addedLabels []string
239239+ nil, // addedTags []string
240240+ nil, // collections []string
241241+ "", // comment string
242242+ "", // createdAfter string
243243+ "", // createdBefore string
244244+ xrpcc.Auth.Did, // createdBy string
245245+ "", // cursor string
246246+ false, // hasComment bool
247247+ false, // includeAllUserRecords bool
248248+ 5, // limit int64
249249+ nil, // removedLabels []string
250250+ nil, // removedTags []string
251251+ nil, // reportTypes []string
252252+ "", // sortDirection string
253253+ uri.String(), // subject string
254254+ "", // subjectType string
255255+ []string{"tools.ozone.moderation.defs#modEventReport"}, // types []string
254256 )
255257 if err != nil {
256258 return false, err