Package com.castlabs.android.network

# Class Request

java.lang.Object
com.castlabs.android.network.Request

public class Request extends Object
A modifiable request. You can use an instance of this class in a `RequestModifier` to change the URI and HTTP headers. Please note that you can use `Uri.Builder` to also modify the query parameters attached to the given URI.

Since:
  4.1.2

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static @interface`
  `Request.RequestType`
  Represents a request data type

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DATA_TYPE_DASH_CALLBACK`
  `static final int`
  `DATA_TYPE_DATAGRAM`
  Request type for RTP/UDP requests
  `static final int`
  `DATA_TYPE_DRM_LICENSE`
  Request type for DRM license requests
  `static final int`
  `DATA_TYPE_DRM_PROVISION`
  Request type for DRM provisioning requests
  `static final int`
  `DATA_TYPE_MANIFEST`
  Request type for manifest requests
  `static final int`
  `DATA_TYPE_OTHER`
  Request type for other requests
  `static final int`
  `DATA_TYPE_SEGMENT`
  Request type for segment requests
  `static final int`
  `DATA_TYPE_THUMBNAIL`
  Request type for thumbnail requests
  `final Map<String,String>`
  `headers`
  The header parameters that will be applied to the request.
  `final int`
  `type`
  The request type.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Request(int type, Uri uri)`
  Create a new request with the given URI and no headers
  `Request(int type, Uri uri, Map<String,String> headers)`
  Create a new request with the given URI and headers
  `Request(int type, Uri uri, Map<String,String> headers, byte[] data)`
  Create a new request with the given URI and headers

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `getData()`
  Get the data that will be send with a post request
  `Uri`
  `getUri()`
  Get the request URI.
  `void`
  `setData(byte[] data)`
  Set the data that will be send with a post request
  `void`
  `setUri(Uri uri)`
  Set the target URI for this request.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DATA_TYPE_MANIFEST

    public static final int DATA_TYPE_MANIFEST
    Request type for manifest requests
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_SEGMENT

    public static final int DATA_TYPE_SEGMENT
    Request type for segment requests
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_OTHER

    public static final int DATA_TYPE_OTHER
    Request type for other requests
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_DRM_PROVISION

    public static final int DATA_TYPE_DRM_PROVISION
    Request type for DRM provisioning requests
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_DRM_LICENSE

    public static final int DATA_TYPE_DRM_LICENSE
    Request type for DRM license requests
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_DASH_CALLBACK

    public static final int DATA_TYPE_DASH_CALLBACK
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_DATAGRAM

    public static final int DATA_TYPE_DATAGRAM
    Request type for RTP/UDP requests
    See Also:
      - Constant Field Values

  - ### DATA_TYPE_THUMBNAIL

    public static final int DATA_TYPE_THUMBNAIL
    Request type for thumbnail requests
    See Also:
      - Constant Field Values

  - ### headers

    @NonNull public final Map<String,String> headers
    The header parameters that will be applied to the request. Use this map to modify the headers. Note that keys and values should be not encoded.

  - ### type

    public final int type
    The request type. This is one of `DATA_TYPE_MANIFEST`, `DATA_TYPE_SEGMENT`, `DATA_TYPE_OTHER`, `DATA_TYPE_DRM_LICENSE`, or `DATA_TYPE_DRM_PROVISION`

- ## Constructor Details

  - ### Request

    public Request(int type, @NonNull Uri uri)
    Create a new request with the given URI and no headers
    Parameters:
      `type` - The request type. This is one of `DATA_TYPE_MANIFEST`, `DATA_TYPE_SEGMENT` or `DATA_TYPE_OTHER`
      `uri` - The URI. Null is not permitted.

  - ### Request

    public Request(int type, @NonNull Uri uri, @Nullable Map<String,String> headers)
    Create a new request with the given URI and headers
    Parameters:
      `type` - The request type. This is one of `DATA_TYPE_MANIFEST`, `DATA_TYPE_SEGMENT` or `DATA_TYPE_OTHER`
      `uri` - The URI. Null is not permitted
      `headers` - The headers

  - ### Request

    public Request(int type, @NonNull Uri uri, @Nullable Map<String,String> headers, @Nullable byte[] data)
    Create a new request with the given URI and headers
    Parameters:
      `type` - The request type. This is one of `DATA_TYPE_MANIFEST`, `DATA_TYPE_SEGMENT` or `DATA_TYPE_OTHER`
      `uri` - The URI. Null is not permitted
      `headers` - The headers
      `data` - The POST payload

- ## Method Details

  - ### getUri

    @NonNull public Uri getUri()
    Get the request URI.
    Returns:
      The request URI. Query parameters are not applied yet

  - ### setUri

    public void setUri(@NonNull Uri uri)
    Set the target URI for this request. `null` is not permitted and will raise an exception.
    Parameters:
      `uri` - The URI. Null is not permitted

  - ### getData

    @Nullable public byte[] getData()
    Get the data that will be send with a post request
    Returns:
      The data or null

  - ### setData

    public void setData(@Nullable byte[] data)
    Set the data that will be send with a post request
    Parameters:
      `data` - The data