Aller au contenu principal
Version: 1.1.0

🔑 Point d'entrée SDK (initialize et connect)

Le SDK Azeoo s'utilise via AzeooSDK : appelez initialize une fois, puis connectUser lorsque l'utilisateur est authentifié.

Import depuis com.azeoo.sdk.core.*.

initialize

fun initialize(
context: Context,
apiKey: String,
environment: String = "production",
config: AzeooConfig? = null,
theme: AzeooThemeConfig? = null,
deepLinks: AzeooDeepLinkConfig? = null,
safeArea: AzeooSafeAreaConfig? = null,
connector: AzeooConnectorConfig? = null,
callback: (error: Exception?) -> Unit
)

Démarre le moteur Flutter, attend la disponibilité Dart, valide la clé API côté serveur, puis appelle callback.

Paramètres :

  • context — Contexte application
  • apiKey — Votre clé API SDK Azeoo
  • environment"production" ou "staging" (optionnel)
  • config — Optionnel : locale, analyticsEnabled, offlineEnabled, connectionTimeoutSeconds
  • theme — Couleurs optionnelles (primary/secondary light/dark, etc.)
  • deepLinks — Scheme/host/pathPrefix optionnels
  • safeArea — Insets optionnels (top, bottom, left, right)
  • connector — Config connecteur optionnelle — voir Connecteurs
  • callbacknull en cas de succès, Exception en cas d'échec
Utilisez initialize, pas init

Utilisez toujours initialize et attendez le callback avant connectUser.

shared

val shared: AzeooSDK

Instance singleton. Lève une exception si initialize n'a pas réussi.

connectUser

fun connectUser(
token: String,
gender: String,
height: AzeooHeight,
weight: AzeooWeight,
callback: (user: AzeooUserProfile?, error: Exception?) -> Unit
)

Authentifie l'utilisateur. Obligatoire avant les modules ou l'API user.

Paramètres :

  • token — JWT utilisateur depuis votre backend
  • gender — Genre de l'utilisateur
  • height — Objet AzeooHeight
  • weight — Objet AzeooWeight
  • callback — Profil en succès (profile.id = id Azeoo), erreur sinon
Ne pas passer userId

L'id utilisateur est dans le JWT et renvoyé dans profile.id. Ne passez pas de userId séparé.

onReady

fun onReady(callback: (Result<Unit>) -> Unit)

Callback appelé quand l'initialisation est terminée. Exécution immédiate si déjà initialisé.

isReady / isInitialized

val isReady: Boolean
val isInitialized: Boolean
val isUserConnected: Boolean

isReady — Côté Flutter prêt et pas d'erreur d'initialisation.

setClubId

fun setClubId(clubId: Long, callback: (error: Exception?) -> Unit)

Change le club actif pour un connecteur azeoo. Rééchange les jetons SDK et préserve la session.

disconnect

fun disconnect(callback: (error: Exception?) -> Unit)

Déconnecte l'utilisateur. Le SDK reste initialisé ; vous pouvez rappeler connectUser.

dispose

fun dispose()

Libère les ressources. Rappelez initialize pour redémarrer.

listener

var listener: AzeooSDKListener?

Listener optionnel pour les événements Flutter → natif. Voir Événements.