Skip to content

Commit 9cce101

Browse files
authored
Finish removing internal code from api package (#107)
* Remove BookmarkFolder internal operations from public api package * Remove internal operations from public api for BookmarkData, ActivityPinData, UserData, FeedsReactionData * Remove internal operations from public api for ReactionGroupData, PollVoteData, PollOptionData, FollowData, AppData * Complete internal operations separation for remaining data models
1 parent 45ddb56 commit 9cce101

38 files changed

+711
-345
lines changed

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/ActivityPinData.kt

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.client.internal.model.toModel
19-
import io.getstream.feeds.android.network.models.ActivityPinResponse
20-
import io.getstream.feeds.android.network.models.PinActivityResponse
2118
import java.util.Date
2219

2320
/**
@@ -53,28 +50,3 @@ public data class ActivityPinData(
5350
public val id: String
5451
get() = "${fid.rawValue}${activity.id}${userId}"
5552
}
56-
57-
/** Converts an [ActivityPinResponse] to an [ActivityPinData] model. */
58-
internal fun ActivityPinResponse.toModel(): ActivityPinData =
59-
ActivityPinData(
60-
activity = activity.toModel(),
61-
createdAt = createdAt,
62-
fid = FeedId(feed),
63-
updatedAt = createdAt,
64-
userId = user.id,
65-
)
66-
67-
/**
68-
* Converts a [PinActivityResponse] to an [ActivityPinData] model.
69-
*
70-
* This conversion is used when pinning an activity to a feed, where the response contains the
71-
* pinned activity details.
72-
*/
73-
internal fun PinActivityResponse.toModel(): ActivityPinData =
74-
ActivityPinData(
75-
activity = activity.toModel(),
76-
createdAt = createdAt,
77-
fid = FeedId(feed),
78-
updatedAt = createdAt, // no updated_at
79-
userId = userId,
80-
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/AppData.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.AppResponseFields
19-
2018
/**
2119
* Data class representing application data configuration.
2220
*
@@ -33,13 +31,3 @@ public data class AppData(
3331
val imageUploadConfig: FileUploadConfigData,
3432
val name: String,
3533
)
36-
37-
/** Converts [AppResponseFields] to [AppData]. */
38-
internal fun AppResponseFields.toModel(): AppData =
39-
AppData(
40-
asyncUrlEnrichEnabled = asyncUrlEnrichEnabled,
41-
autoTranslationEnabled = autoTranslationEnabled,
42-
fileUploadConfig = fileUploadConfig.toModel(),
43-
imageUploadConfig = imageUploadConfig.toModel(),
44-
name = name,
45-
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/BookmarkData.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.client.internal.model.toModel
19-
import io.getstream.feeds.android.network.models.BookmarkResponse
2018
import java.util.Date
2119

2220
/**
@@ -63,14 +61,3 @@ public data class BookmarkData(
6361
public val id: String
6462
get() = "${activity.id}${user.id}"
6563
}
66-
67-
/** Converts a [BookmarkResponse] to a [BookmarkData] model. */
68-
internal fun BookmarkResponse.toModel(): BookmarkData =
69-
BookmarkData(
70-
activity = activity.toModel(),
71-
createdAt = createdAt,
72-
custom = custom,
73-
folder = folder?.toModel(),
74-
updatedAt = updatedAt,
75-
user = user.toModel(),
76-
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/BookmarkFolderData.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.BookmarkFolderResponse
1918
import java.util.Date
2019

2120
/**
@@ -34,13 +33,3 @@ public data class BookmarkFolderData(
3433
val name: String,
3534
val updatedAt: Date,
3635
)
37-
38-
/** Converts a [BookmarkFolderResponse] to a [BookmarkFolderData] model. */
39-
internal fun BookmarkFolderResponse.toModel(): BookmarkFolderData =
40-
BookmarkFolderData(
41-
createdAt = createdAt,
42-
custom = custom,
43-
id = id,
44-
name = name,
45-
updatedAt = updatedAt,
46-
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/FeedData.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18+
import io.getstream.feeds.android.client.internal.model.toModel
1819
import io.getstream.feeds.android.network.models.FeedOwnCapability
1920
import io.getstream.feeds.android.network.models.FeedResponse
2021
import java.util.Date

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/FeedInputData.kt

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.FeedInput
19-
2018
/**
2119
* A data model representing input for creating or updating a feed in the Stream Feeds system.
2220
*
@@ -74,47 +72,3 @@ public sealed class FeedVisibility(public val value: String) {
7472
/** Represents an unknown visibility setting. */
7573
public data class Unknown(val unknownValue: String) : FeedVisibility(unknownValue)
7674
}
77-
78-
/** Converts a [FeedInput] to a [FeedInputData] model. */
79-
internal fun FeedInput.toModel(): FeedInputData =
80-
FeedInputData(
81-
description = description,
82-
name = name,
83-
visibility = visibility?.toModel(),
84-
filterTags = filterTags.orEmpty(),
85-
members = members?.map { it.toModel() }.orEmpty(),
86-
custom = custom.orEmpty(),
87-
)
88-
89-
/** Converts a [FeedInput.Visibility] to a [FeedVisibility] model. */
90-
internal fun FeedInput.Visibility.toModel(): FeedVisibility =
91-
when (this) {
92-
FeedInput.Visibility.Followers -> FeedVisibility.Followers
93-
FeedInput.Visibility.Members -> FeedVisibility.Members
94-
FeedInput.Visibility.Private -> FeedVisibility.Private
95-
FeedInput.Visibility.Public -> FeedVisibility.Public
96-
FeedInput.Visibility.Visible -> FeedVisibility.Visible
97-
is FeedInput.Visibility.Unknown -> FeedVisibility.Unknown(unknownValue)
98-
}
99-
100-
/** Converts a [FeedInputData] to a [FeedInput] model. */
101-
internal fun FeedInputData.toRequest(): FeedInput =
102-
FeedInput(
103-
description = description,
104-
name = name,
105-
visibility = visibility?.toRequest(),
106-
filterTags = filterTags.takeIf { it.isNotEmpty() },
107-
members = members.takeIf { it.isNotEmpty() }?.map { it.toRequest() },
108-
custom = custom.takeIf { it.isNotEmpty() },
109-
)
110-
111-
/** Converts a [FeedVisibility] to a [FeedInput.Visibility] model. */
112-
internal fun FeedVisibility.toRequest(): FeedInput.Visibility =
113-
when (this) {
114-
FeedVisibility.Followers -> FeedInput.Visibility.Followers
115-
FeedVisibility.Members -> FeedInput.Visibility.Members
116-
FeedVisibility.Private -> FeedInput.Visibility.Private
117-
FeedVisibility.Public -> FeedInput.Visibility.Public
118-
FeedVisibility.Visible -> FeedInput.Visibility.Visible
119-
is FeedVisibility.Unknown -> FeedInput.Visibility.Unknown(unknownValue)
120-
}

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/FeedMemberData.kt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.FeedMemberResponse
1918
import java.util.Date
2019

2120
/**
@@ -65,25 +64,3 @@ public sealed class FeedMemberStatus(public val value: String) {
6564
/** Represents a feed member with an unknown status. */
6665
public data class Unknown(val unknownValue: String) : FeedMemberStatus(unknownValue)
6766
}
68-
69-
/** Converts a [FeedMemberResponse] to a [FeedMemberData] model. */
70-
internal fun FeedMemberResponse.toModel() =
71-
FeedMemberData(
72-
createdAt = createdAt,
73-
custom = custom,
74-
inviteAcceptedAt = inviteAcceptedAt,
75-
inviteRejectedAt = inviteRejectedAt,
76-
role = role,
77-
status = status.toModel(),
78-
updatedAt = updatedAt,
79-
user = user.toModel(),
80-
)
81-
82-
/** Converts a [FeedMemberResponse.Status] to a [FeedMemberStatus] model. */
83-
internal fun FeedMemberResponse.Status.toModel(): FeedMemberStatus =
84-
when (this) {
85-
FeedMemberResponse.Status.Member -> FeedMemberStatus.Member
86-
FeedMemberResponse.Status.Pending -> FeedMemberStatus.Pending
87-
FeedMemberResponse.Status.Rejected -> FeedMemberStatus.Rejected
88-
is FeedMemberResponse.Status.Unknown -> FeedMemberStatus.Unknown(unknownValue)
89-
}

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/FeedMemberRequestData.kt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.FeedMemberRequest
19-
2018
/**
2119
* A data model representing a request to add or update a member in a feed.
2220
*
@@ -38,16 +36,3 @@ public data class FeedMemberRequestData(
3836
public val role: String? = null,
3937
public val custom: Map<String, Any?> = emptyMap(),
4038
)
41-
42-
/** Converts a [FeedMemberRequest] to a [FeedMemberRequestData] model. */
43-
internal fun FeedMemberRequest.toModel(): FeedMemberRequestData =
44-
FeedMemberRequestData(userId = userId, invite = invite, role = role, custom = custom.orEmpty())
45-
46-
/** Converts a [FeedMemberRequestData] to a [FeedMemberRequest] model. */
47-
internal fun FeedMemberRequestData.toRequest(): FeedMemberRequest =
48-
FeedMemberRequest(
49-
userId = userId,
50-
invite = invite,
51-
role = role,
52-
custom = custom.takeIf { it.isNotEmpty() },
53-
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/FeedsReactionData.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.FeedsReactionResponse
1918
import java.util.Date
2019

2120
/**
@@ -42,15 +41,3 @@ public data class FeedsReactionData(
4241
public val id: String
4342
get() = "${activityId}${commentId}${user.id}${type}"
4443
}
45-
46-
/** Converts a [FeedsReactionResponse] to a [FeedsReactionData] model. */
47-
internal fun FeedsReactionResponse.toModel(): FeedsReactionData =
48-
FeedsReactionData(
49-
activityId = activityId,
50-
commentId = commentId,
51-
createdAt = createdAt,
52-
custom = custom,
53-
type = type,
54-
updatedAt = updatedAt,
55-
user = user.toModel(),
56-
)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/api/model/FileUploadConfigData.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package io.getstream.feeds.android.client.api.model
1717

18-
import io.getstream.feeds.android.network.models.FileUploadConfig
19-
2018
/**
2119
* Data class representing file upload configuration.
2220
*
@@ -33,13 +31,3 @@ public data class FileUploadConfigData(
3331
val blockedMimeTypes: List<String>,
3432
val sizeLimit: Int,
3533
)
36-
37-
/** Converts [FileUploadConfig] to [FileUploadConfigData]. */
38-
internal fun FileUploadConfig.toModel(): FileUploadConfigData =
39-
FileUploadConfigData(
40-
allowedFileExtensions = allowedFileExtensions,
41-
allowedMimeTypes = allowedMimeTypes,
42-
blockedFileExtensions = blockedFileExtensions,
43-
blockedMimeTypes = blockedMimeTypes,
44-
sizeLimit = sizeLimit,
45-
)

0 commit comments

Comments
 (0)