12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import { ApiPromise } from "@polkadot/api";
- import {
- CuratorGroup,
- CuratorGroupId,
- Channel,
- ChannelCategory,
- ChannelCategoryId,
- Video,
- VideoId,
- } from "@joystream/types/content";
- import { ChannelId } from "@joystream/types/storage";
- import { Hash } from "@polkadot/types/interfaces";
- export const getCuratorGroup = (
- api: ApiPromise,
- id: CuratorGroupId | number
- ): Promise<CuratorGroup> =>
- api.query.content.curatorGroupById(id) as Promise<CuratorGroup>;
- export const getChannel = (
- api: ApiPromise,
- id: ChannelId | number
- ): Promise<Channel> => api.query.content.channelById(id) as Promise<Channel>;
- export const getChannelCategory = (
- api: ApiPromise,
- id: ChannelCategoryId | number
- ): Promise<ChannelCategory> =>
- api.query.content.channelCategoryById(id) as Promise<ChannelCategory>;
- export const getVideo = (
- api: ApiPromise,
- id: VideoId | number
- ): Promise<Video> => api.query.content.videoById(id) as Promise<Video>;
- export const getVideoCategory = (
- api: ApiPromise,
- id: VideoId | number
- ): Promise<Video> => api.query.content.videoCategoryById(id) as Promise<Video>;
- export const getNextChannel = (
- api: ApiPromise,
- hash?: Hash
- ): Promise<ChannelId> =>
- hash
- ? (api.query.content.nextChannelId.at(hash) as Promise<ChannelId>)
- : (api.query.content.nextChannelId() as Promise<ChannelId>);
- export const getNextChannelCategory = (
- api: ApiPromise,
- hash?: Hash
- ): Promise<ChannelCategoryId> =>
- hash
- ? api.query.content.nextChannelCategoryId.at(hash)
- : (api.query.content.nextChannelCategoryId() as Promise<ChannelCategoryId>);
- export const getNextCuratorGroup = (
- api: ApiPromise,
- hash?: Hash
- ): Promise<CuratorGroupId> =>
- hash
- ? api.query.content.nextCuratorGroupId.at(hash)
- : (api.query.content.nextCuratorGroupId() as Promise<CuratorGroupId>);
- export const getNextPerson = (api: ApiPromise, hash?: Hash): Promise<number> =>
- hash
- ? api.query.content.nextPersonId.at(hash)
- : (api.query.content.nextPersonId() as any);
- export const getNextPlaylist = (
- api: ApiPromise,
- hash?: Hash
- ): Promise<number> =>
- hash
- ? api.query.content.nextPlaylistId.at(hash)
- : (api.query.content.nextPlaylistId() as any);
- export const getNextSeries = (api: ApiPromise, hash?: Hash): Promise<number> =>
- hash
- ? api.query.content.nextSeriesId.at(hash)
- : (api.query.content.nextSeriesId() as any);
- export const getNextVideo = (api: ApiPromise, hash?: Hash): Promise<number> =>
- hash
- ? api.query.content.nextVideoId.at(hash)
- : (api.query.content.nextVideoId() as any);
- export const getNextVideoCategory = (
- api: ApiPromise,
- hash?: Hash
- ): Promise<number> =>
- hash
- ? api.query.content.nextVideoCategoryId.at(hash)
- : (api.query.content.nextVideoCategoryId() as any);
|