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

Commit 6cafde2

Browse files
authored
Merge pull request #317 from MJMortimer/email-invoices
Email invoice functionality
2 parents fd80012 + 8705fe8 commit 6cafde2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Xero.Api/Core/Endpoints/InvoicesEndpoint.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Net;
45
using Newtonsoft.Json.Converters;
56
using Xero.Api.Common;
67
using Xero.Api.Core.Endpoints.Base;
@@ -19,6 +20,7 @@ public interface IInvoicesEndpoint : IXeroUpdateEndpoint<InvoicesEndpoint, Invoi
1920
IInvoicesEndpoint ContactIds(IEnumerable<Guid> contactIds);
2021
IInvoicesEndpoint Statuses(IEnumerable<InvoiceStatus> statuses);
2122
IInvoicesEndpoint InvoiceNumbers(IEnumerable<string> invoiceNumbers);
23+
void EmailInvoice(Guid invoiceId);
2224
}
2325

2426
public class InvoicesEndpoint
@@ -60,6 +62,15 @@ public IInvoicesEndpoint InvoiceNumbers(IEnumerable<string> invoiceNumbers)
6062
return this;
6163
}
6264

65+
public void EmailInvoice(Guid invoiceId)
66+
{
67+
var response = Client.Client.Post(string.Format("api.xro/2.0/invoices/{0}/emails", invoiceId), string.Empty);
68+
if (response.StatusCode != HttpStatusCode.NoContent)
69+
{
70+
Client.HandleErrors(response);
71+
}
72+
}
73+
6374
public override void ClearQueryString()
6475
{
6576
base.ClearQueryString();

0 commit comments

Comments
 (0)