EkoMediaRepository

@interface EkoMediaRepository : NSObject

Provides access to the media associated with messages

  • The context used to create the instance

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nonnull) EkoClient *client;

    Swift

    var client: EkoClient { get }
  • Designated intializer

    Declaration

    Objective-C

    - (nonnull instancetype)initWithClient:(nonnull EkoClient *)client;

    Swift

    init(client: EkoClient)

    Parameters

    client

    A valid context instance

  • Downloads the image for the given messageId. This method resumes (or starts) the download for the image.

    Declaration

    Objective-C

    - (void)getImageForMessageId:(nonnull NSString *)messageId
                            size:(EkoMediaSize)size
                   resultHandler:
                       (void (^_Nonnull)(UIImage *_Nullable, EkoMediaSize,
                                         NSError *_Nullable))resultHandler;

    Swift

    func getImageForMessageId(_ messageId: String, size: EkoMediaSize, resultHandler: @escaping (UIImage?, EkoMediaSize, Error?) -> Void)

    Parameters

    messageId

    A message Identifier

    size

    of the media to donwload (defaults to medium if nil)

    resultHandler

    the block to be called with the requested image (or eventual error)

  • Downloads the file for the given messageId. This method resumes (or starts) the download for the file.

    Declaration

    Objective-C

    - (void)getFileForMessageId:(nonnull NSString *)messageId
                  resultHandler:(void (^_Nonnull)(NSData *_Nullable,
                                                  NSError *_Nullable))resultHandler;

    Swift

    func getFileForMessageId(_ messageId: String, resultHandler: @escaping (Data?, Error?) -> Void)

    Parameters

    messageId

    A message Identifier

    resultHandler

    the block to be called with the requested file (or eventual error)

  • Stops (pauses) the media download for the given messageId and EkoMediaSize

    Declaration

    Objective-C

    - (void)cancelGetMediaForMessageId:(nonnull NSString *)messageId
                                  size:(EkoMediaSize)size;

    Swift

    func cancelGetMedia(forMessageId messageId: String, size: EkoMediaSize)

    Parameters

    messageId

    A message Identifier

    size

    A proper EkoMediaSize

  • Unavailable

    Block call of init and new because this object cannot be created directly

    Declaration

    Objective-C

    - (nonnull instancetype)init;