Class DiscogsConnection

java.lang.Object
com.amilesend.client.connection.Connection<GsonFactory>
com.amilesend.discogs.connection.DiscogsConnection

public class DiscogsConnection extends com.amilesend.client.connection.Connection<GsonFactory>
Wraps a OkHttpClient that manages authentication refresh and parsing responses to corresponding POJO types.
See Also:
  • AuthManager
  • Field Details

  • Method Details

    • newRequestBuilderForDownload

      public okhttp3.Request.Builder newRequestBuilderForDownload()
      Creates a new Request.Builder with pre-configured headers for a download request that expects a CSV-formatted response.
      Returns:
      the request builder
    • execute

      public <T> T execute(@NonNull okhttp3.Request request, @NonNull com.amilesend.client.parse.parser.GsonParser<T> parser) throws com.amilesend.client.connection.ConnectionException
      Overrides:
      execute in class com.amilesend.client.connection.Connection<GsonFactory>
      Throws:
      com.amilesend.client.connection.ConnectionException
    • upload

      public UploadInformation upload(@NonNull okhttp3.Request request, String filename)
      Uploads the contents for a given request.
      Parameters:
      request - the request
      filename - the name of the file that is uploaded
      Returns:
      the upload information
      Throws:
      com.amilesend.client.connection.ConnectionException - if an error occurred while uploading the content for the request
      See Also:
    • execute

      public okhttp3.Response execute(@NonNull okhttp3.Request request) throws com.amilesend.client.connection.ConnectionException
      Overrides:
      execute in class com.amilesend.client.connection.Connection<GsonFactory>
      Throws:
      com.amilesend.client.connection.ConnectionException
    • download

      public DownloadInformation download(@NonNull okhttp3.Request request, @NonNull Path folderPath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) throws com.amilesend.client.connection.ConnectionException
      Downloads the contents for the given request to the specified folderPath.
      Parameters:
      request - the request
      folderPath - the path of the folder to download the content to
      callback - the TransferProgressCallback call to invoke to report download transfer progress
      Returns:
      the download information
      Throws:
      com.amilesend.client.connection.ConnectionException - if an error occurred while downloading the content for the request
      See Also:
    • builder

      public static DiscogsConnection.DiscogsConnectionBuilder<?,?> builder()
    • getAuthVerifier

      public AuthVerifier getAuthVerifier()
      The authorization verifier used to check if API calls require authentication prior to invoking the API.