Class DiscogsConnection
java.lang.Object
com.amilesend.client.connection.Connection<GsonFactory>
com.amilesend.discogs.connection.DiscogsConnection
Wraps a
OkHttpClient
that manages authentication refresh and parsing responses to corresponding POJO types.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
DiscogsConnection.DiscogsConnectionBuilder<C extends DiscogsConnection, B extends DiscogsConnection.DiscogsConnectionBuilder<C,
B>> Nested classes/interfaces inherited from class com.amilesend.client.connection.Connection
com.amilesend.client.connection.Connection.ConnectionBuilder<G,
C, B>, com.amilesend.client.connection.Connection.Headers -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from class com.amilesend.client.connection.Connection
FORM_DATA_CONTENT_TYPE, FORM_DATA_MEDIA_TYPE, JSON_CONTENT_TYPE, JSON_MEDIA_TYPE
-
Method Summary
Modifier and TypeMethodDescriptionstatic DiscogsConnection.DiscogsConnectionBuilder
<?, ?> builder()
download
(@NonNull okhttp3.Request request, @NonNull Path folderPath, @NonNull com.amilesend.client.connection.file.TransferProgressCallback callback) Downloads the contents for the givenrequest
to the specifiedfolderPath
.okhttp3.Response
execute
(@NonNull okhttp3.Request request) <T> T
execute
(@NonNull okhttp3.Request request, @NonNull com.amilesend.client.parse.parser.GsonParser<T> parser) The authorization verifier used to check if API calls require authentication prior to invoking the API.okhttp3.Request.Builder
Creates a newRequest.Builder
with pre-configured headers for a download request that expects a CSV-formatted response.Uploads the contents for a givenrequest
.Methods inherited from class com.amilesend.client.connection.Connection
getAuthManager, getBaseUrl, getGsonFactory, getHttpClient, getUserAgent, isGzipContentEncodingEnabled, newRequestBuilder
-
Field Details
-
DEFAULT_BASE_URL
- See Also:
-
TEXT_CSV_TYPE
- See Also:
-
LOCATION
- See Also:
-
CONTENT_DISPOSITION
- See Also:
-
CONTENT_LENGTH
- See Also:
-
-
Method Details
-
newRequestBuilderForDownload
public okhttp3.Request.Builder newRequestBuilderForDownload()Creates a newRequest.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 classcom.amilesend.client.connection.Connection<GsonFactory>
- Throws:
com.amilesend.client.connection.ConnectionException
-
upload
Uploads the contents for a givenrequest
.- Parameters:
request
- the requestfilename
- 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 classcom.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 givenrequest
to the specifiedfolderPath
.- Parameters:
request
- the requestfolderPath
- the path of the folder to download the content tocallback
- theTransferProgressCallback
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
-
getAuthVerifier
The authorization verifier used to check if API calls require authentication prior to invoking the API.
-