001package io.konik.sdk.invoices;
002
003import java.util.Arrays;
004import java.util.LinkedList;
005import java.util.List;
006
007import io.konik.sdk.http.ZinvoiceHttpClient;
008
009public class RestInvoicesApi implements InvoicesApi {
010
011   private final ZinvoiceHttpClient httpClient;
012
013   public RestInvoicesApi(ZinvoiceHttpClient httpClient) {
014      this.httpClient = httpClient;
015   }
016
017   /**
018    * Returns all invoices from outbox.
019    * @return
020    */
021   public List<InvoicesListElement> outbox() {
022      InvoicesListElement[] response = httpClient.get("/invoices/outbox", InvoicesListElement[].class);
023      return new LinkedList<InvoicesListElement>(Arrays.asList(response));
024   }
025
026   /**
027    * Returns all invoices from inbox.
028    * @return
029    */
030   public List<InvoicesListElement> inbox() {
031      InvoicesListElement[] response = httpClient.get("/invoices/inbox", InvoicesListElement[].class);
032      return new LinkedList<InvoicesListElement>(Arrays.asList(response));
033   }
034}