Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ import java.util.Date
* @property feeds The list of feed IDs where this activity appears. An activity can appear in
* multiple feeds simultaneously.
* @property filterTags Tags used for content filtering and categorization.
* @property hidden Whether the activity has been hidden by the current user. Hidden activities may
* be filtered from feed views depending on application logic.
* @property id The unique identifier of the activity.
* @property interestTags Tags indicating user interests or content categories for recommendation
* purposes.
Expand Down Expand Up @@ -105,6 +107,7 @@ public data class ActivityData(
val expiresAt: Date?,
val feeds: List<String>,
val filterTags: List<String>,
val hidden: Boolean,
val id: String,
val interestTags: List<String>,
val isWatched: Boolean?,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.getstream.feeds.android.client.api.model

public data class FeedSuggestionData(
public val feed: FeedData,
public val algorithmScores: Map<String, Float>?,
public val reason: String?,
public val recommendationScore: Float?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import io.getstream.feeds.android.client.api.model.FeedAddActivityRequest
import io.getstream.feeds.android.client.api.model.FeedData
import io.getstream.feeds.android.client.api.model.FeedId
import io.getstream.feeds.android.client.api.model.FeedMemberData
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
import io.getstream.feeds.android.client.api.model.FeedsReactionData
import io.getstream.feeds.android.client.api.model.FollowData
import io.getstream.feeds.android.client.api.model.ModelUpdates
Expand Down Expand Up @@ -282,7 +283,7 @@ public interface Feed {
* @return A [Result] containing a list of [FeedData] representing the suggested feeds if
* successful, or an error if the operation fails.
*/
public suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedData>>
public suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedSuggestionData>>

/**
* Follows another feed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ internal fun ActivityResponse.toModel(): ActivityData =
expiresAt = expiresAt,
feeds = feeds,
filterTags = filterTags,
hidden = hidden,
id = id,
interestTags = interestTags,
isWatched = isWatched,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.getstream.feeds.android.client.internal.model

import io.getstream.feeds.android.client.api.model.FeedData
import io.getstream.feeds.android.client.api.model.FeedId
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
import io.getstream.feeds.android.network.models.FeedSuggestionResponse

internal fun FeedSuggestionResponse.toModel(): FeedSuggestionData =
FeedSuggestionData(
feed =
FeedData(
createdAt = createdAt,
createdBy = createdBy.toModel(),
custom = custom,
deletedAt = deletedAt,
description = description,
fid = FeedId(feed),
filterTags = filterTags,
followerCount = followerCount,
followingCount = followingCount,
groupId = groupId,
id = id,
memberCount = memberCount,
ownCapabilities = ownCapabilities.orEmpty(),
ownMembership = ownMembership?.toModel(),
name = name,
pinCount = pinCount,
updatedAt = updatedAt,
visibility = visibility,
),
algorithmScores = algorithmScores,
reason = reason,
recommendationScore = recommendationScore,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import io.getstream.feeds.android.client.api.model.AggregatedActivityData
import io.getstream.feeds.android.client.api.model.FeedData
import io.getstream.feeds.android.client.api.model.FeedId
import io.getstream.feeds.android.client.api.model.FeedMemberData
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
import io.getstream.feeds.android.client.api.model.FollowData
import io.getstream.feeds.android.client.api.model.ModelUpdates
import io.getstream.feeds.android.client.api.state.query.FeedQuery
Expand Down Expand Up @@ -70,7 +71,10 @@ internal interface FeedsRepository {

// BEGIN: Follows

suspend fun queryFollowSuggestions(feedGroupId: String, limit: Int?): Result<List<FeedData>>
suspend fun queryFollowSuggestions(
feedGroupId: String,
limit: Int?,
): Result<List<FeedSuggestionData>>

suspend fun queryFollows(request: QueryFollowsRequest): Result<PaginationResult<FollowData>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import io.getstream.android.core.result.runSafely
import io.getstream.feeds.android.client.api.model.FeedData
import io.getstream.feeds.android.client.api.model.FeedId
import io.getstream.feeds.android.client.api.model.FeedMemberData
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
import io.getstream.feeds.android.client.api.model.FollowData
import io.getstream.feeds.android.client.api.model.ModelUpdates
import io.getstream.feeds.android.client.api.model.PaginationData
Expand Down Expand Up @@ -120,7 +121,7 @@ internal class FeedsRepositoryImpl(private val api: FeedsApi) : FeedsRepository
override suspend fun queryFollowSuggestions(
feedGroupId: String,
limit: Int?,
): Result<List<FeedData>> = runSafely {
): Result<List<FeedSuggestionData>> = runSafely {
api.getFollowSuggestions(feedGroupId = feedGroupId, limit = limit).suggestions.map {
it.toModel()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.getstream.feeds.android.client.api.model.FeedAddActivityRequest
import io.getstream.feeds.android.client.api.model.FeedData
import io.getstream.feeds.android.client.api.model.FeedId
import io.getstream.feeds.android.client.api.model.FeedMemberData
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
import io.getstream.feeds.android.client.api.model.FeedsReactionData
import io.getstream.feeds.android.client.api.model.FollowData
import io.getstream.feeds.android.client.api.model.ModelUpdates
Expand Down Expand Up @@ -294,7 +295,7 @@ internal class FeedImpl(
.map {}
}

override suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedData>> {
override suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedSuggestionData>> {
return feedsRepository.queryFollowSuggestions(feedGroupId = group, limit = limit)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ internal class FeedsSingleFlightApiTest(private val testCase: SingleFlightTestCa
name = "Test App",
fileUploadConfig = FileUploadConfig(sizeLimit = 0),
imageUploadConfig = FileUploadConfig(sizeLimit = 0),
region = "region",
shard = "shard",
id = 0,
placement = "placement",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ internal class AppRepositoryImplTest {
name = "Test App",
fileUploadConfig = fileUploadConfig,
imageUploadConfig = imageUploadConfig,
region = "region",
shard = "shard",
id = 0,
placement = "placement",
)
val apiResponse = GetApplicationResponse(duration = "100ms", app = appResponseFields)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import io.getstream.feeds.android.client.internal.test.TestData.updateFeedMember
import io.getstream.feeds.android.client.internal.test.TestData.updateFeedResponse
import io.getstream.feeds.android.network.apis.FeedsApi
import io.getstream.feeds.android.network.models.AcceptFollowRequest
import io.getstream.feeds.android.network.models.FeedSuggestionResponse
import io.getstream.feeds.android.network.models.FollowRequest
import io.getstream.feeds.android.network.models.QueryFeedMembersRequest
import io.getstream.feeds.android.network.models.QueryFollowsRequest
Expand Down Expand Up @@ -154,7 +155,7 @@ internal class FeedsRepositoryImplTest {
apiFunction = { feedsApi.getFollowSuggestions("user", 10) },
repositoryCall = { repository.queryFollowSuggestions("user", 10) },
apiResult = apiResult,
repositoryResult = listOf(feedResponse().toModel()),
repositoryResult = apiResult.suggestions.map(FeedSuggestionResponse::toModel),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import io.getstream.feeds.android.client.internal.test.TestData.bookmarkData
import io.getstream.feeds.android.client.internal.test.TestData.commentData
import io.getstream.feeds.android.client.internal.test.TestData.feedData
import io.getstream.feeds.android.client.internal.test.TestData.feedMemberData
import io.getstream.feeds.android.client.internal.test.TestData.feedSuggestionData
import io.getstream.feeds.android.client.internal.test.TestData.feedsReactionData
import io.getstream.feeds.android.client.internal.test.TestData.followData
import io.getstream.feeds.android.client.internal.test.TestData.pollData
Expand Down Expand Up @@ -516,7 +517,8 @@ internal class FeedImplTest {
fun `on queryFollowSuggestions, delegate to repository`() = runTest {
val feed = createFeed()
val limit = 10
val suggestions = listOf(feedData("suggested-1"), feedData("suggested-2"))
val suggestions =
listOf(feedSuggestionData("suggested-1"), feedSuggestionData("suggested-2"))

coEvery { feedsRepository.queryFollowSuggestions("group", limit) } returns
Result.success(suggestions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import io.getstream.feeds.android.client.api.model.FeedData
import io.getstream.feeds.android.client.api.model.FeedId
import io.getstream.feeds.android.client.api.model.FeedMemberData
import io.getstream.feeds.android.client.api.model.FeedMemberStatus
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
import io.getstream.feeds.android.client.api.model.FeedsReactionData
import io.getstream.feeds.android.client.api.model.FileUploadConfigData
import io.getstream.feeds.android.client.api.model.FollowData
Expand All @@ -49,6 +50,7 @@ import io.getstream.feeds.android.network.models.CommentResponse
import io.getstream.feeds.android.network.models.DeleteCommentResponse
import io.getstream.feeds.android.network.models.FeedMemberResponse
import io.getstream.feeds.android.network.models.FeedResponse
import io.getstream.feeds.android.network.models.FeedSuggestionResponse
import io.getstream.feeds.android.network.models.FeedsReactionResponse
import io.getstream.feeds.android.network.models.FollowResponse
import io.getstream.feeds.android.network.models.GetFollowSuggestionsResponse
Expand Down Expand Up @@ -207,6 +209,7 @@ internal object TestData {
comments: List<CommentData> = emptyList(),
feeds: List<String> = emptyList(),
createdAt: Long = 1000,
hidden: Boolean = false,
): ActivityData =
ActivityData(
attachments = emptyList(),
Expand All @@ -221,6 +224,7 @@ internal object TestData {
expiresAt = null,
feeds = feeds,
filterTags = emptyList(),
hidden = hidden,
id = id,
interestTags = emptyList(),
isWatched = null,
Expand Down Expand Up @@ -337,6 +341,8 @@ internal object TestData {
updatedAt = Date(1000),
visibility = ActivityResponse.Visibility.Public,
user = userResponse(),
hidden = false,
preview = false,
)

fun feedsReactionResponse() =
Expand Down Expand Up @@ -606,6 +612,14 @@ internal object TestData {
visibility = "public",
)

fun feedSuggestionData(id: String) =
FeedSuggestionData(
feed = feedData(id),
algorithmScores = emptyMap(),
reason = null,
recommendationScore = null,
)

fun moderationConfigData(
key: String = "config-1",
team: String = "team-1",
Expand Down Expand Up @@ -732,8 +746,29 @@ internal object TestData {
fun rejectFeedMemberResponse() =
RejectFeedMemberInviteResponse(duration = "duration", member = feedMemberResponse())

fun feedSuggestionResponse() =
FeedSuggestionResponse(
createdAt = Date(1000),
description = "Test feed description",
feed = "user:feed-1",
followerCount = 0,
followingCount = 0,
groupId = "user",
id = "feed-1",
memberCount = 0,
name = "Test Feed",
pinCount = 0,
updatedAt = Date(1000),
createdBy = userResponse(),
deletedAt = null,
reason = null,
)

fun followSuggestionsResponse() =
GetFollowSuggestionsResponse(duration = "duration", suggestions = listOf(feedResponse()))
GetFollowSuggestionsResponse(
duration = "duration",
suggestions = listOf(feedSuggestionResponse()),
)

fun commentResponse() =
CommentResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public object Serializer {
.add(
io.getstream.feeds.android.network.models.AWSRekognitionRule.Action.ActionAdapter()
)
.add(
io.getstream.feeds.android.network.models.ActivityFeedbackEventPayload.Action
.ActionAdapter()
)
.add(
io.getstream.feeds.android.network.models.ActivityRequest.Visibility
.VisibilityAdapter()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved.
*
* Licensed under the Stream License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("ArrayInDataClass", "EnumEntryName", "RemoveRedundantQualifierName", "UnusedImport")

package io.getstream.feeds.android.network.models

import com.squareup.moshi.Json
import kotlin.collections.*
import kotlin.collections.Map
import kotlin.io.*

/** Emitted when activity feedback is provided. */
public data class ActivityFeedbackEvent(
@Json(name = "created_at") public val createdAt: java.util.Date,
@Json(name = "activity_feedback")
public val activityFeedback:
io.getstream.feeds.android.network.models.ActivityFeedbackEventPayload,
@Json(name = "custom")
public val custom: kotlin.collections.Map<kotlin.String, Any?> = emptyMap(),
@Json(name = "type") public val type: kotlin.String,
@Json(name = "received_at") public val receivedAt: java.util.Date? = null,
@Json(name = "user")
public val user: io.getstream.feeds.android.network.models.UserResponseCommonFields? = null,
) :
io.getstream.feeds.android.network.models.WSClientEvent,
io.getstream.feeds.android.network.models.WSEvent,
io.getstream.feeds.android.network.models.FeedEvent {

override fun getWSClientEventType(): kotlin.String {
return type
}

override fun getWSEventType(): kotlin.String {
return type
}
}
Loading