wedroid/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java

91 lines
3.1 KiB
Java

package it.unisannio.ding.ids.wedroid.wrapper.api;
import it.unisannio.ding.ids.wedroid.wrapper.entity.Card;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
public interface CardService {
/**
* Get all cards belonging to a list
*
* @param boardID The board ID of cards
* @param lidtID The list ID of cards
* @return list of cards in the list
*/
@GET("/api/boards/{board}/lists/{list}/cards")
Call<List<Card>> getAllCards(@Path("board") String boardID, @Path("list") String lidtID);
/**
* Delete a card
*
* @param boardID The board ID of card
* @param listID The list ID of card
* @param cardID The card ID
* @return void
*/
@DELETE("/api/boards/{board}/lists/{list}/cards/{card}")
Call<Void> deleteCard(@Path("board") String boardID, @Path("list") String listID, @Path("card") String cardID);
/**
*
* @param card new Card
* @param boardID The ID of the board destination
* @param listID The ID of the list destination
* @return the card with matching ID
*/
@POST("/api/boards/{board}/lists/{list}/cards")
Call<Card> newCard(@Path("board") String boardID, @Path("list") String listID, @Body Card card);
/**
* Get information card
* @param boardID the ID of the board
* @param listID the ID of the list
* @param cardID the ID of the card
* @return card body
*/
@GET("/api/boards/{board}/lists/{list}/cards/{card}")
Call<Card> getCard(@Path("board") String boardID, @Path("list") String listID, @Path("card") String cardID);
/**
* Get list of cards by swinlaneID
* @param boardID the ID of the board
* @param swimlaneID the ID of the swimlane
* @return list of swimlane cards
*/
@GET("/api/boards/{board}/swimlanes/{swimlane}/cards")
Call<List<Card>> getCardsForswimlane(@Path("board") String boardID, @Path("swimlane") String swimlaneID);
/**
* Update a card
*
* @param card params to update
* @param boardID the id of the board
* @param listID the id of the list
* @param cardID the id of the card to modify
* @return The card with the matching ID
*/
@Headers("Content-Type: application/merge-patch+json")
@PUT("/api/boards/{board}/lists/{list}/cards/{card}")
Call<Card> putCard(@Path("board") String boardID, @Path("list") String listID,
@Path("card") String cardID, @Body Card card);
@FormUrlEncoded
@PUT("/api/boards/{board}/lists/{list}/cards/{card}")
Call<Card> moveCard(
@Path("board") String boardID,
@Path("list") String oldListID,
@Path("card") String cardID,
@Field("listId") String newListId
);
}