Created
February 2, 2021 22:40
-
-
Save eXponenta/2d30bac6c2c6520d46682b7c2734dee8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare namespace YaSDK { | |
interface InitOptions { | |
adv: { | |
onAdvClose: (wasShown: boolean) => void; | |
} | |
screen: { | |
fullscreen?: boolean; | |
orientation?: { | |
value: 'portrait' | 'landscape'; | |
lock?: boolean; | |
} | |
} | |
} | |
interface AdsRequest { | |
callbacks: { | |
onClose?: () => void; | |
onOpen?: () => void; | |
onError?: (e: Error) => void; | |
onRewarded?: () => void; | |
} | |
} | |
interface Player { | |
setData (data: Record<string, any>, flush?: boolean): Promise<void>; | |
getData <T = {}> (keys?: string[]): Promise<T>; | |
setStats (data: Record<string, number>): Promise<void>; | |
incrementStats (increments: Record<string, number>): Promise<Record<string, number>>; | |
getUniqueID (): string; | |
getIDsPerGame (): Promise<string[]>; | |
getName (): string; | |
getPhoto (size: 'small' | 'medium' | 'large'): string; | |
} | |
interface Purchase { | |
readonly productID: string; | |
readonly purchaseToken: string; | |
readonly developerPayload: string; | |
readonly signature: string; | |
} | |
interface Product { | |
readonly id: string; | |
readonly title : string; | |
readonly description : string; | |
readonly imageURI: string; | |
readonly price: string; | |
readonly priceCurrencyCode: string; | |
} | |
interface Payments { | |
purchase (payload: { id: string, developerPayload?: string }): Promise<Purchase>; | |
getPurchases (): Promise<Purchase[]>; | |
getCatalog (): Promise<Product[]>; | |
consumePurchase (purchaseToken: string): Promise<void>; | |
} | |
interface Api { | |
readonly adv: { | |
showFullscreenAdv (config: AdsRequest): void; | |
} | |
readonly auth: { | |
openAuthDialog (): Promise<void>; | |
} | |
getPlayer (options?: { scopes?: boolean, signed?: boolean }): Promise<Player>; | |
getPayments (options?: { scopes?: boolean, signed?: boolean }): Promise<Payments>; | |
} | |
interface YaGames { | |
init (payload: InitOptions): Promise<Api>; | |
} | |
} | |
declare interface Window { | |
YaGames: YaSDK.YaGames; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment