/// <summary> /// Get the details of an expense. /// </summary> /// <param name="expense_id">The expense_id is the identifier of the expense.</param> /// <returns>Expense object.</returns> public Expense Get(string expense_id) { string url = baseAddress + "/" + expense_id; var responce = ZohoHttpClient.get(url, getQueryParameters()); return(ExpenseParser.getExpense(responce)); }
/// <summary> /// Create a billable or non-billable expense. /// </summary> /// <param name="new_expense">The new_expense is the Expense object which contains the new expense information with account_id and amount as mandatory attributes.</param> /// <param name="receipt_path">The receipt_path is the path of the file which is going to be attaches as a receipt to the expense.</param> /// <returns>Expense object.</returns> public Expense Create(Expense new_expense, string receipt_path) { string url = baseAddress; var json = JsonConvert.SerializeObject(new_expense); var jsonstring = new Dictionary <object, object>(); jsonstring.Add("JSONString", json); var attachments = new string[] { receipt_path }; var file = new KeyValuePair <string, string[]>("receipt", attachments); var responce = ZohoHttpClient.post(url, getQueryParameters(), jsonstring, file); return(ExpenseParser.getExpense(responce)); }
/// <summary> /// Update an existing expense. /// </summary> /// <param name="expense_id">The expense_id is the identifier of the expense.</param> /// <param name="update_info">The update_info is the Expense object which contains the update information.</param> /// <param name="receipt_path">The receipt_path is the path of the file which is going to be attaches as a receipt to the expense.</param> /// <returns>Expense object.</returns> public Expense Update(string expense_id, Expense update_info, string receipt_path) { string url = baseAddress + "/" + expense_id; var file = new KeyValuePair <string, string>("receipt", receipt_path); var json = JsonConvert.SerializeObject(update_info); var jsonstring = new Dictionary <object, object>(); jsonstring.Add("JSONString", json); var responce = ZohoHttpClient.put(url, getQueryParameters(), jsonstring, file); return(ExpenseParser.getExpense(responce)); }