Skip to main content

Posts

Find and load a single post#

findPost#

flatApi.subsocial.findPost(query: FindPostQuery): Promise<PostData | undefined>

Example:

flatApi.subsocial.findPost({id: '1'})
PropertiesDescription
idID of the desired struct.
visibilityFilter for the visible state of the structs (see Visibility).

๐Ÿ†ƒ PostData: CommonData < Post, PostContent >

findPostWithAllDetails#

Finds and loads a post with their extension, and the owner's profile and space (if defined).

flatApi.subsocial.findPostWithAllDetails(id: AnyPostId): Promise<PostWithAllDetails | undefined>

Example:

flatApi.subsocial.findPostWithAllDetails('1')

๐Ÿ†ƒ AnyPostId: PostId | BN

๐Ÿ†ƒ PostWithAllDetails: PostWithOwner & PostWithSpace

findPostWithSomeDetails#

flatApi.subsocial.findPostWithSomeDetails(query: FindPostWithDetailsQuery): Promise<PostWithSomeDetails | undefined>

Example:

flatApi.subsocial.findPostWithAllDetails('1')
PropertiesDescription
idID of desired struct.
visibilityFilter for the visible state of the structs (see Visibility)
withContentOnly?Boolean.
withSpace?Pass true to get the space data.
withOwner?Pass true to get the profile data.

๐Ÿ†ƒ PostWithSomeDetails: { ext?: Exclude<PostWithSomeDetails, "ext">; owner?: ProfileData; post: PostData; space?: SpaceData }

๐Ÿ†ƒ FindPostWithDetailsQuery: FindPostQuery & PostDetailsOpts

๐Ÿ†ƒ Visibility: 'onlyVisible' | 'onlyHidden' | 'onlyPublic' | 'onlyUnlisted'

Find and load an array of posts#

findAllPosts#

flatApi.subsocial.findAllPosts(ids: AnyPostId[]): Promise<PostData[]>

Example:

flatApi.subsocial.findAllPosts([ '1' ])

๐Ÿ†ƒ AnyPostId: PostId | BN

๐Ÿ†ƒ PostData: CommonData < Post, PostContent >

findPosts#

flatApi.subsocial.findPosts(query: FindPostsQuery): Promise<PostData[]>

Example:

flatApi.subsocial.findPosts({
ids: [ '1', '9', '32' ],
visibility: 'onlyVisible',
})
PropertiesDescription
idsAn array of IDs of the desired structs.
visibilityFilter for the visible state of the structs (see Visibility).
withContentOnly?Boolean.

๐Ÿ†ƒ Visibility: 'onlyVisible' | 'onlyHidden' | 'onlyPublic' | 'onlyUnlisted'

The four visible state filters correspond to these conditions:

FiltersDescription
onlyVisibleReturns posts where the hidden field on the corresponding Substrate struct is false.
onlyHiddenReturns posts where the hidden field on the corresponding Substrate struct is true.
onlyPublicReturns posts where the hidden field on the corresponding Substrate struct is false and there is a corresponding JSON file on IPFS.
onlyUnlistedReturns posts where either the hidden field is true or there is no corresponding JSON file on IPFS.

๐Ÿ†ƒ PostData: CommonData < Post, PostContent >

findPostsWithAllDetails#

Finds and loads a posts with their extension, and the owner's profile and space (if defined).

flatApi.subsocial.findPostsWithAllDetails(query: FindPostsQuery): Promise<PostWithAllDetails[]>

Example:

flatApi.subsocial.findPostsWithAllDetails({
ids: [ '1' ],
visibility: 'onlyVisible'
})
PropertiesDescription
idsAn array of IDs of the desired structs.
visibilityFilter for the visible state of the structs (see Visibility)
withContentOnly?Boolean.

๐Ÿ†ƒ Visibility: 'onlyVisible' | 'onlyHidden' | 'onlyPublic' | 'onlyUnlisted'

The four visible state filters correspond to the next conditions:

FiltersDescription
onlyVisibleReturns posts where the hidden field on the corresponding Substrate struct is false.
onlyHiddenReturns posts where the hidden field on the corresponding Substrate struct is true.
onlyPublicReturns posts where the hidden field on the corresponding Substrate struct is false and there is a corresponding JSON file on IPFS.
onlyUnlistedReturns posts where either the hidden field is true or there is no corresponding JSON file on IPFS.

๐Ÿ†ƒ FindPostsQuery: FindStructs < AnyPostId >

๐Ÿ†ƒ PostWithAllDetails: PostWithOwner & PostWithSpace

findPostsWithSomeDetails#

Finds and loads posts with their extension, and the owner's profile and and space (if defined and specified in properties).

flatApi.subsocial.findPostsWithSomeDetails(query: FindPostsWithDetailsQuery): Promise<PostWithSomeDetails[]>

Example:

