Manages common avatar operations.

interface IAvatarManager {
    getAvatarLink(
        id: string,
        kind: AvatarContentKind,
    ): Promise<[null | string, ValidationResult]>;
    resetAvatar(id: string, kind: AvatarContentKind): Promise<ValidationResult>;
    storeAvatar(
        id: string,
        kind: AvatarContentKind,
        content: Blob | File,
        additionalContent?: null | Blob | File,
    ): Promise<ValidationResult>;
}

Implemented by

Methods

  • Returns avatar link for the entity with identifier id and kind kind.

    Parameters

    • id: string

      The identifier of the entity for that avatar link is to be retrieved.

    • kind: AvatarContentKind

      Kind of avatar content.

    Returns Promise<[null | string, ValidationResult]>

  • Resets avatar to default image.

    Parameters

    • id: string

      The identifier of the entity for that avatar to be reseted.

    • kind: AvatarContentKind

      Kind of avatar content.

    Returns Promise<ValidationResult>

  • Stores avatar content, after that reissues current token in order to update links.

    Parameters

    • id: string

      The identifier of the entity for that avatar content should be stored.

    • kind: AvatarContentKind

      Kind of avatar content.

    • content: Blob | File

      Main content of the new avatar.

    • OptionaladditionalContent: null | Blob | File

      Additional content of the new avatar. Used only if kind is AvatarContentKind.Photo.

    Returns Promise<ValidationResult>