react-playmakers
Version:
React wrapper providing utilities for PlayMakers integration
159 lines (158 loc) • 8.89 kB
TypeScript
import { AuthRequestProps } from "./api/Requests";
import { AssetPayloadType, AssetType, CategoryParentType, CategoryPostResponseType, CategoryType, CommentType, CreateQuest, CreateReward, NotificationType, PlayMakersConfig, ProjectConfigType, ProjectPayloadType, ProjectPushPayloadType, ProjectType, Quest, QuestType, QuestWithQuestType, Reward, RewardType, SchemaPayloadType, SchemaType, SelfUser, SubmissionType, UpdateQuest, UpdateReward, User, UserCreateParentResponse, UserLinkFederatedResponse, UserQuest, UserReward, UserUpdateAvatarResponse, VotePostResponseType } from "./types";
declare class Api {
baseUrl: string;
cacheExpiration: number;
uploadsUrl: string;
projectId: any;
twitterSignInUrl: string;
constructor(config: PlayMakersConfig);
call: <T = void>({ url, ...rest }: AuthRequestProps) => Promise<T>;
exports: string[];
extendSubmission: (submission: SubmissionType) => SubmissionType;
baristaRequest: ({ schema, submission }: any) => Promise<boolean>;
createAsset: (params: Partial<AssetPayloadType>) => Promise<AssetType>;
updateAsset: (assetId: string, params: Partial<AssetPayloadType>) => Promise<AssetType>;
updateAssetFile: (assetId: string, file: File) => Promise<AssetType>;
getAsset: (assetId: string) => Promise<AssetType>;
getGlobalAssets: (params: {
[key: string]: unknown;
}) => Promise<AssetType[]>;
getProjectAssets: (params: {
[key: string]: unknown;
}, projectId?: string) => Promise<AssetType[]>;
getSchemaAssets: (schemaId: string, params?: {
[key: string]: unknown;
}) => Promise<AssetType[]>;
deleteAsset: (assetId: string) => Promise<void>;
getCategories: (parentId?: string, projectId?: string, params?: {
[key: string]: unknown;
}) => Promise<CategoryType[]>;
getParentCategories: (categoryId: string) => Promise<CategoryParentType[]>;
createCategory: (name: string, parentId?: string, projectId?: string) => Promise<CategoryPostResponseType>;
deleteCategory: (categoryId: string) => Promise<void>;
renameCategory: (categoryId: string, name: string) => Promise<CategoryPostResponseType>;
getUserComments: (owner: string, params: {
[key: string]: unknown;
}) => Promise<CommentType[]>;
getSubmissionComments: (submissionId: string, params: {
[key: string]: unknown;
}) => Promise<CommentType[]>;
getComment: (id: string) => Promise<CommentType>;
createComment: (submissionId: string, body?: string, state?: string) => Promise<CommentType>;
updateComment: (id: string, body?: string, state?: string) => Promise<CommentType>;
deleteComment: (id: string) => Promise<void>;
getProjects: (params?: {
[key: string]: unknown;
}) => Promise<ProjectType[]>;
getProject: (projectId?: string) => Promise<ProjectType>;
createProject: (projectParams: ProjectPayloadType) => Promise<ProjectType>;
updateProject: (params: Partial<ProjectPushPayloadType>, projectId?: string) => Promise<ProjectType>;
updateProjectConfig: (config: Partial<ProjectConfigType>, projectId?: string) => Promise<void>;
updateProjectThumbnail: (file: File, projectId?: string) => Promise<ProjectType>;
createSchema: (params: SchemaPayloadType) => Promise<SchemaType>;
updateSchema: (schemaId: string, params: Partial<SchemaPayloadType>) => Promise<SchemaType>;
getSchemas: (projectId?: string, params?: {
[key: string]: unknown;
}) => Promise<SchemaType[]>;
getSchemasByCategory: (categoryId: string) => Promise<SchemaType[]>;
getSchema: (schemaId: string) => Promise<SchemaType>;
deleteSchema: (schemaId: string) => Promise<void>;
updateSchemaThumbnail: (schemaId: string, file: File) => Promise<SchemaType>;
createSubmission: (params?: {
[key: string]: unknown;
}, files?: File[]) => Promise<SubmissionType>;
updateSubmission: (submissionId: string, params?: {
[key: string]: unknown;
}, files?: File[]) => Promise<SubmissionType>;
getSubmission: (submissionId: string) => Promise<SubmissionType>;
deleteSubmission: (submissionId: string) => Promise<void>;
getSubmissions: (params?: {
[key: string]: unknown;
}) => Promise<SubmissionType[]>;
getSubmissionsBySchema: (schemaId: string) => Promise<SubmissionType[]>;
getSubmissionsByIds: (submissionIds: string[]) => Promise<SubmissionType[]>;
updateSubmissionsStates: (submissionIds: string[], state: string) => Promise<void>;
signUp: (email: string, username: string, password: string) => Promise<void>;
resendConfirmationCode: (email: string | null, username: string | null) => Promise<void>;
sendPasswordResetCode: (email: string) => Promise<void>;
passwordReset: (username: string, code: string, password: string) => Promise<void>;
signUpConfirmation: (username: string | null, code: string, email: string | null) => Promise<void>;
getMe: () => Promise<SelfUser>;
getUser: (userId: string) => Promise<User>;
getUserMetadata: (idToken: string) => Promise<any[]>;
getTokensFromTwitterToken: (accessToken: string, accessTokenSecret: string) => Promise<unknown>;
getCreators: () => Promise<User[]>;
updateAvatar: (file: File) => Promise<UserUpdateAvatarResponse>;
createUserParent: (username: string, provider: string) => Promise<UserCreateParentResponse>;
linkFederated: (accessToken: string, provider: string) => Promise<UserLinkFederatedResponse>;
unlinkFederated: (sourceUsername: string, provider: string) => Promise<SelfUser>;
vote: (submissionId: string, direction: string) => Promise<VotePostResponseType>;
downVote: (submissionId: string) => Promise<VotePostResponseType>;
upVote: (submissionId: string) => Promise<VotePostResponseType>;
cancelVote: (submissionId: string) => Promise<void>;
getVote: (submissionId: string) => Promise<number>;
voteBalance: (submissionId: string) => Promise<number>;
getNotifications: (params?: {
[key: string]: unknown;
}) => Promise<NotificationType[]>;
markAllNotificationsAsRead: () => Promise<void>;
updateNotification: (notificationId: string, params?: {
[key: string]: unknown;
}) => Promise<NotificationType>;
deleteNotification: (notificationId: string) => Promise<void>;
getTags: (projectId?: string, params?: {
[key: string]: unknown;
}) => Promise<string[]>;
redirectTwitterLogin: () => void;
getSteamProfile: () => Promise<unknown>;
getQuestType: (questTypeId: string) => Promise<QuestType>;
getQuestTypes: (params?: {
[key: string]: any;
}) => Promise<QuestType[]>;
getQuestTypeCategories: (params?: {
[key: string]: any;
}) => Promise<string[]>;
getQuest: (questId: string) => Promise<Quest>;
getQuests: (params: {
[key: string]: any;
}, projectId?: string) => Promise<QuestWithQuestType[]>;
getUserQuests: (params?: {
[key: string]: any;
}, projectId?: string) => Promise<UserQuest[]>;
completeQuest: (questId: string, creatorData?: Record<string, unknown>) => Promise<UserQuest>;
createQuest: (params: CreateQuest) => Promise<Quest>;
updateQuest: (questId: string, params: UpdateQuest) => Promise<Quest>;
deleteQuest: (questId: string) => Promise<void>;
getUserQuest: (userQuestId: string) => Promise<UserQuest>;
getUserQuestsByQuest: (params: {
[key: string]: any;
} | undefined, questId: string) => Promise<UserQuest[]>;
getUserQuestsByProject: (params?: {
[key: string]: any;
}, projectId?: string) => Promise<UserQuest[]>;
getRewardTypes: (params?: {
[key: string]: any;
}) => Promise<RewardType[]>;
getRewardType: (rewardTypeId: string) => Promise<RewardType>;
getRewardsByProject: (params: {
[key: string]: any;
}, projectId?: string) => Promise<Reward[]>;
getReward: (rewardId: string) => Promise<Reward>;
redeemReward: (rewardId: string) => Promise<UserReward>;
createReward: (reward: CreateReward) => Promise<Reward>;
updateReward: (rewardId: string, reward: UpdateReward) => Promise<Reward>;
deleteReward: (rewardId: string) => Promise<void>;
getUserRewards: (params?: {
[key: string]: any;
}) => Promise<UserReward[]>;
getUserRewardsByProject: (params?: {
[key: string]: any;
}, projectId?: string) => Promise<UserReward[]>;
getUserRewardsByReward: (rewardId: string, params?: {
[key: string]: any;
}) => Promise<UserReward[]>;
getUserReward: (userRewardId: string) => Promise<UserReward>;
updateUserRewardState: (userRewardId: string, state: string) => Promise<UserReward>;
}
export { Api };