Newer
Older
NemophilaClient / app / src / main / java / com / example / nemophila / resources / FriendsRest.java
package com.example.nemophila.resources;

import com.example.nemophila.entities.AccountNameJson;
import com.example.nemophila.entities.PostJson;

import java.util.Collection;

import retrofit2.Call;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.PUT;
import retrofit2.http.Path;

public interface FriendsRest {
    @GET("accounts/{uid}/friends")
    Call<Collection<AccountNameJson>> getFriends(
            @Path("uid") String uid
    );

    @FormUrlEncoded
    @PUT("accounts/{uid}/friends/{fid}")
    Call<Void> putFriend(
            @Path("uid") String uid,
            @Path("fid") String fid,
            @Field("token") String token
    );

    @DELETE("accounts/{uid}/friends/{fid}")
    Call<Void> deleteFriend(
            @Path("uid") String uid,
            @Path("fid") String fid,
            @Field("token") String token
    );

    @GET("/accounts/{uid}/requesting")
    Call<Collection<AccountNameJson>> getRequesting(
            @Path("uid") String uid
    );

    @FormUrlEncoded
    @PUT("accounts/{uid}/requesting/{requesting_id}")
    Call<Void> putRequesting(
            @Path("uid") String uid,
            @Path("requesting_id") String requesting_id,
            @Field("token") String token
    );

    @FormUrlEncoded
    @DELETE("accounts/{uid}/requesting/{requesting_id}")
    Call<Void> deleteRequesting(
            @Path("uid") String uid,
            @Path("requesting_id") String requesting_id,
            @Field("token") String token
    );

    @GET("accounts/{uid}/requested")
    Call<Collection<AccountNameJson>> getRequested(
            @Path("uid") String uid
    );

    @FormUrlEncoded
    @DELETE("accounts/{uid}/requested/{requested_id}")
    Call<Void> deleteRequested(
            @Path("uid") String uid,
            @Path("requested_id") String requested_id,
            @Field("token") String token
    );

}