Class InvoicesApiImpl

Object
ch.aaap.harvestclient.impl.InvoicesApiImpl
All Implemented Interfaces:
Api.Create<Invoice>, Api.Delete<Invoice>, Api.Get<Invoice>, Api.Simple<Invoice>, InvoicesApi

public class InvoicesApiImpl extends Object implements InvoicesApi
  • Constructor Details

  • Method Details

    • list

      public List<Invoice> list(InvoiceFilter filter)
      Description copied from interface: InvoicesApi
      Return a list of invoices, sorted by issue date, newest first. Use the filter object to filter the list.
      Specified by:
      list in interface InvoicesApi
      Parameters:
      filter - filtering options
      Returns:
      a (filtered) list of Invoices
    • list

      public Pagination<Invoice> list(InvoiceFilter filter, int page, int perPage)
      Description copied from interface: InvoicesApi
      Return a list of invoices, sorted by issue date, newest first. Use the filter object to filter the list. Page and perPage allow controlling how many results to return.
      Specified by:
      list in interface InvoicesApi
      Parameters:
      filter - filtering options
      page - the page number
      perPage - how many results to return for one page. Max 100
      Returns:
      a (filtered) list of Invoices
    • get

      public Invoice get(Reference<Invoice> invoiceReference)
      Specified by:
      get in interface Api.Get<Invoice>
      Specified by:
      get in interface InvoicesApi
      Parameters:
      invoiceReference - a reference to an existing Invoice
      Returns:
      Return a full Invoice object
    • create

      public Invoice create(Invoice invoiceCreationInfo)
      Description copied from interface: InvoicesApi
      Create a new Invoice according to given creation information.
      Specified by:
      create in interface Api.Create<Invoice>
      Specified by:
      create in interface InvoicesApi
      Parameters:
      invoiceCreationInfo - the creation options
      Returns:
      the newly created Invoice
    • createFrom

      public Invoice createFrom(InvoiceImportInfo invoiceCreationInfo)
      Description copied from interface: InvoicesApi
      Create a new Invoice based on time tracked and expense.
      Specified by:
      createFrom in interface InvoicesApi
      Parameters:
      invoiceCreationInfo - the creation options
      Returns:
      the newly created Invoice
    • addLineItem

      public Invoice addLineItem(Reference<Invoice> invoiceReference, InvoiceItem creationInfo)
      Description copied from interface: InvoicesApi
      Create a new invoice line item and add it to the given invoice
      Specified by:
      addLineItem in interface InvoicesApi
      Parameters:
      invoiceReference - the invoice to add the item to
      creationInfo - the line item to be created
      Returns:
      the updated Invoice
    • updateLineItem

      public Invoice updateLineItem(Reference<Invoice> invoiceReference, Reference<InvoiceItem> invoiceItemReference, InvoiceItemUpdateInfo updateInfo)
      Description copied from interface: InvoicesApi
      Update an existing line item
      Specified by:
      updateLineItem in interface InvoicesApi
      Parameters:
      invoiceReference - the invoice that contains the item
      invoiceItemReference - the line item to be deleted
      updateInfo - the line item to be updated
      Returns:
      the updated Invoice
    • deleteLineItem

      public Invoice deleteLineItem(Reference<Invoice> invoiceReference, Reference<InvoiceItem> invoiceItemReference)
      Description copied from interface: InvoicesApi
      Delete an existing line item
      Specified by:
      deleteLineItem in interface InvoicesApi
      Parameters:
      invoiceReference - the invoice that contains the item
      invoiceItemReference - the line item to be deleted
      Returns:
      the updated Invoice
    • addLineItems

      public Invoice addLineItems(Reference<Invoice> invoiceReference, List<InvoiceItem> creationInfoList)
      Description copied from interface: InvoicesApi
      Create new invoice line items and add it to the given invoice
      Specified by:
      addLineItems in interface InvoicesApi
      Parameters:
      invoiceReference - the invoice to add the item to
      creationInfoList - a list of items to be created
      Returns:
      the updated Invoice
    • updateLineItems

      public Invoice updateLineItems(Reference<Invoice> invoiceReference, List<? extends Reference<InvoiceItem>> invoiceItemReferenceList, List<InvoiceItemUpdateInfo> updateInfoList)
      Description copied from interface: InvoicesApi
      Update an existing line item
      Specified by:
      updateLineItems in interface InvoicesApi
      Parameters:
      invoiceReference - the invoice that contains the item
      invoiceItemReferenceList - a list of the item references to be updated, in the same order as updateInfoList
      updateInfoList - a list of the line items to be updated
      Returns:
      the updated Invoice
    • deleteLineItems

      public Invoice deleteLineItems(Reference<Invoice> invoiceReference, List<? extends Reference<InvoiceItem>> invoiceItemReferenceList)
      Description copied from interface: InvoicesApi
      Delete an existing line item
      Specified by:
      deleteLineItems in interface InvoicesApi
      Parameters:
      invoiceReference - the invoice that contains the item
      invoiceItemReferenceList - a list of the line items to be deleted
      Returns:
      the updated Invoice
    • update

      public Invoice update(Reference<Invoice> invoiceReference, InvoiceUpdateInfo toChange)
      Description copied from interface: InvoicesApi
      Updates an existing Invoice with the properties set in InvoiceUpdateInfo. Be careful: setting a list of InvoiceItem will add them to the existing ones, not replace them. See InvoicesApi.deleteLineItems(Reference, List) to delete existing items
      Specified by:
      update in interface InvoicesApi
      Parameters:
      invoiceReference - the existing invoice to be updated
      toChange - the properties to be updated
      Returns:
      the updated Invoice
    • delete

      public void delete(Reference<Invoice> invoiceReference)
      Description copied from interface: InvoicesApi
      Delete an existing Invoice.
      Specified by:
      delete in interface Api.Delete<Invoice>
      Specified by:
      delete in interface InvoicesApi
      Parameters:
      invoiceReference - a reference to an existing Invoice to be deleted