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. * Basic query language. All these cases are mutually exclusive.
*/ */
sealed interface QueryStringValue { 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 { sealed interface ContentQueryStringValue : QueryStringValue {
val string: String val string: String
val case: Case val case: Case
} }
object NoCondition : QueryStringValue /**
object IsNull : QueryStringValue * The tested field must match the [string].
object IsNotNull : QueryStringValue */
object IsEmpty : QueryStringValue
object IsNotEmpty : QueryStringValue
data class Equals(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue 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 data class Contains(override val string: String, override val case: Case = Case.SENSITIVE) : ContentQueryStringValue
/**
* Case enum for [ContentQueryStringValue]
*/
enum class Case { enum class Case {
/** /**
* Match query sensitive to case. * Match query sensitive to case.

View File

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

View File

@ -16,8 +16,22 @@
package org.matrix.android.sdk.api.query 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( data class RoomTagQueryFilter(
/**
* Set to true to get the rooms which have the tag "m.favourite".
*/
val isFavorite: Boolean?, val isFavorite: Boolean?,
/**
* Set to true to get the rooms which have the tag "m.lowpriority".
*/
val isLowPriority: Boolean?, 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 package org.matrix.android.sdk.api.session.room
/**
* Enum to sort room list.
*/
enum class RoomSortOrder { enum class RoomSortOrder {
/**
* Sort room list by room ascending name.
*/
NAME, NAME,
/**
* Sort room list by room descending last activity.
*/
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, PRIORITY_AND_ACTIVITY,
/**
* Do not sort room list. Useful if the order does not matter. Order can be indeterminate.
*/
NONE NONE
} }

View File

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