Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.kontakti;
- import java.util.List;
- import retrofit2.Call;
- import retrofit2.http.Body;
- import retrofit2.http.GET;
- import retrofit2.http.DELETE;
- import retrofit2.http.POST;
- import retrofit2.http.PUT;
- import retrofit2.http.Path;
- public interface ContactAPI {
- public class message{
- public String status;
- public message(message m){
- this.status = m.status;
- }
- public message(String _status){
- this.status = _status;
- }
- }
- public class contacts{
- public int ID;
- public String name;
- public String address;
- public String phone;
- public String email;
- public contacts(contacts m){
- ID = m.ID;
- name = m.name;
- address = m.address;
- phone = m.phone;
- email = m.email;
- }
- public contacts(int _ID, String _name, String _address,
- String _phone, String _email){
- ID = _ID;
- name = _name;
- address = _address;
- phone = _phone;
- email = _email;
- }
- }
- @GET("/api/users")
- public Call<List<contacts>> api_users();
- @GET("/api/users/{id}")
- public Call<contacts> api_get_user(@Path("id") int id);
- @POST("/api/users/add")
- public Call<contacts> api_add_user(@Body contacts c);
- @PUT("/api/users/update")
- public Call<contacts> api_update_user(@Body contacts c);
- @DELETE("/api/users/delete/{id}")
- public Call<message> api_delete_user(@Path("id") int id);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement