@subsocial/api
Version:
JavaScript API for Subsocial blockchain.
162 lines (161 loc) • 9.12 kB
TypeScript
import { InnerSubsocialApi } from './inner';
import { RawPostWithSomeDetails, RawPostWithAllDetails, AnySpaceId, AnyPostId, AnyAccountId } from '../types';
import { FindPostsQuery, FindPostsWithDetailsQuery, FindPostWithDetailsQuery } from '../filters';
export declare class BasicSubsocialApi extends InnerSubsocialApi {
private structFinders;
/**
* Find and load an array of information about spaces (both for Unlisted and Public spaces) from the Subsocial blockchain and IPFS by a given array of
* space `ids`.
*
* @param ids - An array of the ids of the desired spaces.
*
* @returns An array of data about 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.
*/
findAllSpaces(ids: AnySpaceId[]): Promise<import("../types").RawSpaceData[]>;
/**
* Find and load an array of information about public spaces from 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.
*
* @param ids - An array of the ids of the desired spaces.
*
* @returns An array of data about desired spaces aggregated from Subsocial blockchain and IPFS. If no corresponding
* spaces to given array of `ids`, an empty array is returned.
*/
findPublicSpaces(ids: AnySpaceId[]): Promise<import("../types").RawSpaceData[]>;
/**
* Find and load an array of information about unlisted spaces from Subsocial blockchain and IPFS by a given array of
* space `ids`.
*
* Space 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 space's content on IPFS.
*
* @param ids - An array of ids of desired spaces.
*
* @returns An array of data about desired spaces aggregated from Subsocial blockchain and IPFS. If no corresponding
* spaces to given array of `ids`, an empty array is returned.
*/
findUnlistedSpaces(ids: AnySpaceId[]): Promise<import("../types").RawSpaceData[]>;
/**
* Find and load an array of information about posts (both Unlisted and Public posts) from the Subsocial blockchain and IPFS by a given array of
* post `ids`.
*
*
* @param ids - An array of the ids of the desired posts.
*
* @returns An array of data about 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.
*/
findAllPosts(ids: AnySpaceId[]): Promise<import("../types").RawPostData[]>;
/**
* Find and load an array of information about public posts from 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 post's content on IPFS.
*
* @param ids - An array of the ids of the desired posts.
*
* @returns An array of data about desired posts aggregated from Subsocial blockchain and IPFS. If no corresponding
* posts to given array of `ids`, an empty array is returned.
*/
findPublicPosts(ids: AnySpaceId[]): Promise<import("../types").RawPostData[]>;
/**
* Find and load an array of information about unlisted posts from Subsocial blockchain and IPFS by a given array of
* post `ids`.
*
* 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.
*
* @param ids - An array of ids of desired posts
*
* @returns An array of data about desired posts aggregated from Subsocial blockchain and IPFS. If no corresponding
* posts to given array of `ids`, an empty array is returned.
*/
findUnlistedPosts(ids: AnySpaceId[]): Promise<import("../types").RawPostData[]>;
/** Find and load posts with their extension and owner's profile (if defined). */
findPostsWithSomeDetails(filter: FindPostsWithDetailsQuery): Promise<RawPostWithSomeDetails[]>;
findPublicPostsWithSomeDetails(filter: FindPostsWithDetailsQuery): Promise<RawPostWithSomeDetails[]>;
findUnlistedPostsWithSomeDetails(filter: FindPostsWithDetailsQuery): Promise<RawPostWithSomeDetails[]>;
findPostsWithAllDetails({ ids, visibility }: FindPostsQuery): Promise<RawPostWithAllDetails[]>;
findPublicPostsWithAllDetails(ids: AnyPostId[]): Promise<RawPostWithAllDetails[]>;
findUnlistedPostsWithAllDetails(ids: AnyPostId[]): Promise<RawPostWithAllDetails[]>;
/**
* Find and load an array of information about profile spaces from the Subsocial blockchain and IPFS by a given array of
* account ids `accountsIds`.
*
* A profile space is just a space set to a profile.
*
* @param accountsIds - An array of the account ids related to the desired profile spaces
*
* @returns An array of data about desired profile spaces aggregated from the Subsocial blockchain and IPFS. If there are no
* profile spaces corresponding to the given array of `spaceIds`, an empty array is returned.
*/
findProfileSpaces(accountIds: AnyAccountId[]): Promise<import("../types").RawSpaceData[]>;
/**
* Find and load information about a public space from Subsocial blockchain and IPFS using space id.
*
* Space is considered public if it meets these conditions:
* - The `hidden` field on it's blockchain structure is `false`.
* - And there is a corresponding JSON file that represents the space's content on IPFS.
*
* @param id - Id of desired space.
*
* @returns Data about desired space aggregated from blockchain and IPFS. If no corresponding space to given id,
* `undefined` is returned.
*/
findPublicSpace(id: AnySpaceId): Promise<import("../types").RawSpaceData | undefined>;
/**
* Find and load information about an unlisted space from blockchain and from IPFS by a given space id.
*
* Space 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 space's content on IPFS.
*
* @param id - Id of desired space.
*
* @returns Data about a desired space aggregated from blockchain and IPFS. If no corresponding space to given id,
* `undefined` is returned.
*/
findUnlistedSpace(id: AnySpaceId): Promise<import("../types").RawSpaceData | undefined>;
/**
* Find and load information about a public post from Subsocial blockchain and IPFS using post id.
*
* Post is considered public if it meets the next conditions:
* - The `hidden` field on it's blockchain structure is `false`.
* - And there is a corresponding JSON file that represents the post's content on IPFS.
*
* @param id - Id of desired post.
*
* @returns Data about desired post aggregated from blockchain and IPFS. If no corresponding post to given id,
* `undefined` is returned.
*/
findPublicPost(id: AnySpaceId): Promise<import("../types").RawPostData | undefined>;
/**
* Find and load information about an unlisted post from blockchain and from IPFS by a given post id.
*
* 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.
*
* @param id - Id of desired post.
*
* @returns Data about desired post aggregated from blockchain and IPFS. If no corresponding post to given id,
* `undefined` is returned.
*/
findUnlistedPost(id: AnySpaceId): Promise<import("../types").RawPostData | undefined>;
findPostWithSomeDetails({ id, ...opts }: FindPostWithDetailsQuery): Promise<RawPostWithSomeDetails | undefined>;
findPublicPostWithSomeDetails({ id, ...opts }: FindPostWithDetailsQuery): Promise<RawPostWithSomeDetails | undefined>;
findUnlistedPostWithSomeDetails({ id, ...opts }: FindPostWithDetailsQuery): Promise<RawPostWithSomeDetails | undefined>;
findPostWithAllDetails(id: AnyPostId): Promise<RawPostWithAllDetails | undefined>;
findPublicPostWithAllDetails(id: AnyPostId): Promise<RawPostWithAllDetails | undefined>;
findUnlistedPostWithAllDetails(id: AnyPostId): Promise<RawPostWithAllDetails | undefined>;
findProfileSpace(accountId: AnyAccountId): Promise<import("../types").RawSpaceData | undefined>;
}