openblox
Version:
Roblox API Wrapper For Both Classic And OpenCloud APIs.
24 lines (23 loc) • 2.72 kB
TypeScript
import { Identifier, NumberIsLiteral, StringIsLiteral, UnionPrettify } from "typeforge";
import type { DeepLinkAppsFlyerFormat, DeepLinkRobloxProtocolFormat, DeepLinkRobloxUrlFormat } from "./deepLinkHelpers.types";
type ObjectIsLiteral<Obj extends Record<any, any>> = ({
[Key in keyof Obj]: false;
})["constructor"] extends false ? false : true;
type StringIsEmpty<T> = T extends string ? T extends "" ? true : false : false;
type IsLiteral<T extends unknown> = T extends number ? NumberIsLiteral<T> : T extends string ? StringIsLiteral<T> : T extends Record<any, any> ? ObjectIsLiteral<T> : false;
type DeepLinkFormat = UnionPrettify<"AppsFlyer" | "RobloxProtocol" | "RobloxUrl">;
type DeepLink<PlaceId extends Identifier, HasLaunchData extends boolean, Format extends DeepLinkFormat> = (Format extends "AppsFlyer" ? DeepLinkAppsFlyerFormat<PlaceId, HasLaunchData> : Format extends "RobloxProtocol" ? DeepLinkRobloxProtocolFormat<PlaceId, HasLaunchData> : DeepLinkRobloxUrlFormat<PlaceId, HasLaunchData>);
type DeepLinkReturns<PlaceId extends Identifier, HasLaunchData extends boolean, Format extends DeepLinkFormat> = Format extends "AppsFlyer" ? DeepLinkAppsFlyerFormat<PlaceId, HasLaunchData> & DeepLinkMethods<PlaceId, HasLaunchData, Format> : Format extends "RobloxProtocol" ? DeepLinkRobloxProtocolFormat<PlaceId, HasLaunchData> & DeepLinkMethods<PlaceId, HasLaunchData, Format> : DeepLinkRobloxUrlFormat<PlaceId, HasLaunchData> & DeepLinkMethods<PlaceId, HasLaunchData, Format>;
type DeepLinkMethods<PlaceId extends Identifier, HasLaunchData extends boolean, Format extends DeepLinkFormat> = {
setLaunchData: <LaunchData extends Record<any, any> | undefined | string>(launchData: LaunchData) => DeepLinkReturns<PlaceId, (LaunchData extends undefined ? false : StringIsEmpty<LaunchData> extends true ? false : IsLiteral<LaunchData>), Format>;
toAppsFlyerFormat: () => DeepLinkAppsFlyerFormat<PlaceId, HasLaunchData> & DeepLinkMethods<PlaceId, HasLaunchData, "AppsFlyer">;
toRobloxProtocolFormat: () => DeepLinkRobloxProtocolFormat<PlaceId, HasLaunchData> & DeepLinkMethods<PlaceId, HasLaunchData, "RobloxProtocol">;
toRobloxUrlFormat: () => DeepLinkRobloxUrlFormat<PlaceId, HasLaunchData> & DeepLinkMethods<PlaceId, HasLaunchData, "RobloxUrl">;
"🔒__PRIVATE_SELF": DeepLink<PlaceId, HasLaunchData, Format>;
};
export declare const deepLinkCreate: <PlaceId extends Identifier, LaunchData extends string | Record<any, any>, Format extends "AppsFlyer" | "RobloxProtocol" | "RobloxUrl">({ placeId, launchData, format }: {
placeId: PlaceId;
launchData?: LaunchData | undefined;
format?: Format | undefined;
}) => DeepLinkReturns<PlaceId, IsLiteral<LaunchData>, Format>;
export {};