Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <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);
        }