Yes2SDK API Reference

Welcome to the Yes2SDK API reference. This is the single source of truth for the SDK surface: every public function across the three SDK surfaces (Core in TypeScript/JavaScript, Unity in C#, and Defold in Lua), with, for each function, a clear view of how it behaves on every platform.

Start here for the support matrix and the status legend, then open any module page for full signatures and per-platform detail.


How the SDK is accessed

SurfaceImport / accessAsync style
Core (TS/JS)import Yes2SDK from '@yes2sdk/core' → singleton. Modules via getters: Yes2SDK.ads, Yes2SDK.player, …Promise / async; resolves with results, rejects with a structured ErrorMessage
Unity (C#)using Yes2SDK; → static class. Modules via static props: Yes2SDK.Ads, Yes2SDK.Player, …Callback overloads and Task + CancellationToken overloads (Task surfaces failures as Yes2SDKException)
Defold (Lua)local yes2sdk = require "yes2sdk.yes2sdk" → flat module. Functions are prefixed: yes2sdk.ads_show_interstitial(...), yes2sdk.data_get_int(...)Last-argument callbacks (self, success, payload)

All three bundle the same Core SDK and select the host platform automatically at runtime. Each platform adapter loads only that platform's own SDK from its CDN. Write your game once; it runs everywhere Yes2SDK ships.


Status legend

Each function is rated per platform so you always know what to expect:

StatusMeaning
ReadyFully integrated with the platform's own SDK.
PartialWorks today, with a sensible fallback or platform-specific scope (e.g. local storage, a browser-derived value).
NoneNot offered by this platform. The call stays safe: it returns a clear FeatureNotSupported result or a no-op default, so a single codebase runs cleanly everywhere.

Optional features degrade gracefully: guard them with isSupported() / IsSupported() and your integration behaves correctly on every platform, with zero special-casing required.

Growing fast. A few more modules are already built into Core and on the rollout path. See Upcoming modules below.


Module pages

These modules are available today via Yes2SDK.<module> (Core), Yes2SDK.<Module> (Unity), and yes2sdk.<module>_* (Defold).

ModulePageWhat it does
Lifecycle & eventslifecycle.mdInit, loading progress, start, pause/resume, audio
Adsads.mdInterstitial, rewarded, banner
Analyticsanalytics.mdGameplay events, level/score/tutorial/purchase logging
Sessionsession.mdLocale, country, device, orientation, traffic source
Datadata.mdTyped key-value storage (PlayerPrefs-style): the default for saved game state
Playerplayer.mdIdentity, account-bound saved data, connected players
Authauth.mdSign-in, tokens, account linking
Gamegame.mdGameplay lifecycle, invite links, settings, clipboard
Bannersbanners.mdPositioned display banners (distinct from ads banner)
Friendsfriends.mdPaginated friends list
Scorescore.mdScore submission (incl. encrypted)
Leaderboardleaderboard.mdNamed leaderboards: submit scores, read ranked entries
Statsstats.mdNumeric player statistics (get / set / increment)
IAPiap.mdIn-app purchases: catalog, purchase, consume, subscriptions
Configconfig.mdRemote configuration / feature flags
Reviewreview.mdIn-game rating / feedback prompt
Errorserrors.mdError model, ErrorCode, exceptions

Platform support matrix

A module-level summary across the five live platforms. Per-method detail is on each module page.

ModulePokiGameDistributionCrazyGamesYandexYouTube
Ads: interstitial & rewardedReadyReadyReadyReadyReady
Ads: bannerNoneNoneReadyReadyNone
AnalyticsPartial¹Partial¹Partial¹Partial¹Partial¹
SessionPartialPartialReadyReadyPartial
DataPartial²Partial²ReadyReadyReady
Player: identityNoneNonePartialReadyNone
Player: saved dataPartial²Partial²ReadyReadyReady
AuthNoneNoneReady³Ready³None
Game: lifecycleReadyPartial⁴ReadyReadyPartial⁴
Game: invite linksReadyNoneReadyNoneNone
BannersNoneNoneReadyReady⁵None
FriendsNoneNoneReadyNoneNone
ScoreNone⁶None⁶ReadyNone⁶Ready
LeaderboardNoneNoneNoneReadyNone
StatsNoneNoneNoneReadyNone
IAPNoneNoneNoneReady⁷None
Config: feature flagsPartial⁸Partial⁸Partial⁸ReadyPartial⁸
Review: rating promptNoneNoneNoneReadyNone

¹ Custom analytics events are recorded locally; the gameplay-lifecycle calls (logLevelStart/logLevelEnd) drive each platform's real gameplayStart/gameplayStop. On YouTube, error/warning reporting also flows to the platform's health channel. ² Poki & GameDistribution don't expose a storage API, so Data and Player saved-data persist via namespaced localStorage (device-local). Player identity stays anonymous on these platforms. ³ Auth is available; platform sign-out isn't offered, and account-linking is CrazyGames-only. ⁴ GameDistribution and YouTube track gameplay via internal state. YouTube drives the real lifecycle through firstFrameReady/gameReady. ⁵ Yandex presents a single sticky banner; placement and size are managed for you, and refresh re-displays it. ⁶ Score submission isn't offered by these platforms; calls are recorded locally and are safe to keep in your code. ⁷ Yandex IAP covers products and purchases; subscriptions are not offered yet (isSubscriptionSupported() is false on every platform). ⁸ Config has no remote-config service on these platforms, so getFlagsAsync returns your provided defaults unchanged. Always safe to call. Only Yandex serves remote overrides (isSupported() is true there only).


Upcoming modules

A few more modules are already implemented in Core and on the rollout path. You can design against their API surface today and adopt them as platform support lands:

Achievements · Context · Notifications · Tournament

Full signatures and the rollout picture are in upcoming.md. These map directly to Facebook Instant Games capabilities on the platform roadmap (context, tournaments, notifications), so they're a natural next step.

Module availability by surface

ModuleCoreUnityDefold
Ads · Analytics · Session · Data · Player · Auth · Game · Banners · Friends · Score · Leaderboard · Stats · IAP · Config · ReviewAvailableAvailableComing soon¹⁰
Achievements · Context · Notifications · TournamentBuilt in (Core)Coming soonComing soon
  • Core ships all module implementations; the live set above is wired to the Yes2SDK.<module> API today (including iap, leaderboard, stats, config, review, plus achievements, tournament, context, notifications on the surface), with full platform coverage landing as adapters do.
  • Unity exposes all accessors; the upcoming modules return a clean FeatureNotSupported until their bridges ship.
  • Defold ships the original 10 available modules today, with the newer ones on the roadmap.

¹⁰ Leaderboard / Stats / IAP / Config / Review are live in Core (and on Yandex) today; the Unity and Defold surface bindings are arriving with the platform rollout.


Versions

SDKVersionNotes
Core (TS)see Experimental/Core/package.jsonUMD bundle, injected by the dashboard build pipeline
Unity2.5.0Unity 2021.3+; WebGL build target
Defold1.5.1Defold 1.6+; HTML5 build target

Live platforms across all surfaces: Poki, CrazyGames, Yandex Games, GameDistribution, YouTube Playables.

Pitch your game