AvatarManager

public class AvatarManager

AvatarManager is used to handle all operations with avatars.

  • Is used to create avatar on the server.

    Declaration

    Swift

    public class func createAvatar(fromImage image: UIImage, name: String, description: String = "") -> TaskHandler<AvatarModel>

    Parameters

    image

    Image which will be used for the avatar generation.

    name

    Name for this avatar.

    description

    Description for this avatar.

    Return Value

    Task handler object which can be used for subscription on progress and completion callbacks.

  • Is used to retrieve paginated list of available avatar models for current player sorted by date.

    Declaration

    Swift

    public class func getAvatars(beforeDate date: Date? = nil, completion: @escaping CompletionHandler<[AvatarModel]>)

    Parameters

    date

    Avatars in the next retrieved portion will start from the specified date. If not specified, the first portion of avatars will be retrived.

    completion

    Closure to be executed once the request has finished.

  • Is used to retrieve the AvatarModel from the server.

    Declaration

    Swift

    public class func getAvatar(code: String, completion: @escaping CompletionHandler<AvatarModel>)

    Parameters

    code

    The avatar model ID for which the server information should be downloaded.

    completion

    Closure to be executed once the request has finished.

  • Is used to download the avatar files from the server.

    Declaration

    Swift

    public class func downloadAvatar(avatarModel: AvatarModel) -> TaskHandler<AvatarModel>

    Parameters

    avatarModel

    The avatar model which files should be downloaded.

    Return Value

    Task handler object which can be used for subscription on progress and completion callbacks.

  • Is used to delete avatar from the server. If this avatar was downloaded on this device than it will be also deleted from the device.

    Declaration

    Swift

    public class func deleteAvatar(avatarModel: AvatarModel, completion: @escaping CompletionHandler<Bool>)

    Parameters

    avatarModel

    The avatar model that should be deleted.

    completion

    Closure to be executed once the request has finished.

  • Is used to build AvatarModel from the server response.

    Declaration

    Swift

    public class func buildAvatar(fromResponse response:ResponseAvatarModel) -> AvatarModel

    Parameters

    response

    The avatar server information.

    Return Value

    The avatar model.