Skip to content

Commit

Permalink
feat: refactor setMetadata for SpaceContext
Browse files Browse the repository at this point in the history
  • Loading branch information
d1snin committed Oct 23, 2023
1 parent e45bfd5 commit 27131fe
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package dev.d1s.beam.client.app.state

import dev.d1s.beam.client.BeamClient
import dev.d1s.beam.client.MetadataBuilder
import dev.d1s.beam.client.SpaceViewBuilder
import dev.d1s.beam.client.app.ApplicationContext
import dev.d1s.beam.commons.*
Expand All @@ -43,8 +44,9 @@ public class SpaceContext internal constructor(
modifySpace(slug = slug())
}

public suspend fun setMetadata(metadata: suspend () -> Metadata) {
modifySpace(metadata = metadata())
public suspend fun setMetadata(metadata: suspend MetadataBuilder.() -> Unit) {
val builtMetadata = MetadataBuilder().apply { metadata() }.buildMetadata()
modifySpace(metadata = builtMetadata)
}

public suspend fun setView(view: suspend SpaceViewBuilder.() -> Unit) {
Expand Down

0 comments on commit 27131fe

Please sign in to comment.