diff --git a/Makefile b/Makefile index a6f9a33..df38cad 100644 --- a/Makefile +++ b/Makefile @@ -37,5 +37,9 @@ fmt: ## Run syntax re-formatting (modify in place) check: ## Compile everything, checking syntax (does not output binaries) go build ./... +.PHONY: lexgen +lexgen: ## Generate lexicon type packages from lexicon schemas + glot codegen --output-dir api lexicons/social/scrumble + .env: if [ ! -f ".env" ]; then cp example.dev.env .env; fi diff --git a/api/socialscrumble/betaaccountjoin.go b/api/socialscrumble/betaaccountjoin.go new file mode 100644 index 0000000..696f57c --- /dev/null +++ b/api/socialscrumble/betaaccountjoin.go @@ -0,0 +1,12 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.account.join + +package socialscrumble + +// Indicates that an account (user) wants to to be part of a scene. The key must be the DID of the scene. +type BetaAccountJoin struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.account.join"` + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` + Scene *string `json:"scene,omitempty" cborgen:"scene,omitempty"` +} diff --git a/api/socialscrumble/betaaccountprofile.go b/api/socialscrumble/betaaccountprofile.go new file mode 100644 index 0000000..96679ec --- /dev/null +++ b/api/socialscrumble/betaaccountprofile.go @@ -0,0 +1,16 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.account.profile + +package socialscrumble + +import ( + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// Scrumble user profile. Presence of this record indicates that the account is a scrumble user. Scene community accounts should also include this record. +type BetaAccountProfile struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.account.profile"` + Avatar *lexutil.LexBlob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` +} diff --git a/api/socialscrumble/betacollectioncomment.go b/api/socialscrumble/betacollectioncomment.go new file mode 100644 index 0000000..dd5a469 --- /dev/null +++ b/api/socialscrumble/betacollectioncomment.go @@ -0,0 +1,20 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.collection.comment + +package socialscrumble + +import ( + comatproto "github.com/bluesky-social/indigo/api/atproto" +) + +// Threaded discussion comment on an item. +type BetaCollectionComment struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.collection.comment"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Item comatproto.RepoStrongRef `json:"item" cborgen:"item"` + Parent *comatproto.RepoStrongRef `json:"parent,omitempty" cborgen:"parent,omitempty"` + Scene string `json:"scene" cborgen:"scene"` + // text: TODO: length limit, and whether this is markdown (probably yes, but what subset) + Text string `json:"text" cborgen:"text"` +} diff --git a/api/socialscrumble/betacollectionfeedback.go b/api/socialscrumble/betacollectionfeedback.go new file mode 100644 index 0000000..823c1ff --- /dev/null +++ b/api/socialscrumble/betacollectionfeedback.go @@ -0,0 +1,18 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.collection.feedback + +package socialscrumble + +import ( + comatproto "github.com/bluesky-social/indigo/api/atproto" +) + +// Up/Down feedback on an item of content in a scene, from an account. Aggregating services must check for duplicate feedback. +type BetaCollectionFeedback struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.collection.feedback"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Feedback string `json:"feedback" cborgen:"feedback"` + Scene string `json:"scene" cborgen:"scene"` + Subject comatproto.RepoStrongRef `json:"subject" cborgen:"subject"` +} diff --git a/api/socialscrumble/betacollectionitem.go b/api/socialscrumble/betacollectionitem.go new file mode 100644 index 0000000..8ee69e2 --- /dev/null +++ b/api/socialscrumble/betacollectionitem.go @@ -0,0 +1,120 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.collection.item + +package socialscrumble + +import ( + "encoding/json" + "fmt" + + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// Individual item submitted to a scene. +type BetaCollectionItem struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.collection.item"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Item BetaCollectionItem_Item `json:"item" cborgen:"item"` + Scene string `json:"scene" cborgen:"scene"` + Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` +} + +type BetaCollectionItem_Item struct { + BetaCollectionItem_AtpItem *BetaCollectionItem_AtpItem + BetaCollectionItem_ImageItem *BetaCollectionItem_ImageItem + BetaCollectionItem_TextItem *BetaCollectionItem_TextItem + BetaCollectionItem_WebItem *BetaCollectionItem_WebItem +} + +func (t *BetaCollectionItem_Item) MarshalJSON() ([]byte, error) { + if t.BetaCollectionItem_AtpItem != nil { + t.BetaCollectionItem_AtpItem.LexiconTypeID = "social.scrumble.beta.collection.item#atpItem" + return json.Marshal(t.BetaCollectionItem_AtpItem) + } + if t.BetaCollectionItem_ImageItem != nil { + t.BetaCollectionItem_ImageItem.LexiconTypeID = "social.scrumble.beta.collection.item#imageItem" + return json.Marshal(t.BetaCollectionItem_ImageItem) + } + if t.BetaCollectionItem_TextItem != nil { + t.BetaCollectionItem_TextItem.LexiconTypeID = "social.scrumble.beta.collection.item#textItem" + return json.Marshal(t.BetaCollectionItem_TextItem) + } + if t.BetaCollectionItem_WebItem != nil { + t.BetaCollectionItem_WebItem.LexiconTypeID = "social.scrumble.beta.collection.item#webItem" + return json.Marshal(t.BetaCollectionItem_WebItem) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *BetaCollectionItem_Item) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "social.scrumble.beta.collection.item#atpItem": + t.BetaCollectionItem_AtpItem = new(BetaCollectionItem_AtpItem) + return json.Unmarshal(b, t.BetaCollectionItem_AtpItem) + case "social.scrumble.beta.collection.item#imageItem": + t.BetaCollectionItem_ImageItem = new(BetaCollectionItem_ImageItem) + return json.Unmarshal(b, t.BetaCollectionItem_ImageItem) + case "social.scrumble.beta.collection.item#textItem": + t.BetaCollectionItem_TextItem = new(BetaCollectionItem_TextItem) + return json.Unmarshal(b, t.BetaCollectionItem_TextItem) + case "social.scrumble.beta.collection.item#webItem": + t.BetaCollectionItem_WebItem = new(BetaCollectionItem_WebItem) + return json.Unmarshal(b, t.BetaCollectionItem_WebItem) + default: + return nil + } +} + +// BetaCollectionItem_AspectRatio is a "aspectRatio" in the social.scrumble.beta.collection.item schema. +// +// width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. +type BetaCollectionItem_AspectRatio struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.collection.item#aspectRatio,omitempty"` + Height int64 `json:"height" cborgen:"height"` + Width int64 `json:"width" cborgen:"width"` +} + +// BetaCollectionItem_AtpItem is a "atpItem" in the social.scrumble.beta.collection.item schema. +type BetaCollectionItem_AtpItem struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.collection.item#atpItem,omitempty"` + Cid *string `json:"cid,omitempty" cborgen:"cid,omitempty"` + Uri string `json:"uri" cborgen:"uri"` +} + +// BetaCollectionItem_Image is a "image" in the social.scrumble.beta.collection.item schema. +type BetaCollectionItem_Image struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.collection.item#image,omitempty"` + Alt *string `json:"alt,omitempty" cborgen:"alt,omitempty"` + AspectRatio *BetaCollectionItem_AspectRatio `json:"aspectRatio,omitempty" cborgen:"aspectRatio,omitempty"` + Attribution *string `json:"attribution,omitempty" cborgen:"attribution,omitempty"` + Image lexutil.LexBlob `json:"image" cborgen:"image"` + License *string `json:"license,omitempty" cborgen:"license,omitempty"` +} + +// BetaCollectionItem_ImageItem is a "imageItem" in the social.scrumble.beta.collection.item schema. +type BetaCollectionItem_ImageItem struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.collection.item#imageItem,omitempty"` + Images []BetaCollectionItem_Image `json:"images" cborgen:"images"` +} + +// BetaCollectionItem_TextItem is a "textItem" in the social.scrumble.beta.collection.item schema. +type BetaCollectionItem_TextItem struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.collection.item#textItem,omitempty"` + Text string `json:"text" cborgen:"text"` + Title *string `json:"title,omitempty" cborgen:"title,omitempty"` +} + +// BetaCollectionItem_WebItem is a "webItem" in the social.scrumble.beta.collection.item schema. +type BetaCollectionItem_WebItem struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.collection.item#webItem,omitempty"` + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + Thumb *lexutil.LexBlob `json:"thumb,omitempty" cborgen:"thumb,omitempty"` + Title *string `json:"title,omitempty" cborgen:"title,omitempty"` + Url string `json:"url" cborgen:"url"` +} diff --git a/api/socialscrumble/betacollectionreaction.go b/api/socialscrumble/betacollectionreaction.go new file mode 100644 index 0000000..9ccbe38 --- /dev/null +++ b/api/socialscrumble/betacollectionreaction.go @@ -0,0 +1,18 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.collection.reaction + +package socialscrumble + +import ( + comatproto "github.com/bluesky-social/indigo/api/atproto" +) + +// Emoji reaction. Aggregators need to de-duplicate. +type BetaCollectionReaction struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.collection.reaction"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Emoji string `json:"emoji" cborgen:"emoji"` + Scene string `json:"scene" cborgen:"scene"` + Subject comatproto.RepoStrongRef `json:"subject" cborgen:"subject"` +} diff --git a/api/socialscrumble/betascenedeclaration.go b/api/socialscrumble/betascenedeclaration.go new file mode 100644 index 0000000..22dda80 --- /dev/null +++ b/api/socialscrumble/betascenedeclaration.go @@ -0,0 +1,55 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.scene.declaration + +package socialscrumble + +import ( + appbsky "github.com/bluesky-social/indigo/api/bsky" + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +// Scene metadata and configuration. This record should live under the scene community account. +type BetaSceneDeclaration struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.scene.declaration"` + Avatar *lexutil.LexBlob `json:"avatar,omitempty" cborgen:"avatar,omitempty"` + Config BetaSceneDeclaration_SceneConfig `json:"config" cborgen:"config"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + DescriptionFacets []appbsky.RichtextFacet `json:"descriptionFacets,omitempty" cborgen:"descriptionFacets,omitempty"` + DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` + Guidelines []BetaSceneDeclaration_SceneGuideline `json:"guidelines" cborgen:"guidelines"` +} + +// BetaSceneDeclaration_ConfigItems is a "configItems" in the social.scrumble.beta.scene.declaration schema. +// +// Configuration parameters for the scene (TODO) +type BetaSceneDeclaration_ConfigItems struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.scene.declaration#configItems,omitempty"` + Types []string `json:"types,omitempty" cborgen:"types,omitempty"` +} + +// BetaSceneDeclaration_ConfigLabeler is a "configLabeler" in the social.scrumble.beta.scene.declaration schema. +// +// Configuration parameters for the scene (TODO) +type BetaSceneDeclaration_ConfigLabeler struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.scene.declaration#configLabeler,omitempty"` + Did string `json:"did" cborgen:"did"` +} + +// BetaSceneDeclaration_SceneConfig is a "sceneConfig" in the social.scrumble.beta.scene.declaration schema. +// +// Configuration parameters for the scene +type BetaSceneDeclaration_SceneConfig struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.scene.declaration#sceneConfig,omitempty"` + Items *BetaSceneDeclaration_ConfigItems `json:"items,omitempty" cborgen:"items,omitempty"` + Labelers []BetaSceneDeclaration_ConfigLabeler `json:"labelers,omitempty" cborgen:"labelers,omitempty"` +} + +// BetaSceneDeclaration_SceneGuideline is a "sceneGuideline" in the social.scrumble.beta.scene.declaration schema. +// +// An individual criteria or rule describing sumbissions and behaviors in the scene +type BetaSceneDeclaration_SceneGuideline struct { + LexiconTypeID string `json:"$type,omitempty" cborgen:"$type,const=social.scrumble.beta.scene.declaration#sceneGuideline,omitempty"` + Text string `json:"text" cborgen:"text"` +} diff --git a/api/socialscrumble/betascenemember.go b/api/socialscrumble/betascenemember.go new file mode 100644 index 0000000..fb64ec2 --- /dev/null +++ b/api/socialscrumble/betascenemember.go @@ -0,0 +1,14 @@ +// Code generated by indigo lexgen tool. DO NOT EDIT MANUALLY. + +// Lexicon schema: social.scrumble.beta.scene.member + +package socialscrumble + +// Indicates that an account is a member of the scene. This records gets written to the scene community account. The key should be the account's DID. +type BetaSceneMember struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=social.scrumble.beta.scene.member"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + Did string `json:"did" cborgen:"did"` + // role: TODO: make these refs to a defs file? + Role string `json:"role" cborgen:"role"` +} diff --git a/lexicons/app/bsky/richtext/facet.json b/lexicons/app/bsky/richtext/facet.json new file mode 100644 index 0000000..d93f35d --- /dev/null +++ b/lexicons/app/bsky/richtext/facet.json @@ -0,0 +1,89 @@ +{ + "defs": { + "byteSlice": { + "description": "Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.", + "properties": { + "byteEnd": { + "minimum": 0, + "type": "integer" + }, + "byteStart": { + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "byteStart", + "byteEnd" + ], + "type": "object" + }, + "link": { + "description": "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.", + "properties": { + "uri": { + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + }, + "main": { + "description": "Annotation of a sub-string within rich text.", + "properties": { + "features": { + "items": { + "refs": [ + "#mention", + "#link", + "#tag" + ], + "type": "union" + }, + "type": "array" + }, + "index": { + "ref": "#byteSlice", + "type": "ref" + } + }, + "required": [ + "index", + "features" + ], + "type": "object" + }, + "mention": { + "description": "Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.", + "properties": { + "did": { + "format": "did", + "type": "string" + } + }, + "required": [ + "did" + ], + "type": "object" + }, + "tag": { + "description": "Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags').", + "properties": { + "tag": { + "maxGraphemes": 64, + "maxLength": 640, + "type": "string" + } + }, + "required": [ + "tag" + ], + "type": "object" + } + }, + "id": "app.bsky.richtext.facet", + "lexicon": 1 +} diff --git a/lexicons/com/atproto/repo/strongRef.json b/lexicons/com/atproto/repo/strongRef.json new file mode 100644 index 0000000..0bd6766 --- /dev/null +++ b/lexicons/com/atproto/repo/strongRef.json @@ -0,0 +1,24 @@ +{ + "defs": { + "main": { + "properties": { + "cid": { + "format": "cid", + "type": "string" + }, + "uri": { + "format": "at-uri", + "type": "string" + } + }, + "required": [ + "uri", + "cid" + ], + "type": "object" + } + }, + "description": "A URI with a content-hash fingerprint.", + "id": "com.atproto.repo.strongRef", + "lexicon": 1 +} diff --git a/lexicons/social/scrumble/beta/collection/item.json b/lexicons/social/scrumble/beta/collection/item.json index 78e7503..3fa6e97 100644 --- a/lexicons/social/scrumble/beta/collection/item.json +++ b/lexicons/social/scrumble/beta/collection/item.json @@ -121,6 +121,15 @@ "ref": "#aspectRatio" } } + }, + "aspectRatio": { + "type": "object", + "description": "width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.", + "required": ["width", "height"], + "properties": { + "width": { "type": "integer", "minimum": 1 }, + "height": { "type": "integer", "minimum": 1 } + } } } }