@oap75/api
Version:
JavaScript API for Subsocial blockchain.
131 lines (130 loc) • 7.5 kB
TypeScript
import { BasicSubsocialApi } from './basic';
import { PostWithSomeDetails, PostWithAllDetails } from '@subsocial/types/dto/sub';
import { FindPostsQuery, FindPostsWithDetailsQuery, FindPostWithDetailsQuery } from '../filters';
import { AnySpaceId, AnyPostId } from '@subsocial/types';
export declare class SubsocialApi extends BasicSubsocialApi {
private structFinders;
findAllSpaces(ids: AnySpaceId[]): Promise<import("@subsocial/types/dto/sub").SpaceData[]>;
/**
* Find and load an array of information about public spaces from Subsocial blockchain and IPFS by a given array of
* space `ids`.
*
* Space is considered public if it meets the next 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.
*
* @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.
*/
findPublicSpaces(ids: AnySpaceId[]): Promise<import("@subsocial/types/dto/sub").SpaceData[]>;
/**
* 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("@subsocial/types/dto/sub").SpaceData[]>;
findAllPosts(ids: AnySpaceId[]): Promise<import("@subsocial/types/dto/sub").PostData[]>;
/**
* Find and load an array of information about public posts from Subsocial blockchain and IPFS by a given array of
* post `ids`.
*
* Post is considered public if it meets the next conditions:
* - The `hidden` field on its' blockchain structure is `false`.
* - And there is a 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.
*/
findPublicPosts(ids: AnySpaceId[]): Promise<import("@subsocial/types/dto/sub").PostData[]>;
/**
* 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("@subsocial/types/dto/sub").PostData[]>;
/** Find and load posts with their extension and owner's profile (if defined). */
findPostsWithSomeDetails(filter: FindPostsWithDetailsQuery): Promise<PostWithSomeDetails[]>;
findPublicPostsWithSomeDetails(filter: FindPostsWithDetailsQuery): Promise<PostWithSomeDetails[]>;
findUnlistedPostsWithSomeDetails(filter: FindPostsWithDetailsQuery): Promise<PostWithSomeDetails[]>;
findPostsWithAllDetails({ ids, visibility }: FindPostsQuery): Promise<PostWithAllDetails[]>;
findPublicPostsWithAllDetails(ids: AnyPostId[]): Promise<PostWithAllDetails[]>;
findUnlistedPostsWithAllDetails(ids: AnyPostId[]): Promise<PostWithAllDetails[]>;
/**
* 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("@subsocial/types/dto/sub").SpaceData | 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("@subsocial/types/dto/sub").SpaceData | 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("@subsocial/types/dto/sub").PostData | 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("@subsocial/types/dto/sub").PostData | undefined>;
findPostWithSomeDetails({ id, ...opts }: FindPostWithDetailsQuery): Promise<PostWithSomeDetails | undefined>;
findPublicPostWithSomeDetails({ id, ...opts }: FindPostWithDetailsQuery): Promise<PostWithSomeDetails | undefined>;
findUnlistedPostWithSomeDetails({ id, ...opts }: FindPostWithDetailsQuery): Promise<PostWithSomeDetails | undefined>;
findPostWithAllDetails(id: AnyPostId): Promise<PostWithAllDetails | undefined>;
findPublicPostWithAllDetails(id: AnyPostId): Promise<PostWithAllDetails | undefined>;
findUnlistedPostWithAllDetails(id: AnyPostId): Promise<PostWithAllDetails | undefined>;
}