biketag
Version:
The Javascript client API for BikeTag Games
49 lines (48 loc) • 4.14 kB
TypeScript
import { ImgurImage } from '../common/types';
import { Game, Player, Tag } from '../common/schema';
import { default as TinyCache } from 'tinycache';
export interface ImgurUploadPayload {
imageHash: string;
type?: string;
image?: string | Blob;
title: string;
description: string;
hash?: string;
album?: string;
}
export type uploadTagImagePayload = Partial<Tag> & Partial<ImgurUploadPayload>;
export type queueTagImagePayload = Partial<Tag> & Partial<ImgurUploadPayload> & {
queuehash: string;
};
export declare function sortImgurImagesByUploadDate(images: ImgurImage[], newestFirst: boolean): ImgurImage[];
export declare function getTagNumbersFromText(inputText: string, fallback?: number[] | null, cache?: typeof TinyCache): number[];
export declare function getPlayerDataFromText(inputText: string, cache?: typeof TinyCache): Partial<Player> | undefined;
export declare function getGameSlugFromText(inputText: string, cache?: typeof TinyCache): string | undefined;
export declare function getGameDataFromText(inputText: string, cache?: typeof TinyCache): Partial<Game> | undefined;
export declare function getPlayerFromText(inputText: string, fallback?: string, cache?: typeof TinyCache): string | null;
export declare function getPlayerIdFromText(inputText: string, fallback?: string, cache?: typeof TinyCache): string;
export declare function getDiscussionUrlFromText(inputText: string, fallback?: string, cache?: typeof TinyCache): string;
export declare function getFoundLocationFromText(inputText: string, fallback?: string, cache?: typeof TinyCache): string;
export declare function getConfirmedBoundaryFromText(inputText: string, fallback?: string, cache?: typeof TinyCache): string;
export declare function getTimeFromText(inputText: string, fallback?: number, cache?: typeof TinyCache): number;
export declare function getHintFromText(inputText: string, fallback?: string | null, cache?: typeof TinyCache): string | null;
export declare function getBikeTagNumberFromImage(image: ImgurImage, cache?: typeof TinyCache): number;
export declare function isPlayerImage(image: ImgurImage): boolean;
export declare function isMysteryImage(image: ImgurImage): boolean;
export declare function isFoundImage(image: ImgurImage): boolean;
export declare function sortImgurImagesByTagNumber(images?: ImgurImage[], cache?: typeof TinyCache): ImgurImage[];
export declare function getImgurLinksFromText(inputText: string, fallback?: string[] | null, cache?: typeof TinyCache): string[];
export declare function getBikeTagFromImgurImageSet(mysteryImage?: ImgurImage, foundImage?: ImgurImage, opts?: any): Tag;
export declare const getBikeTagUsernameFromImgurImage: (image: ImgurImage, cache?: typeof TinyCache) => string;
export declare const getBikeTagDiscussionLinkFromImgurImage: (image: ImgurImage) => string | null;
export declare const getBikeTagNumberFromImgurImage: (image: ImgurImage, cache?: typeof TinyCache) => number;
export declare const getBikeTagNumberIndexFromImgurImages: (images?: ImgurImage[], tagNumber?: number, found?: boolean) => number;
export declare const getImageHashFromImgurImage: (image: Partial<ImgurImage>, cache?: typeof TinyCache) => string;
export declare const isValidUpdatePayload: (utp: uploadTagImagePayload) => boolean;
export declare const isValidUploadTagImagePayload: (utp: uploadTagImagePayload) => boolean;
export declare const getUpdateTagPayloadFromTagData: (payload: uploadTagImagePayload, mystery?: boolean, combined?: boolean) => uploadTagImagePayload;
export declare function getQueueTagImagePayloadFromTagData(tagData: queueTagImagePayload, mystery?: boolean): uploadTagImagePayload;
export declare function getUploadTagImagePayloadFromTagData(tagData: uploadTagImagePayload, mystery?: boolean): uploadTagImagePayload;
export declare const getGroupedImagesByTagnumber: (ungroupedImages?: any[], cache?: typeof TinyCache) => any[];
export declare const getGroupedTagsByTagnumber: (groupedImages?: ImgurImage[][], appendToTagData?: {}) => any[];
export declare const getGroupedTagsByPlayer: (groupedImages?: ImgurImage[][], appendToTagData?: {}) => any[];