Package ch.aaap.harvestclient.impl
Class InvoicesApiImpl
Object
ch.aaap.harvestclient.impl.InvoicesApiImpl
- All Implemented Interfaces:
Api.Create<Invoice>
,Api.Delete<Invoice>
,Api.Get<Invoice>
,Api.Simple<Invoice>
,InvoicesApi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddLineItem
(Reference<Invoice> invoiceReference, InvoiceItem creationInfo) Create a new invoice line item and add it to the given invoiceaddLineItems
(Reference<Invoice> invoiceReference, List<InvoiceItem> creationInfoList) Create new invoice line items and add it to the given invoiceCreate a new Invoice according to given creation information.createFrom
(InvoiceImportInfo invoiceCreationInfo) Create a new Invoice based on time tracked and expense.void
Delete an existing Invoice.deleteLineItem
(Reference<Invoice> invoiceReference, Reference<InvoiceItem> invoiceItemReference) Delete an existing line itemdeleteLineItems
(Reference<Invoice> invoiceReference, List<? extends Reference<InvoiceItem>> invoiceItemReferenceList) Delete an existing line itemlist
(InvoiceFilter filter) Return a list of invoices, sorted by issue date, newest first.list
(InvoiceFilter filter, int page, int perPage) Return a list of invoices, sorted by issue date, newest first.update
(Reference<Invoice> invoiceReference, InvoiceUpdateInfo toChange) Updates an existing Invoice with the properties set in InvoiceUpdateInfo.updateLineItem
(Reference<Invoice> invoiceReference, Reference<InvoiceItem> invoiceItemReference, InvoiceItemUpdateInfo updateInfo) Update an existing line itemupdateLineItems
(Reference<Invoice> invoiceReference, List<? extends Reference<InvoiceItem>> invoiceItemReferenceList, List<InvoiceItemUpdateInfo> updateInfoList) Update an existing line item
-
Constructor Details
-
InvoicesApiImpl
-
-
Method Details
-
list
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 interfaceInvoicesApi
- Parameters:
filter
- filtering options- Returns:
- a (filtered) list of Invoices
-
list
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 interfaceInvoicesApi
- Parameters:
filter
- filtering optionspage
- the page numberperPage
- how many results to return for one page. Max 100- Returns:
- a (filtered) list of Invoices
-
get
- Specified by:
get
in interfaceApi.Get<Invoice>
- Specified by:
get
in interfaceInvoicesApi
- Parameters:
invoiceReference
- a reference to an existing Invoice- Returns:
- Return a full Invoice object
-
create
Description copied from interface:InvoicesApi
Create a new Invoice according to given creation information.- Specified by:
create
in interfaceApi.Create<Invoice>
- Specified by:
create
in interfaceInvoicesApi
- Parameters:
invoiceCreationInfo
- the creation options- Returns:
- the newly created Invoice
-
createFrom
Description copied from interface:InvoicesApi
Create a new Invoice based on time tracked and expense.- Specified by:
createFrom
in interfaceInvoicesApi
- Parameters:
invoiceCreationInfo
- the creation options- Returns:
- the newly created Invoice
-
addLineItem
Description copied from interface:InvoicesApi
Create a new invoice line item and add it to the given invoice- Specified by:
addLineItem
in interfaceInvoicesApi
- Parameters:
invoiceReference
- the invoice to add the item tocreationInfo
- 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 interfaceInvoicesApi
- Parameters:
invoiceReference
- the invoice that contains the iteminvoiceItemReference
- the line item to be deletedupdateInfo
- 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 interfaceInvoicesApi
- Parameters:
invoiceReference
- the invoice that contains the iteminvoiceItemReference
- 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 interfaceInvoicesApi
- Parameters:
invoiceReference
- the invoice to add the item tocreationInfoList
- 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 interfaceInvoicesApi
- Parameters:
invoiceReference
- the invoice that contains the iteminvoiceItemReferenceList
- a list of the item references to be updated, in the same order as updateInfoListupdateInfoList
- 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 interfaceInvoicesApi
- Parameters:
invoiceReference
- the invoice that contains the iteminvoiceItemReferenceList
- a list of the line items to be deleted- Returns:
- the updated Invoice
-
update
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. SeeInvoicesApi.deleteLineItems(Reference, List)
to delete existing items- Specified by:
update
in interfaceInvoicesApi
- Parameters:
invoiceReference
- the existing invoice to be updatedtoChange
- the properties to be updated- Returns:
- the updated Invoice
-
delete
Description copied from interface:InvoicesApi
Delete an existing Invoice.- Specified by:
delete
in interfaceApi.Delete<Invoice>
- Specified by:
delete
in interfaceInvoicesApi
- Parameters:
invoiceReference
- a reference to an existing Invoice to be deleted
-