-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CanonicalEmailBlock * Cohort * Dimension * DomainAllow * DomainBlock
- Loading branch information
Showing
6 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...commonMain/kotlin/xyz/wingio/fediapi/software/mastodon/model/admin/CanonicalEmailBlock.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package xyz.wingio.fediapi.software.mastodon.model.admin | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import xyz.wingio.fediapi.SHA256 | ||
|
||
/** | ||
* Represents a canonical email block (hashed). | ||
* | ||
* @param id The ID of the email block in the database. | ||
* @param canonicalEmailHash The SHA256 hash of the canonical email address. | ||
*/ | ||
@Serializable | ||
public data class CanonicalEmailBlock( | ||
val id: String, | ||
@SerialName("canonical_email_hash") val canonicalEmailHash: SHA256 | ||
) |
48 changes: 48 additions & 0 deletions
48
fediapi/src/commonMain/kotlin/xyz/wingio/fediapi/software/mastodon/model/admin/Cohort.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package xyz.wingio.fediapi.software.mastodon.model.admin | ||
|
||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Represents a retention metric. | ||
* | ||
* @param period The timestamp for the start of the period, at midnight. | ||
* @param frequency The size of the bucket for the returned data. | ||
* @param data Retention data for users who registered during the given period. | ||
*/ | ||
@Serializable | ||
public data class Cohort( | ||
val period: Instant, | ||
val frequency: Frequency, | ||
val data: List<Data> | ||
) { | ||
|
||
@Serializable | ||
public enum class Frequency { | ||
/** | ||
* Daily buckets | ||
*/ | ||
@SerialName("day") DAILY, | ||
|
||
/** | ||
* Monthly buckets | ||
*/ | ||
@SerialName("month") MONTHLY, | ||
} | ||
|
||
/** | ||
* Data for users who registered during a given period. | ||
* | ||
* @param date The timestamp for the start of the bucket, at midnight. | ||
* @param rate The percentage rate of users who registered in the specified [period] and were active for the given [date] bucket. | ||
* @param value How many users registered in the specified [period] and were active for the given [date] bucket. | ||
*/ | ||
@Serializable | ||
public data class Data( | ||
val date: Instant, | ||
val rate: Float, | ||
val value: Int | ||
) | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
fediapi/src/commonMain/kotlin/xyz/wingio/fediapi/software/mastodon/model/admin/Dimension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package xyz.wingio.fediapi.software.mastodon.model.admin | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Represents qualitative data about the server. | ||
* | ||
* @param key The unique keystring for the requested dimension. | ||
* @param data The data available for the requested dimension. | ||
*/ | ||
@Serializable | ||
public data class Dimension( | ||
val key: String, | ||
val data: List<Data> | ||
) { | ||
|
||
/** | ||
* Data available for a given dimension | ||
* | ||
* @param key The unique keystring for this data item. | ||
* @param humanKey A human-readable key for this data item. | ||
* @param value The value for this data item. | ||
* @param unit The units associated with this data item’s value, if applicable. | ||
* @param humanValue A human-readable formatted value for this data item. | ||
*/ | ||
@Serializable | ||
public data class Data( | ||
val key: String, | ||
@SerialName("human_key") val humanKey: String, | ||
val value: String, | ||
val unit: String? = null, | ||
@SerialName("human_value") val humanValue: String? = null | ||
) | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
...api/src/commonMain/kotlin/xyz/wingio/fediapi/software/mastodon/model/admin/DomainAllow.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package xyz.wingio.fediapi.software.mastodon.model.admin | ||
|
||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Represents a domain allowed to federate. | ||
* | ||
* @param id The ID of the [DomainAllow] in the database. | ||
* @param domain The domain that is allowed to federate. | ||
* @param createdAt When the domain was allowed to federate. | ||
*/ | ||
@Serializable | ||
public data class DomainAllow( | ||
val id: String, | ||
val domain: String, | ||
@SerialName("created_at") val createdAt: Instant | ||
) |
50 changes: 50 additions & 0 deletions
50
...api/src/commonMain/kotlin/xyz/wingio/fediapi/software/mastodon/model/admin/DomainBlock.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package xyz.wingio.fediapi.software.mastodon.model.admin | ||
|
||
import kotlinx.datetime.Instant | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Represents a domain limited from federating. | ||
* | ||
* @param id The ID of the [DomainBlock] in the database. | ||
* @param domain The domain that is not allowed to federate. | ||
* @param createdAt When the domain was blocked from federating. | ||
* @param severity The policy to be applied by this domain block. | ||
* @param rejectMedia Whether to reject media attachments from this domain | ||
* @param rejectReports Whether to reject reports from this domain | ||
* @param privateComment Reason for why this domain is blocked | ||
* @param publicComment Publicly shown reason for this block | ||
* @param obfuscate Whether to obfuscate public displays of this domain block | ||
*/ | ||
@Serializable | ||
public data class DomainBlock( | ||
val id: String, | ||
val domain: String, | ||
@SerialName("created_at") val createdAt: Instant, | ||
val severity: Severity, | ||
@SerialName("reject_media") val rejectMedia: Boolean, | ||
@SerialName("reject_reports") val rejectReports: Boolean, | ||
@SerialName("private_comment") val privateComment: String?, | ||
@SerialName("public_comment") val publicComment: String?, | ||
val obfuscate: Boolean | ||
) { | ||
|
||
public enum class Severity { | ||
/** | ||
* Account statuses from this domain will be hidden by default | ||
*/ | ||
@SerialName("silence") SILENCE, | ||
|
||
/** | ||
* All incoming data from this domain will be rejected | ||
*/ | ||
@SerialName("suspend") SUSPEND, | ||
|
||
/** | ||
* Do nothing. Allows for rejecting media or reports | ||
*/ | ||
@SerialName("noop") NOOP | ||
} | ||
|
||
} |