misp-bump/app/src/main/java/lu/circl/mispbump/interfaces/MispRestInterface.java

64 lines
1.7 KiB
Java
Raw Normal View History

2019-06-19 20:01:49 +02:00
package lu.circl.mispbump.interfaces;
2019-05-27 16:06:07 +02:00
import java.util.List;
2019-06-19 20:01:49 +02:00
import lu.circl.mispbump.models.restModels.MispOrganisation;
2019-07-16 14:53:36 +02:00
import lu.circl.mispbump.models.restModels.MispRole;
2019-06-19 20:01:49 +02:00
import lu.circl.mispbump.models.restModels.MispServer;
import lu.circl.mispbump.models.restModels.MispUser;
import lu.circl.mispbump.models.restModels.Organisation;
import lu.circl.mispbump.models.restModels.Server;
import lu.circl.mispbump.models.restModels.User;
import lu.circl.mispbump.models.restModels.Version;
2019-05-27 16:06:07 +02:00
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
2019-05-27 20:03:27 +02:00
/**
* RetroFit2 interface for communication with misp instances
*/
2019-06-19 20:01:49 +02:00
public interface MispRestInterface {
2019-05-27 16:06:07 +02:00
2019-06-04 20:48:24 +02:00
// settings routes
@GET("servers/getPyMISPVersion")
Call<Version> pyMispVersion();
2019-07-16 14:53:36 +02:00
@GET("admin/roles")
Call<List<MispRole>> getRoles();
2019-05-27 16:06:07 +02:00
// user routes
@GET("users/view/me")
Call<MispUser> getMyUserInformation();
@GET("users/view/{value}")
Call<MispUser> getUser(@Path("value") int userId);
2019-07-03 23:13:25 +02:00
@GET("admin/users")
Call<List<MispUser>> getAllUsers();
2019-05-27 16:06:07 +02:00
@POST("admin/users/add")
Call<MispUser> addUser(@Body User user);
// organisation routes
@GET("organisations/view/{value}")
Call<MispOrganisation> getOrganisation(@Path("value") int orgId);
@GET("organisations")
Call<List<MispOrganisation>> getAllOrganisations();
2019-05-27 16:06:07 +02:00
@POST("admin/organisations/add")
Call<MispOrganisation> addOrganisation(@Body Organisation organisation);
// server routes
@GET("servers/index")
2019-07-03 23:13:25 +02:00
Call<List<MispServer>> getAllServers();
2019-05-27 16:06:07 +02:00
@POST("servers/add")
2019-06-04 20:48:24 +02:00
Call<Server> addServer(@Body Server server);
2019-05-27 20:03:27 +02:00
}