Skip to content

Instantly share code, notes, and snippets.

@rcgonzalezf
Created September 29, 2015 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcgonzalezf/51f66f4699f223fcfad9 to your computer and use it in GitHub Desktop.
Save rcgonzalezf/51f66f4699f223fcfad9 to your computer and use it in GitHub Desktop.
Upload a Video, using Retrofit.
/*
* @author jules
*
*/
public interface VideoServiceProxy {
public static final String DATA_PARAMETER = "data";
public static final String ID_PARAMETER = "id";
public static final String VIDEO_SVC_PATH = "/video";
public static final String VIDEO_DATA_PATH = VIDEO_SVC_PATH + "/{id}/data";
/**
* This endpoint allows clients to add Video objects by sending POST requests
* that have an application/json body containing the Video object information.
*
* @return
*/
@POST(VIDEO_SVC_PATH)
public Video addVideo(@Body Video video);
/**
* This endpoint allows clients to set the mpeg video data for previously
* added Video objects by sending multipart POST requests to the server.
* The URL that the POST requests should be sent to includes the ID of the
* Video that the data should be associated with (e.g., replace {id} in
* the url /video/{id}/data with a valid ID of a video, such as /video/1/data
* -- assuming that "1" is a valid ID of a video).
*
* @return
*/
@Multipart
@POST(VIDEO_DATA_PATH)
public VideoStatus setVideoData(@Path(ID_PARAMETER) long id, @Part(DATA_PARAMETER) TypedFile videoData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment