ATHttpConnectionManagerAttachment

public class ATHttpConnectionManagerAttachment: NSObject

The ATHttpConnectionManagerAttachment allows to send an attachment to server via ATHttpConnectionManager.

  • The variable allows to set-get the name of the request parameter.

    Usage Example

    let anAttachment = ATHttpConnectionManagerAttachment()
    anAttachment.requestParameterName = "user_avatar"
    

    Declaration

    Swift

    public var requestParameterName :String?
  • The variable allows to set-get the file title of the attachment.

    Usage Example

    let anAttachment = ATHttpConnectionManagerAttachment()
    anAttachment.fileTitle = "Avatar"
    

    Declaration

    Swift

    public var fileTitle :String?
  • The variable allows to set-get the file extension of the attachment.

    Usage Example

    let anAttachment = ATHttpConnectionManagerAttachment()
    anAttachment.fileExtension = "jpg"
    

    Declaration

    Swift

    public var fileExtension :String?
  • The variable allows to set-get the file data of the attachment.

    Usage Example

    let anAttachment = ATHttpConnectionManagerAttachment()
    anAttachment.fileData = UIImageJPEGRepresentation(anAvatarImage, 0.8)!
    

    Declaration

    Swift

    public var fileData :Data?
  • The variable allows to enable/disable the base 64 encoding of the file data of the attachment.

    Usage Example

    let anAttachment = ATHttpConnectionManagerAttachment()
    anAttachment.shouldEncodeInBase64 = true
    

    Declaration

    Swift

    public var shouldEncodeInBase64 :Bool = false
  • Initializer.

    Declaration

    Swift

    public override init()
  • The method allows to initialize the class.

    Usage Example

    let anAvatarImage = UIImage() // Assign image as you want
    let anAttachment = ATHttpConnectionManagerAttachment(requestParameterName: "user_avatar", fileTitle: "Avatar", fileExtension: "jpg", fileData: UIImageJPEGRepresentation(anAvatarImage, 0.8)!, shouldEncodeInBase64: false)
    

    Declaration

    Swift

    public init(requestParameterName pRequestParameterName :String, fileTitle pFileTitle :String? = nil, fileExtension pFileExtension :String? = nil, fileData pFileData :Data, shouldEncodeInBase64 pShouldEncodeInBase64 :Bool = false)

    Parameters

    pRequestParameterName

    Name of the http request parameter.

    pFileTitle

    Title (name without extension) of the file attached.

    pFileExtension

    Extension of the file attached.

    pFileData

    Data of the file attached.

    pShouldEncodeInBase64

    Variable to state if the attachment should be encoded with base64 algorithm.