Skip to main content

Spaces

Find and load a single space#

findSpace#

findSpace(query: FindSpaceQuery): Promise<SpaceData | undefined>

Example:

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

๐Ÿ†ƒ FindSpaceQuery: FindStruct < AnySpaceId >

๐Ÿ†ƒ SpaceData: CommonData < Space, SpaceContent >

Find and load an array of spaces#

findAllSpaces#

flatApi.subsocial.findAllSpaces(ids: AnySpaceId[]): Promise<SpaceData[]>

Example:

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

๐Ÿ†ƒ AnySpaceId: SpaceId | BN

๐Ÿ†ƒ SpaceData: CommonData < Space, SpaceContent >

findSpaces#

flatApi.subsocial.findSpaces(query: FindSpacesQuery): Promise<SpaceData[]>

Example:

flatApi.subsocial.findSpaces({
ids: [ '1', '1354', '1573', '1599', '1040' ],
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'

๐Ÿ†ƒ SpaceData: CommonData < Space, SpaceContent >

findPublicSpaces#

Load an array of information about public spaces from the Subsocial blockchain and IPFS by a given array of space ids.

A space is considered public if it meets these conditions:

  • The hidden field on its blockchain structure is false.
  • And there is a corresponding JSON file that represents the space's content on IPFS.
flatApi.subsocial.findPublicSpaces(ids: AnySpaceId[]): Promise<SpaceData[]>

Example:

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

๐Ÿ†ƒ AnySpaceId: SpaceId | BN

๐Ÿ†ƒ SpaceData: CommonData < Space, SpaceContent >

findUnlistedSpaces#

Find and load an array of information about unlisted spaces from the Subsocial blockchain and IPFS by a given array of space ids.

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

  • The hidden field on its blockchain structure is true.
  • Or there is no corresponding JSON file that represents the space's content on IPFS.
flatApi.subsocial.findUnlistedSpaces(ids: AnySpaceId[]): Promise<SpaceData[]>

Example:

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

๐Ÿ†ƒ AnySpaceId: SpaceId | BN

๐Ÿ†ƒ SpaceData: CommonData < Space, SpaceContent >