Hierarchy

  • SubsocialApi

Implements

Constructors

  • Parameters

    • props: SubsocialApiProps

    Returns SubsocialApi

Properties

_base: BasicSubsocialApi

Accessors

  • get base(): BasicSubsocialApi
  • Deprecated

    Getter for an ApiPromise to connect to Subsocial nodes and query chain states, but in raw format. The raw formatted data needs to be flattened first in order to be readable by JavaScript.

    Accessors for private field _base

    Returns BasicSubsocialApi

  • get blockchain(): SubsocialSubstrateApi
  • Getter for an ApiPromise to connect to Subsocial nodes and query chain states. It is useful in the case of querying data about posts, spaces, and profiles.

    Accessors for private field _base.substrate

    Returns SubsocialSubstrateApi

  • get ipfs(): SubsocialIpfsApi
  • Getter for an aggregated ApiPromise to work with IPFS. It is useful for getting the contents of spaces, posts, and profiles.

    Accessors for private field _base.ipfs

    Returns SubsocialIpfsApi

  • get subsocial(): BasicSubsocialApi
  • Deprecated

    Returns BasicSubsocialApi

  • get substrateApi(): Promise<ApiPromise>
  • Getter for a Polkadot ApiPromise without wrappers to call functions from Subsocial Pallets. It is useful for creating specific txs or queries.

    Accessors for private field _base.substrate.api

    Returns Promise<ApiPromise>

