Skip to content

Commit 737281b

Browse files
committed
Add latest OpenAPI network code (31.10.2025)
1 parent c38ae51 commit 737281b

File tree

45 files changed

+418
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+418
-81
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved.
3+
*
4+
* Licensed under the Stream License;
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.getstream.feeds.android.client.api.model
17+
18+
public data class FeedSuggestionData(
19+
public val feed: FeedData,
20+
public val algorithmScores: Map<String, Float>?,
21+
public val reason: String?,
22+
public val recommendationScore: Float?,
23+
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/state/Feed.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import io.getstream.feeds.android.client.api.model.FeedAddActivityRequest
2323
import io.getstream.feeds.android.client.api.model.FeedData
2424
import io.getstream.feeds.android.client.api.model.FeedId
2525
import io.getstream.feeds.android.client.api.model.FeedMemberData
26+
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
2627
import io.getstream.feeds.android.client.api.model.FeedsReactionData
2728
import io.getstream.feeds.android.client.api.model.FollowData
2829
import io.getstream.feeds.android.client.api.model.ModelUpdates
@@ -282,7 +283,7 @@ public interface Feed {
282283
* @return A [Result] containing a list of [FeedData] representing the suggested feeds if
283284
* successful, or an error if the operation fails.
284285
*/
285-
public suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedData>>
286+
public suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedSuggestionData>>
286287

287288
/**
288289
* Follows another feed.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved.
3+
*
4+
* Licensed under the Stream License;
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://github.com/GetStream/stream-feeds-android/blob/main/LICENSE
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.getstream.feeds.android.client.internal.model
17+
18+
import io.getstream.feeds.android.client.api.model.FeedData
19+
import io.getstream.feeds.android.client.api.model.FeedId
20+
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
21+
import io.getstream.feeds.android.network.models.FeedSuggestionResponse
22+
23+
internal fun FeedSuggestionResponse.toModel(): FeedSuggestionData =
24+
FeedSuggestionData(
25+
feed =
26+
FeedData(
27+
createdAt = createdAt,
28+
createdBy = createdBy.toModel(),
29+
custom = custom,
30+
deletedAt = deletedAt,
31+
description = description,
32+
fid = FeedId(feed),
33+
filterTags = filterTags,
34+
followerCount = followerCount,
35+
followingCount = followingCount,
36+
groupId = groupId,
37+
id = id,
38+
memberCount = memberCount,
39+
ownCapabilities = ownCapabilities.orEmpty(),
40+
ownMembership = ownMembership?.toModel(),
41+
name = name,
42+
pinCount = pinCount,
43+
updatedAt = updatedAt,
44+
visibility = visibility,
45+
),
46+
algorithmScores = algorithmScores,
47+
reason = reason,
48+
recommendationScore = recommendationScore,
49+
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepository.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import io.getstream.feeds.android.client.api.model.AggregatedActivityData
2121
import io.getstream.feeds.android.client.api.model.FeedData
2222
import io.getstream.feeds.android.client.api.model.FeedId
2323
import io.getstream.feeds.android.client.api.model.FeedMemberData
24+
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
2425
import io.getstream.feeds.android.client.api.model.FollowData
2526
import io.getstream.feeds.android.client.api.model.ModelUpdates
2627
import io.getstream.feeds.android.client.api.state.query.FeedQuery
@@ -70,7 +71,10 @@ internal interface FeedsRepository {
7071

7172
// BEGIN: Follows
7273

73-
suspend fun queryFollowSuggestions(feedGroupId: String, limit: Int?): Result<List<FeedData>>
74+
suspend fun queryFollowSuggestions(
75+
feedGroupId: String,
76+
limit: Int?,
77+
): Result<List<FeedSuggestionData>>
7478

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

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImpl.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import io.getstream.android.core.result.runSafely
2020
import io.getstream.feeds.android.client.api.model.FeedData
2121
import io.getstream.feeds.android.client.api.model.FeedId
2222
import io.getstream.feeds.android.client.api.model.FeedMemberData
23+
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
2324
import io.getstream.feeds.android.client.api.model.FollowData
2425
import io.getstream.feeds.android.client.api.model.ModelUpdates
2526
import io.getstream.feeds.android.client.api.model.PaginationData
@@ -120,7 +121,7 @@ internal class FeedsRepositoryImpl(private val api: FeedsApi) : FeedsRepository
120121
override suspend fun queryFollowSuggestions(
121122
feedGroupId: String,
122123
limit: Int?,
123-
): Result<List<FeedData>> = runSafely {
124+
): Result<List<FeedSuggestionData>> = runSafely {
124125
api.getFollowSuggestions(feedGroupId = feedGroupId, limit = limit).suggestions.map {
125126
it.toModel()
126127
}

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/state/FeedImpl.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import io.getstream.feeds.android.client.api.model.FeedAddActivityRequest
2424
import io.getstream.feeds.android.client.api.model.FeedData
2525
import io.getstream.feeds.android.client.api.model.FeedId
2626
import io.getstream.feeds.android.client.api.model.FeedMemberData
27+
import io.getstream.feeds.android.client.api.model.FeedSuggestionData
2728
import io.getstream.feeds.android.client.api.model.FeedsReactionData
2829
import io.getstream.feeds.android.client.api.model.FollowData
2930
import io.getstream.feeds.android.client.api.model.ModelUpdates
@@ -294,7 +295,7 @@ internal class FeedImpl(
294295
.map {}
295296
}
296297

297-
override suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedData>> {
298+
override suspend fun queryFollowSuggestions(limit: Int?): Result<List<FeedSuggestionData>> {
298299
return feedsRepository.queryFollowSuggestions(feedGroupId = group, limit = limit)
299300
}
300301

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/http/FeedsSingleFlightApiTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ internal class FeedsSingleFlightApiTest(private val testCase: SingleFlightTestCa
8686
name = "Test App",
8787
fileUploadConfig = FileUploadConfig(sizeLimit = 0),
8888
imageUploadConfig = FileUploadConfig(sizeLimit = 0),
89-
region = "region",
90-
shard = "shard",
89+
id = 0,
90+
placement = "placement",
9191
),
9292
)
9393

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/AppRepositoryImplTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ internal class AppRepositoryImplTest {
4242
name = "Test App",
4343
fileUploadConfig = fileUploadConfig,
4444
imageUploadConfig = imageUploadConfig,
45-
region = "region",
46-
shard = "shard",
45+
id = 0,
46+
placement = "placement",
4747
)
4848
val apiResponse = GetApplicationResponse(duration = "100ms", app = appResponseFields)
4949

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/repository/FeedsRepositoryImplTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import io.getstream.feeds.android.client.internal.test.TestData.updateFeedMember
4545
import io.getstream.feeds.android.client.internal.test.TestData.updateFeedResponse
4646
import io.getstream.feeds.android.network.apis.FeedsApi
4747
import io.getstream.feeds.android.network.models.AcceptFollowRequest
48+
import io.getstream.feeds.android.network.models.FeedSuggestionResponse
4849
import io.getstream.feeds.android.network.models.FollowRequest
4950
import io.getstream.feeds.android.network.models.QueryFeedMembersRequest
5051
import io.getstream.feeds.android.network.models.QueryFollowsRequest
@@ -154,7 +155,7 @@ internal class FeedsRepositoryImplTest {
154155
apiFunction = { feedsApi.getFollowSuggestions("user", 10) },
155156
repositoryCall = { repository.queryFollowSuggestions("user", 10) },
156157
apiResult = apiResult,
157-
repositoryResult = listOf(feedResponse().toModel()),
158+
repositoryResult = apiResult.suggestions.map(FeedSuggestionResponse::toModel),
158159
)
159160
}
160161

stream-feeds-android-client/src/test/kotlin/io/getstream/feeds/android/client/internal/state/FeedImplTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import io.getstream.feeds.android.client.internal.test.TestData.bookmarkData
4444
import io.getstream.feeds.android.client.internal.test.TestData.commentData
4545
import io.getstream.feeds.android.client.internal.test.TestData.feedData
4646
import io.getstream.feeds.android.client.internal.test.TestData.feedMemberData
47+
import io.getstream.feeds.android.client.internal.test.TestData.feedSuggestionData
4748
import io.getstream.feeds.android.client.internal.test.TestData.feedsReactionData
4849
import io.getstream.feeds.android.client.internal.test.TestData.followData
4950
import io.getstream.feeds.android.client.internal.test.TestData.pollData
@@ -516,7 +517,8 @@ internal class FeedImplTest {
516517
fun `on queryFollowSuggestions, delegate to repository`() = runTest {
517518
val feed = createFeed()
518519
val limit = 10
519-
val suggestions = listOf(feedData("suggested-1"), feedData("suggested-2"))
520+
val suggestions =
521+
listOf(feedSuggestionData("suggested-1"), feedSuggestionData("suggested-2"))
520522

521523
coEvery { feedsRepository.queryFollowSuggestions("group", limit) } returns
522524
Result.success(suggestions)

0 commit comments

Comments
 (0)