From 5303fc11d3ba3845d1b5770a6914c75cfd173f92 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:18:59 -0700 Subject: [PATCH 01/11] api/atproto: remove now-deprecated lexicons --- .../admincreateCommunicationTemplate.go | 33 - api/atproto/admindefs.go | 782 ------------------ .../admindeleteCommunicationTemplate.go | 25 - api/atproto/adminemitModerationEvent.go | 174 ---- api/atproto/admingetModerationEvent.go | 25 - api/atproto/admingetRecord.go | 26 - api/atproto/admingetRepo.go | 25 - .../adminlistCommunicationTemplates.go | 26 - api/atproto/adminqueryModerationEvents.go | 58 -- api/atproto/adminqueryModerationStatuses.go | 59 -- api/atproto/adminsearchRepos.go | 36 - .../adminupdateCommunicationTemplate.go | 36 - api/atproto/reporebaseRepo.go | 28 - api/atproto/syncgetCommitPath.go | 36 - api/atproto/temppushBlob.go | 27 - api/atproto/temptransferAccount.go | 36 - api/atproto/tempupgradeRepoVersion.go | 25 - 17 files changed, 1457 deletions(-) delete mode 100644 api/atproto/admincreateCommunicationTemplate.go delete mode 100644 api/atproto/admindeleteCommunicationTemplate.go delete mode 100644 api/atproto/adminemitModerationEvent.go delete mode 100644 api/atproto/admingetModerationEvent.go delete mode 100644 api/atproto/admingetRecord.go delete mode 100644 api/atproto/admingetRepo.go delete mode 100644 api/atproto/adminlistCommunicationTemplates.go delete mode 100644 api/atproto/adminqueryModerationEvents.go delete mode 100644 api/atproto/adminqueryModerationStatuses.go delete mode 100644 api/atproto/adminsearchRepos.go delete mode 100644 api/atproto/adminupdateCommunicationTemplate.go delete mode 100644 api/atproto/reporebaseRepo.go delete mode 100644 api/atproto/syncgetCommitPath.go delete mode 100644 api/atproto/temppushBlob.go delete mode 100644 api/atproto/temptransferAccount.go delete mode 100644 api/atproto/tempupgradeRepoVersion.go diff --git a/api/atproto/admincreateCommunicationTemplate.go b/api/atproto/admincreateCommunicationTemplate.go deleted file mode 100644 index 15dcd707b..000000000 --- a/api/atproto/admincreateCommunicationTemplate.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.createCommunicationTemplate - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminCreateCommunicationTemplate_Input is the input argument to a com.atproto.admin.createCommunicationTemplate call. -type AdminCreateCommunicationTemplate_Input struct { - // contentMarkdown: Content of the template, markdown supported, can contain variable placeholders. - ContentMarkdown string `json:"contentMarkdown" cborgen:"contentMarkdown"` - // createdBy: DID of the user who is creating the template. - CreatedBy *string `json:"createdBy,omitempty" cborgen:"createdBy,omitempty"` - // name: Name of the template. - Name string `json:"name" cborgen:"name"` - // subject: Subject of the message, used in emails. - Subject string `json:"subject" cborgen:"subject"` -} - -// AdminCreateCommunicationTemplate calls the XRPC method "com.atproto.admin.createCommunicationTemplate". -func AdminCreateCommunicationTemplate(ctx context.Context, c *xrpc.Client, input *AdminCreateCommunicationTemplate_Input) (*AdminDefs_CommunicationTemplateView, error) { - var out AdminDefs_CommunicationTemplateView - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.admin.createCommunicationTemplate", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/admindefs.go b/api/atproto/admindefs.go index 38fe4764f..0dcb456ed 100644 --- a/api/atproto/admindefs.go +++ b/api/atproto/admindefs.go @@ -5,9 +5,6 @@ package atproto // schema: com.atproto.admin.defs import ( - "encoding/json" - "fmt" - "github.com/bluesky-social/indigo/lex/util" ) @@ -25,564 +22,6 @@ type AdminDefs_AccountView struct { RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords,omitempty" cborgen:"relatedRecords,omitempty"` } -// AdminDefs_BlobView is a "blobView" in the com.atproto.admin.defs schema. -type AdminDefs_BlobView struct { - Cid string `json:"cid" cborgen:"cid"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Details *AdminDefs_BlobView_Details `json:"details,omitempty" cborgen:"details,omitempty"` - MimeType string `json:"mimeType" cborgen:"mimeType"` - Moderation *AdminDefs_Moderation `json:"moderation,omitempty" cborgen:"moderation,omitempty"` - Size int64 `json:"size" cborgen:"size"` -} - -type AdminDefs_BlobView_Details struct { - AdminDefs_ImageDetails *AdminDefs_ImageDetails - AdminDefs_VideoDetails *AdminDefs_VideoDetails -} - -func (t *AdminDefs_BlobView_Details) MarshalJSON() ([]byte, error) { - if t.AdminDefs_ImageDetails != nil { - t.AdminDefs_ImageDetails.LexiconTypeID = "com.atproto.admin.defs#imageDetails" - return json.Marshal(t.AdminDefs_ImageDetails) - } - if t.AdminDefs_VideoDetails != nil { - t.AdminDefs_VideoDetails.LexiconTypeID = "com.atproto.admin.defs#videoDetails" - return json.Marshal(t.AdminDefs_VideoDetails) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_BlobView_Details) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#imageDetails": - t.AdminDefs_ImageDetails = new(AdminDefs_ImageDetails) - return json.Unmarshal(b, t.AdminDefs_ImageDetails) - case "com.atproto.admin.defs#videoDetails": - t.AdminDefs_VideoDetails = new(AdminDefs_VideoDetails) - return json.Unmarshal(b, t.AdminDefs_VideoDetails) - - default: - return nil - } -} - -// AdminDefs_CommunicationTemplateView is a "communicationTemplateView" in the com.atproto.admin.defs schema. -type AdminDefs_CommunicationTemplateView struct { - // contentMarkdown: Subject of the message, used in emails. - ContentMarkdown string `json:"contentMarkdown" cborgen:"contentMarkdown"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Disabled bool `json:"disabled" cborgen:"disabled"` - Id string `json:"id" cborgen:"id"` - // lastUpdatedBy: DID of the user who last updated the template. - LastUpdatedBy string `json:"lastUpdatedBy" cborgen:"lastUpdatedBy"` - // name: Name of the template. - Name string `json:"name" cborgen:"name"` - // subject: Content of the template, can contain markdown and variable placeholders. - Subject *string `json:"subject,omitempty" cborgen:"subject,omitempty"` - UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` -} - -// AdminDefs_ImageDetails is a "imageDetails" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_ImageDetails -type AdminDefs_ImageDetails struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#imageDetails" cborgen:"$type,const=com.atproto.admin.defs#imageDetails"` - Height int64 `json:"height" cborgen:"height"` - Width int64 `json:"width" cborgen:"width"` -} - -// AdminDefs_ModEventAcknowledge is a "modEventAcknowledge" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_ModEventAcknowledge -type AdminDefs_ModEventAcknowledge struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventAcknowledge" cborgen:"$type,const=com.atproto.admin.defs#modEventAcknowledge"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` -} - -// AdminDefs_ModEventComment is a "modEventComment" in the com.atproto.admin.defs schema. -// -// # Add a comment to a subject -// -// RECORDTYPE: AdminDefs_ModEventComment -type AdminDefs_ModEventComment struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventComment" cborgen:"$type,const=com.atproto.admin.defs#modEventComment"` - Comment string `json:"comment" cborgen:"comment"` - // sticky: Make the comment persistent on the subject - Sticky *bool `json:"sticky,omitempty" cborgen:"sticky,omitempty"` -} - -// AdminDefs_ModEventEmail is a "modEventEmail" in the com.atproto.admin.defs schema. -// -// # Keep a log of outgoing email to a user -// -// RECORDTYPE: AdminDefs_ModEventEmail -type AdminDefs_ModEventEmail struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventEmail" cborgen:"$type,const=com.atproto.admin.defs#modEventEmail"` - // comment: Additional comment about the outgoing comm. - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - // content: The content of the email sent to the user. - Content *string `json:"content,omitempty" cborgen:"content,omitempty"` - // subjectLine: The subject line of the email sent to the user. - SubjectLine string `json:"subjectLine" cborgen:"subjectLine"` -} - -// AdminDefs_ModEventEscalate is a "modEventEscalate" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_ModEventEscalate -type AdminDefs_ModEventEscalate struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventEscalate" cborgen:"$type,const=com.atproto.admin.defs#modEventEscalate"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` -} - -// AdminDefs_ModEventLabel is a "modEventLabel" in the com.atproto.admin.defs schema. -// -// Apply/Negate labels on a subject -// -// RECORDTYPE: AdminDefs_ModEventLabel -type AdminDefs_ModEventLabel struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventLabel" cborgen:"$type,const=com.atproto.admin.defs#modEventLabel"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - CreateLabelVals []string `json:"createLabelVals" cborgen:"createLabelVals"` - NegateLabelVals []string `json:"negateLabelVals" cborgen:"negateLabelVals"` -} - -// AdminDefs_ModEventMute is a "modEventMute" in the com.atproto.admin.defs schema. -// -// # Mute incoming reports on a subject -// -// RECORDTYPE: AdminDefs_ModEventMute -type AdminDefs_ModEventMute struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventMute" cborgen:"$type,const=com.atproto.admin.defs#modEventMute"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - // durationInHours: Indicates how long the subject should remain muted. - DurationInHours int64 `json:"durationInHours" cborgen:"durationInHours"` -} - -// AdminDefs_ModEventReport is a "modEventReport" in the com.atproto.admin.defs schema. -// -// # Report a subject -// -// RECORDTYPE: AdminDefs_ModEventReport -type AdminDefs_ModEventReport struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventReport" cborgen:"$type,const=com.atproto.admin.defs#modEventReport"` - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - ReportType *string `json:"reportType" cborgen:"reportType"` -} - -// AdminDefs_ModEventResolveAppeal is a "modEventResolveAppeal" in the com.atproto.admin.defs schema. -// -// # Resolve appeal on a subject -// -// RECORDTYPE: AdminDefs_ModEventResolveAppeal -type AdminDefs_ModEventResolveAppeal struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventResolveAppeal" cborgen:"$type,const=com.atproto.admin.defs#modEventResolveAppeal"` - // comment: Describe resolution. - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` -} - -// AdminDefs_ModEventReverseTakedown is a "modEventReverseTakedown" in the com.atproto.admin.defs schema. -// -// # Revert take down action on a subject -// -// RECORDTYPE: AdminDefs_ModEventReverseTakedown -type AdminDefs_ModEventReverseTakedown struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventReverseTakedown" cborgen:"$type,const=com.atproto.admin.defs#modEventReverseTakedown"` - // comment: Describe reasoning behind the reversal. - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` -} - -// AdminDefs_ModEventTag is a "modEventTag" in the com.atproto.admin.defs schema. -// -// Add/Remove a tag on a subject -// -// RECORDTYPE: AdminDefs_ModEventTag -type AdminDefs_ModEventTag struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventTag" cborgen:"$type,const=com.atproto.admin.defs#modEventTag"` - // add: Tags to be added to the subject. If already exists, won't be duplicated. - Add []string `json:"add" cborgen:"add"` - // comment: Additional comment about added/removed tags. - Comment *string `json:"comment,omitempty" cborgen:"comment,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"` -} - -// AdminDefs_ModEventTakedown is a "modEventTakedown" in the com.atproto.admin.defs schema. -// -// # Take down a subject permanently or temporarily -// -// RECORDTYPE: AdminDefs_ModEventTakedown -type AdminDefs_ModEventTakedown struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventTakedown" cborgen:"$type,const=com.atproto.admin.defs#modEventTakedown"` - 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"` -} - -// AdminDefs_ModEventUnmute is a "modEventUnmute" in the com.atproto.admin.defs schema. -// -// # Unmute action on a subject -// -// RECORDTYPE: AdminDefs_ModEventUnmute -type AdminDefs_ModEventUnmute struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#modEventUnmute" cborgen:"$type,const=com.atproto.admin.defs#modEventUnmute"` - // comment: Describe reasoning behind the reversal. - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` -} - -// AdminDefs_ModEventView is a "modEventView" in the com.atproto.admin.defs schema. -type AdminDefs_ModEventView struct { - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - CreatedBy string `json:"createdBy" cborgen:"createdBy"` - CreatorHandle *string `json:"creatorHandle,omitempty" cborgen:"creatorHandle,omitempty"` - Event *AdminDefs_ModEventView_Event `json:"event" cborgen:"event"` - Id int64 `json:"id" cborgen:"id"` - Subject *AdminDefs_ModEventView_Subject `json:"subject" cborgen:"subject"` - SubjectBlobCids []string `json:"subjectBlobCids" cborgen:"subjectBlobCids"` - SubjectHandle *string `json:"subjectHandle,omitempty" cborgen:"subjectHandle,omitempty"` -} - -// AdminDefs_ModEventViewDetail is a "modEventViewDetail" in the com.atproto.admin.defs schema. -type AdminDefs_ModEventViewDetail struct { - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - CreatedBy string `json:"createdBy" cborgen:"createdBy"` - Event *AdminDefs_ModEventViewDetail_Event `json:"event" cborgen:"event"` - Id int64 `json:"id" cborgen:"id"` - Subject *AdminDefs_ModEventViewDetail_Subject `json:"subject" cborgen:"subject"` - SubjectBlobs []*AdminDefs_BlobView `json:"subjectBlobs" cborgen:"subjectBlobs"` -} - -type AdminDefs_ModEventViewDetail_Event struct { - AdminDefs_ModEventTakedown *AdminDefs_ModEventTakedown - AdminDefs_ModEventReverseTakedown *AdminDefs_ModEventReverseTakedown - AdminDefs_ModEventComment *AdminDefs_ModEventComment - AdminDefs_ModEventReport *AdminDefs_ModEventReport - AdminDefs_ModEventLabel *AdminDefs_ModEventLabel - AdminDefs_ModEventAcknowledge *AdminDefs_ModEventAcknowledge - AdminDefs_ModEventEscalate *AdminDefs_ModEventEscalate - AdminDefs_ModEventMute *AdminDefs_ModEventMute - AdminDefs_ModEventEmail *AdminDefs_ModEventEmail - AdminDefs_ModEventResolveAppeal *AdminDefs_ModEventResolveAppeal -} - -func (t *AdminDefs_ModEventViewDetail_Event) MarshalJSON() ([]byte, error) { - if t.AdminDefs_ModEventTakedown != nil { - t.AdminDefs_ModEventTakedown.LexiconTypeID = "com.atproto.admin.defs#modEventTakedown" - return json.Marshal(t.AdminDefs_ModEventTakedown) - } - if t.AdminDefs_ModEventReverseTakedown != nil { - t.AdminDefs_ModEventReverseTakedown.LexiconTypeID = "com.atproto.admin.defs#modEventReverseTakedown" - return json.Marshal(t.AdminDefs_ModEventReverseTakedown) - } - if t.AdminDefs_ModEventComment != nil { - t.AdminDefs_ModEventComment.LexiconTypeID = "com.atproto.admin.defs#modEventComment" - return json.Marshal(t.AdminDefs_ModEventComment) - } - if t.AdminDefs_ModEventReport != nil { - t.AdminDefs_ModEventReport.LexiconTypeID = "com.atproto.admin.defs#modEventReport" - return json.Marshal(t.AdminDefs_ModEventReport) - } - if t.AdminDefs_ModEventLabel != nil { - t.AdminDefs_ModEventLabel.LexiconTypeID = "com.atproto.admin.defs#modEventLabel" - return json.Marshal(t.AdminDefs_ModEventLabel) - } - if t.AdminDefs_ModEventAcknowledge != nil { - t.AdminDefs_ModEventAcknowledge.LexiconTypeID = "com.atproto.admin.defs#modEventAcknowledge" - return json.Marshal(t.AdminDefs_ModEventAcknowledge) - } - if t.AdminDefs_ModEventEscalate != nil { - t.AdminDefs_ModEventEscalate.LexiconTypeID = "com.atproto.admin.defs#modEventEscalate" - return json.Marshal(t.AdminDefs_ModEventEscalate) - } - if t.AdminDefs_ModEventMute != nil { - t.AdminDefs_ModEventMute.LexiconTypeID = "com.atproto.admin.defs#modEventMute" - return json.Marshal(t.AdminDefs_ModEventMute) - } - if t.AdminDefs_ModEventEmail != nil { - t.AdminDefs_ModEventEmail.LexiconTypeID = "com.atproto.admin.defs#modEventEmail" - return json.Marshal(t.AdminDefs_ModEventEmail) - } - if t.AdminDefs_ModEventResolveAppeal != nil { - t.AdminDefs_ModEventResolveAppeal.LexiconTypeID = "com.atproto.admin.defs#modEventResolveAppeal" - return json.Marshal(t.AdminDefs_ModEventResolveAppeal) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_ModEventViewDetail_Event) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#modEventTakedown": - t.AdminDefs_ModEventTakedown = new(AdminDefs_ModEventTakedown) - return json.Unmarshal(b, t.AdminDefs_ModEventTakedown) - case "com.atproto.admin.defs#modEventReverseTakedown": - t.AdminDefs_ModEventReverseTakedown = new(AdminDefs_ModEventReverseTakedown) - return json.Unmarshal(b, t.AdminDefs_ModEventReverseTakedown) - case "com.atproto.admin.defs#modEventComment": - t.AdminDefs_ModEventComment = new(AdminDefs_ModEventComment) - return json.Unmarshal(b, t.AdminDefs_ModEventComment) - case "com.atproto.admin.defs#modEventReport": - t.AdminDefs_ModEventReport = new(AdminDefs_ModEventReport) - return json.Unmarshal(b, t.AdminDefs_ModEventReport) - case "com.atproto.admin.defs#modEventLabel": - t.AdminDefs_ModEventLabel = new(AdminDefs_ModEventLabel) - return json.Unmarshal(b, t.AdminDefs_ModEventLabel) - case "com.atproto.admin.defs#modEventAcknowledge": - t.AdminDefs_ModEventAcknowledge = new(AdminDefs_ModEventAcknowledge) - return json.Unmarshal(b, t.AdminDefs_ModEventAcknowledge) - case "com.atproto.admin.defs#modEventEscalate": - t.AdminDefs_ModEventEscalate = new(AdminDefs_ModEventEscalate) - return json.Unmarshal(b, t.AdminDefs_ModEventEscalate) - case "com.atproto.admin.defs#modEventMute": - t.AdminDefs_ModEventMute = new(AdminDefs_ModEventMute) - return json.Unmarshal(b, t.AdminDefs_ModEventMute) - case "com.atproto.admin.defs#modEventEmail": - t.AdminDefs_ModEventEmail = new(AdminDefs_ModEventEmail) - return json.Unmarshal(b, t.AdminDefs_ModEventEmail) - case "com.atproto.admin.defs#modEventResolveAppeal": - t.AdminDefs_ModEventResolveAppeal = new(AdminDefs_ModEventResolveAppeal) - return json.Unmarshal(b, t.AdminDefs_ModEventResolveAppeal) - - default: - return nil - } -} - -type AdminDefs_ModEventViewDetail_Subject struct { - AdminDefs_RepoView *AdminDefs_RepoView - AdminDefs_RepoViewNotFound *AdminDefs_RepoViewNotFound - AdminDefs_RecordView *AdminDefs_RecordView - AdminDefs_RecordViewNotFound *AdminDefs_RecordViewNotFound -} - -func (t *AdminDefs_ModEventViewDetail_Subject) MarshalJSON() ([]byte, error) { - if t.AdminDefs_RepoView != nil { - t.AdminDefs_RepoView.LexiconTypeID = "com.atproto.admin.defs#repoView" - return json.Marshal(t.AdminDefs_RepoView) - } - if t.AdminDefs_RepoViewNotFound != nil { - t.AdminDefs_RepoViewNotFound.LexiconTypeID = "com.atproto.admin.defs#repoViewNotFound" - return json.Marshal(t.AdminDefs_RepoViewNotFound) - } - if t.AdminDefs_RecordView != nil { - t.AdminDefs_RecordView.LexiconTypeID = "com.atproto.admin.defs#recordView" - return json.Marshal(t.AdminDefs_RecordView) - } - if t.AdminDefs_RecordViewNotFound != nil { - t.AdminDefs_RecordViewNotFound.LexiconTypeID = "com.atproto.admin.defs#recordViewNotFound" - return json.Marshal(t.AdminDefs_RecordViewNotFound) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_ModEventViewDetail_Subject) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#repoView": - t.AdminDefs_RepoView = new(AdminDefs_RepoView) - return json.Unmarshal(b, t.AdminDefs_RepoView) - case "com.atproto.admin.defs#repoViewNotFound": - t.AdminDefs_RepoViewNotFound = new(AdminDefs_RepoViewNotFound) - return json.Unmarshal(b, t.AdminDefs_RepoViewNotFound) - case "com.atproto.admin.defs#recordView": - t.AdminDefs_RecordView = new(AdminDefs_RecordView) - return json.Unmarshal(b, t.AdminDefs_RecordView) - case "com.atproto.admin.defs#recordViewNotFound": - t.AdminDefs_RecordViewNotFound = new(AdminDefs_RecordViewNotFound) - return json.Unmarshal(b, t.AdminDefs_RecordViewNotFound) - - default: - return nil - } -} - -type AdminDefs_ModEventView_Event struct { - AdminDefs_ModEventTakedown *AdminDefs_ModEventTakedown - AdminDefs_ModEventReverseTakedown *AdminDefs_ModEventReverseTakedown - AdminDefs_ModEventComment *AdminDefs_ModEventComment - AdminDefs_ModEventReport *AdminDefs_ModEventReport - AdminDefs_ModEventLabel *AdminDefs_ModEventLabel - AdminDefs_ModEventAcknowledge *AdminDefs_ModEventAcknowledge - AdminDefs_ModEventEscalate *AdminDefs_ModEventEscalate - AdminDefs_ModEventMute *AdminDefs_ModEventMute - AdminDefs_ModEventEmail *AdminDefs_ModEventEmail - AdminDefs_ModEventResolveAppeal *AdminDefs_ModEventResolveAppeal -} - -func (t *AdminDefs_ModEventView_Event) MarshalJSON() ([]byte, error) { - if t.AdminDefs_ModEventTakedown != nil { - t.AdminDefs_ModEventTakedown.LexiconTypeID = "com.atproto.admin.defs#modEventTakedown" - return json.Marshal(t.AdminDefs_ModEventTakedown) - } - if t.AdminDefs_ModEventReverseTakedown != nil { - t.AdminDefs_ModEventReverseTakedown.LexiconTypeID = "com.atproto.admin.defs#modEventReverseTakedown" - return json.Marshal(t.AdminDefs_ModEventReverseTakedown) - } - if t.AdminDefs_ModEventComment != nil { - t.AdminDefs_ModEventComment.LexiconTypeID = "com.atproto.admin.defs#modEventComment" - return json.Marshal(t.AdminDefs_ModEventComment) - } - if t.AdminDefs_ModEventReport != nil { - t.AdminDefs_ModEventReport.LexiconTypeID = "com.atproto.admin.defs#modEventReport" - return json.Marshal(t.AdminDefs_ModEventReport) - } - if t.AdminDefs_ModEventLabel != nil { - t.AdminDefs_ModEventLabel.LexiconTypeID = "com.atproto.admin.defs#modEventLabel" - return json.Marshal(t.AdminDefs_ModEventLabel) - } - if t.AdminDefs_ModEventAcknowledge != nil { - t.AdminDefs_ModEventAcknowledge.LexiconTypeID = "com.atproto.admin.defs#modEventAcknowledge" - return json.Marshal(t.AdminDefs_ModEventAcknowledge) - } - if t.AdminDefs_ModEventEscalate != nil { - t.AdminDefs_ModEventEscalate.LexiconTypeID = "com.atproto.admin.defs#modEventEscalate" - return json.Marshal(t.AdminDefs_ModEventEscalate) - } - if t.AdminDefs_ModEventMute != nil { - t.AdminDefs_ModEventMute.LexiconTypeID = "com.atproto.admin.defs#modEventMute" - return json.Marshal(t.AdminDefs_ModEventMute) - } - if t.AdminDefs_ModEventEmail != nil { - t.AdminDefs_ModEventEmail.LexiconTypeID = "com.atproto.admin.defs#modEventEmail" - return json.Marshal(t.AdminDefs_ModEventEmail) - } - if t.AdminDefs_ModEventResolveAppeal != nil { - t.AdminDefs_ModEventResolveAppeal.LexiconTypeID = "com.atproto.admin.defs#modEventResolveAppeal" - return json.Marshal(t.AdminDefs_ModEventResolveAppeal) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_ModEventView_Event) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#modEventTakedown": - t.AdminDefs_ModEventTakedown = new(AdminDefs_ModEventTakedown) - return json.Unmarshal(b, t.AdminDefs_ModEventTakedown) - case "com.atproto.admin.defs#modEventReverseTakedown": - t.AdminDefs_ModEventReverseTakedown = new(AdminDefs_ModEventReverseTakedown) - return json.Unmarshal(b, t.AdminDefs_ModEventReverseTakedown) - case "com.atproto.admin.defs#modEventComment": - t.AdminDefs_ModEventComment = new(AdminDefs_ModEventComment) - return json.Unmarshal(b, t.AdminDefs_ModEventComment) - case "com.atproto.admin.defs#modEventReport": - t.AdminDefs_ModEventReport = new(AdminDefs_ModEventReport) - return json.Unmarshal(b, t.AdminDefs_ModEventReport) - case "com.atproto.admin.defs#modEventLabel": - t.AdminDefs_ModEventLabel = new(AdminDefs_ModEventLabel) - return json.Unmarshal(b, t.AdminDefs_ModEventLabel) - case "com.atproto.admin.defs#modEventAcknowledge": - t.AdminDefs_ModEventAcknowledge = new(AdminDefs_ModEventAcknowledge) - return json.Unmarshal(b, t.AdminDefs_ModEventAcknowledge) - case "com.atproto.admin.defs#modEventEscalate": - t.AdminDefs_ModEventEscalate = new(AdminDefs_ModEventEscalate) - return json.Unmarshal(b, t.AdminDefs_ModEventEscalate) - case "com.atproto.admin.defs#modEventMute": - t.AdminDefs_ModEventMute = new(AdminDefs_ModEventMute) - return json.Unmarshal(b, t.AdminDefs_ModEventMute) - case "com.atproto.admin.defs#modEventEmail": - t.AdminDefs_ModEventEmail = new(AdminDefs_ModEventEmail) - return json.Unmarshal(b, t.AdminDefs_ModEventEmail) - case "com.atproto.admin.defs#modEventResolveAppeal": - t.AdminDefs_ModEventResolveAppeal = new(AdminDefs_ModEventResolveAppeal) - return json.Unmarshal(b, t.AdminDefs_ModEventResolveAppeal) - - default: - return nil - } -} - -type AdminDefs_ModEventView_Subject struct { - AdminDefs_RepoRef *AdminDefs_RepoRef - RepoStrongRef *RepoStrongRef -} - -func (t *AdminDefs_ModEventView_Subject) MarshalJSON() ([]byte, error) { - if t.AdminDefs_RepoRef != nil { - t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" - return json.Marshal(t.AdminDefs_RepoRef) - } - if t.RepoStrongRef != nil { - t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" - return json.Marshal(t.RepoStrongRef) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_ModEventView_Subject) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#repoRef": - t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) - return json.Unmarshal(b, t.AdminDefs_RepoRef) - case "com.atproto.repo.strongRef": - t.RepoStrongRef = new(RepoStrongRef) - return json.Unmarshal(b, t.RepoStrongRef) - - default: - return nil - } -} - -// AdminDefs_Moderation is a "moderation" in the com.atproto.admin.defs schema. -type AdminDefs_Moderation struct { - SubjectStatus *AdminDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` -} - -// AdminDefs_ModerationDetail is a "moderationDetail" in the com.atproto.admin.defs schema. -type AdminDefs_ModerationDetail struct { - SubjectStatus *AdminDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` -} - -// AdminDefs_RecordView is a "recordView" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_RecordView -type AdminDefs_RecordView struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#recordView" cborgen:"$type,const=com.atproto.admin.defs#recordView"` - BlobCids []string `json:"blobCids" cborgen:"blobCids"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Moderation *AdminDefs_Moderation `json:"moderation" cborgen:"moderation"` - Repo *AdminDefs_RepoView `json:"repo" cborgen:"repo"` - Uri string `json:"uri" cborgen:"uri"` - Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` -} - -// AdminDefs_RecordViewDetail is a "recordViewDetail" in the com.atproto.admin.defs schema. -type AdminDefs_RecordViewDetail struct { - Blobs []*AdminDefs_BlobView `json:"blobs" cborgen:"blobs"` - Cid string `json:"cid" cborgen:"cid"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - Labels []*LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` - Moderation *AdminDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` - Repo *AdminDefs_RepoView `json:"repo" cborgen:"repo"` - Uri string `json:"uri" cborgen:"uri"` - Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` -} - -// AdminDefs_RecordViewNotFound is a "recordViewNotFound" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_RecordViewNotFound -type AdminDefs_RecordViewNotFound struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#recordViewNotFound" cborgen:"$type,const=com.atproto.admin.defs#recordViewNotFound"` - Uri string `json:"uri" cborgen:"uri"` -} - // AdminDefs_RepoBlobRef is a "repoBlobRef" in the com.atproto.admin.defs schema. // // RECORDTYPE: AdminDefs_RepoBlobRef @@ -601,229 +40,8 @@ type AdminDefs_RepoRef struct { Did string `json:"did" cborgen:"did"` } -// AdminDefs_RepoView is a "repoView" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_RepoView -type AdminDefs_RepoView struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#repoView" cborgen:"$type,const=com.atproto.admin.defs#repoView"` - Did string `json:"did" cborgen:"did"` - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` - Handle string `json:"handle" cborgen:"handle"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` - InvitedBy *ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` - InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` - Moderation *AdminDefs_Moderation `json:"moderation" cborgen:"moderation"` - RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords" cborgen:"relatedRecords"` -} - -// AdminDefs_RepoViewDetail is a "repoViewDetail" in the com.atproto.admin.defs schema. -type AdminDefs_RepoViewDetail struct { - Did string `json:"did" cborgen:"did"` - Email *string `json:"email,omitempty" cborgen:"email,omitempty"` - EmailConfirmedAt *string `json:"emailConfirmedAt,omitempty" cborgen:"emailConfirmedAt,omitempty"` - Handle string `json:"handle" cborgen:"handle"` - IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` - InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` - InvitedBy *ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` - Invites []*ServerDefs_InviteCode `json:"invites,omitempty" cborgen:"invites,omitempty"` - InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` - Labels []*LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` - Moderation *AdminDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` - RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords" cborgen:"relatedRecords"` -} - -// AdminDefs_RepoViewNotFound is a "repoViewNotFound" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_RepoViewNotFound -type AdminDefs_RepoViewNotFound struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#repoViewNotFound" cborgen:"$type,const=com.atproto.admin.defs#repoViewNotFound"` - Did string `json:"did" cborgen:"did"` -} - -// AdminDefs_ReportView is a "reportView" in the com.atproto.admin.defs schema. -type AdminDefs_ReportView struct { - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Id int64 `json:"id" cborgen:"id"` - ReasonType *string `json:"reasonType" cborgen:"reasonType"` - ReportedBy string `json:"reportedBy" cborgen:"reportedBy"` - ResolvedByActionIds []int64 `json:"resolvedByActionIds" cborgen:"resolvedByActionIds"` - Subject *AdminDefs_ReportView_Subject `json:"subject" cborgen:"subject"` - SubjectRepoHandle *string `json:"subjectRepoHandle,omitempty" cborgen:"subjectRepoHandle,omitempty"` -} - -// AdminDefs_ReportViewDetail is a "reportViewDetail" in the com.atproto.admin.defs schema. -type AdminDefs_ReportViewDetail struct { - Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` - CreatedAt string `json:"createdAt" cborgen:"createdAt"` - Id int64 `json:"id" cborgen:"id"` - ReasonType *string `json:"reasonType" cborgen:"reasonType"` - ReportedBy string `json:"reportedBy" cborgen:"reportedBy"` - ResolvedByActions []*AdminDefs_ModEventView `json:"resolvedByActions" cborgen:"resolvedByActions"` - Subject *AdminDefs_ReportViewDetail_Subject `json:"subject" cborgen:"subject"` - SubjectStatus *AdminDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` -} - -type AdminDefs_ReportViewDetail_Subject struct { - AdminDefs_RepoView *AdminDefs_RepoView - AdminDefs_RepoViewNotFound *AdminDefs_RepoViewNotFound - AdminDefs_RecordView *AdminDefs_RecordView - AdminDefs_RecordViewNotFound *AdminDefs_RecordViewNotFound -} - -func (t *AdminDefs_ReportViewDetail_Subject) MarshalJSON() ([]byte, error) { - if t.AdminDefs_RepoView != nil { - t.AdminDefs_RepoView.LexiconTypeID = "com.atproto.admin.defs#repoView" - return json.Marshal(t.AdminDefs_RepoView) - } - if t.AdminDefs_RepoViewNotFound != nil { - t.AdminDefs_RepoViewNotFound.LexiconTypeID = "com.atproto.admin.defs#repoViewNotFound" - return json.Marshal(t.AdminDefs_RepoViewNotFound) - } - if t.AdminDefs_RecordView != nil { - t.AdminDefs_RecordView.LexiconTypeID = "com.atproto.admin.defs#recordView" - return json.Marshal(t.AdminDefs_RecordView) - } - if t.AdminDefs_RecordViewNotFound != nil { - t.AdminDefs_RecordViewNotFound.LexiconTypeID = "com.atproto.admin.defs#recordViewNotFound" - return json.Marshal(t.AdminDefs_RecordViewNotFound) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_ReportViewDetail_Subject) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#repoView": - t.AdminDefs_RepoView = new(AdminDefs_RepoView) - return json.Unmarshal(b, t.AdminDefs_RepoView) - case "com.atproto.admin.defs#repoViewNotFound": - t.AdminDefs_RepoViewNotFound = new(AdminDefs_RepoViewNotFound) - return json.Unmarshal(b, t.AdminDefs_RepoViewNotFound) - case "com.atproto.admin.defs#recordView": - t.AdminDefs_RecordView = new(AdminDefs_RecordView) - return json.Unmarshal(b, t.AdminDefs_RecordView) - case "com.atproto.admin.defs#recordViewNotFound": - t.AdminDefs_RecordViewNotFound = new(AdminDefs_RecordViewNotFound) - return json.Unmarshal(b, t.AdminDefs_RecordViewNotFound) - - default: - return nil - } -} - -type AdminDefs_ReportView_Subject struct { - AdminDefs_RepoRef *AdminDefs_RepoRef - RepoStrongRef *RepoStrongRef -} - -func (t *AdminDefs_ReportView_Subject) MarshalJSON() ([]byte, error) { - if t.AdminDefs_RepoRef != nil { - t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" - return json.Marshal(t.AdminDefs_RepoRef) - } - if t.RepoStrongRef != nil { - t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" - return json.Marshal(t.RepoStrongRef) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_ReportView_Subject) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#repoRef": - t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) - return json.Unmarshal(b, t.AdminDefs_RepoRef) - case "com.atproto.repo.strongRef": - t.RepoStrongRef = new(RepoStrongRef) - return json.Unmarshal(b, t.RepoStrongRef) - - default: - return nil - } -} - // AdminDefs_StatusAttr is a "statusAttr" in the com.atproto.admin.defs schema. type AdminDefs_StatusAttr struct { Applied bool `json:"applied" cborgen:"applied"` Ref *string `json:"ref,omitempty" cborgen:"ref,omitempty"` } - -// AdminDefs_SubjectStatusView is a "subjectStatusView" in the com.atproto.admin.defs schema. -type AdminDefs_SubjectStatusView struct { - // appealed: True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. - Appealed *bool `json:"appealed,omitempty" cborgen:"appealed,omitempty"` - // 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"` - // 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"` - LastReviewedAt *string `json:"lastReviewedAt,omitempty" cborgen:"lastReviewedAt,omitempty"` - LastReviewedBy *string `json:"lastReviewedBy,omitempty" cborgen:"lastReviewedBy,omitempty"` - MuteUntil *string `json:"muteUntil,omitempty" cborgen:"muteUntil,omitempty"` - ReviewState *string `json:"reviewState" cborgen:"reviewState"` - Subject *AdminDefs_SubjectStatusView_Subject `json:"subject" cborgen:"subject"` - SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"` - SubjectRepoHandle *string `json:"subjectRepoHandle,omitempty" cborgen:"subjectRepoHandle,omitempty"` - SuspendUntil *string `json:"suspendUntil,omitempty" cborgen:"suspendUntil,omitempty"` - Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` - Takendown *bool `json:"takendown,omitempty" cborgen:"takendown,omitempty"` - // updatedAt: Timestamp referencing when the last update was made to the moderation status of the subject - UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` -} - -type AdminDefs_SubjectStatusView_Subject struct { - AdminDefs_RepoRef *AdminDefs_RepoRef - RepoStrongRef *RepoStrongRef -} - -func (t *AdminDefs_SubjectStatusView_Subject) MarshalJSON() ([]byte, error) { - if t.AdminDefs_RepoRef != nil { - t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" - return json.Marshal(t.AdminDefs_RepoRef) - } - if t.RepoStrongRef != nil { - t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" - return json.Marshal(t.RepoStrongRef) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminDefs_SubjectStatusView_Subject) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#repoRef": - t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) - return json.Unmarshal(b, t.AdminDefs_RepoRef) - case "com.atproto.repo.strongRef": - t.RepoStrongRef = new(RepoStrongRef) - return json.Unmarshal(b, t.RepoStrongRef) - - default: - return nil - } -} - -// AdminDefs_VideoDetails is a "videoDetails" in the com.atproto.admin.defs schema. -// -// RECORDTYPE: AdminDefs_VideoDetails -type AdminDefs_VideoDetails struct { - LexiconTypeID string `json:"$type,const=com.atproto.admin.defs#videoDetails" cborgen:"$type,const=com.atproto.admin.defs#videoDetails"` - Height int64 `json:"height" cborgen:"height"` - Length int64 `json:"length" cborgen:"length"` - Width int64 `json:"width" cborgen:"width"` -} diff --git a/api/atproto/admindeleteCommunicationTemplate.go b/api/atproto/admindeleteCommunicationTemplate.go deleted file mode 100644 index 5cf03ff46..000000000 --- a/api/atproto/admindeleteCommunicationTemplate.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.deleteCommunicationTemplate - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminDeleteCommunicationTemplate_Input is the input argument to a com.atproto.admin.deleteCommunicationTemplate call. -type AdminDeleteCommunicationTemplate_Input struct { - Id string `json:"id" cborgen:"id"` -} - -// AdminDeleteCommunicationTemplate calls the XRPC method "com.atproto.admin.deleteCommunicationTemplate". -func AdminDeleteCommunicationTemplate(ctx context.Context, c *xrpc.Client, input *AdminDeleteCommunicationTemplate_Input) error { - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.admin.deleteCommunicationTemplate", nil, input, nil); err != nil { - return err - } - - return nil -} diff --git a/api/atproto/adminemitModerationEvent.go b/api/atproto/adminemitModerationEvent.go deleted file mode 100644 index 733f61f59..000000000 --- a/api/atproto/adminemitModerationEvent.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.emitModerationEvent - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/bluesky-social/indigo/lex/util" - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminEmitModerationEvent_Input is the input argument to a com.atproto.admin.emitModerationEvent call. -type AdminEmitModerationEvent_Input struct { - CreatedBy string `json:"createdBy" cborgen:"createdBy"` - Event *AdminEmitModerationEvent_Input_Event `json:"event" cborgen:"event"` - Subject *AdminEmitModerationEvent_Input_Subject `json:"subject" cborgen:"subject"` - SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"` -} - -type AdminEmitModerationEvent_Input_Event struct { - AdminDefs_ModEventTakedown *AdminDefs_ModEventTakedown - AdminDefs_ModEventAcknowledge *AdminDefs_ModEventAcknowledge - AdminDefs_ModEventEscalate *AdminDefs_ModEventEscalate - AdminDefs_ModEventComment *AdminDefs_ModEventComment - AdminDefs_ModEventLabel *AdminDefs_ModEventLabel - AdminDefs_ModEventReport *AdminDefs_ModEventReport - AdminDefs_ModEventMute *AdminDefs_ModEventMute - AdminDefs_ModEventReverseTakedown *AdminDefs_ModEventReverseTakedown - AdminDefs_ModEventUnmute *AdminDefs_ModEventUnmute - AdminDefs_ModEventEmail *AdminDefs_ModEventEmail - AdminDefs_ModEventTag *AdminDefs_ModEventTag -} - -func (t *AdminEmitModerationEvent_Input_Event) MarshalJSON() ([]byte, error) { - if t.AdminDefs_ModEventTakedown != nil { - t.AdminDefs_ModEventTakedown.LexiconTypeID = "com.atproto.admin.defs#modEventTakedown" - return json.Marshal(t.AdminDefs_ModEventTakedown) - } - if t.AdminDefs_ModEventAcknowledge != nil { - t.AdminDefs_ModEventAcknowledge.LexiconTypeID = "com.atproto.admin.defs#modEventAcknowledge" - return json.Marshal(t.AdminDefs_ModEventAcknowledge) - } - if t.AdminDefs_ModEventEscalate != nil { - t.AdminDefs_ModEventEscalate.LexiconTypeID = "com.atproto.admin.defs#modEventEscalate" - return json.Marshal(t.AdminDefs_ModEventEscalate) - } - if t.AdminDefs_ModEventComment != nil { - t.AdminDefs_ModEventComment.LexiconTypeID = "com.atproto.admin.defs#modEventComment" - return json.Marshal(t.AdminDefs_ModEventComment) - } - if t.AdminDefs_ModEventLabel != nil { - t.AdminDefs_ModEventLabel.LexiconTypeID = "com.atproto.admin.defs#modEventLabel" - return json.Marshal(t.AdminDefs_ModEventLabel) - } - if t.AdminDefs_ModEventReport != nil { - t.AdminDefs_ModEventReport.LexiconTypeID = "com.atproto.admin.defs#modEventReport" - return json.Marshal(t.AdminDefs_ModEventReport) - } - if t.AdminDefs_ModEventMute != nil { - t.AdminDefs_ModEventMute.LexiconTypeID = "com.atproto.admin.defs#modEventMute" - return json.Marshal(t.AdminDefs_ModEventMute) - } - if t.AdminDefs_ModEventReverseTakedown != nil { - t.AdminDefs_ModEventReverseTakedown.LexiconTypeID = "com.atproto.admin.defs#modEventReverseTakedown" - return json.Marshal(t.AdminDefs_ModEventReverseTakedown) - } - if t.AdminDefs_ModEventUnmute != nil { - t.AdminDefs_ModEventUnmute.LexiconTypeID = "com.atproto.admin.defs#modEventUnmute" - return json.Marshal(t.AdminDefs_ModEventUnmute) - } - if t.AdminDefs_ModEventEmail != nil { - t.AdminDefs_ModEventEmail.LexiconTypeID = "com.atproto.admin.defs#modEventEmail" - return json.Marshal(t.AdminDefs_ModEventEmail) - } - if t.AdminDefs_ModEventTag != nil { - t.AdminDefs_ModEventTag.LexiconTypeID = "com.atproto.admin.defs#modEventTag" - return json.Marshal(t.AdminDefs_ModEventTag) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminEmitModerationEvent_Input_Event) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#modEventTakedown": - t.AdminDefs_ModEventTakedown = new(AdminDefs_ModEventTakedown) - return json.Unmarshal(b, t.AdminDefs_ModEventTakedown) - case "com.atproto.admin.defs#modEventAcknowledge": - t.AdminDefs_ModEventAcknowledge = new(AdminDefs_ModEventAcknowledge) - return json.Unmarshal(b, t.AdminDefs_ModEventAcknowledge) - case "com.atproto.admin.defs#modEventEscalate": - t.AdminDefs_ModEventEscalate = new(AdminDefs_ModEventEscalate) - return json.Unmarshal(b, t.AdminDefs_ModEventEscalate) - case "com.atproto.admin.defs#modEventComment": - t.AdminDefs_ModEventComment = new(AdminDefs_ModEventComment) - return json.Unmarshal(b, t.AdminDefs_ModEventComment) - case "com.atproto.admin.defs#modEventLabel": - t.AdminDefs_ModEventLabel = new(AdminDefs_ModEventLabel) - return json.Unmarshal(b, t.AdminDefs_ModEventLabel) - case "com.atproto.admin.defs#modEventReport": - t.AdminDefs_ModEventReport = new(AdminDefs_ModEventReport) - return json.Unmarshal(b, t.AdminDefs_ModEventReport) - case "com.atproto.admin.defs#modEventMute": - t.AdminDefs_ModEventMute = new(AdminDefs_ModEventMute) - return json.Unmarshal(b, t.AdminDefs_ModEventMute) - case "com.atproto.admin.defs#modEventReverseTakedown": - t.AdminDefs_ModEventReverseTakedown = new(AdminDefs_ModEventReverseTakedown) - return json.Unmarshal(b, t.AdminDefs_ModEventReverseTakedown) - case "com.atproto.admin.defs#modEventUnmute": - t.AdminDefs_ModEventUnmute = new(AdminDefs_ModEventUnmute) - return json.Unmarshal(b, t.AdminDefs_ModEventUnmute) - case "com.atproto.admin.defs#modEventEmail": - t.AdminDefs_ModEventEmail = new(AdminDefs_ModEventEmail) - return json.Unmarshal(b, t.AdminDefs_ModEventEmail) - case "com.atproto.admin.defs#modEventTag": - t.AdminDefs_ModEventTag = new(AdminDefs_ModEventTag) - return json.Unmarshal(b, t.AdminDefs_ModEventTag) - - default: - return nil - } -} - -type AdminEmitModerationEvent_Input_Subject struct { - AdminDefs_RepoRef *AdminDefs_RepoRef - RepoStrongRef *RepoStrongRef -} - -func (t *AdminEmitModerationEvent_Input_Subject) MarshalJSON() ([]byte, error) { - if t.AdminDefs_RepoRef != nil { - t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" - return json.Marshal(t.AdminDefs_RepoRef) - } - if t.RepoStrongRef != nil { - t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" - return json.Marshal(t.RepoStrongRef) - } - return nil, fmt.Errorf("cannot marshal empty enum") -} -func (t *AdminEmitModerationEvent_Input_Subject) UnmarshalJSON(b []byte) error { - typ, err := util.TypeExtract(b) - if err != nil { - return err - } - - switch typ { - case "com.atproto.admin.defs#repoRef": - t.AdminDefs_RepoRef = new(AdminDefs_RepoRef) - return json.Unmarshal(b, t.AdminDefs_RepoRef) - case "com.atproto.repo.strongRef": - t.RepoStrongRef = new(RepoStrongRef) - return json.Unmarshal(b, t.RepoStrongRef) - - default: - return nil - } -} - -// AdminEmitModerationEvent calls the XRPC method "com.atproto.admin.emitModerationEvent". -func AdminEmitModerationEvent(ctx context.Context, c *xrpc.Client, input *AdminEmitModerationEvent_Input) (*AdminDefs_ModEventView, error) { - var out AdminDefs_ModEventView - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.admin.emitModerationEvent", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/admingetModerationEvent.go b/api/atproto/admingetModerationEvent.go deleted file mode 100644 index 316372d1f..000000000 --- a/api/atproto/admingetModerationEvent.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.getModerationEvent - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminGetModerationEvent calls the XRPC method "com.atproto.admin.getModerationEvent". -func AdminGetModerationEvent(ctx context.Context, c *xrpc.Client, id int64) (*AdminDefs_ModEventViewDetail, error) { - var out AdminDefs_ModEventViewDetail - - params := map[string]interface{}{ - "id": id, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.getModerationEvent", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/admingetRecord.go b/api/atproto/admingetRecord.go deleted file mode 100644 index 234bc83a0..000000000 --- a/api/atproto/admingetRecord.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.getRecord - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminGetRecord calls the XRPC method "com.atproto.admin.getRecord". -func AdminGetRecord(ctx context.Context, c *xrpc.Client, cid string, uri string) (*AdminDefs_RecordViewDetail, error) { - var out AdminDefs_RecordViewDetail - - params := map[string]interface{}{ - "cid": cid, - "uri": uri, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.getRecord", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/admingetRepo.go b/api/atproto/admingetRepo.go deleted file mode 100644 index 97100285e..000000000 --- a/api/atproto/admingetRepo.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.getRepo - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminGetRepo calls the XRPC method "com.atproto.admin.getRepo". -func AdminGetRepo(ctx context.Context, c *xrpc.Client, did string) (*AdminDefs_RepoViewDetail, error) { - var out AdminDefs_RepoViewDetail - - params := map[string]interface{}{ - "did": did, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.getRepo", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/adminlistCommunicationTemplates.go b/api/atproto/adminlistCommunicationTemplates.go deleted file mode 100644 index 01616a9eb..000000000 --- a/api/atproto/adminlistCommunicationTemplates.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.listCommunicationTemplates - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminListCommunicationTemplates_Output is the output of a com.atproto.admin.listCommunicationTemplates call. -type AdminListCommunicationTemplates_Output struct { - CommunicationTemplates []*AdminDefs_CommunicationTemplateView `json:"communicationTemplates" cborgen:"communicationTemplates"` -} - -// AdminListCommunicationTemplates calls the XRPC method "com.atproto.admin.listCommunicationTemplates". -func AdminListCommunicationTemplates(ctx context.Context, c *xrpc.Client) (*AdminListCommunicationTemplates_Output, error) { - var out AdminListCommunicationTemplates_Output - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.listCommunicationTemplates", nil, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/adminqueryModerationEvents.go b/api/atproto/adminqueryModerationEvents.go deleted file mode 100644 index a30b15170..000000000 --- a/api/atproto/adminqueryModerationEvents.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.queryModerationEvents - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminQueryModerationEvents_Output is the output of a com.atproto.admin.queryModerationEvents call. -type AdminQueryModerationEvents_Output struct { - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Events []*AdminDefs_ModEventView `json:"events" cborgen:"events"` -} - -// AdminQueryModerationEvents calls the XRPC method "com.atproto.admin.queryModerationEvents". -// -// 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 -// comment: If specified, only events with comments containing the keyword are returned -// 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 -// includeAllUserRecords: If true, events on all record types (posts, lists, profile etc.) owned by the did are returned -// 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. -// types: The types of events (fully qualified string in the format of com.atproto.admin#modEvent) to filter by. If not specified, all events are returned. -func AdminQueryModerationEvents(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) (*AdminQueryModerationEvents_Output, error) { - var out AdminQueryModerationEvents_Output - - params := map[string]interface{}{ - "addedLabels": addedLabels, - "addedTags": addedTags, - "comment": comment, - "createdAfter": createdAfter, - "createdBefore": createdBefore, - "createdBy": createdBy, - "cursor": cursor, - "hasComment": hasComment, - "includeAllUserRecords": includeAllUserRecords, - "limit": limit, - "removedLabels": removedLabels, - "removedTags": removedTags, - "reportTypes": reportTypes, - "sortDirection": sortDirection, - "subject": subject, - "types": types, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.queryModerationEvents", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/adminqueryModerationStatuses.go b/api/atproto/adminqueryModerationStatuses.go deleted file mode 100644 index 89b86b928..000000000 --- a/api/atproto/adminqueryModerationStatuses.go +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.queryModerationStatuses - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminQueryModerationStatuses_Output is the output of a com.atproto.admin.queryModerationStatuses call. -type AdminQueryModerationStatuses_Output struct { - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - SubjectStatuses []*AdminDefs_SubjectStatusView `json:"subjectStatuses" cborgen:"subjectStatuses"` -} - -// AdminQueryModerationStatuses calls the XRPC method "com.atproto.admin.queryModerationStatuses". -// -// appealed: Get subjects in unresolved appealed status -// comment: Search subjects by keyword from comments -// 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 -// 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 -// reviewedAfter: Search subjects reviewed after a given timestamp -// reviewedBefore: Search subjects reviewed before a given timestamp -// takendown: Get subjects that were taken down -func AdminQueryModerationStatuses(ctx context.Context, c *xrpc.Client, appealed bool, comment string, cursor string, excludeTags []string, ignoreSubjects []string, includeMuted bool, lastReviewedBy string, limit int64, reportedAfter string, reportedBefore string, reviewState string, reviewedAfter string, reviewedBefore string, sortDirection string, sortField string, subject string, tags []string, takendown bool) (*AdminQueryModerationStatuses_Output, error) { - var out AdminQueryModerationStatuses_Output - - params := map[string]interface{}{ - "appealed": appealed, - "comment": comment, - "cursor": cursor, - "excludeTags": excludeTags, - "ignoreSubjects": ignoreSubjects, - "includeMuted": includeMuted, - "lastReviewedBy": lastReviewedBy, - "limit": limit, - "reportedAfter": reportedAfter, - "reportedBefore": reportedBefore, - "reviewState": reviewState, - "reviewedAfter": reviewedAfter, - "reviewedBefore": reviewedBefore, - "sortDirection": sortDirection, - "sortField": sortField, - "subject": subject, - "tags": tags, - "takendown": takendown, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.queryModerationStatuses", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/adminsearchRepos.go b/api/atproto/adminsearchRepos.go deleted file mode 100644 index 023af9df3..000000000 --- a/api/atproto/adminsearchRepos.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.searchRepos - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminSearchRepos_Output is the output of a com.atproto.admin.searchRepos call. -type AdminSearchRepos_Output struct { - Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` - Repos []*AdminDefs_RepoView `json:"repos" cborgen:"repos"` -} - -// AdminSearchRepos calls the XRPC method "com.atproto.admin.searchRepos". -// -// term: DEPRECATED: use 'q' instead -func AdminSearchRepos(ctx context.Context, c *xrpc.Client, cursor string, limit int64, q string, term string) (*AdminSearchRepos_Output, error) { - var out AdminSearchRepos_Output - - params := map[string]interface{}{ - "cursor": cursor, - "limit": limit, - "q": q, - "term": term, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.admin.searchRepos", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/adminupdateCommunicationTemplate.go b/api/atproto/adminupdateCommunicationTemplate.go deleted file mode 100644 index 066eea469..000000000 --- a/api/atproto/adminupdateCommunicationTemplate.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.admin.updateCommunicationTemplate - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// AdminUpdateCommunicationTemplate_Input is the input argument to a com.atproto.admin.updateCommunicationTemplate call. -type AdminUpdateCommunicationTemplate_Input struct { - // contentMarkdown: Content of the template, markdown supported, can contain variable placeholders. - ContentMarkdown *string `json:"contentMarkdown,omitempty" cborgen:"contentMarkdown,omitempty"` - Disabled *bool `json:"disabled,omitempty" cborgen:"disabled,omitempty"` - // id: ID of the template to be updated. - Id string `json:"id" cborgen:"id"` - // name: Name of the template. - Name *string `json:"name,omitempty" cborgen:"name,omitempty"` - // subject: Subject of the message, used in emails. - Subject *string `json:"subject,omitempty" cborgen:"subject,omitempty"` - // updatedBy: DID of the user who is updating the template. - UpdatedBy *string `json:"updatedBy,omitempty" cborgen:"updatedBy,omitempty"` -} - -// AdminUpdateCommunicationTemplate calls the XRPC method "com.atproto.admin.updateCommunicationTemplate". -func AdminUpdateCommunicationTemplate(ctx context.Context, c *xrpc.Client, input *AdminUpdateCommunicationTemplate_Input) (*AdminDefs_CommunicationTemplateView, error) { - var out AdminDefs_CommunicationTemplateView - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.admin.updateCommunicationTemplate", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/reporebaseRepo.go b/api/atproto/reporebaseRepo.go deleted file mode 100644 index 7608e4f45..000000000 --- a/api/atproto/reporebaseRepo.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.repo.rebaseRepo - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// RepoRebaseRepo_Input is the input argument to a com.atproto.repo.rebaseRepo call. -type RepoRebaseRepo_Input struct { - // repo: The handle or DID of the repo. - Repo string `json:"repo" cborgen:"repo"` - // swapCommit: Compare and swap with the previous commit by cid. - SwapCommit *string `json:"swapCommit,omitempty" cborgen:"swapCommit,omitempty"` -} - -// RepoRebaseRepo calls the XRPC method "com.atproto.repo.rebaseRepo". -func RepoRebaseRepo(ctx context.Context, c *xrpc.Client, input *RepoRebaseRepo_Input) error { - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.repo.rebaseRepo", nil, input, nil); err != nil { - return err - } - - return nil -} diff --git a/api/atproto/syncgetCommitPath.go b/api/atproto/syncgetCommitPath.go deleted file mode 100644 index 72255f730..000000000 --- a/api/atproto/syncgetCommitPath.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.sync.getCommitPath - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// SyncGetCommitPath_Output is the output of a com.atproto.sync.getCommitPath call. -type SyncGetCommitPath_Output struct { - Commits []string `json:"commits" cborgen:"commits"` -} - -// SyncGetCommitPath calls the XRPC method "com.atproto.sync.getCommitPath". -// -// did: The DID of the repo. -// earliest: The earliest commit to start from -// latest: The most recent commit -func SyncGetCommitPath(ctx context.Context, c *xrpc.Client, did string, earliest string, latest string) (*SyncGetCommitPath_Output, error) { - var out SyncGetCommitPath_Output - - params := map[string]interface{}{ - "did": did, - "earliest": earliest, - "latest": latest, - } - if err := c.Do(ctx, xrpc.Query, "", "com.atproto.sync.getCommitPath", params, nil, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/temppushBlob.go b/api/atproto/temppushBlob.go deleted file mode 100644 index 1a5908c36..000000000 --- a/api/atproto/temppushBlob.go +++ /dev/null @@ -1,27 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.temp.pushBlob - -import ( - "context" - "io" - - "github.com/bluesky-social/indigo/xrpc" -) - -// TempPushBlob calls the XRPC method "com.atproto.temp.pushBlob". -// -// did: The DID of the repo. -func TempPushBlob(ctx context.Context, c *xrpc.Client, input io.Reader, did string) error { - - params := map[string]interface{}{ - "did": did, - } - if err := c.Do(ctx, xrpc.Procedure, "*/*", "com.atproto.temp.pushBlob", params, input, nil); err != nil { - return err - } - - return nil -} diff --git a/api/atproto/temptransferAccount.go b/api/atproto/temptransferAccount.go deleted file mode 100644 index 2c7e6f41a..000000000 --- a/api/atproto/temptransferAccount.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.temp.transferAccount - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// TempTransferAccount_Input is the input argument to a com.atproto.temp.transferAccount call. -type TempTransferAccount_Input struct { - Did string `json:"did" cborgen:"did"` - Handle string `json:"handle" cborgen:"handle"` - PlcOp interface{} `json:"plcOp" cborgen:"plcOp"` -} - -// TempTransferAccount_Output is the output of a com.atproto.temp.transferAccount call. -type TempTransferAccount_Output struct { - AccessJwt string `json:"accessJwt" cborgen:"accessJwt"` - Did string `json:"did" cborgen:"did"` - Handle string `json:"handle" cborgen:"handle"` - RefreshJwt string `json:"refreshJwt" cborgen:"refreshJwt"` -} - -// TempTransferAccount calls the XRPC method "com.atproto.temp.transferAccount". -func TempTransferAccount(ctx context.Context, c *xrpc.Client, input *TempTransferAccount_Input) (*TempTransferAccount_Output, error) { - var out TempTransferAccount_Output - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.temp.transferAccount", nil, input, &out); err != nil { - return nil, err - } - - return &out, nil -} diff --git a/api/atproto/tempupgradeRepoVersion.go b/api/atproto/tempupgradeRepoVersion.go deleted file mode 100644 index c28c904ed..000000000 --- a/api/atproto/tempupgradeRepoVersion.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. - -package atproto - -// schema: com.atproto.temp.upgradeRepoVersion - -import ( - "context" - - "github.com/bluesky-social/indigo/xrpc" -) - -// TempUpgradeRepoVersion_Input is the input argument to a com.atproto.temp.upgradeRepoVersion call. -type TempUpgradeRepoVersion_Input struct { - Did string `json:"did" cborgen:"did"` -} - -// TempUpgradeRepoVersion calls the XRPC method "com.atproto.temp.upgradeRepoVersion". -func TempUpgradeRepoVersion(ctx context.Context, c *xrpc.Client, input *TempUpgradeRepoVersion_Input) error { - if err := c.Do(ctx, xrpc.Procedure, "application/json", "com.atproto.temp.upgradeRepoVersion", nil, input, nil); err != nil { - return err - } - - return nil -} From aaeb0a70b4a4780dfb3126be0760db88d901495d Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:19:17 -0700 Subject: [PATCH 02/11] api/ozone: new tools.ozone.* namespace Lexicons --- api/ozone/communicationcreateTemplate.go | 33 ++ api/ozone/communicationdefs.go | 21 + api/ozone/communicationdeleteTemplate.go | 25 + api/ozone/communicationlistTemplates.go | 26 + api/ozone/communicationupdateTemplate.go | 36 ++ api/ozone/moderationdefs.go | 666 +++++++++++++++++++++++ api/ozone/moderationemitEvent.go | 175 ++++++ api/ozone/moderationgetEvent.go | 25 + api/ozone/moderationgetRecord.go | 26 + api/ozone/moderationgetRepo.go | 25 + api/ozone/moderationqueryEvents.go | 58 ++ api/ozone/moderationqueryStatuses.go | 59 ++ api/ozone/moderationsearchRepos.go | 36 ++ 13 files changed, 1211 insertions(+) create mode 100644 api/ozone/communicationcreateTemplate.go create mode 100644 api/ozone/communicationdefs.go create mode 100644 api/ozone/communicationdeleteTemplate.go create mode 100644 api/ozone/communicationlistTemplates.go create mode 100644 api/ozone/communicationupdateTemplate.go create mode 100644 api/ozone/moderationdefs.go create mode 100644 api/ozone/moderationemitEvent.go create mode 100644 api/ozone/moderationgetEvent.go create mode 100644 api/ozone/moderationgetRecord.go create mode 100644 api/ozone/moderationgetRepo.go create mode 100644 api/ozone/moderationqueryEvents.go create mode 100644 api/ozone/moderationqueryStatuses.go create mode 100644 api/ozone/moderationsearchRepos.go diff --git a/api/ozone/communicationcreateTemplate.go b/api/ozone/communicationcreateTemplate.go new file mode 100644 index 000000000..aef239863 --- /dev/null +++ b/api/ozone/communicationcreateTemplate.go @@ -0,0 +1,33 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.communication.createTemplate + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// CommunicationCreateTemplate_Input is the input argument to a tools.ozone.communication.createTemplate call. +type CommunicationCreateTemplate_Input struct { + // contentMarkdown: Content of the template, markdown supported, can contain variable placeholders. + ContentMarkdown string `json:"contentMarkdown" cborgen:"contentMarkdown"` + // createdBy: DID of the user who is creating the template. + CreatedBy *string `json:"createdBy,omitempty" cborgen:"createdBy,omitempty"` + // name: Name of the template. + Name string `json:"name" cborgen:"name"` + // subject: Subject of the message, used in emails. + Subject string `json:"subject" cborgen:"subject"` +} + +// CommunicationCreateTemplate calls the XRPC method "tools.ozone.communication.createTemplate". +func CommunicationCreateTemplate(ctx context.Context, c *xrpc.Client, input *CommunicationCreateTemplate_Input) (*CommunicationDefs_TemplateView, error) { + var out CommunicationDefs_TemplateView + if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.communication.createTemplate", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/communicationdefs.go b/api/ozone/communicationdefs.go new file mode 100644 index 000000000..8184894c2 --- /dev/null +++ b/api/ozone/communicationdefs.go @@ -0,0 +1,21 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.communication.defs + +// CommunicationDefs_TemplateView is a "templateView" in the tools.ozone.communication.defs schema. +type CommunicationDefs_TemplateView struct { + // contentMarkdown: Subject of the message, used in emails. + ContentMarkdown string `json:"contentMarkdown" cborgen:"contentMarkdown"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Disabled bool `json:"disabled" cborgen:"disabled"` + Id string `json:"id" cborgen:"id"` + // lastUpdatedBy: DID of the user who last updated the template. + LastUpdatedBy string `json:"lastUpdatedBy" cborgen:"lastUpdatedBy"` + // name: Name of the template. + Name string `json:"name" cborgen:"name"` + // subject: Content of the template, can contain markdown and variable placeholders. + Subject *string `json:"subject,omitempty" cborgen:"subject,omitempty"` + UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` +} diff --git a/api/ozone/communicationdeleteTemplate.go b/api/ozone/communicationdeleteTemplate.go new file mode 100644 index 000000000..5ef1108b0 --- /dev/null +++ b/api/ozone/communicationdeleteTemplate.go @@ -0,0 +1,25 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.communication.deleteTemplate + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// CommunicationDeleteTemplate_Input is the input argument to a tools.ozone.communication.deleteTemplate call. +type CommunicationDeleteTemplate_Input struct { + Id string `json:"id" cborgen:"id"` +} + +// CommunicationDeleteTemplate calls the XRPC method "tools.ozone.communication.deleteTemplate". +func CommunicationDeleteTemplate(ctx context.Context, c *xrpc.Client, input *CommunicationDeleteTemplate_Input) error { + if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.communication.deleteTemplate", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/api/ozone/communicationlistTemplates.go b/api/ozone/communicationlistTemplates.go new file mode 100644 index 000000000..2cdd50db9 --- /dev/null +++ b/api/ozone/communicationlistTemplates.go @@ -0,0 +1,26 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.communication.listTemplates + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// CommunicationListTemplates_Output is the output of a tools.ozone.communication.listTemplates call. +type CommunicationListTemplates_Output struct { + CommunicationTemplates []*CommunicationDefs_TemplateView `json:"communicationTemplates" cborgen:"communicationTemplates"` +} + +// CommunicationListTemplates calls the XRPC method "tools.ozone.communication.listTemplates". +func CommunicationListTemplates(ctx context.Context, c *xrpc.Client) (*CommunicationListTemplates_Output, error) { + var out CommunicationListTemplates_Output + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.communication.listTemplates", nil, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/communicationupdateTemplate.go b/api/ozone/communicationupdateTemplate.go new file mode 100644 index 000000000..78b30a8ef --- /dev/null +++ b/api/ozone/communicationupdateTemplate.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.communication.updateTemplate + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// CommunicationUpdateTemplate_Input is the input argument to a tools.ozone.communication.updateTemplate call. +type CommunicationUpdateTemplate_Input struct { + // contentMarkdown: Content of the template, markdown supported, can contain variable placeholders. + ContentMarkdown *string `json:"contentMarkdown,omitempty" cborgen:"contentMarkdown,omitempty"` + Disabled *bool `json:"disabled,omitempty" cborgen:"disabled,omitempty"` + // id: ID of the template to be updated. + Id string `json:"id" cborgen:"id"` + // name: Name of the template. + Name *string `json:"name,omitempty" cborgen:"name,omitempty"` + // subject: Subject of the message, used in emails. + Subject *string `json:"subject,omitempty" cborgen:"subject,omitempty"` + // updatedBy: DID of the user who is updating the template. + UpdatedBy *string `json:"updatedBy,omitempty" cborgen:"updatedBy,omitempty"` +} + +// CommunicationUpdateTemplate calls the XRPC method "tools.ozone.communication.updateTemplate". +func CommunicationUpdateTemplate(ctx context.Context, c *xrpc.Client, input *CommunicationUpdateTemplate_Input) (*CommunicationDefs_TemplateView, error) { + var out CommunicationDefs_TemplateView + if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.communication.updateTemplate", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationdefs.go b/api/ozone/moderationdefs.go new file mode 100644 index 000000000..0a075c79b --- /dev/null +++ b/api/ozone/moderationdefs.go @@ -0,0 +1,666 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.defs + +import ( + "encoding/json" + "fmt" + + comatprototypes "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/lex/util" +) + +// ModerationDefs_BlobView is a "blobView" in the tools.ozone.moderation.defs schema. +type ModerationDefs_BlobView struct { + Cid string `json:"cid" cborgen:"cid"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Details *ModerationDefs_BlobView_Details `json:"details,omitempty" cborgen:"details,omitempty"` + MimeType string `json:"mimeType" cborgen:"mimeType"` + Moderation *ModerationDefs_Moderation `json:"moderation,omitempty" cborgen:"moderation,omitempty"` + Size int64 `json:"size" cborgen:"size"` +} + +type ModerationDefs_BlobView_Details struct { + ModerationDefs_ImageDetails *ModerationDefs_ImageDetails + ModerationDefs_VideoDetails *ModerationDefs_VideoDetails +} + +func (t *ModerationDefs_BlobView_Details) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_ImageDetails != nil { + t.ModerationDefs_ImageDetails.LexiconTypeID = "tools.ozone.moderation.defs#imageDetails" + return json.Marshal(t.ModerationDefs_ImageDetails) + } + if t.ModerationDefs_VideoDetails != nil { + t.ModerationDefs_VideoDetails.LexiconTypeID = "tools.ozone.moderation.defs#videoDetails" + return json.Marshal(t.ModerationDefs_VideoDetails) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_BlobView_Details) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.moderation.defs#imageDetails": + t.ModerationDefs_ImageDetails = new(ModerationDefs_ImageDetails) + return json.Unmarshal(b, t.ModerationDefs_ImageDetails) + case "tools.ozone.moderation.defs#videoDetails": + t.ModerationDefs_VideoDetails = new(ModerationDefs_VideoDetails) + return json.Unmarshal(b, t.ModerationDefs_VideoDetails) + + default: + return nil + } +} + +// ModerationDefs_ImageDetails is a "imageDetails" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_ImageDetails +type ModerationDefs_ImageDetails struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#imageDetails" cborgen:"$type,const=tools.ozone.moderation.defs#imageDetails"` + Height int64 `json:"height" cborgen:"height"` + Width int64 `json:"width" cborgen:"width"` +} + +// ModerationDefs_ModEventAcknowledge is a "modEventAcknowledge" in the tools.ozone.moderation.defs schema. +// +// 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"` +} + +// ModerationDefs_ModEventComment is a "modEventComment" in the tools.ozone.moderation.defs schema. +// +// # Add a comment to a subject +// +// RECORDTYPE: ModerationDefs_ModEventComment +type ModerationDefs_ModEventComment struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventComment" cborgen:"$type,const=tools.ozone.moderation.defs#modEventComment"` + Comment string `json:"comment" cborgen:"comment"` + // sticky: Make the comment persistent on the subject + Sticky *bool `json:"sticky,omitempty" cborgen:"sticky,omitempty"` +} + +// ModerationDefs_ModEventEmail is a "modEventEmail" in the tools.ozone.moderation.defs schema. +// +// # Keep a log of outgoing email to a user +// +// RECORDTYPE: ModerationDefs_ModEventEmail +type ModerationDefs_ModEventEmail struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventEmail" cborgen:"$type,const=tools.ozone.moderation.defs#modEventEmail"` + // comment: Additional comment about the outgoing comm. + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + // content: The content of the email sent to the user. + Content *string `json:"content,omitempty" cborgen:"content,omitempty"` + // subjectLine: The subject line of the email sent to the user. + SubjectLine string `json:"subjectLine" cborgen:"subjectLine"` +} + +// ModerationDefs_ModEventEscalate is a "modEventEscalate" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_ModEventEscalate +type ModerationDefs_ModEventEscalate struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventEscalate" cborgen:"$type,const=tools.ozone.moderation.defs#modEventEscalate"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` +} + +// ModerationDefs_ModEventLabel is a "modEventLabel" in the tools.ozone.moderation.defs schema. +// +// Apply/Negate labels on a subject +// +// RECORDTYPE: ModerationDefs_ModEventLabel +type ModerationDefs_ModEventLabel struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventLabel" cborgen:"$type,const=tools.ozone.moderation.defs#modEventLabel"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + CreateLabelVals []string `json:"createLabelVals" cborgen:"createLabelVals"` + NegateLabelVals []string `json:"negateLabelVals" cborgen:"negateLabelVals"` +} + +// ModerationDefs_ModEventMute is a "modEventMute" in the tools.ozone.moderation.defs schema. +// +// # Mute incoming reports on a subject +// +// RECORDTYPE: ModerationDefs_ModEventMute +type ModerationDefs_ModEventMute struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventMute" cborgen:"$type,const=tools.ozone.moderation.defs#modEventMute"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + // durationInHours: Indicates how long the subject should remain muted. + DurationInHours int64 `json:"durationInHours" cborgen:"durationInHours"` +} + +// ModerationDefs_ModEventReport is a "modEventReport" in the tools.ozone.moderation.defs schema. +// +// # Report a subject +// +// RECORDTYPE: ModerationDefs_ModEventReport +type ModerationDefs_ModEventReport struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventReport" cborgen:"$type,const=tools.ozone.moderation.defs#modEventReport"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` + ReportType *string `json:"reportType" cborgen:"reportType"` +} + +// ModerationDefs_ModEventResolveAppeal is a "modEventResolveAppeal" in the tools.ozone.moderation.defs schema. +// +// # Resolve appeal on a subject +// +// RECORDTYPE: ModerationDefs_ModEventResolveAppeal +type ModerationDefs_ModEventResolveAppeal struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventResolveAppeal" cborgen:"$type,const=tools.ozone.moderation.defs#modEventResolveAppeal"` + // comment: Describe resolution. + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` +} + +// ModerationDefs_ModEventReverseTakedown is a "modEventReverseTakedown" in the tools.ozone.moderation.defs schema. +// +// # Revert take down action on a subject +// +// RECORDTYPE: ModerationDefs_ModEventReverseTakedown +type ModerationDefs_ModEventReverseTakedown struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventReverseTakedown" cborgen:"$type,const=tools.ozone.moderation.defs#modEventReverseTakedown"` + // comment: Describe reasoning behind the reversal. + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` +} + +// ModerationDefs_ModEventTag is a "modEventTag" in the tools.ozone.moderation.defs schema. +// +// Add/Remove a tag on a subject +// +// RECORDTYPE: ModerationDefs_ModEventTag +type ModerationDefs_ModEventTag struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventTag" cborgen:"$type,const=tools.ozone.moderation.defs#modEventTag"` + // add: Tags to be added to the subject. If already exists, won't be duplicated. + Add []string `json:"add" cborgen:"add"` + // comment: Additional comment about added/removed tags. + Comment *string `json:"comment,omitempty" cborgen:"comment,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"` +} + +// ModerationDefs_ModEventTakedown is a "modEventTakedown" in the tools.ozone.moderation.defs schema. +// +// # Take down a subject permanently or temporarily +// +// RECORDTYPE: ModerationDefs_ModEventTakedown +type ModerationDefs_ModEventTakedown struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventTakedown" cborgen:"$type,const=tools.ozone.moderation.defs#modEventTakedown"` + 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"` +} + +// ModerationDefs_ModEventUnmute is a "modEventUnmute" in the tools.ozone.moderation.defs schema. +// +// # Unmute action on a subject +// +// RECORDTYPE: ModerationDefs_ModEventUnmute +type ModerationDefs_ModEventUnmute struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventUnmute" cborgen:"$type,const=tools.ozone.moderation.defs#modEventUnmute"` + // comment: Describe reasoning behind the reversal. + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` +} + +// ModerationDefs_ModEventView is a "modEventView" in the tools.ozone.moderation.defs schema. +type ModerationDefs_ModEventView struct { + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedBy string `json:"createdBy" cborgen:"createdBy"` + CreatorHandle *string `json:"creatorHandle,omitempty" cborgen:"creatorHandle,omitempty"` + Event *ModerationDefs_ModEventView_Event `json:"event" cborgen:"event"` + Id int64 `json:"id" cborgen:"id"` + Subject *ModerationDefs_ModEventView_Subject `json:"subject" cborgen:"subject"` + SubjectBlobCids []string `json:"subjectBlobCids" cborgen:"subjectBlobCids"` + SubjectHandle *string `json:"subjectHandle,omitempty" cborgen:"subjectHandle,omitempty"` +} + +// ModerationDefs_ModEventViewDetail is a "modEventViewDetail" in the tools.ozone.moderation.defs schema. +type ModerationDefs_ModEventViewDetail struct { + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + CreatedBy string `json:"createdBy" cborgen:"createdBy"` + Event *ModerationDefs_ModEventViewDetail_Event `json:"event" cborgen:"event"` + Id int64 `json:"id" cborgen:"id"` + Subject *ModerationDefs_ModEventViewDetail_Subject `json:"subject" cborgen:"subject"` + SubjectBlobs []*ModerationDefs_BlobView `json:"subjectBlobs" cborgen:"subjectBlobs"` +} + +type ModerationDefs_ModEventViewDetail_Event struct { + ModerationDefs_ModEventTakedown *ModerationDefs_ModEventTakedown + ModerationDefs_ModEventReverseTakedown *ModerationDefs_ModEventReverseTakedown + ModerationDefs_ModEventComment *ModerationDefs_ModEventComment + ModerationDefs_ModEventReport *ModerationDefs_ModEventReport + ModerationDefs_ModEventLabel *ModerationDefs_ModEventLabel + ModerationDefs_ModEventAcknowledge *ModerationDefs_ModEventAcknowledge + ModerationDefs_ModEventEscalate *ModerationDefs_ModEventEscalate + ModerationDefs_ModEventMute *ModerationDefs_ModEventMute + ModerationDefs_ModEventEmail *ModerationDefs_ModEventEmail + ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal +} + +func (t *ModerationDefs_ModEventViewDetail_Event) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_ModEventTakedown != nil { + t.ModerationDefs_ModEventTakedown.LexiconTypeID = "tools.ozone.moderation.defs#modEventTakedown" + return json.Marshal(t.ModerationDefs_ModEventTakedown) + } + if t.ModerationDefs_ModEventReverseTakedown != nil { + t.ModerationDefs_ModEventReverseTakedown.LexiconTypeID = "tools.ozone.moderation.defs#modEventReverseTakedown" + return json.Marshal(t.ModerationDefs_ModEventReverseTakedown) + } + if t.ModerationDefs_ModEventComment != nil { + t.ModerationDefs_ModEventComment.LexiconTypeID = "tools.ozone.moderation.defs#modEventComment" + return json.Marshal(t.ModerationDefs_ModEventComment) + } + if t.ModerationDefs_ModEventReport != nil { + t.ModerationDefs_ModEventReport.LexiconTypeID = "tools.ozone.moderation.defs#modEventReport" + return json.Marshal(t.ModerationDefs_ModEventReport) + } + if t.ModerationDefs_ModEventLabel != nil { + t.ModerationDefs_ModEventLabel.LexiconTypeID = "tools.ozone.moderation.defs#modEventLabel" + return json.Marshal(t.ModerationDefs_ModEventLabel) + } + if t.ModerationDefs_ModEventAcknowledge != nil { + t.ModerationDefs_ModEventAcknowledge.LexiconTypeID = "tools.ozone.moderation.defs#modEventAcknowledge" + return json.Marshal(t.ModerationDefs_ModEventAcknowledge) + } + if t.ModerationDefs_ModEventEscalate != nil { + t.ModerationDefs_ModEventEscalate.LexiconTypeID = "tools.ozone.moderation.defs#modEventEscalate" + return json.Marshal(t.ModerationDefs_ModEventEscalate) + } + if t.ModerationDefs_ModEventMute != nil { + t.ModerationDefs_ModEventMute.LexiconTypeID = "tools.ozone.moderation.defs#modEventMute" + return json.Marshal(t.ModerationDefs_ModEventMute) + } + if t.ModerationDefs_ModEventEmail != nil { + t.ModerationDefs_ModEventEmail.LexiconTypeID = "tools.ozone.moderation.defs#modEventEmail" + return json.Marshal(t.ModerationDefs_ModEventEmail) + } + if t.ModerationDefs_ModEventResolveAppeal != nil { + t.ModerationDefs_ModEventResolveAppeal.LexiconTypeID = "tools.ozone.moderation.defs#modEventResolveAppeal" + return json.Marshal(t.ModerationDefs_ModEventResolveAppeal) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_ModEventViewDetail_Event) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.moderation.defs#modEventTakedown": + t.ModerationDefs_ModEventTakedown = new(ModerationDefs_ModEventTakedown) + return json.Unmarshal(b, t.ModerationDefs_ModEventTakedown) + case "tools.ozone.moderation.defs#modEventReverseTakedown": + t.ModerationDefs_ModEventReverseTakedown = new(ModerationDefs_ModEventReverseTakedown) + return json.Unmarshal(b, t.ModerationDefs_ModEventReverseTakedown) + case "tools.ozone.moderation.defs#modEventComment": + t.ModerationDefs_ModEventComment = new(ModerationDefs_ModEventComment) + return json.Unmarshal(b, t.ModerationDefs_ModEventComment) + case "tools.ozone.moderation.defs#modEventReport": + t.ModerationDefs_ModEventReport = new(ModerationDefs_ModEventReport) + return json.Unmarshal(b, t.ModerationDefs_ModEventReport) + case "tools.ozone.moderation.defs#modEventLabel": + t.ModerationDefs_ModEventLabel = new(ModerationDefs_ModEventLabel) + return json.Unmarshal(b, t.ModerationDefs_ModEventLabel) + case "tools.ozone.moderation.defs#modEventAcknowledge": + t.ModerationDefs_ModEventAcknowledge = new(ModerationDefs_ModEventAcknowledge) + return json.Unmarshal(b, t.ModerationDefs_ModEventAcknowledge) + case "tools.ozone.moderation.defs#modEventEscalate": + t.ModerationDefs_ModEventEscalate = new(ModerationDefs_ModEventEscalate) + return json.Unmarshal(b, t.ModerationDefs_ModEventEscalate) + case "tools.ozone.moderation.defs#modEventMute": + t.ModerationDefs_ModEventMute = new(ModerationDefs_ModEventMute) + return json.Unmarshal(b, t.ModerationDefs_ModEventMute) + case "tools.ozone.moderation.defs#modEventEmail": + t.ModerationDefs_ModEventEmail = new(ModerationDefs_ModEventEmail) + return json.Unmarshal(b, t.ModerationDefs_ModEventEmail) + case "tools.ozone.moderation.defs#modEventResolveAppeal": + t.ModerationDefs_ModEventResolveAppeal = new(ModerationDefs_ModEventResolveAppeal) + return json.Unmarshal(b, t.ModerationDefs_ModEventResolveAppeal) + + default: + return nil + } +} + +type ModerationDefs_ModEventViewDetail_Subject struct { + ModerationDefs_RepoView *ModerationDefs_RepoView + ModerationDefs_RepoViewNotFound *ModerationDefs_RepoViewNotFound + ModerationDefs_RecordView *ModerationDefs_RecordView + ModerationDefs_RecordViewNotFound *ModerationDefs_RecordViewNotFound +} + +func (t *ModerationDefs_ModEventViewDetail_Subject) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_RepoView != nil { + t.ModerationDefs_RepoView.LexiconTypeID = "tools.ozone.moderation.defs#repoView" + return json.Marshal(t.ModerationDefs_RepoView) + } + if t.ModerationDefs_RepoViewNotFound != nil { + t.ModerationDefs_RepoViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#repoViewNotFound" + return json.Marshal(t.ModerationDefs_RepoViewNotFound) + } + if t.ModerationDefs_RecordView != nil { + t.ModerationDefs_RecordView.LexiconTypeID = "tools.ozone.moderation.defs#recordView" + return json.Marshal(t.ModerationDefs_RecordView) + } + if t.ModerationDefs_RecordViewNotFound != nil { + t.ModerationDefs_RecordViewNotFound.LexiconTypeID = "tools.ozone.moderation.defs#recordViewNotFound" + return json.Marshal(t.ModerationDefs_RecordViewNotFound) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_ModEventViewDetail_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.moderation.defs#repoView": + t.ModerationDefs_RepoView = new(ModerationDefs_RepoView) + return json.Unmarshal(b, t.ModerationDefs_RepoView) + case "tools.ozone.moderation.defs#repoViewNotFound": + t.ModerationDefs_RepoViewNotFound = new(ModerationDefs_RepoViewNotFound) + return json.Unmarshal(b, t.ModerationDefs_RepoViewNotFound) + case "tools.ozone.moderation.defs#recordView": + t.ModerationDefs_RecordView = new(ModerationDefs_RecordView) + return json.Unmarshal(b, t.ModerationDefs_RecordView) + case "tools.ozone.moderation.defs#recordViewNotFound": + t.ModerationDefs_RecordViewNotFound = new(ModerationDefs_RecordViewNotFound) + return json.Unmarshal(b, t.ModerationDefs_RecordViewNotFound) + + default: + return nil + } +} + +type ModerationDefs_ModEventView_Event struct { + ModerationDefs_ModEventTakedown *ModerationDefs_ModEventTakedown + ModerationDefs_ModEventReverseTakedown *ModerationDefs_ModEventReverseTakedown + ModerationDefs_ModEventComment *ModerationDefs_ModEventComment + ModerationDefs_ModEventReport *ModerationDefs_ModEventReport + ModerationDefs_ModEventLabel *ModerationDefs_ModEventLabel + ModerationDefs_ModEventAcknowledge *ModerationDefs_ModEventAcknowledge + ModerationDefs_ModEventEscalate *ModerationDefs_ModEventEscalate + ModerationDefs_ModEventMute *ModerationDefs_ModEventMute + ModerationDefs_ModEventEmail *ModerationDefs_ModEventEmail + ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal +} + +func (t *ModerationDefs_ModEventView_Event) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_ModEventTakedown != nil { + t.ModerationDefs_ModEventTakedown.LexiconTypeID = "tools.ozone.moderation.defs#modEventTakedown" + return json.Marshal(t.ModerationDefs_ModEventTakedown) + } + if t.ModerationDefs_ModEventReverseTakedown != nil { + t.ModerationDefs_ModEventReverseTakedown.LexiconTypeID = "tools.ozone.moderation.defs#modEventReverseTakedown" + return json.Marshal(t.ModerationDefs_ModEventReverseTakedown) + } + if t.ModerationDefs_ModEventComment != nil { + t.ModerationDefs_ModEventComment.LexiconTypeID = "tools.ozone.moderation.defs#modEventComment" + return json.Marshal(t.ModerationDefs_ModEventComment) + } + if t.ModerationDefs_ModEventReport != nil { + t.ModerationDefs_ModEventReport.LexiconTypeID = "tools.ozone.moderation.defs#modEventReport" + return json.Marshal(t.ModerationDefs_ModEventReport) + } + if t.ModerationDefs_ModEventLabel != nil { + t.ModerationDefs_ModEventLabel.LexiconTypeID = "tools.ozone.moderation.defs#modEventLabel" + return json.Marshal(t.ModerationDefs_ModEventLabel) + } + if t.ModerationDefs_ModEventAcknowledge != nil { + t.ModerationDefs_ModEventAcknowledge.LexiconTypeID = "tools.ozone.moderation.defs#modEventAcknowledge" + return json.Marshal(t.ModerationDefs_ModEventAcknowledge) + } + if t.ModerationDefs_ModEventEscalate != nil { + t.ModerationDefs_ModEventEscalate.LexiconTypeID = "tools.ozone.moderation.defs#modEventEscalate" + return json.Marshal(t.ModerationDefs_ModEventEscalate) + } + if t.ModerationDefs_ModEventMute != nil { + t.ModerationDefs_ModEventMute.LexiconTypeID = "tools.ozone.moderation.defs#modEventMute" + return json.Marshal(t.ModerationDefs_ModEventMute) + } + if t.ModerationDefs_ModEventEmail != nil { + t.ModerationDefs_ModEventEmail.LexiconTypeID = "tools.ozone.moderation.defs#modEventEmail" + return json.Marshal(t.ModerationDefs_ModEventEmail) + } + if t.ModerationDefs_ModEventResolveAppeal != nil { + t.ModerationDefs_ModEventResolveAppeal.LexiconTypeID = "tools.ozone.moderation.defs#modEventResolveAppeal" + return json.Marshal(t.ModerationDefs_ModEventResolveAppeal) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_ModEventView_Event) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.moderation.defs#modEventTakedown": + t.ModerationDefs_ModEventTakedown = new(ModerationDefs_ModEventTakedown) + return json.Unmarshal(b, t.ModerationDefs_ModEventTakedown) + case "tools.ozone.moderation.defs#modEventReverseTakedown": + t.ModerationDefs_ModEventReverseTakedown = new(ModerationDefs_ModEventReverseTakedown) + return json.Unmarshal(b, t.ModerationDefs_ModEventReverseTakedown) + case "tools.ozone.moderation.defs#modEventComment": + t.ModerationDefs_ModEventComment = new(ModerationDefs_ModEventComment) + return json.Unmarshal(b, t.ModerationDefs_ModEventComment) + case "tools.ozone.moderation.defs#modEventReport": + t.ModerationDefs_ModEventReport = new(ModerationDefs_ModEventReport) + return json.Unmarshal(b, t.ModerationDefs_ModEventReport) + case "tools.ozone.moderation.defs#modEventLabel": + t.ModerationDefs_ModEventLabel = new(ModerationDefs_ModEventLabel) + return json.Unmarshal(b, t.ModerationDefs_ModEventLabel) + case "tools.ozone.moderation.defs#modEventAcknowledge": + t.ModerationDefs_ModEventAcknowledge = new(ModerationDefs_ModEventAcknowledge) + return json.Unmarshal(b, t.ModerationDefs_ModEventAcknowledge) + case "tools.ozone.moderation.defs#modEventEscalate": + t.ModerationDefs_ModEventEscalate = new(ModerationDefs_ModEventEscalate) + return json.Unmarshal(b, t.ModerationDefs_ModEventEscalate) + case "tools.ozone.moderation.defs#modEventMute": + t.ModerationDefs_ModEventMute = new(ModerationDefs_ModEventMute) + return json.Unmarshal(b, t.ModerationDefs_ModEventMute) + case "tools.ozone.moderation.defs#modEventEmail": + t.ModerationDefs_ModEventEmail = new(ModerationDefs_ModEventEmail) + return json.Unmarshal(b, t.ModerationDefs_ModEventEmail) + case "tools.ozone.moderation.defs#modEventResolveAppeal": + t.ModerationDefs_ModEventResolveAppeal = new(ModerationDefs_ModEventResolveAppeal) + return json.Unmarshal(b, t.ModerationDefs_ModEventResolveAppeal) + + default: + return nil + } +} + +type ModerationDefs_ModEventView_Subject struct { + AdminDefs_RepoRef *comatprototypes.AdminDefs_RepoRef + RepoStrongRef *comatprototypes.RepoStrongRef +} + +func (t *ModerationDefs_ModEventView_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_ModEventView_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(comatprototypes.AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(comatprototypes.RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + + default: + return nil + } +} + +// ModerationDefs_Moderation is a "moderation" in the tools.ozone.moderation.defs schema. +type ModerationDefs_Moderation struct { + SubjectStatus *ModerationDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` +} + +// ModerationDefs_ModerationDetail is a "moderationDetail" in the tools.ozone.moderation.defs schema. +type ModerationDefs_ModerationDetail struct { + SubjectStatus *ModerationDefs_SubjectStatusView `json:"subjectStatus,omitempty" cborgen:"subjectStatus,omitempty"` +} + +// ModerationDefs_RecordView is a "recordView" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_RecordView +type ModerationDefs_RecordView struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#recordView" cborgen:"$type,const=tools.ozone.moderation.defs#recordView"` + BlobCids []string `json:"blobCids" cborgen:"blobCids"` + Cid string `json:"cid" cborgen:"cid"` + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + Moderation *ModerationDefs_Moderation `json:"moderation" cborgen:"moderation"` + Repo *ModerationDefs_RepoView `json:"repo" cborgen:"repo"` + Uri string `json:"uri" cborgen:"uri"` + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// ModerationDefs_RecordViewDetail is a "recordViewDetail" in the tools.ozone.moderation.defs schema. +type ModerationDefs_RecordViewDetail struct { + Blobs []*ModerationDefs_BlobView `json:"blobs" cborgen:"blobs"` + Cid string `json:"cid" cborgen:"cid"` + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + Labels []*comatprototypes.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` + Moderation *ModerationDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` + Repo *ModerationDefs_RepoView `json:"repo" cborgen:"repo"` + Uri string `json:"uri" cborgen:"uri"` + Value *util.LexiconTypeDecoder `json:"value" cborgen:"value"` +} + +// ModerationDefs_RecordViewNotFound is a "recordViewNotFound" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_RecordViewNotFound +type ModerationDefs_RecordViewNotFound struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#recordViewNotFound" cborgen:"$type,const=tools.ozone.moderation.defs#recordViewNotFound"` + Uri string `json:"uri" cborgen:"uri"` +} + +// ModerationDefs_RepoView is a "repoView" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_RepoView +type ModerationDefs_RepoView struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#repoView" cborgen:"$type,const=tools.ozone.moderation.defs#repoView"` + Did string `json:"did" cborgen:"did"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` + InvitedBy *comatprototypes.ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` + InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` + Moderation *ModerationDefs_Moderation `json:"moderation" cborgen:"moderation"` + RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords" cborgen:"relatedRecords"` +} + +// ModerationDefs_RepoViewDetail is a "repoViewDetail" in the tools.ozone.moderation.defs schema. +type ModerationDefs_RepoViewDetail struct { + Did string `json:"did" cborgen:"did"` + Email *string `json:"email,omitempty" cborgen:"email,omitempty"` + EmailConfirmedAt *string `json:"emailConfirmedAt,omitempty" cborgen:"emailConfirmedAt,omitempty"` + Handle string `json:"handle" cborgen:"handle"` + IndexedAt string `json:"indexedAt" cborgen:"indexedAt"` + InviteNote *string `json:"inviteNote,omitempty" cborgen:"inviteNote,omitempty"` + InvitedBy *comatprototypes.ServerDefs_InviteCode `json:"invitedBy,omitempty" cborgen:"invitedBy,omitempty"` + Invites []*comatprototypes.ServerDefs_InviteCode `json:"invites,omitempty" cborgen:"invites,omitempty"` + InvitesDisabled *bool `json:"invitesDisabled,omitempty" cborgen:"invitesDisabled,omitempty"` + Labels []*comatprototypes.LabelDefs_Label `json:"labels,omitempty" cborgen:"labels,omitempty"` + Moderation *ModerationDefs_ModerationDetail `json:"moderation" cborgen:"moderation"` + RelatedRecords []*util.LexiconTypeDecoder `json:"relatedRecords" cborgen:"relatedRecords"` +} + +// ModerationDefs_RepoViewNotFound is a "repoViewNotFound" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_RepoViewNotFound +type ModerationDefs_RepoViewNotFound struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#repoViewNotFound" cborgen:"$type,const=tools.ozone.moderation.defs#repoViewNotFound"` + Did string `json:"did" cborgen:"did"` +} + +// ModerationDefs_SubjectStatusView is a "subjectStatusView" in the tools.ozone.moderation.defs schema. +type ModerationDefs_SubjectStatusView struct { + // appealed: True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators. + Appealed *bool `json:"appealed,omitempty" cborgen:"appealed,omitempty"` + // 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"` + // 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"` + LastReviewedAt *string `json:"lastReviewedAt,omitempty" cborgen:"lastReviewedAt,omitempty"` + LastReviewedBy *string `json:"lastReviewedBy,omitempty" cborgen:"lastReviewedBy,omitempty"` + MuteUntil *string `json:"muteUntil,omitempty" cborgen:"muteUntil,omitempty"` + ReviewState *string `json:"reviewState" cborgen:"reviewState"` + Subject *ModerationDefs_SubjectStatusView_Subject `json:"subject" cborgen:"subject"` + SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"` + SubjectRepoHandle *string `json:"subjectRepoHandle,omitempty" cborgen:"subjectRepoHandle,omitempty"` + SuspendUntil *string `json:"suspendUntil,omitempty" cborgen:"suspendUntil,omitempty"` + Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` + Takendown *bool `json:"takendown,omitempty" cborgen:"takendown,omitempty"` + // updatedAt: Timestamp referencing when the last update was made to the moderation status of the subject + UpdatedAt string `json:"updatedAt" cborgen:"updatedAt"` +} + +type ModerationDefs_SubjectStatusView_Subject struct { + AdminDefs_RepoRef *comatprototypes.AdminDefs_RepoRef + RepoStrongRef *comatprototypes.RepoStrongRef +} + +func (t *ModerationDefs_SubjectStatusView_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationDefs_SubjectStatusView_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(comatprototypes.AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(comatprototypes.RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + + default: + return nil + } +} + +// ModerationDefs_VideoDetails is a "videoDetails" in the tools.ozone.moderation.defs schema. +// +// RECORDTYPE: ModerationDefs_VideoDetails +type ModerationDefs_VideoDetails struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#videoDetails" cborgen:"$type,const=tools.ozone.moderation.defs#videoDetails"` + Height int64 `json:"height" cborgen:"height"` + Length int64 `json:"length" cborgen:"length"` + Width int64 `json:"width" cborgen:"width"` +} diff --git a/api/ozone/moderationemitEvent.go b/api/ozone/moderationemitEvent.go new file mode 100644 index 000000000..bdb47df6e --- /dev/null +++ b/api/ozone/moderationemitEvent.go @@ -0,0 +1,175 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.emitEvent + +import ( + "context" + "encoding/json" + "fmt" + + comatprototypes "github.com/bluesky-social/indigo/api/atproto" + "github.com/bluesky-social/indigo/lex/util" + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationEmitEvent_Input is the input argument to a tools.ozone.moderation.emitEvent call. +type ModerationEmitEvent_Input struct { + CreatedBy string `json:"createdBy" cborgen:"createdBy"` + Event *ModerationEmitEvent_Input_Event `json:"event" cborgen:"event"` + Subject *ModerationEmitEvent_Input_Subject `json:"subject" cborgen:"subject"` + SubjectBlobCids []string `json:"subjectBlobCids,omitempty" cborgen:"subjectBlobCids,omitempty"` +} + +type ModerationEmitEvent_Input_Event struct { + ModerationDefs_ModEventTakedown *ModerationDefs_ModEventTakedown + ModerationDefs_ModEventAcknowledge *ModerationDefs_ModEventAcknowledge + ModerationDefs_ModEventEscalate *ModerationDefs_ModEventEscalate + ModerationDefs_ModEventComment *ModerationDefs_ModEventComment + ModerationDefs_ModEventLabel *ModerationDefs_ModEventLabel + ModerationDefs_ModEventReport *ModerationDefs_ModEventReport + ModerationDefs_ModEventMute *ModerationDefs_ModEventMute + ModerationDefs_ModEventReverseTakedown *ModerationDefs_ModEventReverseTakedown + ModerationDefs_ModEventUnmute *ModerationDefs_ModEventUnmute + ModerationDefs_ModEventEmail *ModerationDefs_ModEventEmail + ModerationDefs_ModEventTag *ModerationDefs_ModEventTag +} + +func (t *ModerationEmitEvent_Input_Event) MarshalJSON() ([]byte, error) { + if t.ModerationDefs_ModEventTakedown != nil { + t.ModerationDefs_ModEventTakedown.LexiconTypeID = "tools.ozone.moderation.defs#modEventTakedown" + return json.Marshal(t.ModerationDefs_ModEventTakedown) + } + if t.ModerationDefs_ModEventAcknowledge != nil { + t.ModerationDefs_ModEventAcknowledge.LexiconTypeID = "tools.ozone.moderation.defs#modEventAcknowledge" + return json.Marshal(t.ModerationDefs_ModEventAcknowledge) + } + if t.ModerationDefs_ModEventEscalate != nil { + t.ModerationDefs_ModEventEscalate.LexiconTypeID = "tools.ozone.moderation.defs#modEventEscalate" + return json.Marshal(t.ModerationDefs_ModEventEscalate) + } + if t.ModerationDefs_ModEventComment != nil { + t.ModerationDefs_ModEventComment.LexiconTypeID = "tools.ozone.moderation.defs#modEventComment" + return json.Marshal(t.ModerationDefs_ModEventComment) + } + if t.ModerationDefs_ModEventLabel != nil { + t.ModerationDefs_ModEventLabel.LexiconTypeID = "tools.ozone.moderation.defs#modEventLabel" + return json.Marshal(t.ModerationDefs_ModEventLabel) + } + if t.ModerationDefs_ModEventReport != nil { + t.ModerationDefs_ModEventReport.LexiconTypeID = "tools.ozone.moderation.defs#modEventReport" + return json.Marshal(t.ModerationDefs_ModEventReport) + } + if t.ModerationDefs_ModEventMute != nil { + t.ModerationDefs_ModEventMute.LexiconTypeID = "tools.ozone.moderation.defs#modEventMute" + return json.Marshal(t.ModerationDefs_ModEventMute) + } + if t.ModerationDefs_ModEventReverseTakedown != nil { + t.ModerationDefs_ModEventReverseTakedown.LexiconTypeID = "tools.ozone.moderation.defs#modEventReverseTakedown" + return json.Marshal(t.ModerationDefs_ModEventReverseTakedown) + } + if t.ModerationDefs_ModEventUnmute != nil { + t.ModerationDefs_ModEventUnmute.LexiconTypeID = "tools.ozone.moderation.defs#modEventUnmute" + return json.Marshal(t.ModerationDefs_ModEventUnmute) + } + if t.ModerationDefs_ModEventEmail != nil { + t.ModerationDefs_ModEventEmail.LexiconTypeID = "tools.ozone.moderation.defs#modEventEmail" + return json.Marshal(t.ModerationDefs_ModEventEmail) + } + if t.ModerationDefs_ModEventTag != nil { + t.ModerationDefs_ModEventTag.LexiconTypeID = "tools.ozone.moderation.defs#modEventTag" + return json.Marshal(t.ModerationDefs_ModEventTag) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationEmitEvent_Input_Event) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "tools.ozone.moderation.defs#modEventTakedown": + t.ModerationDefs_ModEventTakedown = new(ModerationDefs_ModEventTakedown) + return json.Unmarshal(b, t.ModerationDefs_ModEventTakedown) + case "tools.ozone.moderation.defs#modEventAcknowledge": + t.ModerationDefs_ModEventAcknowledge = new(ModerationDefs_ModEventAcknowledge) + return json.Unmarshal(b, t.ModerationDefs_ModEventAcknowledge) + case "tools.ozone.moderation.defs#modEventEscalate": + t.ModerationDefs_ModEventEscalate = new(ModerationDefs_ModEventEscalate) + return json.Unmarshal(b, t.ModerationDefs_ModEventEscalate) + case "tools.ozone.moderation.defs#modEventComment": + t.ModerationDefs_ModEventComment = new(ModerationDefs_ModEventComment) + return json.Unmarshal(b, t.ModerationDefs_ModEventComment) + case "tools.ozone.moderation.defs#modEventLabel": + t.ModerationDefs_ModEventLabel = new(ModerationDefs_ModEventLabel) + return json.Unmarshal(b, t.ModerationDefs_ModEventLabel) + case "tools.ozone.moderation.defs#modEventReport": + t.ModerationDefs_ModEventReport = new(ModerationDefs_ModEventReport) + return json.Unmarshal(b, t.ModerationDefs_ModEventReport) + case "tools.ozone.moderation.defs#modEventMute": + t.ModerationDefs_ModEventMute = new(ModerationDefs_ModEventMute) + return json.Unmarshal(b, t.ModerationDefs_ModEventMute) + case "tools.ozone.moderation.defs#modEventReverseTakedown": + t.ModerationDefs_ModEventReverseTakedown = new(ModerationDefs_ModEventReverseTakedown) + return json.Unmarshal(b, t.ModerationDefs_ModEventReverseTakedown) + case "tools.ozone.moderation.defs#modEventUnmute": + t.ModerationDefs_ModEventUnmute = new(ModerationDefs_ModEventUnmute) + return json.Unmarshal(b, t.ModerationDefs_ModEventUnmute) + case "tools.ozone.moderation.defs#modEventEmail": + t.ModerationDefs_ModEventEmail = new(ModerationDefs_ModEventEmail) + return json.Unmarshal(b, t.ModerationDefs_ModEventEmail) + case "tools.ozone.moderation.defs#modEventTag": + t.ModerationDefs_ModEventTag = new(ModerationDefs_ModEventTag) + return json.Unmarshal(b, t.ModerationDefs_ModEventTag) + + default: + return nil + } +} + +type ModerationEmitEvent_Input_Subject struct { + AdminDefs_RepoRef *comatprototypes.AdminDefs_RepoRef + RepoStrongRef *comatprototypes.RepoStrongRef +} + +func (t *ModerationEmitEvent_Input_Subject) MarshalJSON() ([]byte, error) { + if t.AdminDefs_RepoRef != nil { + t.AdminDefs_RepoRef.LexiconTypeID = "com.atproto.admin.defs#repoRef" + return json.Marshal(t.AdminDefs_RepoRef) + } + if t.RepoStrongRef != nil { + t.RepoStrongRef.LexiconTypeID = "com.atproto.repo.strongRef" + return json.Marshal(t.RepoStrongRef) + } + return nil, fmt.Errorf("cannot marshal empty enum") +} +func (t *ModerationEmitEvent_Input_Subject) UnmarshalJSON(b []byte) error { + typ, err := util.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.admin.defs#repoRef": + t.AdminDefs_RepoRef = new(comatprototypes.AdminDefs_RepoRef) + return json.Unmarshal(b, t.AdminDefs_RepoRef) + case "com.atproto.repo.strongRef": + t.RepoStrongRef = new(comatprototypes.RepoStrongRef) + return json.Unmarshal(b, t.RepoStrongRef) + + default: + return nil + } +} + +// ModerationEmitEvent calls the XRPC method "tools.ozone.moderation.emitEvent". +func ModerationEmitEvent(ctx context.Context, c *xrpc.Client, input *ModerationEmitEvent_Input) (*ModerationDefs_ModEventView, error) { + var out ModerationDefs_ModEventView + if err := c.Do(ctx, xrpc.Procedure, "application/json", "tools.ozone.moderation.emitEvent", nil, input, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationgetEvent.go b/api/ozone/moderationgetEvent.go new file mode 100644 index 000000000..0faff234b --- /dev/null +++ b/api/ozone/moderationgetEvent.go @@ -0,0 +1,25 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.getEvent + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationGetEvent calls the XRPC method "tools.ozone.moderation.getEvent". +func ModerationGetEvent(ctx context.Context, c *xrpc.Client, id int64) (*ModerationDefs_ModEventViewDetail, error) { + var out ModerationDefs_ModEventViewDetail + + params := map[string]interface{}{ + "id": id, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.getEvent", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationgetRecord.go b/api/ozone/moderationgetRecord.go new file mode 100644 index 000000000..5b582c5f4 --- /dev/null +++ b/api/ozone/moderationgetRecord.go @@ -0,0 +1,26 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.getRecord + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationGetRecord calls the XRPC method "tools.ozone.moderation.getRecord". +func ModerationGetRecord(ctx context.Context, c *xrpc.Client, cid string, uri string) (*ModerationDefs_RecordViewDetail, error) { + var out ModerationDefs_RecordViewDetail + + params := map[string]interface{}{ + "cid": cid, + "uri": uri, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.getRecord", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationgetRepo.go b/api/ozone/moderationgetRepo.go new file mode 100644 index 000000000..dace63290 --- /dev/null +++ b/api/ozone/moderationgetRepo.go @@ -0,0 +1,25 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.getRepo + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationGetRepo calls the XRPC method "tools.ozone.moderation.getRepo". +func ModerationGetRepo(ctx context.Context, c *xrpc.Client, did string) (*ModerationDefs_RepoViewDetail, error) { + var out ModerationDefs_RepoViewDetail + + params := map[string]interface{}{ + "did": did, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.getRepo", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationqueryEvents.go b/api/ozone/moderationqueryEvents.go new file mode 100644 index 000000000..fee7adc39 --- /dev/null +++ b/api/ozone/moderationqueryEvents.go @@ -0,0 +1,58 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.queryEvents + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationQueryEvents_Output is the output of a tools.ozone.moderation.queryEvents call. +type ModerationQueryEvents_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Events []*ModerationDefs_ModEventView `json:"events" cborgen:"events"` +} + +// ModerationQueryEvents calls the XRPC method "tools.ozone.moderation.queryEvents". +// +// 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 +// comment: If specified, only events with comments containing the keyword are returned +// 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 +// includeAllUserRecords: If true, events on all record types (posts, lists, profile etc.) owned by the did are returned +// 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. +// 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, 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) { + var out ModerationQueryEvents_Output + + params := map[string]interface{}{ + "addedLabels": addedLabels, + "addedTags": addedTags, + "comment": comment, + "createdAfter": createdAfter, + "createdBefore": createdBefore, + "createdBy": createdBy, + "cursor": cursor, + "hasComment": hasComment, + "includeAllUserRecords": includeAllUserRecords, + "limit": limit, + "removedLabels": removedLabels, + "removedTags": removedTags, + "reportTypes": reportTypes, + "sortDirection": sortDirection, + "subject": subject, + "types": types, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.queryEvents", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationqueryStatuses.go b/api/ozone/moderationqueryStatuses.go new file mode 100644 index 000000000..467816c15 --- /dev/null +++ b/api/ozone/moderationqueryStatuses.go @@ -0,0 +1,59 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.queryStatuses + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationQueryStatuses_Output is the output of a tools.ozone.moderation.queryStatuses call. +type ModerationQueryStatuses_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + SubjectStatuses []*ModerationDefs_SubjectStatusView `json:"subjectStatuses" cborgen:"subjectStatuses"` +} + +// ModerationQueryStatuses calls the XRPC method "tools.ozone.moderation.queryStatuses". +// +// appealed: Get subjects in unresolved appealed status +// comment: Search subjects by keyword from comments +// 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 +// 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 +// reviewedAfter: Search subjects reviewed after a given timestamp +// reviewedBefore: Search subjects reviewed before a given timestamp +// takendown: Get subjects that were taken down +func ModerationQueryStatuses(ctx context.Context, c *xrpc.Client, appealed bool, comment string, cursor string, excludeTags []string, ignoreSubjects []string, includeMuted bool, lastReviewedBy string, limit int64, reportedAfter string, reportedBefore string, reviewState string, reviewedAfter string, reviewedBefore string, sortDirection string, sortField string, subject string, tags []string, takendown bool) (*ModerationQueryStatuses_Output, error) { + var out ModerationQueryStatuses_Output + + params := map[string]interface{}{ + "appealed": appealed, + "comment": comment, + "cursor": cursor, + "excludeTags": excludeTags, + "ignoreSubjects": ignoreSubjects, + "includeMuted": includeMuted, + "lastReviewedBy": lastReviewedBy, + "limit": limit, + "reportedAfter": reportedAfter, + "reportedBefore": reportedBefore, + "reviewState": reviewState, + "reviewedAfter": reviewedAfter, + "reviewedBefore": reviewedBefore, + "sortDirection": sortDirection, + "sortField": sortField, + "subject": subject, + "tags": tags, + "takendown": takendown, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.queryStatuses", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} diff --git a/api/ozone/moderationsearchRepos.go b/api/ozone/moderationsearchRepos.go new file mode 100644 index 000000000..9d05154a3 --- /dev/null +++ b/api/ozone/moderationsearchRepos.go @@ -0,0 +1,36 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package ozone + +// schema: tools.ozone.moderation.searchRepos + +import ( + "context" + + "github.com/bluesky-social/indigo/xrpc" +) + +// ModerationSearchRepos_Output is the output of a tools.ozone.moderation.searchRepos call. +type ModerationSearchRepos_Output struct { + Cursor *string `json:"cursor,omitempty" cborgen:"cursor,omitempty"` + Repos []*ModerationDefs_RepoView `json:"repos" cborgen:"repos"` +} + +// ModerationSearchRepos calls the XRPC method "tools.ozone.moderation.searchRepos". +// +// term: DEPRECATED: use 'q' instead +func ModerationSearchRepos(ctx context.Context, c *xrpc.Client, cursor string, limit int64, q string, term string) (*ModerationSearchRepos_Output, error) { + var out ModerationSearchRepos_Output + + params := map[string]interface{}{ + "cursor": cursor, + "limit": limit, + "q": q, + "term": term, + } + if err := c.Do(ctx, xrpc.Query, "", "tools.ozone.moderation.searchRepos", params, nil, &out); err != nil { + return nil, err + } + + return &out, nil +} From bbb0d297b8d04461e1c285a9c9ccd11213015e65 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:19:34 -0700 Subject: [PATCH 03/11] Makefile: lexgen tools.ozone namespace --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 6e9f5bc98..d840b27f7 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ check: ## Compile everything, checking syntax (does not output binaries) lexgen: ## Run codegen tool for lexicons (lexicon JSON to Go packages) go run ./cmd/lexgen/ --package bsky --prefix app.bsky --outdir api/bsky $(LEXDIR) go run ./cmd/lexgen/ --package atproto --prefix com.atproto --outdir api/atproto $(LEXDIR) + go run ./cmd/lexgen/ --package ozone --prefix tools.ozone --outdir api/ozone $(LEXDIR) .PHONY: cborgen cborgen: ## Run codegen tool for CBOR serialization From be54f81c68e23fb7f5967a040a499ada4b652763 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:19:49 -0700 Subject: [PATCH 04/11] lexutil: update cborgen run --- lex/util/cbor_gen_test.go | 152 +++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/lex/util/cbor_gen_test.go b/lex/util/cbor_gen_test.go index 637769dab..76bc90ee3 100644 --- a/lex/util/cbor_gen_test.go +++ b/lex/util/cbor_gen_test.go @@ -36,7 +36,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.Bool (bool) (bool) - if uint64(len("bool")) > cbg.MaxLength { + if len("bool") > 8192 { return xerrors.Errorf("Value in field \"bool\" was too long") } @@ -52,7 +52,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.Null (string) (string) - if uint64(len("null")) > cbg.MaxLength { + if len("null") > 8192 { return xerrors.Errorf("Value in field \"null\" was too long") } @@ -68,7 +68,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { return err } } else { - if uint64(len(*t.Null)) > cbg.MaxLength { + if len(*t.Null) > 8192 { return xerrors.Errorf("Value in field t.Null was too long") } @@ -81,7 +81,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.Array ([]string) (slice) - if uint64(len("array")) > cbg.MaxLength { + if len("array") > 8192 { return xerrors.Errorf("Value in field \"array\" was too long") } @@ -92,7 +92,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.Array)) > cbg.MaxLength { + if len(t.Array) > 8192 { return xerrors.Errorf("Slice value in field t.Array was too long") } @@ -100,7 +100,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Array { - if uint64(len(v)) > cbg.MaxLength { + if len(v) > 8192 { return xerrors.Errorf("Value in field v was too long") } @@ -116,7 +116,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { // t.Absent (string) (string) if t.Absent != nil { - if uint64(len("absent")) > cbg.MaxLength { + if len("absent") > 8192 { return xerrors.Errorf("Value in field \"absent\" was too long") } @@ -132,7 +132,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { return err } } else { - if uint64(len(*t.Absent)) > cbg.MaxLength { + if len(*t.Absent) > 8192 { return xerrors.Errorf("Value in field t.Absent was too long") } @@ -146,7 +146,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.Object (util.basicSchemaInner) (struct) - if uint64(len("object")) > cbg.MaxLength { + if len("object") > 8192 { return xerrors.Errorf("Value in field \"object\" was too long") } @@ -162,7 +162,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.String (string) (string) - if uint64(len("string")) > cbg.MaxLength { + if len("string") > 8192 { return xerrors.Errorf("Value in field \"string\" was too long") } @@ -173,7 +173,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.String)) > cbg.MaxLength { + if len(t.String) > 8192 { return xerrors.Errorf("Value in field t.String was too long") } @@ -185,7 +185,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.Integer (int64) (int64) - if uint64(len("integer")) > cbg.MaxLength { + if len("integer") > 8192 { return xerrors.Errorf("Value in field \"integer\" was too long") } @@ -207,7 +207,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { } // t.Unicode (string) (string) - if uint64(len("unicode")) > cbg.MaxLength { + if len("unicode") > 8192 { return xerrors.Errorf("Value in field \"unicode\" was too long") } @@ -218,7 +218,7 @@ func (t *basicSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.Unicode)) > cbg.MaxLength { + if len(t.Unicode) > 8192 { return xerrors.Errorf("Value in field t.Unicode was too long") } @@ -260,7 +260,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -300,7 +300,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -316,7 +316,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Array: array too large (%d)", extra) } @@ -338,7 +338,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { _ = err { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -361,7 +361,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -383,7 +383,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { case "string": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -394,10 +394,10 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { case "integer": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -420,7 +420,7 @@ func (t *basicSchema) UnmarshalCBOR(r io.Reader) (err error) { case "unicode": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -449,7 +449,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { } // t.Arr ([]string) (slice) - if uint64(len("arr")) > cbg.MaxLength { + if len("arr") > 8192 { return xerrors.Errorf("Value in field \"arr\" was too long") } @@ -460,7 +460,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.Arr)) > cbg.MaxLength { + if len(t.Arr) > 8192 { return xerrors.Errorf("Slice value in field t.Arr was too long") } @@ -468,7 +468,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.Arr { - if uint64(len(v)) > cbg.MaxLength { + if len(v) > 8192 { return xerrors.Errorf("Value in field v was too long") } @@ -482,7 +482,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { } // t.Bool (bool) (bool) - if uint64(len("bool")) > cbg.MaxLength { + if len("bool") > 8192 { return xerrors.Errorf("Value in field \"bool\" was too long") } @@ -498,7 +498,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { } // t.Number (int64) (int64) - if uint64(len("number")) > cbg.MaxLength { + if len("number") > 8192 { return xerrors.Errorf("Value in field \"number\" was too long") } @@ -520,7 +520,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { } // t.String (string) (string) - if uint64(len("string")) > cbg.MaxLength { + if len("string") > 8192 { return xerrors.Errorf("Value in field \"string\" was too long") } @@ -531,7 +531,7 @@ func (t *basicSchemaInner) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.String)) > cbg.MaxLength { + if len(t.String) > 8192 { return xerrors.Errorf("Value in field t.String was too long") } @@ -573,7 +573,7 @@ func (t *basicSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -590,7 +590,7 @@ func (t *basicSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.Arr: array too large (%d)", extra) } @@ -612,7 +612,7 @@ func (t *basicSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { _ = err { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -644,10 +644,10 @@ func (t *basicSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { case "number": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -670,7 +670,7 @@ func (t *basicSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { case "string": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -699,7 +699,7 @@ func (t *ipldSchema) MarshalCBOR(w io.Writer) error { } // t.A (util.LexLink) (struct) - if uint64(len("a")) > cbg.MaxLength { + if len("a") > 8192 { return xerrors.Errorf("Value in field \"a\" was too long") } @@ -715,7 +715,7 @@ func (t *ipldSchema) MarshalCBOR(w io.Writer) error { } // t.B (util.LexBytes) (slice) - if uint64(len("b")) > cbg.MaxLength { + if len("b") > 8192 { return xerrors.Errorf("Value in field \"b\" was too long") } @@ -726,7 +726,7 @@ func (t *ipldSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.B)) > cbg.ByteArrayMaxLen { + if len(t.B) > 2097152 { return xerrors.Errorf("Byte array in field t.B was too long") } @@ -739,7 +739,7 @@ func (t *ipldSchema) MarshalCBOR(w io.Writer) error { } // t.C (util.LexBlob) (struct) - if uint64(len("c")) > cbg.MaxLength { + if len("c") > 8192 { return xerrors.Errorf("Value in field \"c\" was too long") } @@ -785,7 +785,7 @@ func (t *ipldSchema) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -812,7 +812,7 @@ func (t *ipldSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.B: byte array too large (%d)", extra) } if maj != cbg.MajByteString { @@ -864,7 +864,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { } // t.A (string) (string) - if uint64(len("a")) > cbg.MaxLength { + if len("a") > 8192 { return xerrors.Errorf("Value in field \"a\" was too long") } @@ -875,7 +875,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.A)) > cbg.MaxLength { + if len(t.A) > 8192 { return xerrors.Errorf("Value in field t.A was too long") } @@ -887,7 +887,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { } // t.B (int64) (int64) - if uint64(len("b")) > cbg.MaxLength { + if len("b") > 8192 { return xerrors.Errorf("Value in field \"b\" was too long") } @@ -909,7 +909,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { } // t.C (bool) (bool) - if uint64(len("c")) > cbg.MaxLength { + if len("c") > 8192 { return xerrors.Errorf("Value in field \"c\" was too long") } @@ -927,7 +927,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { // t.D (string) (string) if t.D != nil { - if uint64(len("d")) > cbg.MaxLength { + if len("d") > 8192 { return xerrors.Errorf("Value in field \"d\" was too long") } @@ -943,7 +943,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { return err } } else { - if uint64(len(*t.D)) > cbg.MaxLength { + if len(*t.D) > 8192 { return xerrors.Errorf("Value in field t.D was too long") } @@ -957,7 +957,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { } // t.E (string) (string) - if uint64(len("e")) > cbg.MaxLength { + if len("e") > 8192 { return xerrors.Errorf("Value in field \"e\" was too long") } @@ -973,7 +973,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { return err } } else { - if uint64(len(*t.E)) > cbg.MaxLength { + if len(*t.E) > 8192 { return xerrors.Errorf("Value in field t.E was too long") } @@ -986,7 +986,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { } // t.F ([]string) (slice) - if uint64(len("f")) > cbg.MaxLength { + if len("f") > 8192 { return xerrors.Errorf("Value in field \"f\" was too long") } @@ -997,7 +997,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.F)) > cbg.MaxLength { + if len(t.F) > 8192 { return xerrors.Errorf("Slice value in field t.F was too long") } @@ -1005,7 +1005,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.F { - if uint64(len(v)) > cbg.MaxLength { + if len(v) > 8192 { return xerrors.Errorf("Value in field v was too long") } @@ -1019,7 +1019,7 @@ func (t *basicOldSchema) MarshalCBOR(w io.Writer) error { } // t.G (util.basicOldSchemaInner) (struct) - if uint64(len("g")) > cbg.MaxLength { + if len("g") > 8192 { return xerrors.Errorf("Value in field \"g\" was too long") } @@ -1065,7 +1065,7 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1078,7 +1078,7 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { case "a": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1089,10 +1089,10 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { case "b": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1142,7 +1142,7 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1163,7 +1163,7 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1179,7 +1179,7 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.F: array too large (%d)", extra) } @@ -1201,7 +1201,7 @@ func (t *basicOldSchema) UnmarshalCBOR(r io.Reader) (err error) { _ = err { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1243,7 +1243,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { } // t.H (string) (string) - if uint64(len("h")) > cbg.MaxLength { + if len("h") > 8192 { return xerrors.Errorf("Value in field \"h\" was too long") } @@ -1254,7 +1254,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.H)) > cbg.MaxLength { + if len(t.H) > 8192 { return xerrors.Errorf("Value in field t.H was too long") } @@ -1266,7 +1266,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { } // t.I (int64) (int64) - if uint64(len("i")) > cbg.MaxLength { + if len("i") > 8192 { return xerrors.Errorf("Value in field \"i\" was too long") } @@ -1288,7 +1288,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { } // t.J (bool) (bool) - if uint64(len("j")) > cbg.MaxLength { + if len("j") > 8192 { return xerrors.Errorf("Value in field \"j\" was too long") } @@ -1304,7 +1304,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { } // t.K ([]string) (slice) - if uint64(len("k")) > cbg.MaxLength { + if len("k") > 8192 { return xerrors.Errorf("Value in field \"k\" was too long") } @@ -1315,7 +1315,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.K)) > cbg.MaxLength { + if len(t.K) > 8192 { return xerrors.Errorf("Slice value in field t.K was too long") } @@ -1323,7 +1323,7 @@ func (t *basicOldSchemaInner) MarshalCBOR(w io.Writer) error { return err } for _, v := range t.K { - if uint64(len(v)) > cbg.MaxLength { + if len(v) > 8192 { return xerrors.Errorf("Value in field v was too long") } @@ -1367,7 +1367,7 @@ func (t *basicOldSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1380,7 +1380,7 @@ func (t *basicOldSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { case "h": { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1391,10 +1391,10 @@ func (t *basicOldSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { case "i": { maj, extra, err := cr.ReadHeader() - var extraI int64 if err != nil { return err } + var extraI int64 switch maj { case cbg.MajUnsignedInt: extraI = int64(extra) @@ -1439,7 +1439,7 @@ func (t *basicOldSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.MaxLength { + if extra > 8192 { return fmt.Errorf("t.K: array too large (%d)", extra) } @@ -1461,7 +1461,7 @@ func (t *basicOldSchemaInner) UnmarshalCBOR(r io.Reader) (err error) { _ = err { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1493,7 +1493,7 @@ func (t *ipldOldSchema) MarshalCBOR(w io.Writer) error { } // t.A (util.LexLink) (struct) - if uint64(len("a")) > cbg.MaxLength { + if len("a") > 8192 { return xerrors.Errorf("Value in field \"a\" was too long") } @@ -1509,7 +1509,7 @@ func (t *ipldOldSchema) MarshalCBOR(w io.Writer) error { } // t.B (util.LexBytes) (slice) - if uint64(len("b")) > cbg.MaxLength { + if len("b") > 8192 { return xerrors.Errorf("Value in field \"b\" was too long") } @@ -1520,7 +1520,7 @@ func (t *ipldOldSchema) MarshalCBOR(w io.Writer) error { return err } - if uint64(len(t.B)) > cbg.ByteArrayMaxLen { + if len(t.B) > 2097152 { return xerrors.Errorf("Byte array in field t.B was too long") } @@ -1564,7 +1564,7 @@ func (t *ipldOldSchema) UnmarshalCBOR(r io.Reader) (err error) { for i := uint64(0); i < n; i++ { { - sval, err := cbg.ReadString(cr) + sval, err := cbg.ReadStringWithMax(cr, 8192) if err != nil { return err } @@ -1591,7 +1591,7 @@ func (t *ipldOldSchema) UnmarshalCBOR(r io.Reader) (err error) { return err } - if extra > cbg.ByteArrayMaxLen { + if extra > 2097152 { return fmt.Errorf("t.B: byte array too large (%d)", extra) } if maj != cbg.MajByteString { From 9c384fde1c2ad512026216d246f2f1074bcfbcad Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:43:02 -0700 Subject: [PATCH 05/11] automod: update to tools.ozone namespace --- automod/engine/persist.go | 35 ++++++++++++++++---------------- automod/engine/persisthelpers.go | 17 ++++++++-------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/automod/engine/persist.go b/automod/engine/persist.go index 694444d1f..7d18187da 100644 --- a/automod/engine/persist.go +++ b/automod/engine/persist.go @@ -5,6 +5,7 @@ import ( "fmt" comatproto "github.com/bluesky-social/indigo/api/atproto" + toolsozone "github.com/bluesky-social/indigo/api/ozone" ) func (eng *Engine) persistCounters(ctx context.Context, eff *Effects) error { @@ -92,16 +93,16 @@ func (eng *Engine) persistAccountModActions(c *AccountContext) error { actionNewLabelCount.WithLabelValues("account", val).Inc() } comment := "[automod]: auto-labeling account" - _, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{ + _, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{ CreatedBy: xrpcc.Auth.Did, - Event: &comatproto.AdminEmitModerationEvent_Input_Event{ - AdminDefs_ModEventLabel: &comatproto.AdminDefs_ModEventLabel{ + Event: &toolsozone.ModerationEmitEvent_Input_Event{ + ModerationDefs_ModEventLabel: &toolsozone.ModerationDefs_ModEventLabel{ CreateLabelVals: newLabels, NegateLabelVals: []string{}, Comment: &comment, }, }, - Subject: &comatproto.AdminEmitModerationEvent_Input_Subject{ + Subject: &toolsozone.ModerationEmitEvent_Input_Subject{ AdminDefs_RepoRef: &comatproto.AdminDefs_RepoRef{ Did: c.Account.Identity.DID.String(), }, @@ -128,14 +129,14 @@ func (eng *Engine) persistAccountModActions(c *AccountContext) error { c.Logger.Warn("account-takedown") actionNewTakedownCount.WithLabelValues("account").Inc() comment := "[automod]: auto account-takedown" - _, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{ + _, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{ CreatedBy: xrpcc.Auth.Did, - Event: &comatproto.AdminEmitModerationEvent_Input_Event{ - AdminDefs_ModEventTakedown: &comatproto.AdminDefs_ModEventTakedown{ + Event: &toolsozone.ModerationEmitEvent_Input_Event{ + ModerationDefs_ModEventTakedown: &toolsozone.ModerationDefs_ModEventTakedown{ Comment: &comment, }, }, - Subject: &comatproto.AdminEmitModerationEvent_Input_Subject{ + Subject: &toolsozone.ModerationEmitEvent_Input_Subject{ AdminDefs_RepoRef: &comatproto.AdminDefs_RepoRef{ Did: c.Account.Identity.DID.String(), }, @@ -166,7 +167,7 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error { atURI := c.RecordOp.ATURI().String() newLabels := dedupeStrings(c.effects.RecordLabels) if len(newLabels) > 0 && eng.AdminClient != nil { - rv, err := comatproto.AdminGetRecord(ctx, eng.AdminClient, c.RecordOp.CID.String(), c.RecordOp.ATURI().String()) + rv, err := toolsozone.ModerationGetRecord(ctx, eng.AdminClient, c.RecordOp.CID.String(), c.RecordOp.ATURI().String()) if err != nil { c.Logger.Warn("failed to fetch private record metadata", "err", err) } else { @@ -256,16 +257,16 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error { actionNewLabelCount.WithLabelValues("record", val).Inc() } comment := "[automod]: auto-labeling record" - _, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{ + _, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{ CreatedBy: xrpcc.Auth.Did, - Event: &comatproto.AdminEmitModerationEvent_Input_Event{ - AdminDefs_ModEventLabel: &comatproto.AdminDefs_ModEventLabel{ + Event: &toolsozone.ModerationEmitEvent_Input_Event{ + ModerationDefs_ModEventLabel: &toolsozone.ModerationDefs_ModEventLabel{ CreateLabelVals: newLabels, NegateLabelVals: []string{}, Comment: &comment, }, }, - Subject: &comatproto.AdminEmitModerationEvent_Input_Subject{ + Subject: &toolsozone.ModerationEmitEvent_Input_Subject{ RepoStrongRef: &strongRef, }, }) @@ -285,14 +286,14 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error { c.Logger.Warn("record-takedown") actionNewTakedownCount.WithLabelValues("record").Inc() comment := "[automod]: automated record-takedown" - _, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{ + _, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{ CreatedBy: xrpcc.Auth.Did, - Event: &comatproto.AdminEmitModerationEvent_Input_Event{ - AdminDefs_ModEventTakedown: &comatproto.AdminDefs_ModEventTakedown{ + Event: &toolsozone.ModerationEmitEvent_Input_Event{ + ModerationDefs_ModEventTakedown: &toolsozone.ModerationDefs_ModEventTakedown{ Comment: &comment, }, }, - Subject: &comatproto.AdminEmitModerationEvent_Input_Subject{ + Subject: &toolsozone.ModerationEmitEvent_Input_Subject{ RepoStrongRef: &strongRef, }, SubjectBlobCids: dedupeStrings(c.effects.BlobTakedowns), diff --git a/automod/engine/persisthelpers.go b/automod/engine/persisthelpers.go index 696d8924a..aff249799 100644 --- a/automod/engine/persisthelpers.go +++ b/automod/engine/persisthelpers.go @@ -6,6 +6,7 @@ import ( "time" comatproto "github.com/bluesky-social/indigo/api/atproto" + toolsozone "github.com/bluesky-social/indigo/api/ozone" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/automod/countstore" "github.com/bluesky-social/indigo/xrpc" @@ -117,8 +118,8 @@ func (eng *Engine) createReportIfFresh(ctx context.Context, xrpcc *xrpc.Client, // before creating a report, query to see if automod has already reported this account in the past week for the same reason // NOTE: this is running in an inner loop (if there are multiple reports), which is a bit inefficient, but seems acceptable - // AdminQueryModerationEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, inc ludeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) - resp, err := comatproto.AdminQueryModerationEvents( + // ModerationQueryEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, inc ludeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) + resp, err := toolsozone.ModerationQueryEvents( ctx, xrpcc, nil, @@ -136,7 +137,7 @@ func (eng *Engine) createReportIfFresh(ctx context.Context, xrpcc *xrpc.Client, nil, "", did.String(), - []string{"com.atproto.admin.defs#modEventReport"}, + []string{"tools.ozone.moderation.defs#modEventReport"}, ) if err != nil { @@ -144,7 +145,7 @@ func (eng *Engine) createReportIfFresh(ctx context.Context, xrpcc *xrpc.Client, } for _, modEvt := range resp.Events { // defensively ensure that our query params worked correctly - if modEvt.Event.AdminDefs_ModEventReport == nil || modEvt.CreatedBy != xrpcc.Auth.Did || modEvt.Subject.AdminDefs_RepoRef == nil || modEvt.Subject.AdminDefs_RepoRef.Did != did.String() || (modEvt.Event.AdminDefs_ModEventReport.ReportType != nil && *modEvt.Event.AdminDefs_ModEventReport.ReportType != mr.ReasonType) { + if modEvt.Event.ModerationDefs_ModEventReport == nil || modEvt.CreatedBy != xrpcc.Auth.Did || modEvt.Subject.AdminDefs_RepoRef == nil || modEvt.Subject.AdminDefs_RepoRef.Did != did.String() || (modEvt.Event.ModerationDefs_ModEventReport.ReportType != nil && *modEvt.Event.ModerationDefs_ModEventReport.ReportType != mr.ReasonType) { continue } // igonre if older @@ -188,8 +189,8 @@ func (eng *Engine) createRecordReportIfFresh(ctx context.Context, xrpcc *xrpc.Cl // before creating a report, query to see if automod has already reported this account in the past week for the same reason // NOTE: this is running in an inner loop (if there are multiple reports), which is a bit inefficient, but seems acceptable - // AdminQueryModerationEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, inc ludeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) - resp, err := comatproto.AdminQueryModerationEvents( + // ModerationQueryEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, inc ludeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) + resp, err := toolsozone.ModerationQueryEvents( ctx, xrpcc, nil, @@ -207,14 +208,14 @@ func (eng *Engine) createRecordReportIfFresh(ctx context.Context, xrpcc *xrpc.Cl nil, "", uri.String(), - []string{"com.atproto.admin.defs#modEventReport"}, + []string{"tools.ozone.moderation.defs#modEventReport"}, ) if err != nil { return false, err } for _, modEvt := range resp.Events { // defensively ensure that our query params worked correctly - if modEvt.Event.AdminDefs_ModEventReport == nil || modEvt.CreatedBy != xrpcc.Auth.Did || modEvt.Subject.RepoStrongRef == nil || modEvt.Subject.RepoStrongRef.Uri != uri.String() || (modEvt.Event.AdminDefs_ModEventReport.ReportType != nil && *modEvt.Event.AdminDefs_ModEventReport.ReportType != mr.ReasonType) { + if modEvt.Event.ModerationDefs_ModEventReport == nil || modEvt.CreatedBy != xrpcc.Auth.Did || modEvt.Subject.RepoStrongRef == nil || modEvt.Subject.RepoStrongRef.Uri != uri.String() || (modEvt.Event.ModerationDefs_ModEventReport.ReportType != nil && *modEvt.Event.ModerationDefs_ModEventReport.ReportType != mr.ReasonType) { continue } // igonre if older From a154a2be21113f71fb669b8d61121ff0befb83c9 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:43:30 -0700 Subject: [PATCH 06/11] beemo: update to tools.ozone namespace --- cmd/beemo/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/beemo/main.go b/cmd/beemo/main.go index 2a8bb9c9e..aa423c94b 100644 --- a/cmd/beemo/main.go +++ b/cmd/beemo/main.go @@ -14,6 +14,7 @@ import ( "time" comatproto "github.com/bluesky-social/indigo/api/atproto" + toolsozone "github.com/bluesky-social/indigo/api/ozone" "github.com/bluesky-social/indigo/util" "github.com/bluesky-social/indigo/xrpc" @@ -145,9 +146,9 @@ func pollNewReports(cctx *cli.Context) error { xrpcc.Auth.RefreshJwt = refresh.RefreshJwt // query just new reports (regardless of resolution state) - // AdminQueryModerationEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, includeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) (*AdminQueryModerationEvents_Output, error) + // ModerationQueryEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, includeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) (*ModerationQueryEvents_Output, error) var limit int64 = 50 - me, err := comatproto.AdminQueryModerationEvents( + me, err := toolsozone.ModerationQueryEvents( cctx.Context, xrpcc, nil, @@ -165,14 +166,14 @@ func pollNewReports(cctx *cli.Context) error { nil, "", "", - []string{"com.atproto.admin.defs#modEventReport"}, + []string{"tools.ozone.moderation.defs#modEventReport"}, ) if err != nil { return err } // this works out to iterate from newest to oldest, which is the behavior we want (report only newest, then break) for _, evt := range me.Events { - report := evt.Event.AdminDefs_ModEventReport + report := evt.Event.ModerationDefs_ModEventReport // TODO: filter out based on subject state? similar to old "report.ResolvedByActionIds" createdAt, err := time.Parse(time.RFC3339, evt.CreatedAt) if err != nil { From 447f36c91e3df0b8dc01d0cd9ceee07076344b3d Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:44:13 -0700 Subject: [PATCH 07/11] gosky: update to tools.ozone namespace --- cmd/gosky/admin.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/cmd/gosky/admin.go b/cmd/gosky/admin.go index a5d7ae4b2..b1914c4fb 100644 --- a/cmd/gosky/admin.go +++ b/cmd/gosky/admin.go @@ -13,6 +13,7 @@ import ( "github.com/bluesky-social/indigo/api" "github.com/bluesky-social/indigo/api/atproto" comatproto "github.com/bluesky-social/indigo/api/atproto" + toolsozone "github.com/bluesky-social/indigo/api/ozone" "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/bluesky-social/indigo/util/cliutil" @@ -79,7 +80,7 @@ var checkUserCmd = &cli.Command{ xrpcc.AdminToken = &adminKey xrpcc.Host = id.PDSEndpoint() - rep, err := atproto.AdminGetRepo(ctx, xrpcc, did) + rep, err := toolsozone.ModerationGetRepo(ctx, xrpcc, did) if err != nil { return fmt.Errorf("getRepo %s: %w", did, err) } @@ -125,7 +126,7 @@ var checkUserCmd = &cli.Command{ fmt.Println("INVITES DISABLED") } - var invited []*atproto.AdminDefs_RepoViewDetail + var invited []*toolsozone.ModerationDefs_RepoViewDetail var lk sync.Mutex var wg sync.WaitGroup var used int @@ -140,7 +141,7 @@ var checkUserCmd = &cli.Command{ wg.Add(1) go func(did string) { defer wg.Done() - repo, err := atproto.AdminGetRepo(ctx, xrpcc, did) + repo, err := toolsozone.ModerationGetRepo(ctx, xrpcc, did) if err != nil { fmt.Println("ERROR: ", err) return @@ -246,7 +247,7 @@ var buildInviteTreeCmd = &cli.Command{ return u, nil } - repo, err := atproto.AdminGetRepo(ctx, xrpcc, did) + repo, err := toolsozone.ModerationGetRepo(ctx, xrpcc, did) if err != nil { return nil, err } @@ -260,7 +261,7 @@ var buildInviteTreeCmd = &cli.Command{ if ok { invby = invu.Handle } else { - invrepo, err := atproto.AdminGetRepo(ctx, xrpcc, fa) + invrepo, err := toolsozone.ModerationGetRepo(ctx, xrpcc, fa) if err != nil { return nil, fmt.Errorf("resolving inviter (%q): %w", fa, err) } @@ -385,7 +386,7 @@ var listReportsCmd = &cli.Command{ // fetch recent moderation reports // AdminQueryModerationEvents(ctx context.Context, c *xrpc.Client, createdBy string, cursor string, includeAllUserRecords bool, limit int64, sortDirection string, subject string, types []string) (*AdminQueryModerationEvents_Output, error) - resp, err := atproto.AdminQueryModerationEvents( + resp, err := toolsozone.ModerationQueryEvents( ctx, xrpcc, nil, @@ -403,7 +404,7 @@ var listReportsCmd = &cli.Command{ nil, "", "", - []string{"com.atproto.admin.defs#modEventReport"}, + []string{"tools.ozone.moderation.defs#modEventReport"}, ) if err != nil { return err @@ -560,7 +561,7 @@ var listInviteTreeCmd = &cli.Command{ } } - rep, err := atproto.AdminGetRepo(ctx, xrpcc, next) + rep, err := toolsozone.ModerationGetRepo(ctx, xrpcc, next) if err != nil { fmt.Printf("Failed to getRepo for DID %s: %s\n", next, err.Error()) continue @@ -643,14 +644,14 @@ var takeDownAccountCmd = &cli.Command{ adminUser = resp } - resp, err := atproto.AdminEmitModerationEvent(ctx, xrpcc, &atproto.AdminEmitModerationEvent_Input{ + resp, err := toolsozone.ModerationEmitEvent(ctx, xrpcc, &toolsozone.ModerationEmitEvent_Input{ CreatedBy: adminUser, - Event: &atproto.AdminEmitModerationEvent_Input_Event{ - AdminDefs_ModEventTakedown: &atproto.AdminDefs_ModEventTakedown{ + Event: &toolsozone.ModerationEmitEvent_Input_Event{ + ModerationDefs_ModEventTakedown: &toolsozone.ModerationDefs_ModEventTakedown{ Comment: &reason, }, }, - Subject: &atproto.AdminEmitModerationEvent_Input_Subject{ + Subject: &toolsozone.ModerationEmitEvent_Input_Subject{ AdminDefs_RepoRef: &atproto.AdminDefs_RepoRef{ Did: did, }, @@ -697,7 +698,7 @@ var queryModerationStatusesCmd = &cli.Command{ did = resp } - resp, err := atproto.AdminQueryModerationEvents( + resp, err := toolsozone.ModerationQueryEvents( ctx, xrpcc, nil, @@ -715,7 +716,7 @@ var queryModerationStatusesCmd = &cli.Command{ nil, "", "", - []string{"com.atproto.admin.defs#modEventReport"}, + []string{"tools.ozone.moderation.defs#modEventReport"}, ) if err != nil { return err From dd1824a4f088f662c94f03f63a9c06bd8ac06eab Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Mon, 11 Mar 2024 19:44:33 -0700 Subject: [PATCH 08/11] pds: remove deprecated endpoints --- pds/handlers.go | 19 ---------------- pds/stubs.go | 59 ------------------------------------------------ testing/utils.go | 12 ---------- 3 files changed, 90 deletions(-) diff --git a/pds/handlers.go b/pds/handlers.go index 63f85bb12..73827a429 100644 --- a/pds/handlers.go +++ b/pds/handlers.go @@ -316,10 +316,6 @@ func (s *Server) handleComAtprotoSyncGetCheckout(ctx context.Context, did string panic("not yet implemented") } -func (s *Server) handleComAtprotoSyncGetCommitPath(ctx context.Context, did string, earliest string, latest string) (*comatprototypes.SyncGetCommitPath_Output, error) { - panic("not yet implemented") -} - func (s *Server) handleComAtprotoSyncGetHead(ctx context.Context, did string) (*comatprototypes.SyncGetHead_Output, error) { user, err := s.lookupUserByDid(ctx, did) if err != nil { @@ -354,17 +350,6 @@ func (s *Server) handleComAtprotoSyncGetRepo(ctx context.Context, did string, si return buf, nil } -func (s *Server) handleComAtprotoAdminGetRecord(ctx context.Context, cid string, uri string) (*comatprototypes.AdminDefs_RecordViewDetail, error) { - panic("nyi") -} - -func (s *Server) handleComAtprotoAdminGetRepo(ctx context.Context, did string) (*comatprototypes.AdminDefs_RepoViewDetail, error) { - panic("nyi") -} -func (s *Server) handleComAtprotoAdminSearchRepos(ctx context.Context, cursor string, limit int, q string, term string) (*comatprototypes.AdminSearchRepos_Output, error) { - panic("nyi") -} - func (s *Server) handleComAtprotoSyncGetBlocks(ctx context.Context, cids []string, did string) (io.Reader, error) { panic("nyi") } @@ -466,10 +451,6 @@ func (s *Server) handleComAtprotoSyncGetLatestCommit(ctx context.Context, did st panic("nyi") } -func (s *Server) handleComAtprotoTempUpgradeRepoVersion(ctx context.Context, body *comatprototypes.TempUpgradeRepoVersion_Input) error { - panic("nyi") -} - func (s *Server) handleComAtprotoAdminGetAccountInfo(ctx context.Context, did string) (*comatprototypes.AdminDefs_AccountView, error) { panic("nyi") } diff --git a/pds/stubs.go b/pds/stubs.go index 787348764..2543cced2 100644 --- a/pds/stubs.go +++ b/pds/stubs.go @@ -15,10 +15,7 @@ func (s *Server) RegisterHandlersComAtproto(e *echo.Echo) error { e.POST("/xrpc/com.atproto.admin.enableAccountInvites", s.HandleComAtprotoAdminEnableAccountInvites) e.GET("/xrpc/com.atproto.admin.getAccountInfo", s.HandleComAtprotoAdminGetAccountInfo) e.GET("/xrpc/com.atproto.admin.getInviteCodes", s.HandleComAtprotoAdminGetInviteCodes) - e.GET("/xrpc/com.atproto.admin.getRecord", s.HandleComAtprotoAdminGetRecord) - e.GET("/xrpc/com.atproto.admin.getRepo", s.HandleComAtprotoAdminGetRepo) e.GET("/xrpc/com.atproto.admin.getSubjectStatus", s.HandleComAtprotoAdminGetSubjectStatus) - e.GET("/xrpc/com.atproto.admin.searchRepos", s.HandleComAtprotoAdminSearchRepos) e.POST("/xrpc/com.atproto.admin.sendEmail", s.HandleComAtprotoAdminSendEmail) e.POST("/xrpc/com.atproto.admin.updateAccountEmail", s.HandleComAtprotoAdminUpdateAccountEmail) e.POST("/xrpc/com.atproto.admin.updateAccountHandle", s.HandleComAtprotoAdminUpdateAccountHandle) @@ -162,35 +159,6 @@ func (s *Server) HandleComAtprotoAdminGetInviteCodes(c echo.Context) error { return c.JSON(200, out) } -func (s *Server) HandleComAtprotoAdminGetRecord(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetRecord") - defer span.End() - cid := c.QueryParam("cid") - uri := c.QueryParam("uri") - var out *comatprototypes.AdminDefs_RecordViewDetail - var handleErr error - // func (s *Server) handleComAtprotoAdminGetRecord(ctx context.Context,cid string,uri string) (*comatprototypes.AdminDefs_RecordViewDetail, error) - out, handleErr = s.handleComAtprotoAdminGetRecord(ctx, cid, uri) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - -func (s *Server) HandleComAtprotoAdminGetRepo(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetRepo") - defer span.End() - did := c.QueryParam("did") - var out *comatprototypes.AdminDefs_RepoViewDetail - var handleErr error - // func (s *Server) handleComAtprotoAdminGetRepo(ctx context.Context,did string) (*comatprototypes.AdminDefs_RepoViewDetail, error) - out, handleErr = s.handleComAtprotoAdminGetRepo(ctx, did) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - func (s *Server) HandleComAtprotoAdminGetSubjectStatus(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminGetSubjectStatus") defer span.End() @@ -207,33 +175,6 @@ func (s *Server) HandleComAtprotoAdminGetSubjectStatus(c echo.Context) error { return c.JSON(200, out) } -func (s *Server) HandleComAtprotoAdminSearchRepos(c echo.Context) error { - ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminSearchRepos") - defer span.End() - cursor := c.QueryParam("cursor") - - var limit int - if p := c.QueryParam("limit"); p != "" { - var err error - limit, err = strconv.Atoi(p) - if err != nil { - return err - } - } else { - limit = 50 - } - q := c.QueryParam("q") - term := c.QueryParam("term") - var out *comatprototypes.AdminSearchRepos_Output - var handleErr error - // func (s *Server) handleComAtprotoAdminSearchRepos(ctx context.Context,cursor string,limit int,q string,term string) (*comatprototypes.AdminSearchRepos_Output, error) - out, handleErr = s.handleComAtprotoAdminSearchRepos(ctx, cursor, limit, q, term) - if handleErr != nil { - return handleErr - } - return c.JSON(200, out) -} - func (s *Server) HandleComAtprotoAdminSendEmail(c echo.Context) error { ctx, span := otel.Tracer("server").Start(c.Request().Context(), "HandleComAtprotoAdminSendEmail") defer span.End() diff --git a/testing/utils.go b/testing/utils.go index 8f1a049ba..51c57b29e 100644 --- a/testing/utils.go +++ b/testing/utils.go @@ -399,18 +399,6 @@ func (u *TestUser) ChangeHandle(t *testing.T, nhandle string) { } } -func (u *TestUser) DoRebase(t *testing.T) { - t.Helper() - - ctx := context.TODO() - err := atproto.RepoRebaseRepo(ctx, u.client, &atproto.RepoRebaseRepo_Input{ - Repo: u.did, - }) - if err != nil { - t.Fatal(err) - } -} - func TestPLC(t *testing.T) *plc.FakeDid { // TODO: just do in memory... tdir, err := os.MkdirTemp("", "plcserv") From 0c1826d3bc52319a0cd518878a5d2b8d638b4b68 Mon Sep 17 00:00:00 2001 From: Jaz Volpert Date: Tue, 12 Mar 2024 16:56:05 +0000 Subject: [PATCH 09/11] Fix cborgen --- api/ozone/moderationdefs.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/api/ozone/moderationdefs.go b/api/ozone/moderationdefs.go index 0a075c79b..e62fae6d0 100644 --- a/api/ozone/moderationdefs.go +++ b/api/ozone/moderationdefs.go @@ -86,6 +86,16 @@ type ModerationDefs_ModEventComment struct { Sticky *bool `json:"sticky,omitempty" cborgen:"sticky,omitempty"` } +// ModerationDefs_ModEventDivert is a "modEventDivert" in the tools.ozone.moderation.defs schema. +// +// Divert a record's blobs to a 3rd party service for further scanning/tagging +// +// RECORDTYPE: ModerationDefs_ModEventDivert +type ModerationDefs_ModEventDivert struct { + LexiconTypeID string `json:"$type,const=tools.ozone.moderation.defs#modEventDivert" cborgen:"$type,const=tools.ozone.moderation.defs#modEventDivert"` + Comment *string `json:"comment,omitempty" cborgen:"comment,omitempty"` +} + // ModerationDefs_ModEventEmail is a "modEventEmail" in the tools.ozone.moderation.defs schema. // // # Keep a log of outgoing email to a user @@ -237,6 +247,7 @@ type ModerationDefs_ModEventViewDetail_Event struct { ModerationDefs_ModEventMute *ModerationDefs_ModEventMute ModerationDefs_ModEventEmail *ModerationDefs_ModEventEmail ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal + ModerationDefs_ModEventDivert *ModerationDefs_ModEventDivert } func (t *ModerationDefs_ModEventViewDetail_Event) MarshalJSON() ([]byte, error) { @@ -280,6 +291,10 @@ func (t *ModerationDefs_ModEventViewDetail_Event) MarshalJSON() ([]byte, error) t.ModerationDefs_ModEventResolveAppeal.LexiconTypeID = "tools.ozone.moderation.defs#modEventResolveAppeal" return json.Marshal(t.ModerationDefs_ModEventResolveAppeal) } + if t.ModerationDefs_ModEventDivert != nil { + t.ModerationDefs_ModEventDivert.LexiconTypeID = "tools.ozone.moderation.defs#modEventDivert" + return json.Marshal(t.ModerationDefs_ModEventDivert) + } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *ModerationDefs_ModEventViewDetail_Event) UnmarshalJSON(b []byte) error { @@ -319,6 +334,9 @@ func (t *ModerationDefs_ModEventViewDetail_Event) UnmarshalJSON(b []byte) error case "tools.ozone.moderation.defs#modEventResolveAppeal": t.ModerationDefs_ModEventResolveAppeal = new(ModerationDefs_ModEventResolveAppeal) return json.Unmarshal(b, t.ModerationDefs_ModEventResolveAppeal) + case "tools.ozone.moderation.defs#modEventDivert": + t.ModerationDefs_ModEventDivert = new(ModerationDefs_ModEventDivert) + return json.Unmarshal(b, t.ModerationDefs_ModEventDivert) default: return nil @@ -387,6 +405,7 @@ type ModerationDefs_ModEventView_Event struct { ModerationDefs_ModEventMute *ModerationDefs_ModEventMute ModerationDefs_ModEventEmail *ModerationDefs_ModEventEmail ModerationDefs_ModEventResolveAppeal *ModerationDefs_ModEventResolveAppeal + ModerationDefs_ModEventDivert *ModerationDefs_ModEventDivert } func (t *ModerationDefs_ModEventView_Event) MarshalJSON() ([]byte, error) { @@ -430,6 +449,10 @@ func (t *ModerationDefs_ModEventView_Event) MarshalJSON() ([]byte, error) { t.ModerationDefs_ModEventResolveAppeal.LexiconTypeID = "tools.ozone.moderation.defs#modEventResolveAppeal" return json.Marshal(t.ModerationDefs_ModEventResolveAppeal) } + if t.ModerationDefs_ModEventDivert != nil { + t.ModerationDefs_ModEventDivert.LexiconTypeID = "tools.ozone.moderation.defs#modEventDivert" + return json.Marshal(t.ModerationDefs_ModEventDivert) + } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *ModerationDefs_ModEventView_Event) UnmarshalJSON(b []byte) error { @@ -469,6 +492,9 @@ func (t *ModerationDefs_ModEventView_Event) UnmarshalJSON(b []byte) error { case "tools.ozone.moderation.defs#modEventResolveAppeal": t.ModerationDefs_ModEventResolveAppeal = new(ModerationDefs_ModEventResolveAppeal) return json.Unmarshal(b, t.ModerationDefs_ModEventResolveAppeal) + case "tools.ozone.moderation.defs#modEventDivert": + t.ModerationDefs_ModEventDivert = new(ModerationDefs_ModEventDivert) + return json.Unmarshal(b, t.ModerationDefs_ModEventDivert) default: return nil From 9b74bfeac081e1d02209581fab638541ebdadd04 Mon Sep 17 00:00:00 2001 From: Jaz Volpert Date: Tue, 12 Mar 2024 17:51:38 +0000 Subject: [PATCH 10/11] Update cborgen (fixing runtime oob on long strings) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b5bada5aa..2b8ba0b76 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( github.com/scylladb/gocqlx/v2 v2.8.1-0.20230309105046-dec046bd85e6 github.com/stretchr/testify v1.8.4 github.com/urfave/cli/v2 v2.25.7 - github.com/whyrusleeping/cbor-gen v0.1.0 + github.com/whyrusleeping/cbor-gen v0.1.1-0.20240311221002-68b9f235c302 github.com/whyrusleeping/go-did v0.0.0-20230824162731-404d1707d5d6 gitlab.com/yawning/secp256k1-voi v0.0.0-20230925100816-f2616030848b go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 diff --git a/go.sum b/go.sum index 6130e9751..aab98ff04 100644 --- a/go.sum +++ b/go.sum @@ -626,8 +626,8 @@ github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSD github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11 h1:5HZfQkwe0mIfyDmc1Em5GqlNRzcdtlv4HTNmdpt7XH0= github.com/whyrusleeping/cbor v0.0.0-20171005072247-63513f603b11/go.mod h1:Wlo/SzPmxVp6vXpGt/zaXhHH0fn4IxgqZc82aKg6bpQ= -github.com/whyrusleeping/cbor-gen v0.1.0 h1:Jneeq3V5enErVcuL0NKEbD1Gi+iOvEeFhXOV1S1Fc6g= -github.com/whyrusleeping/cbor-gen v0.1.0/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so= +github.com/whyrusleeping/cbor-gen v0.1.1-0.20240311221002-68b9f235c302 h1:MhInbXe4SzcImAKktUvWBCWZgcw6MYf5NfumTj1BhAw= +github.com/whyrusleeping/cbor-gen v0.1.1-0.20240311221002-68b9f235c302/go.mod h1:pM99HXyEbSQHcosHc0iW7YFmwnscr+t9Te4ibko05so= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E= github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8= github.com/whyrusleeping/go-did v0.0.0-20230824162731-404d1707d5d6 h1:yJ9/LwIGIk/c0CdoavpC9RNSGSruIspSZtxG3Nnldic= From ea0eb13b4accab60e32c118482a3d59e41c1bd9b Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Tue, 12 Mar 2024 15:46:46 -0700 Subject: [PATCH 11/11] xrpc: use admin token for tools.ozone.* endpoints --- xrpc/xrpc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xrpc/xrpc.go b/xrpc/xrpc.go index 6e0776433..ffd44856e 100644 --- a/xrpc/xrpc.go +++ b/xrpc/xrpc.go @@ -184,7 +184,7 @@ func (c *Client) Do(ctx context.Context, kind XRPCRequestType, inpenc string, me } // use admin auth if we have it configured and are doing a request that requires it - if c.AdminToken != nil && (strings.HasPrefix(method, "com.atproto.admin.") || method == "com.atproto.account.createInviteCode" || method == "com.atproto.server.createInviteCodes") { + if c.AdminToken != nil && (strings.HasPrefix(method, "com.atproto.admin.") || strings.HasPrefix(method, "tools.ozone.") || method == "com.atproto.account.createInviteCode" || method == "com.atproto.server.createInviteCodes") { req.Header.Set("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte("admin:"+*c.AdminToken))) } else if c.Auth != nil { req.Header.Set("Authorization", "Bearer "+c.Auth.AccessJwt)