Methods

  • Find and load data about a domain from the Subsocial blockchain by a given string of domainName.

    Returns

    Data about a desired domain name from the Subsocial blockchain. If there is no domain name corresponding to the given domainName, undefined is returned.

    Parameters

    • domainName: string

      A string that is a domain name.

    Returns Promise<undefined | DomainStruct>

  • Find and load an array of information about some domain structs from the Subsocial blockchain by a given array of domainNames.

    Returns

    An array of data about the desired domain structs aggregated from the Subsocial blockchain. If there are no domains corresponding to the given array of domainNames, an empty array is returned.

    Parameters

    • domainNames: string[]

      An array of domain names.

    Returns Promise<DomainStruct[]>

  • Find and load data about a post from the Subsocial blockchain and IPFS by a given query object.

    Returns

    Data about a post aggregated from the Subsocial blockchain and IPFS. If there is no post corresponding to the given query object, undefined is returned.

    Parameters

    • query: FindPostQuery

      An object containing the desired post id, a visibility filter (hidden field), and a content filter (with or without IPFS content).

    Returns Promise<undefined | PostData>

  • Find and load information about post structs (can be Unlisted or Public, depending on filters) from the Subsocial blockchain and IPFS by a given post id and filters object.

    Returns

    Data about post structs aggregated from the Subsocial blockchain and IPFS. If there are no post structs corresponding to the given post id and filters object, undefined is returned.

    Parameters

    • id: AnyId

      The post id of the desired post structs.

    • Optional filters: Filters

      (Optional) An object containing a visibility filter (hidden field) and content filter (with or without IPFS content).

    Returns Promise<undefined | PostStruct>

  • Find and load an array of information about post structs (can be Unlisted or Public, depending on filters) from the Subsocial blockchain and IPFS by a given array of post ids and filters object.

    Returns

    An array of information about post structs aggregated from the Subsocial blockchain and IPFS. If there are no post structs corresponding to the given post ids and filters object, an empty array is returned.

    Parameters

    • ids: AnyId[]

      An array of the post ids of the desired post structs.

    • Optional filters: Filters

      (Optional) An object containing a visibility filter (hidden field) and content filter (with or without IPFS content).

    Returns Promise<PostStruct[]>

  • Find and load information about a post with all of its details: extension (PostExtensionData), owner (SpaceData), and space (SpaceData). These methods are deprecated, because they are slow (although quite useful for UI).

    Parameters

    • id: AnyId

    Returns Promise<undefined | PostWithAllDetails>

  • Find and load information about a post with some of its details: extension (PostExtensionData), owner (SpaceData), and space (SpaceData). These methods are deprecated, because they are slow (although quite useful for UI).

    Parameters

    • query: FindPostQuery

    Returns Promise<undefined | PostWithSomeDetails>

  • Find and load an array of information about posts (can be Unlisted or Public, depending on filter object) from the Subsocial blockchain and IPFS by a given filter object.

    Returns

    An array of data about the desired posts aggregated from the Subsocial blockchain and IPFS. If there are no posts corresponding to the given filter object, an empty array is returned.

    Parameters

    • filter: FindPostsQuery

      An object containing the desired post ids, a visibility filter (hidden field), and a content filter (with or without IPFS content).

    Returns Promise<PostData[]>

  • Find and load an array of information about a post with all of its details: extension (PostExtensionData), owner (SpaceData), and space (SpaceData). These methods are deprecated, because they are slow (although quite useful for UI).

    Parameters

    • query: FindPostsQuery

    Returns Promise<PostWithAllDetails[]>

  • Find and load information about a profile space from the Subsocial blockchain and IPFS using an account id.

    A profile space is just a space set to a profile.

    Returns

    Data about the desired profile space aggregated from the Subsocial blockchain and IPFS. If there is space corresponding to the given account id, undefined is returned.

    Parameters

    • account: AnyAccountId

      An account id corresponding to a desired space profile.

    Returns Promise<undefined | SpaceData>

  • Find and load an array of information about profile spaces from Subsocial blockchain and IPFS by a given array of account ids accounts.

    A profile space is just a space set to a profile.

    Returns

    Find and load an array of information about the profile space of each accountId in the array from the Subsocial blockchain and IPFS.

    Parameters

    • accounts: AnyAccountId[]

      An array of the account ids related to the desired profile spaces

    Returns Promise<SpaceData[]>

  • Find and load an array of public posts from the Subsocial blockchain and IPFS by a given array of post ids.

    A post is considered public if it meets the following conditions:

    • The hidden field on its blockchain structure is false.
    • There is a corresponding JSON file that represents the space's content on IPFS.

    Returns

    An array of data about the desired posts aggregated from the Subsocial blockchain and IPFS. If there are no posts corresponding to the given array of ids, an empty array is returned.

    Parameters

    • ids: AnyId[]

      An array of the ids of the desired posts.

    Returns Promise<PostData[]>

  • Find and load an array of information about a public post with all of its details: extension (PostExtensionData), owner (SpaceData), and space (SpaceData). These methods are deprecated, because they are slow (although quite useful for UI).

    Parameters

    • ids: AnyId[]

    Returns Promise<PostWithAllDetails[]>

  • Find and load an array of information about a public post with some of its details: extension (PostExtensionData), owner (SpaceData), and space (SpaceData). These methods are deprecated, because they are slow (although quite useful for UI).

    Parameters

    • query: FindPostsWithDetailsQuery

    Returns Promise<PostWithSomeDetails[]>

  • Find and 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 the following conditions:

    • The hidden field on its blockchain structure is false.
    • There is a corresponding JSON file that represents the space's content on IPFS.

    Returns

    An array of data about the desired spaces aggregated from the Subsocial blockchain and IPFS. If there are no spaces corresponding to the given array of ids, an empty array is returned.

    Parameters

    • ids: AnyId[]

      An array of the ids of the desired spaces.

    Returns Promise<SpaceData[]>

  • Find and load data about a reaction from the Subsocial blockchain by a given id.

    Returns

    Data about the reaction consisting the reaction kind, creation, update metadata if any. If there is no reaction with given id, undefined is returned.

    Parameters

    • id: AnyId

      The desired reaction id

    Returns Promise<undefined | ReactionStruct>

  • Find and load an array of information about a reactions from the Subsocial blockchain from all the given id in ids array.

    Returns

    An array of data about desired reactions.

    Parameters

    • id: AnyId[]

    Returns Promise<ReactionStruct[]>

  • Find and load data about a space (can be Unlisted or Public, depending on filters set on query) from the Subsocial blockchain and IPFS by a given query object.

    Returns

    Data about a space aggregated from the Subsocial blockchain and IPFS. If there is no space corresponding to the given query object, undefined is returned.

    Parameters

    • query: FindSpaceQuery

      An object containing the desired space id, a visibility filter (hidden field), and a content filter (with or without IPFS content).

    Returns Promise<undefined | SpaceData>

  • Find and load information about space structs (can be Unlisted or Public, depending on filters) from the Subsocial blockchain and IPFS by a given space id and filters object.

    Returns

    Data about space structs aggregated from the Subsocial blockchain and IPFS. If there are no space structs corresponding to the given space id and filters object, undefined is returned.

    Parameters

    • id: AnyId

      The space id of the desired space structs.

    • Optional filters: Filters

      (Optional) An object containing a visibility filter (hidden field) and content filter (with or without IPFS content).

    Returns Promise<undefined | SpaceStruct>

  • Find and load an array of information about space structs (can be Unlisted or Public, depending on filters) from the Subsocial blockchain and IPFS by a given array of space ids and filters object.

    Returns

    An array of information about space structs aggregated from the Subsocial blockchain and IPFS. If there are no space structs corresponding to the given space ids and filters, an empty array is returned.

    Parameters

    • ids: AnyId[]

      An array of the space ids of the desired space structs.

    • Optional filters: Filters

      (Optional) An object containing a visibility filter (hidden field) and content filter (with or without IPFS content).

    Returns Promise<SpaceStruct[]>

  • Find and load an array of information about spaces (can be Unlisted or Public, depending on filter object) from the Subsocial blockchain and IPFS by a given filter object.

    Returns

    An array of data about desired spaces aggregated from the Subsocial blockchain and IPFS. If there are no spaces corresponding to the given filter object, undefined is returned.

    Parameters

    • filter: FindSpacesQuery

      An object containing the desired space ids, a visibility filter (hidden field), and a content filter (with or without IPFS content).

    Returns Promise<SpaceData[]>

  • Find and load an array of information about an unlisted post with all of its details: extension (PostExtensionData), owner (SpaceData), and space (SpaceData). These methods are deprecated, because they are slow (although quite useful for UI).

    Parameters

    • ids: AnyId[]

    Returns Promise<PostWithAllDetails[]>

  • 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.
    • There is no corresponding JSON file that represents the space's content on IPFS.

    Returns

    An array of data about the desired spaces aggregated from the Subsocial blockchain and IPFS. If there are no spaces corresponding to the given array of ids, an empty array is returned.

    Parameters

    • ids: AnyId[]

      An array of the ids of the desired spaces.

    Returns Promise<SpaceData[]>

  • Create an instance of subsocial api with given config and connected substrate node

    Parameters

    • __namedParameters: CreateSubsocialApiProps

    Returns Promise<SubsocialApi>