1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 07:56:19 +00:00

make sharee parts non null that can't be null

This commit is contained in:
Christian Schabesberger 2020-10-13 15:23:59 +02:00 committed by Abel García de Prada
parent 90b6ff52f2
commit 34bf83df30

View File

@ -35,63 +35,49 @@ data class ShareeOcsResponse(
@Json(name = "exact") @Json(name = "exact")
val exact: ExactSharees?, val exact: ExactSharees?,
@Json(name = "groups") @Json(name = "groups")
val groups: List<ShareeItem>?, val groups: List<ShareeItem>,
@Json(name = "remotes") @Json(name = "remotes")
val remotes: List<ShareeItem>?, val remotes: List<ShareeItem>,
@Json(name = "users") @Json(name = "users")
val users: List<ShareeItem>? val users: List<ShareeItem>
) { ) {
fun getFlatRepresentationWithoutExact() fun getFlatRepresentationWithoutExact() = ArrayList<ShareeItem>().apply {
= ArrayList<ShareeItem>().apply {
if(users != null) {
addAll(users) addAll(users)
}
if(remotes != null) {
addAll(remotes) addAll(remotes)
}
if(groups != null) {
addAll(groups) addAll(groups)
} }
}
} }
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
data class ExactSharees( data class ExactSharees(
@Json(name = "groups") @Json(name = "groups")
val groups: List<ShareeItem>?, val groups: List<ShareeItem>,
@Json(name = "remotes") @Json(name = "remotes")
val remotes: List<ShareeItem>?, val remotes: List<ShareeItem>,
@Json(name = "users") @Json(name = "users")
val users: List<ShareeItem>? val users: List<ShareeItem>
) { ) {
fun getFlatRepresentation() fun getFlatRepresentation() = ArrayList<ShareeItem>().apply {
= ArrayList<ShareeItem>().apply {
if(users != null) {
addAll(users) addAll(users)
}
if(remotes != null) {
addAll(remotes) addAll(remotes)
}
if(groups != null) {
addAll(groups) addAll(groups)
} }
}
} }
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
data class ShareeItem( data class ShareeItem(
@Json(name = "label") @Json(name = "label")
val label: String?, val label: String,
@Json(name = "value") @Json(name = "value")
val value: ShareeValue? val value: ShareeValue
) )
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
data class ShareeValue( data class ShareeValue(
@Json(name = "shareType") @Json(name = "shareType")
val shareType: Int?, val shareType: Int,
@Json(name = "shareWith") @Json(name = "shareWith")
val shareWith: String?, val shareWith: String,
@Json(name ="shareWithAdditionalInfo") @Json(name = "shareWithAdditionalInfo")
val additionalInfo: String? val additionalInfo: String?
) )