summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HttpRequest.java
blob: 1fd4f43cd47c06129fd3b1f500cde7028f6918a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.mapbox.mapboxsdk.http;

/**
 * Interface definition for performing http requests.
 * <p>
 * This allows to provide alternative implementations for the http interaction of this library.
 * </p>
 */
public interface HttpRequest {

  int CONNECTION_ERROR = 0;
  int TEMPORARY_ERROR = 1;
  int PERMANENT_ERROR = 2;

  /**
   * Executes the request.
   *
   * @param httpRequest  callback to be invoked when we receive a response
   * @param nativePtr    the pointer associated to the request
   * @param resourceUrl  the resource url to download
   * @param etag         http header, identifier for a specific version of a resource
   * @param modified     http header, used to determine if a resource hasn't been modified since
   * @param offlineUsage flag to indicate a resource will be used for offline, appends offline=true as a query parameter
   */
  void executeRequest(HttpResponder httpRequest, long nativePtr, String resourceUrl,
                      String etag, String modified, boolean offlineUsage);

  /**
   * Cancels the request.
   */
  void cancelRequest();
}