StoryblokClientImpl

class StoryblokClientImpl(apiBuilder: Api.Config.Content.() -> Unit, serializersModuleBuilder: SerializersModuleBuilder.() -> Unit, jsonBuilder: JsonBuilder.() -> Unit, val json: Json = Json { isLenient = true decodeEnumsCaseInsensitive = true classDiscriminator = "component" serializersModule = SerializersModule { polymorphic(Component::class) { defaultDeserializer { serializer<Component.Unknown>() } } serializersModuleBuilder() } jsonBuilder() // Applied after jsonBuilder so it cannot be turned off: the schema classes name their fields with // @JsonNames, which is only honoured while alternative names are enabled. useAlternativeNames = true }, val http: HttpClient = HttpClient { configureStoryblok(json, apiBuilder) }) : StoryblokClient(source)

Default StoryblokClient implementation. Create clients through the StoryblokClient factory functions instead of instantiating this class directly.

Constructors

Link copied to clipboard
constructor(apiBuilder: Api.Config.Content.() -> Unit, serializersModuleBuilder: SerializersModuleBuilder.() -> Unit, jsonBuilder: JsonBuilder.() -> Unit, json: Json = Json { isLenient = true decodeEnumsCaseInsensitive = true classDiscriminator = "component" serializersModule = SerializersModule { polymorphic(Component::class) { defaultDeserializer { serializer<Component.Unknown>() } } serializersModuleBuilder() } jsonBuilder() // Applied after jsonBuilder so it cannot be turned off: the schema classes name their fields with // @JsonNames, which is only honoured while alternative names are enabled. useAlternativeNames = true }, http: HttpClient = HttpClient { configureStoryblok(json, apiBuilder) })

Properties

Link copied to clipboard
open override val http: HttpClient

The underlying Ktor HTTP client.

Link copied to clipboard
val json: Json
Link copied to clipboard

Relation fields per component, mapping each field name to whether its Story type is nullable (for list relations, whether the list's element type is nullable).

Functions

Link copied to clipboard
open override fun close()

Closes the underlying HTTP client and releases resources.

Link copied to clipboard
open override fun stories(config: PagingConfig = PagingConfig(pageSize = 25), resolveLevel: Int = 1, query: StoriesQuery<Component>.() -> Unit = {}): Pager<Int, Story<Component>>

Retrieves multiple stories as a PagingData stream.

open override fun <T : Component> stories(config: PagingConfig, typeInfo: TypeInfo, resolveLevel: Int = 1, query: StoriesQuery<T>.() -> Unit = {}): Pager<Int, Story<T>>

Retrieves multiple stories as a PagingData stream with explicit type information for the Component type.

Link copied to clipboard
inline fun <T : Component> StoryblokClient.stories(config: PagingConfig = PagingConfig(pageSize = 25), resolveLevel: Int = 1, noinline query: StoriesQuery<T>.() -> Unit = {}): Pager<Int, Story<T>>

Retrieves multiple stories as a PagingData stream, using reified type information for the Component type.

Link copied to clipboard
open override fun story(slug: String, resolveLevel: Int = 1, query: StoryQuery<Component>.() -> Unit = {}): Flow<Story<Component>>

Retrieves a Story by its slug.

open override fun story(uuid: Uuid, resolveLevel: Int = 1, query: StoryQuery<Component>.() -> Unit = {}): Flow<Story<Component>>

Retrieves a Story by its UUID.

open override fun <T : Component> story(slug: String, typeInfo: TypeInfo, resolveLevel: Int = 1, query: StoryQuery<T>.() -> Unit = {}): Flow<Story<T>>

Retrieves a Story by its slug with explicit type information for the Component type.

open override fun <T : Component> story(uuid: Uuid, typeInfo: TypeInfo, resolveLevel: Int = 1, query: StoryQuery<T>.() -> Unit = {}): Flow<Story<T>>

Retrieves a Story by its UUID with explicit type information for the Component type.

Link copied to clipboard
inline fun <T : Component> StoryblokClient.story(slug: String, resolveLevel: Int = 1, noinline query: StoryQuery<T>.() -> Unit = {}): Flow<Story<T>>

Retrieves a Story by its slug using reified type information for the Component type.

inline fun <T : Component> StoryblokClient.story(uuid: Uuid, resolveLevel: Int = 1, noinline query: StoryQuery<T>.() -> Unit = {}): Flow<Story<T>>

Retrieves a Story by its UUID using reified type information for the Component type.