From dc874cb169f43dd3dbcd0834475d2c7fb847d9a0 Mon Sep 17 00:00:00 2001 From: Adrian Lapierre Date: Thu, 12 Oct 2023 09:58:38 +0200 Subject: [PATCH] SessionQueryResponseAdapter for easy querying session status with KsefResultStream --- .../iterator/SessionQueryResponseAdapter.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ksef-api/src/main/java/io/alapierre/ksef/client/iterator/SessionQueryResponseAdapter.java diff --git a/ksef-api/src/main/java/io/alapierre/ksef/client/iterator/SessionQueryResponseAdapter.java b/ksef-api/src/main/java/io/alapierre/ksef/client/iterator/SessionQueryResponseAdapter.java new file mode 100644 index 0000000..d190d22 --- /dev/null +++ b/ksef-api/src/main/java/io/alapierre/ksef/client/iterator/SessionQueryResponseAdapter.java @@ -0,0 +1,36 @@ +package io.alapierre.ksef.client.iterator; + +import io.alapierre.ksef.client.model.rest.auth.SessionStatus; +import lombok.RequiredArgsConstructor; + +import java.util.List; + +/** + * @author Adrian Lapierre {@literal al@alapierre.io} + * Copyrights by original author 2023.10.12 + */ +@RequiredArgsConstructor +public class SessionQueryResponseAdapter implements PageableResult { + + private final SessionStatus sessionStatus; + + @Override + public int getNumberOfElements() { + return sessionStatus.getNumberOfElements(); + } + + @Override + public int getPageSize() { + return sessionStatus.getPageSize(); + } + + @Override + public int getPageOffset() { + return sessionStatus.getPageOffset(); + } + + @Override + public List getItems() { + return sessionStatus.getInvoiceStatusList(); + } +}