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

commonMain.app.bsky.actor.profile.kt Maven / Gradle / Ivy

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

package app.bsky.actor

import com.atproto.repo.StrongRef
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmInline
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.Blob
import sh.christian.ozone.api.model.Timestamp
import sh.christian.ozone.api.runtime.valueClassSerializer

@Serializable
public sealed interface ProfileLabelsUnion {
  public class SelfLabelsSerializer : KSerializer by valueClassSerializer(
    serialName = "com.atproto.label.defs#selfLabels",
    constructor = ::SelfLabels,
    valueProvider = SelfLabels::value,
    valueSerializerProvider = { com.atproto.label.SelfLabels.serializer() },
  )

  @Serializable(with = SelfLabelsSerializer::class)
  @JvmInline
  @SerialName("com.atproto.label.defs#selfLabels")
  public value class SelfLabels(
    public val `value`: com.atproto.label.SelfLabels,
  ) : ProfileLabelsUnion
}

/**
 * @param description Free-form profile description text.
 * @param avatar Small image to be displayed next to posts from account. AKA, 'profile picture'
 * @param banner Larger horizontal image to display behind profile view.
 * @param labels Self-label values, specific to the Bluesky application, on the overall account.
 */
@Serializable
public data class Profile(
  public val displayName: String? = null,
  /**
   * Free-form profile description text.
   */
  public val description: String? = null,
  /**
   * Small image to be displayed next to posts from account. AKA, 'profile picture'
   */
  public val avatar: Blob? = null,
  /**
   * Larger horizontal image to display behind profile view.
   */
  public val banner: Blob? = null,
  /**
   * Self-label values, specific to the Bluesky application, on the overall account.
   */
  public val labels: ProfileLabelsUnion? = null,
  public val joinedViaStarterPack: StrongRef? = null,
  public val pinnedPost: StrongRef? = null,
  public val createdAt: Timestamp? = null,
) {
  init {
    require(displayName == null || displayName.count() <= 640) {
      "displayName.count() must be <= 640, but was ${displayName?.count()}"
    }
    require(description == null || description.count() <= 2_560) {
      "description.count() must be <= 2_560, but was ${description?.count()}"
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy