Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should NoteMetadata allow other fields? #83

Open
hyoban opened this issue Mar 4, 2024 · 1 comment
Open

Should NoteMetadata allow other fields? #83

hyoban opened this issue Mar 4, 2024 · 1 comment

Comments

@hyoban
Copy link
Member

hyoban commented Mar 4, 2024

https://indexer.crossbell.io/v1/notes?characterId=10

export interface NoteMetadata extends BaseMetadata, AttributesMetadata {
/**
* The tags of this note.
*
* @example
* ['article', 'dairy']
*/
tags?: string[]
/**
* The title of this note.
*/
title?: string
/**
* The (markdown) content of this note.
*
* @example
* '# Hello World\n\nThis is a markdown note.'
*/
content?: string
/**
* The attachments of this note.
*/
attachments?: (
| NoteMetadataAttachmentBase<'address'>
| NoteMetadataAttachmentBase<'content'>
)[]
/**
* The source of this note. I.e. where it was originally created.
* For example, it could be your app's name so that you could filtering the notes by the source in your app.
*
* @example
* ['xlog']
*/
sources?: string[]
/**
* Where this note was created. User can view this note on this location.
*
* @example
* ['https://twitter.com/_Crossbell/status/1555900801058488322']
*/
external_urls?: string[]
/**
* The date this content was published, following the ISO 8601 format.
*
* Example case: a blog post was originally published on a website at time A,
* then was synced to the blockchain at time B.
* The `date_published` of the note is time A.
* The date of the blockchain sync is time B (shown as the `createdAt` field
* in the indexer's response).
*
* @example
* '2022-01-01T00:00:00Z'
*/
date_published?: string
/**
* A content warning for this note. On the client side, this will be displayed as a warning.
*
* @example
* 'nsfw'
*/
content_warning?: 'nsfw' | 'sensitive' | 'spoiler'
/**
* The variant of this note.
*
* - `undefined`: the normal note.
* - `"achievement"`: the achievement variant.
*
* @example
* 'achievement'
*/
variant?: 'achievement'
}

Now we cannot access other properties on NoteMetadata like summary

Or this is a mistake, summary should not be there.

@hyoban hyoban changed the title Does NoteMetadata include the summary field? Should NoteMetadata allow other fields? Mar 4, 2024
@songkeys
Copy link
Member

The NoteMetadata follows https://github.com/Crossbell-Box/CIPs/blob/main/CIPs/CIP-5.md#note-metadata.

I believe summary is a specific attribute in xLog. If there is an app-specific attribute, it should go into the attributes field. Otherwise, the future database may not be able to store it correctly because it is planned to adhere to the spec by only storing specific fields for performance reasons. /cc @DIYgod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants