diff --git a/Makefile b/Makefile index 0daf699f..e6abbecf 100644 --- a/Makefile +++ b/Makefile @@ -68,6 +68,10 @@ check: ## Compile everything, checking syntax (does not output binaries) lexgen: ## Run codegen tool for lexicons (lexicon JSON to Go packages) go run ./cmd/lexgen/ --build-file cmd/lexgen/bsky.json $(LEXDIR) +.PHONY: lexgen-ext +lexgen-ext: ## Run codegen tool for lexicons (lexicon JSON to Go packages) + go run ./cmd/lexgen/ --build-file cmd/lexgen/ext.json $(LEXDIR) + .PHONY: cborgen cborgen: ## Run codegen tool for CBOR serialization go run ./gen diff --git a/api-ext/standardsite/graphrecommend.go b/api-ext/standardsite/graphrecommend.go new file mode 100644 index 00000000..5da4ba77 --- /dev/null +++ b/api-ext/standardsite/graphrecommend.go @@ -0,0 +1,20 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: site.standard.graph.recommend + +package standardsite + +import ( + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +func init() { + lexutil.RegisterType("site.standard.graph.recommend", &GraphRecommend{}) +} + +type GraphRecommend struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.graph.recommend"` + CreatedAt string `json:"createdAt" cborgen:"createdAt"` + // document: AT-URI reference to the document record being recommended (ex: at://did:plc:abc123/site.standard.document/xyz789). + Document string `json:"document" cborgen:"document"` +} diff --git a/api-ext/standardsite/graphsubscription.go b/api-ext/standardsite/graphsubscription.go new file mode 100644 index 00000000..2859adeb --- /dev/null +++ b/api-ext/standardsite/graphsubscription.go @@ -0,0 +1,20 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: site.standard.graph.subscription + +package standardsite + +import ( + lexutil "github.com/bluesky-social/indigo/lex/util" +) + +func init() { + lexutil.RegisterType("site.standard.graph.subscription", &GraphSubscription{}) +} + +type GraphSubscription struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.graph.subscription"` + CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` + // publication: AT-URI reference to the publication record being subscribed to (ex: at://did:plc:abc123/site.standard.publication/xyz789). + Publication string `json:"publication" cborgen:"publication"` +} diff --git a/api-ext/standardsite/standarddocument.go b/api-ext/standardsite/standarddocument.go new file mode 100644 index 00000000..d79f0392 --- /dev/null +++ b/api-ext/standardsite/standarddocument.go @@ -0,0 +1,113 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: site.standard.document + +package standardsite + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + comatproto "github.com/bluesky-social/indigo/api/atproto" + lexutil "github.com/bluesky-social/indigo/lex/util" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + lexutil.RegisterType("site.standard.document", &Document{}) +} + +type Document struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.document"` + // bskyPostRef: Strong reference to a Bluesky post. Useful to keep track of comments off-platform. + BskyPostRef *comatproto.RepoStrongRef `json:"bskyPostRef,omitempty" cborgen:"bskyPostRef,omitempty"` + // content: Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats. + Content *lexutil.LexiconTypeDecoder `json:"content,omitempty" cborgen:"content,omitempty"` + Contributors []*Document_Contributor `json:"contributors,omitempty" cborgen:"contributors,omitempty"` + // coverImage: Image to used for thumbnail or cover image. Less than 1MB is size. + CoverImage *lexutil.LexBlob `json:"coverImage,omitempty" cborgen:"coverImage,omitempty"` + // description: A brief description or excerpt from the document. + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + // labels: Self-label values for this post. Effectively content warnings. + Labels *Document_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"` + // links: Array of values describing relationships between this document and external resources + Links *lexutil.LexiconTypeDecoder `json:"links,omitempty" cborgen:"links,omitempty"` + // path: Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash. + Path *string `json:"path,omitempty" cborgen:"path,omitempty"` + // publishedAt: Timestamp of the documents publish time. + PublishedAt string `json:"publishedAt" cborgen:"publishedAt"` + // site: Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes. + Site string `json:"site" cborgen:"site"` + // tags: Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags. + Tags []string `json:"tags,omitempty" cborgen:"tags,omitempty"` + // textContent: Plaintext representation of the documents contents. Should not contain markdown or other formatting. + TextContent *string `json:"textContent,omitempty" cborgen:"textContent,omitempty"` + // title: Title of the document. + Title string `json:"title" cborgen:"title"` + // updatedAt: Timestamp of the documents last edit. + UpdatedAt *string `json:"updatedAt,omitempty" cborgen:"updatedAt,omitempty"` +} + +// Document_Contributor is a "contributor" in the site.standard.document schema. +type Document_Contributor struct { + Did string `json:"did" cborgen:"did"` + DisplayName *string `json:"displayName,omitempty" cborgen:"displayName,omitempty"` + Role *string `json:"role,omitempty" cborgen:"role,omitempty"` +} + +// Self-label values for this post. Effectively content warnings. +type Document_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *Document_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *Document_Labels) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *Document_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *Document_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := lexutil.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/api-ext/standardsite/standardpublication.go b/api-ext/standardsite/standardpublication.go new file mode 100644 index 00000000..7fedbd03 --- /dev/null +++ b/api-ext/standardsite/standardpublication.go @@ -0,0 +1,99 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: site.standard.publication + +package standardsite + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + comatproto "github.com/bluesky-social/indigo/api/atproto" + lexutil "github.com/bluesky-social/indigo/lex/util" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + lexutil.RegisterType("site.standard.publication", &Publication{}) +} + +type Publication struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.publication"` + // basicTheme: Simplified publication theme for tools and apps to utilize when displaying content. + BasicTheme *ThemeBasic `json:"basicTheme,omitempty" cborgen:"basicTheme,omitempty"` + // description: Brief description of the publication. + Description *string `json:"description,omitempty" cborgen:"description,omitempty"` + // icon: Square image to identify the publication. Should be at least 256x256. + Icon *lexutil.LexBlob `json:"icon,omitempty" cborgen:"icon,omitempty"` + // labels: Self-label values for this publication. Effectively content warnings. + Labels *Publication_Labels `json:"labels,omitempty" cborgen:"labels,omitempty"` + // name: Name of the publication. + Name string `json:"name" cborgen:"name"` + // preferences: Object containing platform specific preferences (with a few shared properties). + Preferences *Publication_Preferences `json:"preferences,omitempty" cborgen:"preferences,omitempty"` + // url: Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path. + Url string `json:"url" cborgen:"url"` +} + +// Self-label values for this publication. Effectively content warnings. +type Publication_Labels struct { + LabelDefs_SelfLabels *comatproto.LabelDefs_SelfLabels +} + +func (t *Publication_Labels) MarshalJSON() ([]byte, error) { + if t.LabelDefs_SelfLabels != nil { + t.LabelDefs_SelfLabels.LexiconTypeID = "com.atproto.label.defs#selfLabels" + return json.Marshal(t.LabelDefs_SelfLabels) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *Publication_Labels) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return json.Unmarshal(b, t.LabelDefs_SelfLabels) + default: + return nil + } +} + +func (t *Publication_Labels) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.LabelDefs_SelfLabels != nil { + return t.LabelDefs_SelfLabels.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *Publication_Labels) UnmarshalCBOR(r io.Reader) error { + typ, b, err := lexutil.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "com.atproto.label.defs#selfLabels": + t.LabelDefs_SelfLabels = new(comatproto.LabelDefs_SelfLabels) + return t.LabelDefs_SelfLabels.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// Publication_Preferences is a "preferences" in the site.standard.publication schema. +type Publication_Preferences struct { + // showInDiscover: Boolean which decides whether the publication should appear in discovery feeds. + ShowInDiscover *bool `json:"showInDiscover,omitempty" cborgen:"showInDiscover,omitempty"` +} diff --git a/api-ext/standardsite/themebasic.go b/api-ext/standardsite/themebasic.go new file mode 100644 index 00000000..33911ddb --- /dev/null +++ b/api-ext/standardsite/themebasic.go @@ -0,0 +1,251 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: site.standard.theme.basic + +package standardsite + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + + lexutil "github.com/bluesky-social/indigo/lex/util" + cbg "github.com/whyrusleeping/cbor-gen" +) + +func init() { + lexutil.RegisterType("site.standard.theme.basic", &ThemeBasic{}) +} + +type ThemeBasic struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.theme.basic"` + // accent: Color used for links and button backgrounds. + Accent *ThemeBasic_Accent `json:"accent" cborgen:"accent"` + // accentForeground: Color used for button text. + AccentForeground *ThemeBasic_AccentForeground `json:"accentForeground" cborgen:"accentForeground"` + // background: Color used for content background. + Background *ThemeBasic_Background `json:"background" cborgen:"background"` + // foreground: Color used for content text. + Foreground *ThemeBasic_Foreground `json:"foreground" cborgen:"foreground"` +} + +// Color used for links and button backgrounds. +type ThemeBasic_Accent struct { + ThemeColor_Rgb *ThemeColor_Rgb +} + +func (t *ThemeBasic_Accent) MarshalJSON() ([]byte, error) { + if t.ThemeColor_Rgb != nil { + t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" + return json.Marshal(t.ThemeColor_Rgb) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ThemeBasic_Accent) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return json.Unmarshal(b, t.ThemeColor_Rgb) + default: + return nil + } +} + +func (t *ThemeBasic_Accent) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.ThemeColor_Rgb != nil { + return t.ThemeColor_Rgb.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ThemeBasic_Accent) UnmarshalCBOR(r io.Reader) error { + typ, b, err := lexutil.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// Color used for button text. +type ThemeBasic_AccentForeground struct { + ThemeColor_Rgb *ThemeColor_Rgb +} + +func (t *ThemeBasic_AccentForeground) MarshalJSON() ([]byte, error) { + if t.ThemeColor_Rgb != nil { + t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" + return json.Marshal(t.ThemeColor_Rgb) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ThemeBasic_AccentForeground) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return json.Unmarshal(b, t.ThemeColor_Rgb) + default: + return nil + } +} + +func (t *ThemeBasic_AccentForeground) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.ThemeColor_Rgb != nil { + return t.ThemeColor_Rgb.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ThemeBasic_AccentForeground) UnmarshalCBOR(r io.Reader) error { + typ, b, err := lexutil.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// Color used for content background. +type ThemeBasic_Background struct { + ThemeColor_Rgb *ThemeColor_Rgb +} + +func (t *ThemeBasic_Background) MarshalJSON() ([]byte, error) { + if t.ThemeColor_Rgb != nil { + t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" + return json.Marshal(t.ThemeColor_Rgb) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ThemeBasic_Background) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return json.Unmarshal(b, t.ThemeColor_Rgb) + default: + return nil + } +} + +func (t *ThemeBasic_Background) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.ThemeColor_Rgb != nil { + return t.ThemeColor_Rgb.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ThemeBasic_Background) UnmarshalCBOR(r io.Reader) error { + typ, b, err := lexutil.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} + +// Color used for content text. +type ThemeBasic_Foreground struct { + ThemeColor_Rgb *ThemeColor_Rgb +} + +func (t *ThemeBasic_Foreground) MarshalJSON() ([]byte, error) { + if t.ThemeColor_Rgb != nil { + t.ThemeColor_Rgb.LexiconTypeID = "site.standard.theme.color#rgb" + return json.Marshal(t.ThemeColor_Rgb) + } + return nil, fmt.Errorf("can not marshal empty union as JSON") +} + +func (t *ThemeBasic_Foreground) UnmarshalJSON(b []byte) error { + typ, err := lexutil.TypeExtract(b) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return json.Unmarshal(b, t.ThemeColor_Rgb) + default: + return nil + } +} + +func (t *ThemeBasic_Foreground) MarshalCBOR(w io.Writer) error { + + if t == nil { + _, err := w.Write(cbg.CborNull) + return err + } + if t.ThemeColor_Rgb != nil { + return t.ThemeColor_Rgb.MarshalCBOR(w) + } + return fmt.Errorf("can not marshal empty union as CBOR") +} + +func (t *ThemeBasic_Foreground) UnmarshalCBOR(r io.Reader) error { + typ, b, err := lexutil.CborTypeExtractReader(r) + if err != nil { + return err + } + + switch typ { + case "site.standard.theme.color#rgb": + t.ThemeColor_Rgb = new(ThemeColor_Rgb) + return t.ThemeColor_Rgb.UnmarshalCBOR(bytes.NewReader(b)) + default: + return nil + } +} diff --git a/api-ext/standardsite/themecolor.go b/api-ext/standardsite/themecolor.go new file mode 100644 index 00000000..207b9ca2 --- /dev/null +++ b/api-ext/standardsite/themecolor.go @@ -0,0 +1,21 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +// Lexicon schema: site.standard.theme.color + +package standardsite + +// ThemeColor_Rgb is a "rgb" in the site.standard.theme.color schema. +type ThemeColor_Rgb struct { + LexiconTypeID string `json:"$type" cborgen:"$type,const=site.standard.theme.color#rgb"` + B int64 `json:"b" cborgen:"b"` + G int64 `json:"g" cborgen:"g"` + R int64 `json:"r" cborgen:"r"` +} + +// ThemeColor_Rgba is a "rgba" in the site.standard.theme.color schema. +type ThemeColor_Rgba struct { + A int64 `json:"a" cborgen:"a"` + B int64 `json:"b" cborgen:"b"` + G int64 `json:"g" cborgen:"g"` + R int64 `json:"r" cborgen:"r"` +} diff --git a/cmd/lexgen/ext.json b/cmd/lexgen/ext.json new file mode 100644 index 00000000..b786b3a1 --- /dev/null +++ b/cmd/lexgen/ext.json @@ -0,0 +1,14 @@ +[ + { + "package": "atproto", + "prefix": "com.atproto", + "outdir": "api/atproto", + "import": "github.com/bluesky-social/indigo/api/atproto" + }, + { + "package": "standardsite", + "prefix": "site.standard", + "outdir": "api-ext/standardsite", + "import": "github.com/bluesky-social/indigo/api-ext/standardsite" + } +] diff --git a/lexicons/site/standard/document.json b/lexicons/site/standard/document.json new file mode 100644 index 00000000..5d7d9d8f --- /dev/null +++ b/lexicons/site/standard/document.json @@ -0,0 +1,125 @@ +{ + "defs": { + "contributor": { + "properties": { + "did": { + "format": "did", + "type": "string" + }, + "displayName": { + "maxGraphemes": 100, + "maxLength": 1000, + "type": "string" + }, + "role": { + "maxGraphemes": 100, + "maxLength": 1000, + "type": "string" + } + }, + "required": [ + "did" + ], + "type": "object" + }, + "main": { + "description": "A document record representing a published article, blog post, or other content. Documents can belong to a publication or exist independently.", + "key": "tid", + "record": { + "properties": { + "bskyPostRef": { + "description": "Strong reference to a Bluesky post. Useful to keep track of comments off-platform.", + "ref": "com.atproto.repo.strongRef", + "type": "ref" + }, + "content": { + "closed": false, + "description": "Open union used to define the record's content. Each entry must specify a $type and may be extended with other lexicons to support additional content formats.", + "refs": [], + "type": "union" + }, + "contributors": { + "items": { + "ref": "#contributor", + "type": "ref" + }, + "type": "array" + }, + "coverImage": { + "accept": [ + "image/*" + ], + "description": "Image to used for thumbnail or cover image. Less than 1MB is size.", + "maxSize": 1000000, + "type": "blob" + }, + "description": { + "description": "A brief description or excerpt from the document.", + "maxGraphemes": 3000, + "maxLength": 30000, + "type": "string" + }, + "labels": { + "description": "Self-label values for this post. Effectively content warnings.", + "refs": [ + "com.atproto.label.defs#selfLabels" + ], + "type": "union" + }, + "links": { + "description": "Array of values describing relationships between this document and external resources", + "refs": [], + "type": "union" + }, + "path": { + "description": "Combine with site or publication url to construct a canonical URL to the document. Prepend with a leading slash.", + "type": "string" + }, + "publishedAt": { + "description": "Timestamp of the documents publish time.", + "format": "datetime", + "type": "string" + }, + "site": { + "description": "Points to a publication record (at://) or a publication url (https://) for loose documents. Avoid trailing slashes.", + "format": "uri", + "type": "string" + }, + "tags": { + "description": "Array of strings used to tag or categorize the document. Avoid prepending tags with hashtags.", + "items": { + "maxGraphemes": 128, + "maxLength": 1280, + "type": "string" + }, + "type": "array" + }, + "textContent": { + "description": "Plaintext representation of the documents contents. Should not contain markdown or other formatting.", + "type": "string" + }, + "title": { + "description": "Title of the document.", + "maxGraphemes": 500, + "maxLength": 5000, + "type": "string" + }, + "updatedAt": { + "description": "Timestamp of the documents last edit.", + "format": "datetime", + "type": "string" + } + }, + "required": [ + "site", + "title", + "publishedAt" + ], + "type": "object" + }, + "type": "record" + } + }, + "id": "site.standard.document", + "lexicon": 1 +} diff --git a/lexicons/site/standard/graph/recommend.json b/lexicons/site/standard/graph/recommend.json new file mode 100644 index 00000000..27625ddf --- /dev/null +++ b/lexicons/site/standard/graph/recommend.json @@ -0,0 +1,29 @@ +{ + "defs": { + "main": { + "description": "Record declaring a recommendation of a document.", + "key": "tid", + "record": { + "properties": { + "createdAt": { + "format": "datetime", + "type": "string" + }, + "document": { + "description": "AT-URI reference to the document record being recommended (ex: at://did:plc:abc123/site.standard.document/xyz789).", + "format": "at-uri", + "type": "string" + } + }, + "required": [ + "document", + "createdAt" + ], + "type": "object" + }, + "type": "record" + } + }, + "id": "site.standard.graph.recommend", + "lexicon": 1 +} diff --git a/lexicons/site/standard/graph/subscription.json b/lexicons/site/standard/graph/subscription.json new file mode 100644 index 00000000..f0da5f7a --- /dev/null +++ b/lexicons/site/standard/graph/subscription.json @@ -0,0 +1,28 @@ +{ + "defs": { + "main": { + "description": "Record declaring a subscription to a publication.", + "key": "tid", + "record": { + "properties": { + "createdAt": { + "format": "datetime", + "type": "string" + }, + "publication": { + "description": "AT-URI reference to the publication record being subscribed to (ex: at://did:plc:abc123/site.standard.publication/xyz789).", + "format": "at-uri", + "type": "string" + } + }, + "required": [ + "publication" + ], + "type": "object" + }, + "type": "record" + } + }, + "id": "site.standard.graph.subscription", + "lexicon": 1 +} diff --git a/lexicons/site/standard/publication.json b/lexicons/site/standard/publication.json new file mode 100644 index 00000000..a93f818d --- /dev/null +++ b/lexicons/site/standard/publication.json @@ -0,0 +1,72 @@ +{ + "defs": { + "main": { + "description": "A publication record representing a blog, website, or content platform. Publications serve as containers for documents and define the overall branding and settings.", + "key": "tid", + "record": { + "properties": { + "basicTheme": { + "description": "Simplified publication theme for tools and apps to utilize when displaying content.", + "ref": "site.standard.theme.basic", + "type": "ref" + }, + "description": { + "description": "Brief description of the publication.", + "maxGraphemes": 3000, + "maxLength": 30000, + "type": "string" + }, + "icon": { + "accept": [ + "image/*" + ], + "description": "Square image to identify the publication. Should be at least 256x256.", + "maxSize": 1000000, + "type": "blob" + }, + "labels": { + "description": "Self-label values for this publication. Effectively content warnings.", + "refs": [ + "com.atproto.label.defs#selfLabels" + ], + "type": "union" + }, + "name": { + "description": "Name of the publication.", + "maxGraphemes": 500, + "maxLength": 5000, + "type": "string" + }, + "preferences": { + "description": "Object containing platform specific preferences (with a few shared properties).", + "ref": "#preferences", + "type": "ref" + }, + "url": { + "description": "Base publication url (ex: https://standard.site). The canonical document URL is formed by combining this value with the document path.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "url", + "name" + ], + "type": "object" + }, + "type": "record" + }, + "preferences": { + "properties": { + "showInDiscover": { + "default": true, + "description": "Boolean which decides whether the publication should appear in discovery feeds.", + "type": "boolean" + } + }, + "type": "object" + } + }, + "id": "site.standard.publication", + "lexicon": 1 +} diff --git a/lexicons/site/standard/theme/basic.json b/lexicons/site/standard/theme/basic.json new file mode 100644 index 00000000..86969ff6 --- /dev/null +++ b/lexicons/site/standard/theme/basic.json @@ -0,0 +1,50 @@ +{ + "defs": { + "main": { + "description": "A simplified theme definition for publications, providing basic color customization for content display across different platforms and applications.", + "key": "tid", + "record": { + "properties": { + "accent": { + "description": "Color used for links and button backgrounds.", + "refs": [ + "site.standard.theme.color#rgb" + ], + "type": "union" + }, + "accentForeground": { + "description": "Color used for button text.", + "refs": [ + "site.standard.theme.color#rgb" + ], + "type": "union" + }, + "background": { + "description": "Color used for content background.", + "refs": [ + "site.standard.theme.color#rgb" + ], + "type": "union" + }, + "foreground": { + "description": "Color used for content text.", + "refs": [ + "site.standard.theme.color#rgb" + ], + "type": "union" + } + }, + "required": [ + "background", + "foreground", + "accent", + "accentForeground" + ], + "type": "object" + }, + "type": "record" + } + }, + "id": "site.standard.theme.basic", + "lexicon": 1 +} diff --git a/lexicons/site/standard/theme/color.json b/lexicons/site/standard/theme/color.json new file mode 100644 index 00000000..5b6282da --- /dev/null +++ b/lexicons/site/standard/theme/color.json @@ -0,0 +1,62 @@ +{ + "defs": { + "rgb": { + "properties": { + "b": { + "maximum": 255, + "minimum": 0, + "type": "integer" + }, + "g": { + "maximum": 255, + "minimum": 0, + "type": "integer" + }, + "r": { + "maximum": 255, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "r", + "g", + "b" + ], + "type": "object" + }, + "rgba": { + "properties": { + "a": { + "maximum": 100, + "minimum": 0, + "type": "integer" + }, + "b": { + "maximum": 255, + "minimum": 0, + "type": "integer" + }, + "g": { + "maximum": 255, + "minimum": 0, + "type": "integer" + }, + "r": { + "maximum": 255, + "minimum": 0, + "type": "integer" + } + }, + "required": [ + "r", + "g", + "b", + "a" + ], + "type": "object" + } + }, + "id": "site.standard.theme.color", + "lexicon": 1 +}