private IRestRequest CreateInvoiceCategoryRequest(InvoiceItemCategoryOptions options) { var request = Request(InvoiceItemResource, RestSharp.Method.POST); request.AddBody(options); return(request); }
/// <summary> /// Creates a new invoice category under the authenticated account. Makes a POST and a GET request to the Invoice_Item_Categories resource. /// </summary> /// <param name="options">The options for the new invoice category to be created</param> public InvoiceItemCategory CreateInvoiceCategory(InvoiceItemCategoryOptions options) { var request = Request("invoice_item_categories", RestSharp.Method.POST); request.AddBody(options); return(Execute <InvoiceItemCategory>(request)); }
private IRestRequest UpdateInvoiceCategoryRequest(long invoiceCategoryId, InvoiceItemCategoryOptions options) { var request = Request($"{InvoiceItemResource}/{invoiceCategoryId}", RestSharp.Method.PUT); request.AddBody(options); return(request); }
/// <summary> /// Updates an Invoice category on the authenticated account. Makes a PUT and a GET request to the Clients resource. /// </summary> /// <param name="invoiceCategoryId">The ID for the invoice category to update</param> /// <param name="options">The options to be updated</param> public InvoiceItemCategory UpdateInvoiceCategory(long invoiceCategoryId, InvoiceItemCategoryOptions options) { var request = Request("invoice_item_categories/" + invoiceCategoryId, RestSharp.Method.PUT); request.AddBody(options); return(Execute <InvoiceItemCategory>(request)); }
/// <summary> /// Update a invoice category on the authenticated account. Makes a PUT and a GET request to the Invoice_Item_Categories resource. /// </summary> /// <param name="invoiceCategoryId">The ID of the invoice 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 InvoiceItemCategory UpdateInvoiceCategory(long invoiceCategoryId, string name = null, bool?useAsExpense = null, bool?useAsService = null) { var options = new InvoiceItemCategoryOptions() { Name = name, UseAsExpense = useAsExpense, UseAsService = useAsService }; return(UpdateInvoiceCategory(invoiceCategoryId, options)); }
/// <summary> /// Creates a new invoice category under the authenticated account. Makes both a POST and a GET request to the Invoice_Item_Categories resource. /// </summary> /// <param name="name">The name of the invoice category</param> /// <param name="unitName">The unit name of the invoice category (Unit name and price must be set together)</param> /// <param name="unitPrice">The unit price of the invoice category (Unit name and price must be set together)</param> public InvoiceItemCategory CreateInvoiceCategory(string name, bool useAsExpense = false, bool useAsService = false) { if (name == null) { throw new ArgumentNullException("name"); } var newInvoiceCategory = new InvoiceItemCategoryOptions() { Name = name, UseAsExpense = useAsExpense, UseAsService = useAsService }; return(CreateInvoiceCategory(newInvoiceCategory)); }
/// <summary> /// Creates a new invoice category under the authenticated account. Makes a POST and a GET request to the Invoice_Item_Categories resource. /// </summary> /// <param name="options">The options for the new invoice category to be created</param> public InvoiceItemCategory CreateInvoiceCategory(InvoiceItemCategoryOptions options) { var request = CreateRequest(INVOICE_CATEGORIES_RESOURCE, options); return(Execute <InvoiceItemCategory>(request)); }
/// <summary> /// Updates an Invoice category on the authenticated account. Makes a PUT and a GET request to the Clients resource. /// </summary> /// <param name="invoiceCategoryId">The ID for the invoice category to update</param> /// <param name="options">The options to be updated</param> public Task <InvoiceItemCategory> UpdateInvoiceCategoryAsync(long invoiceCategoryId, InvoiceItemCategoryOptions options) { var request = UpdateRequest(INVOICE_CATEGORIES_RESOURCE, invoiceCategoryId, options); return(ExecuteAsync <InvoiceItemCategory>(request)); }
/// <summary> /// Updates an Invoice category on the authenticated account. Makes a PUT and a GET request to the Clients resource. /// </summary> /// <param name="invoiceCategoryId">The ID for the invoice category to update</param> /// <param name="options">The options to be updated</param> /// <param name="cancellationToken"></param> public async Task <InvoiceItemCategory> UpdateInvoiceCategoryAsync(long invoiceCategoryId, InvoiceItemCategoryOptions options, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <InvoiceItemCategory>(UpdateInvoiceCategoryRequest(invoiceCategoryId, options), cancellationToken)); }
/// <summary> /// Updates an Invoice category on the authenticated account. Makes a PUT and a GET request to the Clients resource. /// </summary> /// <param name="invoiceCategoryId">The ID for the invoice category to update</param> /// <param name="options">The options to be updated</param> public InvoiceItemCategory UpdateInvoiceCategory(long invoiceCategoryId, InvoiceItemCategoryOptions options) { return(Execute <InvoiceItemCategory>(UpdateInvoiceCategoryRequest(invoiceCategoryId, options))); }
/// <summary> /// Creates a new invoice category under the authenticated account. Makes a POST and a GET request to the Invoice_Item_Categories resource. /// </summary> /// <param name="options">The options for the new invoice category to be created</param> /// <param name="cancellationToken"></param> public async Task <InvoiceItemCategory> CreateInvoiceCategoryAsync(InvoiceItemCategoryOptions options, CancellationToken cancellationToken = default(CancellationToken)) { return(await ExecuteAsync <InvoiceItemCategory>(CreateInvoiceCategoryRequest(options), cancellationToken)); }
/// <summary> /// Creates a new invoice category under the authenticated account. Makes a POST and a GET request to the Invoice_Item_Categories resource. /// </summary> /// <param name="options">The options for the new invoice category to be created</param> public InvoiceItemCategory CreateInvoiceCategory(InvoiceItemCategoryOptions options) { return(Execute <InvoiceItemCategory>(CreateInvoiceCategoryRequest(options))); }