suspend fun getChannels()

in kotlin/app-homepage-react/src/main/kotlin/org/homepage/services/GetChannelsService.kt [10:27]


    suspend fun getChannels(query: String): GetChannelsResponse {
        val serverUrl = spaceTokenInfo.spaceAppInstance.spaceServer.serverUrl
        val channels = spaceTokenInfo.appSpaceClient().chats.channels.listAllChannels(
            query,
            publicOnly = true,
            withArchived = false,
            batchInfo = BatchInfo(offset = null, batchSize = 50)
        ) {
            name()
            icon()
            channelId()
            access()
        }
            .data
            .map { ChannelOut(it.channelId, it.name, it.icon?.let { icon -> "$serverUrl/d/$icon" }) }

        return GetChannelsResponse(channels)
    }