Created
August 27, 2016 08:42
-
-
Save Foso/a98a7c11e795808fa8ca6471464f068e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SampleRetrofitInterface { | |
@GET("/posts") | |
Call<List<Post>> getPostList(); | |
@GET("/posts/{id}") | |
Call<Post> getSinglePost(@Path("id") int postId); | |
@GET("/posts/") | |
Call<Post> getSinglePostQuery(@Query("userId") int userId); | |
@PUT("/posts/{id}") | |
Call<Post> putSinglePost(@Path("id") int postId); | |
@DELETE("/posts/{id}") | |
Call<String> deletePost(@Path("id") int postId); | |
@POST("users/new") | |
Call<Post> createPost(@Body Post post); | |
Retrofit retrofit = new Retrofit.Builder() | |
.addConverterFactory(GsonConverterFactory.create()) | |
.baseUrl("https://jsonplaceholder.typicode.com") | |
.build(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment