private IRestRequest UpdateExpenseCategoryRequest(long expenseCategoryId, ExpenseCategoryOptions options) { var request = Request($"{ExpenseCategoriesResource}/{expenseCategoryId}", RestSharp.Method.PUT); request.AddBody(options); return(request); }
/// <summary> /// Creates a new expense category under the authenticated account. Makes a POST and a GET request to the Expense_Categories resource. /// </summary> /// <param name="options">The options for the new expense category to be created</param> public ExpenseCategory CreateExpenseCategory(ExpenseCategoryOptions options) { var request = Request("expense_categories", RestSharp.Method.POST); request.AddBody(options); return(Execute <ExpenseCategory>(request)); }
/// <summary> /// Updates an expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource. /// </summary> /// <param name="expenseCategoryId">The ID for the expense category to update</param> /// <param name="options">The options to be updated</param> public ExpenseCategory UpdateExpenseCategory(long expenseCategoryId, ExpenseCategoryOptions options) { var request = Request("expense_categories/" + expenseCategoryId, RestSharp.Method.PUT); request.AddBody(options); return(Execute <ExpenseCategory>(request)); }
private IRestRequest CreateExpenseCategoryRequest(ExpenseCategoryOptions options) { var request = Request(ExpenseCategoriesResource, RestSharp.Method.POST); request.AddBody(options); return(request); }
/// <summary> /// Update a expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource. /// </summary> /// <param name="expenseCategoryId">The ID of the expense category to update</param> /// <param name="name">The updated name</param> /// <param name="unitName">The updated unit name (Unit name and price must be set together)</param> /// <param name="unitPrice">The updated unit price (Unit name and price must be set together)</param> public ExpenseCategory UpdateExpenseCategory(long expenseCategoryId, string name = null, string unitName = null, decimal?unitPrice = null) { var options = new ExpenseCategoryOptions() { Name = name, UnitName = unitName, UnitPrice = unitPrice }; return(UpdateExpenseCategory(expenseCategoryId, options)); }
/// <summary> /// Creates a new expense category under the authenticated account. Makes both a POST and a GET request to the Expense_Categories resource. /// </summary> /// <param name="name">The name of the expense category</param> /// <param name="unitName">The unit name of the expense category (Unit name and price must be set together)</param> /// <param name="unitPrice">The unit price of the expense category (Unit name and price must be set together)</param> public ExpenseCategory CreateExpenseCategory(string name, string unitName = null, decimal?unitPrice = null) { if (name == null) { throw new ArgumentNullException("name"); } var newExpenseCategory = new ExpenseCategoryOptions() { Name = name, UnitName = unitName, UnitPrice = unitPrice }; return(CreateExpenseCategory(newExpenseCategory)); }
/// <summary> /// Creates a new expense category under the authenticated account. Makes a POST and a GET request to the Expense_Categories resource. /// </summary> /// <param name="options">The options for the new expense category to be created</param> public ExpenseCategory CreateExpenseCategory(ExpenseCategoryOptions options) { var request = CreateRequest(EXPENSE_CATEGORIES_RESOURCE, options); return(Execute <ExpenseCategory>(request)); }
/// <summary> /// Updates an expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource. /// </summary> /// <param name="expenseCategoryId">The ID for the expense category to update</param> /// <param name="options">The options to be updated</param> public Task <ExpenseCategory> UpdateExpenseCategoryAsync(long expenseCategoryId, ExpenseCategoryOptions options) { var request = UpdateRequest(EXPENSE_CATEGORIES_RESOURCE, expenseCategoryId, options); return(ExecuteAsync <ExpenseCategory>(request)); }
/// <summary> /// Creates a new expense category under the authenticated account. Makes a POST and a GET request to the Expense_Categories resource. /// </summary> /// <param name="options">The options for the new expense category to be created</param> public Task <ExpenseCategory> CreateExpenseCategoryAsync(ExpenseCategoryOptions options) { var request = CreateRequest(EXPENSE_CATEGORIES_RESOURCE, options); return(ExecuteAsync <ExpenseCategory>(request)); }
/// <summary> /// Updates an expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource. /// </summary> /// <param name="expenseCategoryId">The ID for the expense category to update</param> /// <param name="options">The options to be updated</param> /// <param name="cancellationToken"></param> public async Task <ExpenseCategory> UpdateExpenseCategoryAsync(long expenseCategoryId, ExpenseCategoryOptions options, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <ExpenseCategory>(UpdateExpenseCategoryRequest(expenseCategoryId, options), cancellationToken)); }
/// <summary> /// Updates an expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource. /// </summary> /// <param name="expenseCategoryId">The ID for the expense category to update</param> /// <param name="options">The options to be updated</param> public ExpenseCategory UpdateExpenseCategory(long expenseCategoryId, ExpenseCategoryOptions options) { return(Execute <ExpenseCategory>(UpdateExpenseCategoryRequest(expenseCategoryId, options))); }
/// <summary> /// Creates a new expense category under the authenticated account. Makes a POST and a GET request to the Expense_Categories resource. /// </summary> /// <param name="options">The options for the new expense category to be created</param> /// <param name="cancellationToken"></param> public async Task <ExpenseCategory> CreateExpenseCategoryAsync(ExpenseCategoryOptions options, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <ExpenseCategory>(CreateExpenseCategoryRequest(options), cancellationToken)); }
/// <summary> /// Creates a new expense category under the authenticated account. Makes a POST and a GET request to the Expense_Categories resource. /// </summary> /// <param name="options">The options for the new expense category to be created</param> public ExpenseCategory CreateExpenseCategory(ExpenseCategoryOptions options) { return(Execute <ExpenseCategory>(CreateExpenseCategoryRequest(options))); }