Package com.avaya.clientservices.downloadservice

## Interface DownloadService

-     public interface DownloadService

  The DownloadService provides provides a set of APIs that allow app to download any files through a URL securely including auto configure setting file, trust cert file, custom logo file, etc. The service is configured with `DownloadServiceConfiguration` object created by the client application. In order to get the service object and leverage the available download service features `Client.getDownloadService()` is used.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `DownloadWatcher` | `downloadFile​(DownloadServiceConfiguration downloadServiceConfiguration, java.net.URL sourceURL, java.lang.String destinationDirectory, DownloadCompletionHandler<java.io.File> completionHandler)` | Retrieve File for downloaded data from URL.
    `DownloadWatcher` | `downloadFile​(DownloadServiceConfiguration downloadServiceConfiguration, java.net.URL sourceURL, java.lang.String destinationDirectory, DownloadOptionalParameters optionalParameters, DownloadWithParametersCompletionHandler<java.io.File> completionHandler)` | Retrieve File for downloaded data from URL.
    `DownloadWatcher` | `retrieveDataFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration, java.net.URL sourceURL, DownloadCompletionHandler<byte[]> completionHandler)` | Retrieve arbitrary binary data from URL.
    `DownloadWatcher` | `retrieveDataFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration, java.net.URL sourceURL, DownloadOptionalParameters optionalParameters, DownloadWithParametersCompletionHandler<byte[]> completionHandler)` | Retrieve arbitrary binary data from URL.
    `DownloadWatcher` | `retrieveTextFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration, java.net.URL sourceURL, DownloadCompletionHandler<java.lang.String> completionHandler)` | Retrieve text data from URL.
    `DownloadWatcher` | `retrieveTextFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration, java.net.URL sourceURL, DownloadOptionalParameters optionalParameters, DownloadWithParametersCompletionHandler<java.lang.String> completionHandler)` | Retrieve text data from URL.

- - ### Method Detail

    - #### retrieveDataFromUrl

          DownloadWatcher retrieveDataFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration,
                                              java.net.URL sourceURL,
                                              DownloadCompletionHandler<byte[]> completionHandler)

      Retrieve arbitrary binary data from URL. The download limit is set to 5 MB. If a client needs to download files larger than 5 MB it should use `downloadFile(com.avaya.clientservices.downloadservice.DownloadServiceConfiguration, java.net.URL, java.lang.String, com.avaya.clientservices.downloadservice.DownloadCompletionHandler<java.io.File>)` Otherwise, a successful result is not guaranteed. The operation can fail with DownloadServiceError.Failed error.
      Parameters:
        `downloadServiceConfiguration` - Service configuration that will be used for this request.
        `sourceURL` - URL of the source file.
        `completionHandler` - The completion handler for this operation.
      Returns:
        DownloadWatcher object for monitoring download requests.

    - #### retrieveDataFromUrl

          DownloadWatcher retrieveDataFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration,
                                              java.net.URL sourceURL,
                                              DownloadOptionalParameters optionalParameters,
                                              DownloadWithParametersCompletionHandler<byte[]> completionHandler)

      Retrieve arbitrary binary data from URL. The download limit is set to 5 MB. If a client needs to download files larger than 5 MB it should use `downloadFile(com.avaya.clientservices.downloadservice.DownloadServiceConfiguration, java.net.URL, java.lang.String, com.avaya.clientservices.downloadservice.DownloadCompletionHandler<java.io.File>)` Otherwise, a successful result is not guaranteed. The operation can fail with DownloadServiceError.Failed error.
      Parameters:
        `downloadServiceConfiguration` - Service configuration that will be used for this request.
        `sourceURL` - URL of the source file.
        `optionalParameters` - Optional parameters to control download process.
        `completionHandler` - The completion handler for this operation.
      Returns:
        DownloadWatcher object for monitoring download requests.

    - #### retrieveTextFromUrl

          DownloadWatcher retrieveTextFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration,
                                              java.net.URL sourceURL,
                                              DownloadCompletionHandler<java.lang.String> completionHandler)

      Retrieve text data from URL. The download limit is set to 5 MB. If a client needs to download files larger than 5 MB it should use `downloadFile(com.avaya.clientservices.downloadservice.DownloadServiceConfiguration, java.net.URL, java.lang.String, com.avaya.clientservices.downloadservice.DownloadCompletionHandler<java.io.File>)` Otherwise, a successful result is not guaranteed. The operation can fail with DownloadServiceError.Failed error. Use this method only for downloading text files(Content-Type prefix "text" or "message"). Otherwise the operation will fail with DownloadServiceError.InvalidContentType error.
      Parameters:
        `downloadServiceConfiguration` - Service configuration that will be used for this request.
        `sourceURL` - URL of the source file.
        `completionHandler` - The completion handler for this operation.
      Returns:
        DownloadWatcher object for monitoring download requests.

    - #### retrieveTextFromUrl

          DownloadWatcher retrieveTextFromUrl​(DownloadServiceConfiguration downloadServiceConfiguration,
                                              java.net.URL sourceURL,
                                              DownloadOptionalParameters optionalParameters,
                                              DownloadWithParametersCompletionHandler<java.lang.String> completionHandler)

      Retrieve text data from URL. The download limit is set to 5 MB. If a client needs to download files larger than 5 MB it should use `downloadFile(com.avaya.clientservices.downloadservice.DownloadServiceConfiguration, java.net.URL, java.lang.String, com.avaya.clientservices.downloadservice.DownloadCompletionHandler<java.io.File>)` Otherwise, a successful result is not guaranteed. The operation can fail with DownloadServiceError.Failed error. Use this method only for downloading text files(Content-Type prefix "text" or "message"). Otherwise the operation will fail with DownloadServiceError.InvalidContentType error.
      Parameters:
        `downloadServiceConfiguration` - Service configuration that will be used for this request.
        `sourceURL` - URL of the source file.
        `optionalParameters` - Optional parameters to control download process.
        `completionHandler` - The completion handler for this operation.
      Returns:
        DownloadWatcher object for monitoring download requests.

    - #### downloadFile

          DownloadWatcher downloadFile​(DownloadServiceConfiguration downloadServiceConfiguration,
                                       java.net.URL sourceURL,
                                       java.lang.String destinationDirectory,
                                       DownloadCompletionHandler<java.io.File> completionHandler)

      Retrieve File for downloaded data from URL. This function allows clients to download large files.
      Parameters:
        `downloadServiceConfiguration` - Service configuration that will be used for this request.
        `sourceURL` - URL of the source file.
        `destinationDirectory` - The directory for storing downloaded data.
        `completionHandler` - The completion handler for this operation.
      Returns:
        DownloadWatcher object for monitoring download requests.

    - #### downloadFile

          DownloadWatcher downloadFile​(DownloadServiceConfiguration downloadServiceConfiguration,
                                       java.net.URL sourceURL,
                                       java.lang.String destinationDirectory,
                                       DownloadOptionalParameters optionalParameters,
                                       DownloadWithParametersCompletionHandler<java.io.File> completionHandler)

      Retrieve File for downloaded data from URL. This function allows clients to download large files.
      Parameters:
        `downloadServiceConfiguration` - Service configuration that will be used for this request.
        `sourceURL` - URL of the source file.
        `destinationDirectory` - The directory for storing downloaded data.
        `optionalParameters` - Optional parameters to control download process.
        `completionHandler` - The completion handler for this operation.
      Returns:
        DownloadWatcher object for monitoring download requests.