Package com.bambuser.broadcaster
Class BackendApi
- java.lang.Object
-
- com.bambuser.broadcaster.BackendApi
-
public final class BackendApi extends Object
This class contains a few convenience methods for doing requests to Bambuser's API. Do not invoke on the UI thread.
-
-
Field Summary
Fields Modifier and Type Field Description static String
TICKET_FILE_AUTHOR
Author of the uploaded file.static String
TICKET_FILE_CREATED
Creation date of the uploaded file.static String
TICKET_FILE_CUSTOM_DATA
Arbitrary data stored along with the file.static String
TICKET_FILE_NAME
Name of the file which will be uploaded.static String
TICKET_FILE_POS_ACCURACY
Geo-position accuracy (meters, decimal) of the provided position.static String
TICKET_FILE_POS_LAT
Geo-position latitude (degrees, decimal) of the uploaded file.static String
TICKET_FILE_POS_LON
Geo-position longitude (degrees, decimal) of the uploaded file.static String
TICKET_FILE_TITLE
Short free-text title of the uploaded file, analogous to the title for a Bambuser broadcast.static String
TICKET_FILE_TYPE
Type of the file which will be uploaded.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Pair<Integer,String>
getUploadTicketForApplicationId(Context context, Map<String,String> params, String applicationId)
Method for doing a POST request to the Bambuser ticket API endpoint, requiring a Bambuser-provided application ID.
-
-
-
Field Detail
-
TICKET_FILE_TYPE
public static final String TICKET_FILE_TYPE
Type of the file which will be uploaded. Mandatory. Values currently supported by the backend are "video" and "image".- See Also:
- Constant Field Values
-
TICKET_FILE_NAME
public static final String TICKET_FILE_NAME
Name of the file which will be uploaded. Mandatory. The provided file name can be another than the local file name, but the file extension should be correct or the server may reject the upload.- See Also:
- Constant Field Values
-
TICKET_FILE_CREATED
public static final String TICKET_FILE_CREATED
Creation date of the uploaded file. Optional. The date is given as unixtime, in seconds. If no date is supplied, only the time of upload will be available server-side.- See Also:
- Constant Field Values
-
TICKET_FILE_AUTHOR
public static final String TICKET_FILE_AUTHOR
Author of the uploaded file. Optional.- See Also:
- Constant Field Values
-
TICKET_FILE_TITLE
public static final String TICKET_FILE_TITLE
Short free-text title of the uploaded file, analogous to the title for a Bambuser broadcast. Optional.- See Also:
- Constant Field Values
-
TICKET_FILE_CUSTOM_DATA
public static final String TICKET_FILE_CUSTOM_DATA
Arbitrary data stored along with the file. Max 10KB per uploaded file. Optional.- See Also:
- Constant Field Values
-
TICKET_FILE_POS_LAT
public static final String TICKET_FILE_POS_LAT
Geo-position latitude (degrees, decimal) of the uploaded file. Optional.- See Also:
- Constant Field Values
-
TICKET_FILE_POS_LON
public static final String TICKET_FILE_POS_LON
Geo-position longitude (degrees, decimal) of the uploaded file. Optional.- See Also:
- Constant Field Values
-
TICKET_FILE_POS_ACCURACY
public static final String TICKET_FILE_POS_ACCURACY
Geo-position accuracy (meters, decimal) of the provided position. Optional.- See Also:
- Constant Field Values
-
-
Method Detail
-
getUploadTicketForApplicationId
public static Pair<Integer,String> getUploadTicketForApplicationId(Context context, Map<String,String> params, String applicationId)
Method for doing a POST request to the Bambuser ticket API endpoint, requiring a Bambuser-provided application ID. Request always done using HTTPS. This must not be invoked on the UI thread.For further information on using this method, see the UploadHelper class in the example app source.
- Parameters:
context
- A Context object. Must not be null.params
- Parameters for the ticket endpoint. Some are mandatory. Must not be null.applicationId
- Secret Bambuser-provided application specific ID.- Returns:
- A Pair containing the http response code and the response String, if any. The response String is expected to be a JSON object containing an "upload_url", to which the actual file data should be uploaded using a PUT HTTP(S) request.
-
-