Package ch.aaap.harvestclient.impl
Class ExpensesApiImpl
Object
ch.aaap.harvestclient.impl.ExpensesApiImpl
- All Implemented Interfaces:
 Api.Create<Expense>,Api.Delete<Expense>,Api.Get<Expense>,Api.Simple<Expense>,ExpensesApi
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionattachReceipt(Reference<Expense> expenseReference, File file) Attach a file as a receipt for an ExpenseattachReceipt(Reference<Expense> expenseReference, InputStream inputStream, String fileName) Attach a file as a receipt for an ExpenseCreate a new Expense.voidDelete an existing Expense.Return an existing Expense.list(ExpenseFilter filter) list(ExpenseFilter filter, int page, int perPage) update(Reference<Expense> expenseReference, ExpenseUpdateInfo toChange) Updates the specific expense by setting the values of the parameters passed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.aaap.harvestclient.api.ExpensesApi
removeReceipt 
- 
Constructor Details
- 
ExpensesApiImpl
 
 - 
 - 
Method Details
- 
list
- Specified by:
 listin interfaceExpensesApi- Parameters:
 filter- filtering options- Returns:
 - a list of all Expenses in the account, sorted by creation date, newest first. If no admin rights, return only the user expenses.
 
 - 
list
- Specified by:
 listin interfaceExpensesApi- Parameters:
 filter- filtering optionspage- the page numberperPage- how many results to return for one page. Max 100- Returns:
 - a list of all Expenses in the account, sorted by creation date, newest first. If no admin rights, return only the user expenses.
 
 - 
get
Description copied from interface:ExpensesApiReturn an existing Expense.- Specified by:
 getin interfaceApi.Get<Expense>- Specified by:
 getin interfaceExpensesApi- Parameters:
 expenseReference- a reference to an existing Expense- Returns:
 - the full Expense object
 
 - 
create
Description copied from interface:ExpensesApiCreate a new Expense. Example:Expense expense = harvest.expenses().create(ImmutableExpense.builder() .name("expense name") .build());- Specified by:
 createin interfaceApi.Create<Expense>- Specified by:
 createin interfaceExpensesApi- Parameters:
 creationInfo- creation information- Returns:
 - the created Expense
 
 - 
update
Description copied from interface:ExpensesApiUpdates the specific expense by setting the values of the parameters passed. Any parameters not provided will be left unchanged- Specified by:
 updatein interfaceExpensesApi- Parameters:
 expenseReference- An existing Expense to be updatedtoChange- the changes to be performed- Returns:
 - the updated Expense
 
 - 
attachReceipt
public Expense attachReceipt(Reference<Expense> expenseReference, InputStream inputStream, String fileName) throws IOException Description copied from interface:ExpensesApiAttach a file as a receipt for an Expense- Specified by:
 attachReceiptin interfaceExpensesApi- Parameters:
 expenseReference- An existing Expense to be updatedinputStream- a receipt inputstream (allowed filetypes: png, gif, pdf, jpeg, jpg). Calling code is responsible for closing the streamfileName- a filename for Harvest- Returns:
 - the updated Expense
 - Throws:
 IOException- if there is a problem reading the inputStream
 - 
attachReceipt
Description copied from interface:ExpensesApiAttach a file as a receipt for an Expense- Specified by:
 attachReceiptin interfaceExpensesApi- Parameters:
 expenseReference- An existing Expense to be updatedfile- a receipt file (allowed extensions: png, gif, pdf, jpeg, jpg)- Returns:
 - the updated Expense
 
 - 
delete
Description copied from interface:ExpensesApiDelete an existing Expense. Only possible if no time entries are associated with it- Specified by:
 deletein interfaceApi.Delete<Expense>- Specified by:
 deletein interfaceExpensesApi- Parameters:
 expenseReference- a reference to the Expense to be deleted
 
 -