diff --git a/lexicons/fyi/frontpage/feed/comment.json b/lexicons/fyi/frontpage/feed/comment.json new file mode 100644 index 00000000..8a7c8eb2 --- /dev/null +++ b/lexicons/fyi/frontpage/feed/comment.json @@ -0,0 +1,33 @@ +{ + "lexicon": 1, + "id": "fyi.frontpage.feed.comment", + "defs": { + "main": { + "type": "record", + "description": "Record containing a Frontpage comment.", + "key": "tid", + "record": { + "type": "object", + "required": ["createdAt", "post", "blocks"], + "properties": { + "blocks": { + "type": "array", + "maxLength": 50, + "description": "The content of the comment. Note, there are additional constraints placed on the total size of the content within the Frontpage AppView that are not possible to express in lexicon. Generally a comment can have a maximum length of 10,000 graphemes, the Frontpage AppView will enforce this limit.", + "items": { + "type": "ref", + "ref": "fyi.frontpage.richtext.block" + } + }, + "createdAt": { + "type": "string", + "format": "datetime", + "description": "Client-declared timestamp when this comment was originally created." + }, + "parent": { "type": "ref", "ref": "com.atproto.repo.strongRef" }, + "post": { "type": "ref", "ref": "com.atproto.repo.strongRef" } + } + } + } + } +} diff --git a/lexicons/fyi/frontpage/feed/post.json b/lexicons/fyi/frontpage/feed/post.json new file mode 100644 index 00000000..d7224de7 --- /dev/null +++ b/lexicons/fyi/frontpage/feed/post.json @@ -0,0 +1,43 @@ +{ + "lexicon": 1, + "id": "fyi.frontpage.feed.post", + "defs": { + "main": { + "type": "record", + "description": "Record containing a Frontpage post.", + "key": "tid", + "record": { + "type": "object", + "required": ["title", "createdAt"], + "properties": { + "title": { + "type": "string", + "maxLength": 3000, + "maxGraphemes": 300, + "description": "The title of the post." + }, + "subject": { + "type": "union", + "description": "The piece of content that this Frontpage post is about.", + "refs": ["#urlSubject"] + }, + "createdAt": { + "type": "string", + "format": "datetime", + "description": "Client-declared timestamp when this post was originally created." + } + } + } + }, + "urlSubject": { + "type": "object", + "required": ["url"], + "properties": { + "url": { + "type": "string", + "format": "uri" + } + } + } + } +} diff --git a/lexicons/fyi/frontpage/feed/vote.json b/lexicons/fyi/frontpage/feed/vote.json new file mode 100644 index 00000000..96d86b05 --- /dev/null +++ b/lexicons/fyi/frontpage/feed/vote.json @@ -0,0 +1,27 @@ +{ + "lexicon": 1, + "id": "fyi.frontpage.feed.vote", + "defs": { + "main": { + "type": "record", + "description": "Record containing a Frontpage vote.", + "key": "tid", + "record": { + "type": "object", + "required": ["subject", "createdAt"], + "properties": { + "subject": { + "type": "ref", + "description": "The post or comment that this Frontpage vote is for.", + "ref": "com.atproto.repo.strongRef" + }, + "createdAt": { + "type": "string", + "format": "datetime", + "description": "Client-declared timestamp when this vote was originally created." + } + } + } + } + } +} diff --git a/lexicons/fyi/frontpage/richtext/block.json b/lexicons/fyi/frontpage/richtext/block.json new file mode 100644 index 00000000..d90f3d6f --- /dev/null +++ b/lexicons/fyi/frontpage/richtext/block.json @@ -0,0 +1,26 @@ +{ + "lexicon": 1, + "id": "fyi.frontpage.richtext.block", + "defs": { + "main": { + "type": "object", + "required": ["content"], + "properties": { + "content": { + "type": "union", + "refs": ["#plaintextParagraph"] + } + } + }, + "plaintextParagraph": { + "type": "object", + "properties": { + "text": { + "type": "string", + "maxLength": 100000, + "maxGraphemes": 10000 + } + } + } + } +} diff --git a/packages/frontpage-atproto-client/src/index.ts b/packages/frontpage-atproto-client/src/index.ts index 5072765c..36771fad 100644 --- a/packages/frontpage-atproto-client/src/index.ts +++ b/packages/frontpage-atproto-client/src/index.ts @@ -21,6 +21,10 @@ import * as ComAtprotoRepoListRecords from "./types/com/atproto/repo/listRecords import * as ComAtprotoRepoPutRecord from "./types/com/atproto/repo/putRecord.js"; import * as ComAtprotoRepoStrongRef from "./types/com/atproto/repo/strongRef.js"; import * as ComAtprotoRepoUploadBlob from "./types/com/atproto/repo/uploadBlob.js"; +import * as FyiFrontpageFeedComment from "./types/fyi/frontpage/feed/comment.js"; +import * as FyiFrontpageFeedPost from "./types/fyi/frontpage/feed/post.js"; +import * as FyiFrontpageFeedVote from "./types/fyi/frontpage/feed/vote.js"; +import * as FyiFrontpageRichtextBlock from "./types/fyi/frontpage/richtext/block.js"; import * as FyiUnravelFrontpageComment from "./types/fyi/unravel/frontpage/comment.js"; import * as FyiUnravelFrontpagePost from "./types/fyi/unravel/frontpage/post.js"; import * as FyiUnravelFrontpageVote from "./types/fyi/unravel/frontpage/vote.js"; @@ -37,6 +41,10 @@ export * as ComAtprotoRepoListRecords from "./types/com/atproto/repo/listRecords export * as ComAtprotoRepoPutRecord from "./types/com/atproto/repo/putRecord.js"; export * as ComAtprotoRepoStrongRef from "./types/com/atproto/repo/strongRef.js"; export * as ComAtprotoRepoUploadBlob from "./types/com/atproto/repo/uploadBlob.js"; +export * as FyiFrontpageFeedComment from "./types/fyi/frontpage/feed/comment.js"; +export * as FyiFrontpageFeedPost from "./types/fyi/frontpage/feed/post.js"; +export * as FyiFrontpageFeedVote from "./types/fyi/frontpage/feed/vote.js"; +export * as FyiFrontpageRichtextBlock from "./types/fyi/frontpage/richtext/block.js"; export * as FyiUnravelFrontpageComment from "./types/fyi/unravel/frontpage/comment.js"; export * as FyiUnravelFrontpagePost from "./types/fyi/unravel/frontpage/post.js"; export * as FyiUnravelFrontpageVote from "./types/fyi/unravel/frontpage/vote.js"; @@ -202,14 +210,291 @@ export class ComAtprotoRepoNS { export class FyiNS { _client: XrpcClient; + frontpage: FyiFrontpageNS; unravel: FyiUnravelNS; constructor(client: XrpcClient) { this._client = client; + this.frontpage = new FyiFrontpageNS(client); this.unravel = new FyiUnravelNS(client); } } +export class FyiFrontpageNS { + _client: XrpcClient; + feed: FyiFrontpageFeedNS; + richtext: FyiFrontpageRichtextNS; + + constructor(client: XrpcClient) { + this._client = client; + this.feed = new FyiFrontpageFeedNS(client); + this.richtext = new FyiFrontpageRichtextNS(client); + } +} + +export class FyiFrontpageFeedNS { + _client: XrpcClient; + comment: FyiFrontpageFeedCommentRecord; + post: FyiFrontpageFeedPostRecord; + vote: FyiFrontpageFeedVoteRecord; + + constructor(client: XrpcClient) { + this._client = client; + this.comment = new FyiFrontpageFeedCommentRecord(client); + this.post = new FyiFrontpageFeedPostRecord(client); + this.vote = new FyiFrontpageFeedVoteRecord(client); + } +} + +export class FyiFrontpageFeedCommentRecord { + _client: XrpcClient; + + constructor(client: XrpcClient) { + this._client = client; + } + + async list( + params: OmitKey, + ): Promise<{ + cursor?: string; + records: { uri: string; value: FyiFrontpageFeedComment.Record }[]; + }> { + const res = await this._client.call("com.atproto.repo.listRecords", { + collection: "fyi.frontpage.feed.comment", + ...params, + }); + return res.data; + } + + async get( + params: OmitKey, + ): Promise<{ + uri: string; + cid: string; + value: FyiFrontpageFeedComment.Record; + }> { + const res = await this._client.call("com.atproto.repo.getRecord", { + collection: "fyi.frontpage.feed.comment", + ...params, + }); + return res.data; + } + + async create( + params: OmitKey< + ComAtprotoRepoCreateRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.frontpage.feed.comment"; + const res = await this._client.call( + "com.atproto.repo.createRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + + async put( + params: OmitKey< + ComAtprotoRepoPutRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.frontpage.feed.comment"; + const res = await this._client.call( + "com.atproto.repo.putRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + + async delete( + params: OmitKey, + headers?: Record, + ): Promise { + await this._client.call( + "com.atproto.repo.deleteRecord", + undefined, + { collection: "fyi.frontpage.feed.comment", ...params }, + { headers }, + ); + } +} + +export class FyiFrontpageFeedPostRecord { + _client: XrpcClient; + + constructor(client: XrpcClient) { + this._client = client; + } + + async list( + params: OmitKey, + ): Promise<{ + cursor?: string; + records: { uri: string; value: FyiFrontpageFeedPost.Record }[]; + }> { + const res = await this._client.call("com.atproto.repo.listRecords", { + collection: "fyi.frontpage.feed.post", + ...params, + }); + return res.data; + } + + async get( + params: OmitKey, + ): Promise<{ uri: string; cid: string; value: FyiFrontpageFeedPost.Record }> { + const res = await this._client.call("com.atproto.repo.getRecord", { + collection: "fyi.frontpage.feed.post", + ...params, + }); + return res.data; + } + + async create( + params: OmitKey< + ComAtprotoRepoCreateRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.frontpage.feed.post"; + const res = await this._client.call( + "com.atproto.repo.createRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + + async put( + params: OmitKey< + ComAtprotoRepoPutRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.frontpage.feed.post"; + const res = await this._client.call( + "com.atproto.repo.putRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + + async delete( + params: OmitKey, + headers?: Record, + ): Promise { + await this._client.call( + "com.atproto.repo.deleteRecord", + undefined, + { collection: "fyi.frontpage.feed.post", ...params }, + { headers }, + ); + } +} + +export class FyiFrontpageFeedVoteRecord { + _client: XrpcClient; + + constructor(client: XrpcClient) { + this._client = client; + } + + async list( + params: OmitKey, + ): Promise<{ + cursor?: string; + records: { uri: string; value: FyiFrontpageFeedVote.Record }[]; + }> { + const res = await this._client.call("com.atproto.repo.listRecords", { + collection: "fyi.frontpage.feed.vote", + ...params, + }); + return res.data; + } + + async get( + params: OmitKey, + ): Promise<{ uri: string; cid: string; value: FyiFrontpageFeedVote.Record }> { + const res = await this._client.call("com.atproto.repo.getRecord", { + collection: "fyi.frontpage.feed.vote", + ...params, + }); + return res.data; + } + + async create( + params: OmitKey< + ComAtprotoRepoCreateRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.frontpage.feed.vote"; + const res = await this._client.call( + "com.atproto.repo.createRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + + async put( + params: OmitKey< + ComAtprotoRepoPutRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.frontpage.feed.vote"; + const res = await this._client.call( + "com.atproto.repo.putRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + + async delete( + params: OmitKey, + headers?: Record, + ): Promise { + await this._client.call( + "com.atproto.repo.deleteRecord", + undefined, + { collection: "fyi.frontpage.feed.vote", ...params }, + { headers }, + ); + } +} + +export class FyiFrontpageRichtextNS { + _client: XrpcClient; + + constructor(client: XrpcClient) { + this._client = client; + } +} + export class FyiUnravelNS { _client: XrpcClient; frontpage: FyiUnravelFrontpageNS; @@ -286,6 +571,24 @@ export class FyiUnravelFrontpageCommentRecord { return res.data; } + async put( + params: OmitKey< + ComAtprotoRepoPutRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.unravel.frontpage.comment"; + const res = await this._client.call( + "com.atproto.repo.putRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + async delete( params: OmitKey, headers?: Record, @@ -351,6 +654,24 @@ export class FyiUnravelFrontpagePostRecord { return res.data; } + async put( + params: OmitKey< + ComAtprotoRepoPutRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.unravel.frontpage.post"; + const res = await this._client.call( + "com.atproto.repo.putRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + async delete( params: OmitKey, headers?: Record, @@ -416,6 +737,24 @@ export class FyiUnravelFrontpageVoteRecord { return res.data; } + async put( + params: OmitKey< + ComAtprotoRepoPutRecord.InputSchema, + "collection" | "record" + >, + record: Un$Typed, + headers?: Record, + ): Promise<{ uri: string; cid: string }> { + const collection = "fyi.unravel.frontpage.vote"; + const res = await this._client.call( + "com.atproto.repo.putRecord", + undefined, + { collection, ...params, record: { ...record, $type: collection } }, + { encoding: "application/json", headers }, + ); + return res.data; + } + async delete( params: OmitKey, headers?: Record, diff --git a/packages/frontpage-atproto-client/src/lexicons.ts b/packages/frontpage-atproto-client/src/lexicons.ts index 7e216d1d..1cd17b1d 100644 --- a/packages/frontpage-atproto-client/src/lexicons.ts +++ b/packages/frontpage-atproto-client/src/lexicons.ts @@ -766,6 +766,147 @@ export const schemaDict = { }, }, }, + FyiFrontpageFeedComment: { + lexicon: 1, + id: "fyi.frontpage.feed.comment", + defs: { + main: { + type: "record", + description: "Record containing a Frontpage comment.", + key: "tid", + record: { + type: "object", + required: ["createdAt", "post", "blocks"], + properties: { + blocks: { + type: "array", + maxLength: 50, + description: + "The content of the comment. Note, there are additional constraints placed on the total size of the content within the Frontpage AppView that are not possible to express in lexicon. Generally a comment can have a maximum length of 10,000 graphemes, the Frontpage AppView will enforce this limit.", + items: { + type: "ref", + ref: "lex:fyi.frontpage.richtext.block", + }, + }, + createdAt: { + type: "string", + format: "datetime", + description: + "Client-declared timestamp when this comment was originally created.", + }, + parent: { + type: "ref", + ref: "lex:com.atproto.repo.strongRef", + }, + post: { + type: "ref", + ref: "lex:com.atproto.repo.strongRef", + }, + }, + }, + }, + }, + }, + FyiFrontpageFeedPost: { + lexicon: 1, + id: "fyi.frontpage.feed.post", + defs: { + main: { + type: "record", + description: "Record containing a Frontpage post.", + key: "tid", + record: { + type: "object", + required: ["title", "createdAt"], + properties: { + title: { + type: "string", + maxLength: 3000, + maxGraphemes: 300, + description: "The title of the post.", + }, + subject: { + type: "union", + description: + "The piece of content that this Frontpage post is about.", + refs: ["lex:fyi.frontpage.feed.post#urlSubject"], + }, + createdAt: { + type: "string", + format: "datetime", + description: + "Client-declared timestamp when this post was originally created.", + }, + }, + }, + }, + urlSubject: { + type: "object", + required: ["url"], + properties: { + url: { + type: "string", + format: "uri", + }, + }, + }, + }, + }, + FyiFrontpageFeedVote: { + lexicon: 1, + id: "fyi.frontpage.feed.vote", + defs: { + main: { + type: "record", + description: "Record containing a Frontpage vote.", + key: "tid", + record: { + type: "object", + required: ["subject", "createdAt"], + properties: { + subject: { + type: "ref", + description: + "The post or comment that this Frontpage vote is for.", + ref: "lex:com.atproto.repo.strongRef", + }, + createdAt: { + type: "string", + format: "datetime", + description: + "Client-declared timestamp when this vote was originally created.", + }, + }, + }, + }, + }, + }, + FyiFrontpageRichtextBlock: { + lexicon: 1, + id: "fyi.frontpage.richtext.block", + defs: { + main: { + type: "object", + required: ["content"], + properties: { + content: { + type: "union", + refs: ["lex:fyi.frontpage.richtext.block#plaintextParagraph"], + }, + }, + }, + plaintextParagraph: { + type: "object", + properties: { + text: { + type: "string", + maxLength: 100000, + maxGraphemes: 10000, + }, + }, + }, + }, + }, FyiUnravelFrontpageComment: { lexicon: 1, id: "fyi.unravel.frontpage.comment", @@ -909,6 +1050,10 @@ export const ids = { ComAtprotoRepoPutRecord: "com.atproto.repo.putRecord", ComAtprotoRepoStrongRef: "com.atproto.repo.strongRef", ComAtprotoRepoUploadBlob: "com.atproto.repo.uploadBlob", + FyiFrontpageFeedComment: "fyi.frontpage.feed.comment", + FyiFrontpageFeedPost: "fyi.frontpage.feed.post", + FyiFrontpageFeedVote: "fyi.frontpage.feed.vote", + FyiFrontpageRichtextBlock: "fyi.frontpage.richtext.block", FyiUnravelFrontpageComment: "fyi.unravel.frontpage.comment", FyiUnravelFrontpagePost: "fyi.unravel.frontpage.post", FyiUnravelFrontpageVote: "fyi.unravel.frontpage.vote", diff --git a/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/comment.ts b/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/comment.ts new file mode 100644 index 00000000..11bcb466 --- /dev/null +++ b/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/comment.ts @@ -0,0 +1,38 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { type ValidationResult, BlobRef } from "@atproto/lexicon"; +import { CID } from "multiformats/cid"; +import { validate as _validate } from "../../../../lexicons"; +import { + type $Typed, + is$typed as _is$typed, + type OmitKey, +} from "../../../../util"; +import type * as FyiFrontpageRichtextBlock from "../richtext/block.js"; +import type * as ComAtprotoRepoStrongRef from "../../../com/atproto/repo/strongRef.js"; + +const is$typed = _is$typed, + validate = _validate; +const id = "fyi.frontpage.feed.comment"; + +export interface Record { + $type: "fyi.frontpage.feed.comment"; + /** The content of the comment. Note, there are additional constraints placed on the total size of the content within the Frontpage AppView that are not possible to express in lexicon. Generally a comment can have a maximum length of 10,000 graphemes, the Frontpage AppView will enforce this limit. */ + blocks: FyiFrontpageRichtextBlock.Main[]; + /** Client-declared timestamp when this comment was originally created. */ + createdAt: string; + parent?: ComAtprotoRepoStrongRef.Main; + post: ComAtprotoRepoStrongRef.Main; + [k: string]: unknown; +} + +const hashRecord = "main"; + +export function isRecord(v: V) { + return is$typed(v, id, hashRecord); +} + +export function validateRecord(v: V) { + return validate(v, id, hashRecord, true); +} diff --git a/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/post.ts b/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/post.ts new file mode 100644 index 00000000..856b1dc0 --- /dev/null +++ b/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/post.ts @@ -0,0 +1,50 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { type ValidationResult, BlobRef } from "@atproto/lexicon"; +import { CID } from "multiformats/cid"; +import { validate as _validate } from "../../../../lexicons"; +import { + type $Typed, + is$typed as _is$typed, + type OmitKey, +} from "../../../../util"; + +const is$typed = _is$typed, + validate = _validate; +const id = "fyi.frontpage.feed.post"; + +export interface Record { + $type: "fyi.frontpage.feed.post"; + /** The title of the post. */ + title: string; + subject?: $Typed | { $type: string }; + /** Client-declared timestamp when this post was originally created. */ + createdAt: string; + [k: string]: unknown; +} + +const hashRecord = "main"; + +export function isRecord(v: V) { + return is$typed(v, id, hashRecord); +} + +export function validateRecord(v: V) { + return validate(v, id, hashRecord, true); +} + +export interface UrlSubject { + $type?: "fyi.frontpage.feed.post#urlSubject"; + url: string; +} + +const hashUrlSubject = "urlSubject"; + +export function isUrlSubject(v: V) { + return is$typed(v, id, hashUrlSubject); +} + +export function validateUrlSubject(v: V) { + return validate(v, id, hashUrlSubject); +} diff --git a/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/vote.ts b/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/vote.ts new file mode 100644 index 00000000..a3f17fd7 --- /dev/null +++ b/packages/frontpage-atproto-client/src/types/fyi/frontpage/feed/vote.ts @@ -0,0 +1,34 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { type ValidationResult, BlobRef } from "@atproto/lexicon"; +import { CID } from "multiformats/cid"; +import { validate as _validate } from "../../../../lexicons"; +import { + type $Typed, + is$typed as _is$typed, + type OmitKey, +} from "../../../../util"; +import type * as ComAtprotoRepoStrongRef from "../../../com/atproto/repo/strongRef.js"; + +const is$typed = _is$typed, + validate = _validate; +const id = "fyi.frontpage.feed.vote"; + +export interface Record { + $type: "fyi.frontpage.feed.vote"; + subject: ComAtprotoRepoStrongRef.Main; + /** Client-declared timestamp when this vote was originally created. */ + createdAt: string; + [k: string]: unknown; +} + +const hashRecord = "main"; + +export function isRecord(v: V) { + return is$typed(v, id, hashRecord); +} + +export function validateRecord(v: V) { + return validate(v, id, hashRecord, true); +} diff --git a/packages/frontpage-atproto-client/src/types/fyi/frontpage/richtext/block.ts b/packages/frontpage-atproto-client/src/types/fyi/frontpage/richtext/block.ts new file mode 100644 index 00000000..9b6166d0 --- /dev/null +++ b/packages/frontpage-atproto-client/src/types/fyi/frontpage/richtext/block.ts @@ -0,0 +1,45 @@ +/** + * GENERATED CODE - DO NOT MODIFY + */ +import { type ValidationResult, BlobRef } from "@atproto/lexicon"; +import { CID } from "multiformats/cid"; +import { validate as _validate } from "../../../../lexicons"; +import { + type $Typed, + is$typed as _is$typed, + type OmitKey, +} from "../../../../util"; + +const is$typed = _is$typed, + validate = _validate; +const id = "fyi.frontpage.richtext.block"; + +export interface Main { + $type?: "fyi.frontpage.richtext.block"; + content: $Typed | { $type: string }; +} + +const hashMain = "main"; + +export function isMain(v: V) { + return is$typed(v, id, hashMain); +} + +export function validateMain(v: V) { + return validate
(v, id, hashMain); +} + +export interface PlaintextParagraph { + $type?: "fyi.frontpage.richtext.block#plaintextParagraph"; + text?: string; +} + +const hashPlaintextParagraph = "plaintextParagraph"; + +export function isPlaintextParagraph(v: V) { + return is$typed(v, id, hashPlaintextParagraph); +} + +export function validatePlaintextParagraph(v: V) { + return validate(v, id, hashPlaintextParagraph); +}