Add some Kdoc

This commit is contained in:
Benoit Marty 2022-05-24 17:14:23 +02:00 committed by Benoit Marty
parent 0b6f35b256
commit 5fbcec0c9c
5 changed files with 91 additions and 7 deletions

View File

@ -20,20 +20,52 @@ package org.matrix.android.sdk.api.query
* Basic query language. All these cases are mutually exclusive.
*/
sealed interface QueryStringValue {
/**
* No condition, i.e. there will be no test on the tested field
*/
object NoCondition : QueryStringValue
/**
* The tested field has to be null
*/
object IsNull : QueryStringValue
/**
* The tested field has to be not null
*/
object IsNotNull : QueryStringValue
/**
* The tested field has to be empty
*/
object IsEmpty : QueryStringValue
/**
* The tested field has to not empty
*/
object IsNotEmpty : QueryStringValue
/**
* Interface to check String content
*/
sealed interface ContentQueryStringValue : QueryStringValue {
val string: String
val case: Case
}
object NoCondition : QueryStringValue
object IsNull : QueryStringValue
object IsNotNull : QueryStringValue
object IsEmpty : QueryStringValue
object IsNotEmpty : QueryStringValue
/**
* The tested field must match the [string].
*/
data class Equals(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue
/**
* The tested field must contain the [string]
*/
data class Contains(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue
/**
* Case enum for [ContentQueryStringValue]
*/
enum class Case {
/**
* Match query sensitive to case.

View File

@ -16,8 +16,23 @@
package org.matrix.android.sdk.api.query
/**
* To filter by Room category
* @see [org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams]
*/
enum class RoomCategoryFilter {
/**
* Get only the DM, i.e. the rooms referenced in `m.direct` account data.
*/
ONLY_DM,
/**
* Get only the Room, not the DM, i.e. the rooms not referenced in `m.direct` account data.
*/
ONLY_ROOMS,
/**
* Get the room with non-0 notifications.
*/
ONLY_WITH_NOTIFICATIONS,
}

View File

@ -16,8 +16,22 @@
package org.matrix.android.sdk.api.query
/**
* Filter room by their tag.
* @see [org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams]
* @see [org.matrix.android.sdk.api.session.room.model.tag.RoomTag]
*/
data class RoomTagQueryFilter(
/**
* Set to true to get the rooms which have the tag "m.favourite".
*/
val isFavorite: Boolean?,
/**
* Set to true to get the rooms which have the tag "m.lowpriority".
*/
val isLowPriority: Boolean?,
val isServerNotice: Boolean?
/**
* Set to true to get the rooms which have the tag "m.server_notice".
*/
val isServerNotice: Boolean?,
)

View File

@ -16,9 +16,28 @@
package org.matrix.android.sdk.api.session.room
/**
* Enum to sort room list.
*/
enum class RoomSortOrder {
/**
* Sort room list by room ascending name.
*/
NAME,
/**
* Sort room list by room descending last activity.
*/
ACTIVITY,
/**
* Sort room list by room priority and last activity: favorite room first, low priority room last,
* then descending last activity.
*/
PRIORITY_AND_ACTIVITY,
/**
* Do not sort room list. Useful if the order does not matter. Order can be indeterminate.
*/
NONE
}

View File

@ -93,6 +93,10 @@ data class RoomSummaryQueryParams(
val activeGroupId: String? = null
) {
/**
* Builder for [RoomSummaryQueryParams].
* [roomSummaryQueryParams] and [spaceSummaryQueryParams] can also be used to build an instance of [RoomSummaryQueryParams].
*/
class Builder {
var displayName: QueryStringValue = QueryStringValue.NoCondition
var canonicalAlias: QueryStringValue = QueryStringValue.NoCondition