Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #317 from MJMortimer/email-invoices
Browse files Browse the repository at this point in the history
Email invoice functionality
  • Loading branch information
MJMortimer authored Feb 19, 2018
2 parents fd80012 + 8705fe8 commit 6cafde2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Xero.Api/Core/Endpoints/InvoicesEndpoint.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using Newtonsoft.Json.Converters;
using Xero.Api.Common;
using Xero.Api.Core.Endpoints.Base;
Expand All @@ -19,6 +20,7 @@ public interface IInvoicesEndpoint : IXeroUpdateEndpoint<InvoicesEndpoint, Invoi
IInvoicesEndpoint ContactIds(IEnumerable<Guid> contactIds);
IInvoicesEndpoint Statuses(IEnumerable<InvoiceStatus> statuses);
IInvoicesEndpoint InvoiceNumbers(IEnumerable<string> invoiceNumbers);
void EmailInvoice(Guid invoiceId);
}

public class InvoicesEndpoint
Expand Down Expand Up @@ -60,6 +62,15 @@ public IInvoicesEndpoint InvoiceNumbers(IEnumerable<string> invoiceNumbers)
return this;
}

public void EmailInvoice(Guid invoiceId)
{
var response = Client.Client.Post(string.Format("api.xro/2.0/invoices/{0}/emails", invoiceId), string.Empty);
if (response.StatusCode != HttpStatusCode.NoContent)
{
Client.HandleErrors(response);
}
}

public override void ClearQueryString()
{
base.ClearQueryString();
Expand Down

0 comments on commit 6cafde2

Please sign in to comment.