flatApi.subsocial.findPostsWithSomeDetails({
id: '1',
withOwner: true
}): Promise<PostWithSomeDetails[]>
PropertiesDescription
idsAn array of IDs of the desired structs.
visibilityFilter for the visible state of the structs (see Visibility)
withContentOnly?Boolean.
withSpace?Pass true to get the space data.
withOwner?Pass true to get the profile data.

๐Ÿ†ƒ PostWithSomeDetails: { ext?: Exclude<PostWithSomeDetails, "ext">; owner?: ProfileData; post: PostData; space?: SpaceData }

๐Ÿ†ƒ FindPostWithDetailsQuery: FindPostQuery & PostDetailsOpts

๐Ÿ†ƒ Visibility: 'onlyVisible' | 'onlyHidden' | 'onlyPublic' | 'onlyUnlisted'

findPublicPostsWithAllDetails#

Finds and loads posts that have the hidden == false field in the Substrate struct, and their IPFS content is not empty, with their extension, and the owner's profile and space (if defined).

flatApi.subsocial.findPublicPostsWithAllDetails(ids: AnyPostId[]): Promise<PostWithAllDetails[]>

Example:

flatApi.subsocial.findPublicPostsWithAllDetails(['1'])

๐Ÿ†ƒ AnyPostId: PostId | BN

๐Ÿ†ƒ PostWithAllDetails: PostWithOwner & PostWithSpace

findPublicPostsWithSomeDetails#

Finds and loads posts that have the hidden == false field in the Substrate struct and their IPFS content is not empty, with their extension, and the owner's profile and space (if defined and specified in properties).

flatApi.subsocial.findPublicPostsWithSomeDetails(query: FindPostsWithDetailsQuery): Promise<PostWithSomeDetails[]>

Example:

flatApi.subsocial.findPublicPostsWithSomeDetails({
id: '1',
withOwner: true
}): Promise<PostWithSomeDetails[]>
PropertiesDescription
idsAn array of IDs of the desired structs.
visibilityFilter for the visible state of the structs (see Visibility)
withContentOnly?Boolean.
withSpace?Pass true to get the space data.
withOwner?Pass true to get the profile data.

๐Ÿ†ƒ PostWithSomeDetails: { ext?: Exclude<PostWithSomeDetails, "ext">; owner?: ProfileData; post: PostData; space?: SpaceData }

๐Ÿ†ƒ FindPostWithDetailsQuery: FindPostQuery & PostDetailsOpts

๐Ÿ†ƒ Visibility: 'onlyVisible' | 'onlyHidden' | 'onlyPublic' | 'onlyUnlisted'

findUnlistedPosts#

Finds and loads an array of information about unlisted posts from the Subsocial blockchain and IPFS by a given array of post ids.

A post is considered unlisted if it meets either of these conditions:

  • The hidden field on it's blockchain structure is true.
  • Or there is no corresponding JSON file that represents the post's content on IPFS.
flatApi.subsocia.findUnlistedPosts(ids: AnyPostId[]): Promise<PostData[]>

Example:

flatApi.subsocia.findUnlistedPosts(['1'])

๐Ÿ†ƒ AnyPostId: PostId | BN

๐Ÿ†ƒ PostData: CommonData < Post, PostContent >

findUnlistedPostsWithAllDetails#

Finds and loads posts that have the hidden == true field in the Substrate struct and their IPFS content is not empty, with their extension, and the owner's profile and space (if defined).

flatApi.subsocial.findUnlistedPostsWithAllDetails(ids: AnyPostId[]): Promise<PostWithAllDetails[]>

Example:

flatApi.subsocial.findUnlistedPostsWithAllDetails(['1'])

๐Ÿ†ƒ AnyPostId: PostId | BN

๐Ÿ†ƒ PostWithAllDetails: PostWithOwner & PostWithSpace

findUnlistedPostsWithSomeDetails#

Finds and loads posts that have the' hidden == true' field in the Substrate struct and their IPFS content is not empty, with their extension, and owner's profile and space (if defined and specified in properties).

flatApi.subsocial.findUnlistedPostsWithSomeDetails(query: FindPostsWithDetailsQuery): Promise<PostWithSomeDetails[]>

Example:

flatApi.subsocial.findUnlistedPostsWithSomeDetails({
ids: ['1'],
withOwner: true
}): Promise<PostWithSomeDetails[]>
PropertiesDescription
idsAn array of IDs of the desired structs.
visibilityFilter for the visible state of the structs (see Visibility)
withContentOnly?Boolean.
withSpace?Pass true to get the space data.
withOwner?Pass true to get the profile data.

๐Ÿ†ƒ PostWithSomeDetails: { ext?: Exclude<PostWithSomeDetails, "ext">; owner?: ProfileData; post: PostData; space?: SpaceData }

๐Ÿ†ƒ FindPostsWithDetailsQuery: FindPostsQuery & PostDetailsOpts

๐Ÿ†ƒ Visibility: 'onlyVisible' | 'onlyHidden' | 'onlyPublic' | 'onlyUnlisted'