Newer
Older
CosmosClient / app / src / main / java / com / example / cosmosclient / resources / GroupsRest.java
package com.example.cosmosclient.resources;

import com.example.cosmosclient.entities.AddRequestsResponse;
import com.example.cosmosclient.entities.CreateGroupResponse;
import com.example.cosmosclient.entities.Group;
import com.example.cosmosclient.entities.Request;
import com.example.cosmosclient.entities.Requests;
import com.example.cosmosclient.entities.User;

import java.util.ArrayList;
import java.util.Date;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;


public interface GroupsRest {
    @POST("groups")
    @FormUrlEncoded
    Call<CreateGroupResponse> createGroup(@Field("name") String name, @Field("uId") String uId, @Field("token") String token);

    @POST("groups/{gId}/requests")
    @FormUrlEncoded
    Call<AddRequestsResponse> addRequests(@Path("gId") String gId, @Field("uId") String uId, @Field("product") String product, @Field("deadline") String deadline, @Field("location") int location, @Field("token") String token);

    @GET("groups/{gId}/requests")
    Call<Requests> getRequestsListByGid(@Path("gId") String gId, @Query("token") String token, @Query("detail") boolean detail, @Query("quantity") int quantity);

    @PUT("groups/{gId}/requests/{rId}")
    @FormUrlEncoded
    Call<AddRequestsResponse> updateRequest(@Path("gId") String gId, @Path("rId") String rId, @Field("uId") String uId, @Field("product") String product, @Field("deadline") String deadline, @Field("location") int location, @Field("done") boolean done, @Field("token") String token);

//    @GET("{gId}/requests/{rId}")
//    Call<Request> getRequestsDetailByGidAndRid(@Path("gid") String gid, @Path("rid") String rid, @Query("token") String token);

}