Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

Protected avatarColor

avatarColor: null | Color = null

data

data: ModelData = {}

The resource object from the API.

exists

exists: boolean = false

Whether or not the resource exists on the server.

freshness

freshness: Date = ...

The time at which the model's data was last updated. Watching the value of this property is a fast way to retain/cache a subtree if data hasn't changed.

Protected store

store: Store

The data store that this resource should be persisted to.

Methods

Protected apiEndpoint

  • apiEndpoint(): string

attribute

  • attribute<T>(attribute: string): T

avatarUrl

  • avatarUrl(): null | string

badges

Protected calculateAvatarColor

  • calculateAvatarColor(): void
  • Calculate the dominant color of the user's avatar. The dominant color will be set to the avatarColor property once it has been calculated.

    Returns void

canDelete

  • canDelete(): undefined | boolean

canEdit

  • canEdit(): undefined | boolean

canEditCredentials

  • canEditCredentials(): undefined | boolean

canEditGroups

  • canEditGroups(): undefined | boolean

color

  • color(): string

commentCount

  • commentCount(): undefined | number

Protected copyData

delete

discussionCount

  • discussionCount(): undefined | number

displayName

  • displayName(): string

email

  • email(): undefined | string

groups

  • groups(): false | (undefined | Group)[]

id

  • id(): undefined | string

isAdmin

  • isAdmin(): undefined | boolean

isEmailConfirmed

  • isEmailConfirmed(): undefined | boolean

isOnline

  • isOnline(): boolean

joinTime

  • joinTime(): undefined | null | Date

lastSeenAt

  • lastSeenAt(): undefined | null | Date

markedAllAsReadAt

  • markedAllAsReadAt(): undefined | null | Date

newNotificationCount

  • newNotificationCount(): undefined | number

password

  • password(): undefined | string

preferences

  • preferences(): undefined | null | Record<string, any>

pushAttributes

pushData

Protected rawRelationship

save

savePreferences

  • savePreferences(newPreferences: Record<string, unknown>): Promise<User>

slug

  • slug(): string

unreadNotificationCount

  • unreadNotificationCount(): undefined | number

username

  • username(): string

Static attribute

  • attribute<T>(name: string): () => T
  • attribute<T, O>(name: string, transform: (attr: O) => T): () => T
  • Generate a function which returns the value of the given attribute.

    Type parameters

    • T

    Parameters

    • name: string

    Returns () => T

      • (): T
      • Generate a function which returns the value of the given attribute.

        Returns T

  • Type parameters

    • T

    • O = unknown

    Parameters

    • name: string
    • transform: (attr: O) => T
        • (attr: O): T
        • Parameters

          • attr: O

          Returns T

    Returns () => T

      • (): T
      • Returns T

Static Protected getIdentifier

Static hasMany

  • hasMany<M>(name: string): () => false | (undefined | M)[]
  • Generate a function which returns the value of the given has-many relationship.

    Type parameters

    Parameters

    • name: string

    Returns () => false | (undefined | M)[]

    false if no information about the relationship exists; an array if it does, containing models if they have been loaded, and undefined for those that have not.

      • (): false | (undefined | M)[]
      • Generate a function which returns the value of the given has-many relationship.

        Returns false | (undefined | M)[]

        false if no information about the relationship exists; an array if it does, containing models if they have been loaded, and undefined for those that have not.

Static hasOne

  • hasOne<M>(name: string): () => false | M
  • hasOne<M>(name: string): () => null | false | M
  • Generate a function which returns the value of the given has-one relationship.

    Type parameters

    Parameters

    • name: string

    Returns () => false | M

    false if no information about the relationship exists; undefined if the relationship exists but the model has not been loaded; or the model if it has been loaded.

      • (): false | M
      • Generate a function which returns the value of the given has-one relationship.

        Returns false | M

        false if no information about the relationship exists; undefined if the relationship exists but the model has not been loaded; or the model if it has been loaded.

  • Type parameters

    Parameters

    • name: string

    Returns () => null | false | M

      • (): null | false | M
      • Returns null | false | M

Static transformDate

  • transformDate(value: string): Date
  • transformDate(value: null | string): null | Date
  • transformDate(value: undefined | string): undefined | Date
  • transformDate(value: undefined | null | string): undefined | null | Date

Generated using TypeDoc version 0.22.10