Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cleanup for using named constants instead of magic strings. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,44 @@ public interface VideoSvcApi {

public static final String ID_PARAMETER = "id";

public static final String RATING_PARAMETER = "rating";

public static final String TOKEN_PATH = "/oauth/token";

// The path where we expect the VideoSvc to live
public static final String VIDEO_SVC_PATH = "/video";

public static final String VIDEO_ITEM_PATH
= VIDEO_SVC_PATH + "/{"+VideoSvcApi.ID_PARAMETER+"}";

// The path where we expect the VideoSvc to live
public static final String VIDEO_DATA_PATH = VIDEO_SVC_PATH + "/{"+VideoSvcApi.ID_PARAMETER+"}/data";
public static final String VIDEO_DATA_PATH = VIDEO_ITEM_PATH + "/data";

public static final String VIDEO_RATING_PATH = VIDEO_ITEM_PATH + "/rating";

public static final String VIDEO_RATE_VIDEO_PATH
= VIDEO_RATING_PATH + "/{"+VideoSvcApi.RATING_PARAMETER+"}";

@GET(VIDEO_SVC_PATH)
public Collection<Video> getVideoList();

@GET(VIDEO_SVC_PATH + "/{id}")
public Video getVideoById(@Path("id") long id);
@GET(VIDEO_ITEM_PATH)
public Video getVideoById(@Path(ID_PARAMETER) long id);

@POST(VIDEO_SVC_PATH)
public Video addVideo(@Body Video v);

@POST(VIDEO_SVC_PATH+"/{id}/rating/{rating}")
public AverageVideoRating rateVideo(@Path("id") long id, @Path("rating") int rating);
@POST(VIDEO_RATE_VIDEO_PATH)
public AverageVideoRating rateVideo(@Path(ID_PARAMETER) long id,
@Path(RATING_PARAMETER) int rating);

@GET(VIDEO_SVC_PATH+"/{id}/rating")
public AverageVideoRating getVideoRating(@Path("id") long id);
@GET(VIDEO_RATING_PATH)
public AverageVideoRating getVideoRating(@Path(ID_PARAMETER) long id);

@Multipart
@POST(VIDEO_DATA_PATH)
public VideoStatus setVideoData(@Path(ID_PARAMETER) long id, @Part(DATA_PARAMETER) TypedFile videoData);
public VideoStatus setVideoData(@Path(ID_PARAMETER) long id,
@Part(DATA_PARAMETER) TypedFile videoData);

/**
* This method uses Retrofit's @Streaming annotation to indicate that the
Expand All @@ -75,7 +86,7 @@ public interface VideoSvcApi {
* @return
*/
@Streaming
@GET(VIDEO_DATA_PATH)
Response getVideoData(@Path(ID_PARAMETER) long id);
@GET(VIDEO_DATA_PATH)
Response getVideoData(@Path(ID_PARAMETER) long id);

}