All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.tools.ozone.moderation.queryStatuses.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("DEPRECATION")

package tools.ozone.moderation

import kotlin.Any
import kotlin.Boolean
import kotlin.Long
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.Did
import sh.christian.ozone.api.Nsid
import sh.christian.ozone.api.Uri
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.model.Timestamp

/**
 * @param includeAllUserRecords All subjects, or subjects from given 'collections' param, belonging
 * to the account specified in the 'subject' param will be returned.
 * @param subject The subject to get the status for.
 * @param comment Search subjects by keyword from comments
 * @param reportedAfter Search subjects reported after a given timestamp
 * @param reportedBefore Search subjects reported before a given timestamp
 * @param reviewedAfter Search subjects reviewed after a given timestamp
 * @param hostingDeletedAfter Search subjects where the associated record/account was deleted after
 * a given timestamp
 * @param hostingDeletedBefore Search subjects where the associated record/account was deleted
 * before a given timestamp
 * @param hostingUpdatedAfter Search subjects where the associated record/account was updated after
 * a given timestamp
 * @param hostingUpdatedBefore Search subjects where the associated record/account was updated
 * before a given timestamp
 * @param hostingStatuses Search subjects by the status of the associated record/account
 * @param reviewedBefore Search subjects reviewed before a given timestamp
 * @param includeMuted By default, we don't include muted subjects in the results. Set this to true
 * to include them.
 * @param onlyMuted When set to true, only muted subjects and reporters will be returned.
 * @param reviewState Specify when fetching subjects in a certain state
 * @param lastReviewedBy Get all subject statuses that were reviewed by a specific moderator
 * @param takendown Get subjects that were taken down
 * @param appealed Get subjects in unresolved appealed status
 * @param collections If specified, subjects belonging to the given collections will be returned.
 * When subjectType is set to 'account', this will be ignored.
 * @param subjectType If specified, subjects of the given type (account or record) will be returned.
 * When this is set to 'account' the 'collections' parameter will be ignored. When
 * includeAllUserRecords or subject is set, this will be ignored.
 */
@Serializable
public data class QueryStatusesQueryParams(
  /**
   * All subjects, or subjects from given 'collections' param, belonging to the account specified in
   * the 'subject' param will be returned.
   */
  public val includeAllUserRecords: Boolean? = null,
  /**
   * The subject to get the status for.
   */
  public val subject: Uri? = null,
  /**
   * Search subjects by keyword from comments
   */
  public val comment: String? = null,
  /**
   * Search subjects reported after a given timestamp
   */
  public val reportedAfter: Timestamp? = null,
  /**
   * Search subjects reported before a given timestamp
   */
  public val reportedBefore: Timestamp? = null,
  /**
   * Search subjects reviewed after a given timestamp
   */
  public val reviewedAfter: Timestamp? = null,
  /**
   * Search subjects where the associated record/account was deleted after a given timestamp
   */
  public val hostingDeletedAfter: Timestamp? = null,
  /**
   * Search subjects where the associated record/account was deleted before a given timestamp
   */
  public val hostingDeletedBefore: Timestamp? = null,
  /**
   * Search subjects where the associated record/account was updated after a given timestamp
   */
  public val hostingUpdatedAfter: Timestamp? = null,
  /**
   * Search subjects where the associated record/account was updated before a given timestamp
   */
  public val hostingUpdatedBefore: Timestamp? = null,
  /**
   * Search subjects by the status of the associated record/account
   */
  public val hostingStatuses: ReadOnlyList = persistentListOf(),
  /**
   * Search subjects reviewed before a given timestamp
   */
  public val reviewedBefore: Timestamp? = null,
  /**
   * By default, we don't include muted subjects in the results. Set this to true to include them.
   */
  public val includeMuted: Boolean? = null,
  /**
   * When set to true, only muted subjects and reporters will be returned.
   */
  public val onlyMuted: Boolean? = null,
  /**
   * Specify when fetching subjects in a certain state
   */
  public val reviewState: String? = null,
  public val ignoreSubjects: ReadOnlyList = persistentListOf(),
  /**
   * Get all subject statuses that were reviewed by a specific moderator
   */
  public val lastReviewedBy: Did? = null,
  public val sortField: String? = "lastReportedAt",
  public val sortDirection: String? = "desc",
  /**
   * Get subjects that were taken down
   */
  public val takendown: Boolean? = null,
  /**
   * Get subjects in unresolved appealed status
   */
  public val appealed: Boolean? = null,
  public val limit: Long? = 50,
  public val tags: ReadOnlyList = persistentListOf(),
  public val excludeTags: ReadOnlyList = persistentListOf(),
  public val cursor: String? = null,
  /**
   * If specified, subjects belonging to the given collections will be returned. When subjectType is
   * set to 'account', this will be ignored.
   */
  public val collections: ReadOnlyList = persistentListOf(),
  /**
   * If specified, subjects of the given type (account or record) will be returned. When this is set
   * to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is
   * set, this will be ignored.
   */
  public val subjectType: QueryStatusesSubjectType? = null,
) {
  init {
    require(limit == null || limit >= 1) {
      "limit must be >= 1, but was $limit"
    }
    require(limit == null || limit <= 100) {
      "limit must be <= 100, but was $limit"
    }
    require(collections.count() <= 20) {
      "collections.count() must be <= 20, but was ${collections.count()}"
    }
  }

  public fun asList(): ReadOnlyList> = buildList {
    add("includeAllUserRecords" to includeAllUserRecords)
    add("subject" to subject)
    add("comment" to comment)
    add("reportedAfter" to reportedAfter)
    add("reportedBefore" to reportedBefore)
    add("reviewedAfter" to reviewedAfter)
    add("hostingDeletedAfter" to hostingDeletedAfter)
    add("hostingDeletedBefore" to hostingDeletedBefore)
    add("hostingUpdatedAfter" to hostingUpdatedAfter)
    add("hostingUpdatedBefore" to hostingUpdatedBefore)
    hostingStatuses.forEach {
      add("hostingStatuses" to it)
    }
    add("reviewedBefore" to reviewedBefore)
    add("includeMuted" to includeMuted)
    add("onlyMuted" to onlyMuted)
    add("reviewState" to reviewState)
    ignoreSubjects.forEach {
      add("ignoreSubjects" to it)
    }
    add("lastReviewedBy" to lastReviewedBy)
    add("sortField" to sortField)
    add("sortDirection" to sortDirection)
    add("takendown" to takendown)
    add("appealed" to appealed)
    add("limit" to limit)
    tags.forEach {
      add("tags" to it)
    }
    excludeTags.forEach {
      add("excludeTags" to it)
    }
    add("cursor" to cursor)
    collections.forEach {
      add("collections" to it)
    }
    add("subjectType" to subjectType)
  }.toImmutableList()
}

@Serializable
public data class QueryStatusesResponse(
  public val cursor: String? = null,
  public val subjectStatuses: ReadOnlyList,
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy