io.contentchef.callback.common.CallbackContentChef.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of contentchef-jvm-callback-common Show documentation
Show all versions of contentchef-jvm-callback-common Show documentation
ContentChef's JVM callback common SDK stuff - https://www.contentchef.io
package io.contentchef.callback.common
import io.contentchef.common.configuration.ContentChefEnvironment
import io.contentchef.common.configuration.ContentChefEnvironmentConfiguration
import io.contentchef.common.network.RequestFactory
/**
* Exposes methods used to retrieve contents from ContentChef's backend
*/
internal class CallbackContentChef constructor(
private val contentChefEnvironmentConfiguration: ContentChefEnvironmentConfiguration,
private val requestFactory: RequestFactory,
private val requestExecutor: RequestExecutor
) : ContentChef {
override fun getPreviewChannel(
previewApiKey: String,
publishingChannel: String
): PreviewChannel {
return AbstractChannel(
contentChefEnvironmentConfiguration.generateWebserviceURL(
ContentChefEnvironmentConfiguration.Companion.WebService.PREVIEW_CONTENT,
publishingChannel
),
contentChefEnvironmentConfiguration.generateWebserviceURL(
ContentChefEnvironmentConfiguration.Companion.WebService.PREVIEW_SEARCH,
publishingChannel
),
previewApiKey,
requestFactory,
requestExecutor
)
}
override fun getOnlineChannel(onlineApiKey: String, publishingChannel: String): OnlineChannel {
require(contentChefEnvironmentConfiguration.contentChefEnvironment == ContentChefEnvironment.LIVE) {
"Online channel can only be used with LIVE environment setup"
}
return AbstractChannel(
contentChefEnvironmentConfiguration.generateWebserviceURL(
ContentChefEnvironmentConfiguration.Companion.WebService.ONLINE_CONTENT,
publishingChannel
),
contentChefEnvironmentConfiguration.generateWebserviceURL(
ContentChefEnvironmentConfiguration.Companion.WebService.ONLINE_SEARCH,
publishingChannel
),
onlineApiKey,
requestFactory,
requestExecutor
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy