FDK client for Kotlin language
Get started with the Kotlin Development SDK for Fynd Platform
- Add the dependency in your app build.gradle
implementation 'com.github.gofynd:fdk-client-kotlin:1.6.0'
in your app build.gradle - Add it in your root build.gradle at the end of repositories: allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
- Start integrating
var config: ApplicationConfig? = null
try {
config = ApplicationConfig(
applicationId = "YOUR_APPLICATION_ID",
applicationToken = "YOUR_APPLICATION_TOKEN"
)
} catch (e: Exception) {
print(e.message)
}
applicationConfig?.let { config ->
val applicationClient = ApplicationClient(config = config)
GlobalScope.launch {
applicationClient.catalog.getProductDetailBySlug(slug: "product-slug")
.safeAwait{ response,error ->
response?.let{
print(it.peekContent()?.name)
}
error?.let{
print(it.message)
}
}
}
var config: PlatformConfig? = null
try {
config = PlatformConfig(
companyId = "COMPANY_ID",
apiKey = "API_KEY",
apiSecret = "API_SECRET",
domain = "DOMAIN"
)
} catch (e: Exception) {
print(e.message)
}
platormConfig?.let { config ->
val platfromClient = PlatformClient(config = config)
GlobalScope.launch {
platformClient.catalog.getCompanyDetail()
.safeAwait{ response,error ->
response?.let{
print(it.peekContent()?.name)
}
error?.let{
print(it.message)
}
}
}