Skip to content

Commit 0d89f73

Browse files
author
Ashley Medway
committed
Updated to use latest RestSharp. FromID is now being returned as SenderID, this makes sense to me but hasn't been updated on the MailJet API documentation!
1 parent 057c720 commit 0d89f73

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

MailJet.Client.Tests/GetMessages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public void GetMessagesFilterBySender_Test()
9797
Assert.IsNotNull(result);
9898
Assert.IsTrue(result.Data.Any());
9999
Assert.AreEqual(result.Count, result.Data.Count);
100-
Assert.IsTrue(result.Data.All(x => x.FromID == 3));
100+
Assert.IsTrue(result.Data.All(x => x.SenderID == 3));
101101
}
102102

103103
[Test]

MailJetClient/MailJet.Client.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
<ConsolePause>false</ConsolePause>
2929
</PropertyGroup>
3030
<ItemGroup>
31-
<Reference Include="RestSharp">
32-
<HintPath>..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
31+
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
32+
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
33+
<Private>True</Private>
3334
</Reference>
3435
<Reference Include="System" />
3536
<Reference Include="System.Net" />

MailJetClient/MailJetClient.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Newtonsoft.Json;
77
using Newtonsoft.Json.Linq;
88
using RestSharp;
9+
using RestSharp.Authenticators;
910
using System;
1011
using System.Collections.Generic;
1112
using System.IO;
@@ -243,7 +244,13 @@ public Response<DataItem> SendMessage(MailMessage Message)
243244
throw new InvalidOperationException("Attachments cannot exceed 15MB. http://dev.mailjet.com/guides/send-api-guide/");
244245

245246
foreach (var item in Message.Attachments)
246-
request.AddFile("attachment", x => item.ContentStream.CopyTo(x), item.Name);
247+
{
248+
using (MemoryStream ms = new MemoryStream())
249+
{
250+
item.ContentStream.CopyTo(ms);
251+
request.AddFile("attachment", ms.ToArray(), item.Name);
252+
}
253+
}
247254
}
248255

249256
var view = Message.AlternateViews.FirstOrDefault();

MailJetClient/Response/Data/MessageData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class MessageData : DataItem
1313
public long Delay { get; set; }
1414
public int DestinationID { get; set; }
1515
public int FilterTime { get; set; }
16-
public long FromID { get; set; }
16+
public long SenderID { get; set; }
1717
public bool IsClickTracked { get; set; }
1818
public bool IsHtmlPartIncluded { get; set; }
1919
public bool IsOpenTracked { get; set; }

MailJetClient/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
4-
<package id="RestSharp" version="105.1.0" targetFramework="net45" />
4+
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
55
</packages>

0 commit comments

Comments
 (0)