1
0
Fork 0

bulk remove queue records

This commit is contained in:
xeviff 2024-05-20 16:58:54 +02:00
parent 81ae8678ce
commit e4284af7f0
4 changed files with 31 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<groupId>tv.mangrana</groupId>
<artifactId>mangrana-commons</artifactId>
<version>7.0.0</version>
<version>7.1.2</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>

View File

@ -2,6 +2,7 @@ package tv.mangrana.sonarr.api.client.gateway;
import tv.mangrana.sonarr.api.schema.command.RefreshSerieCommand;
import tv.mangrana.sonarr.api.schema.history.SonarrHistory;
import tv.mangrana.sonarr.api.schema.queue.QueueBulk;
import tv.mangrana.sonarr.api.schema.queue.SonarrQueue;
import tv.mangrana.sonarr.api.schema.series.SonarrSerie;
import tv.mangrana.utils.rest.APIInterface;
@ -32,6 +33,11 @@ public interface SonarrAPIInterface extends APIInterface {
void deleteQueueElement(@PathParam("id") Integer idElement, @QueryParam("removeFromClient") boolean removeFromClient,
@QueryParam("apikey") String apikey);
@DELETE
@Path("/queue/bulk")
@Consumes({ MediaType.APPLICATION_JSON })
void deleteQueueElements(QueueBulk ids, @QueryParam("apikey") String apikey);
@GET
@Path("/series/{id}")
@Produces({ MediaType.APPLICATION_JSON })

View File

@ -3,6 +3,7 @@ package tv.mangrana.sonarr.api.client.gateway;
import tv.mangrana.config.CommonConfigFileLoader;
import tv.mangrana.sonarr.api.schema.command.RefreshSerieCommand;
import tv.mangrana.sonarr.api.schema.history.SonarrHistory;
import tv.mangrana.sonarr.api.schema.queue.QueueBulk;
import tv.mangrana.sonarr.api.schema.queue.SonarrQueue;
import tv.mangrana.sonarr.api.schema.series.SonarrSerie;
import tv.mangrana.utils.EasyLogger;
@ -39,6 +40,11 @@ public class SonarrApiGateway {
log("sent Delete command to Sonarr for the queue element with id "+idElement);
}
public void deleteQueueElements(List<Integer> ids) {
proxy.deleteQueueElements(new QueueBulk(ids), apiKey);
log("sent Delete command to Sonarr for the queue elements with ids "+ids);
}
public SonarrSerie getSerieById(Integer seriesId) {
SonarrSerie serie = null;
try {

View File

@ -0,0 +1,18 @@
package tv.mangrana.sonarr.api.schema.queue;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class QueueBulk {
@JsonProperty("ids")
List<Integer> ids;
public QueueBulk(List<Integer> ids) {
this.ids = ids;
}
public List<Integer> getIds() {
return ids;
}
}