@oap75/types
Version:
JavaScript type definitions for Subsocial blockchain.
29 lines (28 loc) • 1.21 kB
TypeScript
import { Space, Post, Profile } from '../substrate/interfaces';
import { CommonContent, SpaceContent, PostContent, CommentContent, ProfileContent } from '../offchain';
import { CommonStruct } from '../common';
import { SocialAccountWithId } from '.';
export declare type CommonData<S extends CommonStruct, C extends CommonContent> = {
struct: S;
content?: C;
};
export declare type SpaceData = CommonData<Space, SpaceContent>;
export declare type PostData = CommonData<Post, PostContent>;
export declare type CommentData = CommonData<Post, CommentContent>;
export declare type ProfileData = CommonData<SocialAccountWithId, ProfileContent> & {
profile?: Profile;
};
export declare type AnySubsocialData = SpaceData | PostData | CommentData | ProfileData;
export declare type PostWithSomeDetails = {
post: PostData;
ext?: Exclude<PostWithSomeDetails, 'ext'>;
owner?: ProfileData;
space?: SpaceData;
};
export declare type PostWithOwner = Exclude<PostWithSomeDetails, 'owner'> & {
owner: ProfileData;
};
export declare type PostWithSpace = Exclude<PostWithSomeDetails, 'space'> & {
space: SpaceData;
};
export declare type PostWithAllDetails = PostWithOwner & PostWithSpace;