Пример #1
0
        private IRestRequest UpdateExpenseCategoryRequest(long expenseCategoryId, ExpenseCategoryOptions options)
        {
            var request = Request($"{ExpenseCategoriesResource}/{expenseCategoryId}", RestSharp.Method.PUT);

            request.AddBody(options);

            return(request);
        }
Пример #2
0
        /// <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));
        }
Пример #3
0
        /// <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));
        }
Пример #4
0
        private IRestRequest CreateExpenseCategoryRequest(ExpenseCategoryOptions options)
        {
            var request = Request(ExpenseCategoriesResource, RestSharp.Method.POST);

            request.AddBody(options);

            return(request);
        }
Пример #5
0
        /// <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));
        }
Пример #6
0
        /// <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));
        }
Пример #7
0
        /// <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));
        }
Пример #8
0
        /// <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));
        }
Пример #9
0
        /// <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));
        }
Пример #10
0
 /// <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));
 }
Пример #11
0
 /// <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)));
 }
Пример #12
0
 /// <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));
 }
Пример #13
0
 /// <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)));
 }