Skip to content

Commit

Permalink
updating SendGrid to API v3; updating all extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
brettsam committed Sep 26, 2016
1 parent d74a04f commit a269bd3
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 100 deletions.
1 change: 1 addition & 0 deletions sample/SendGrid-CSharp/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"type": "sendGrid",
"name": "$return",
"direction": "out",
"apiKey": "MySendGridKey",
"to": "{CustomerEmail}"
}
]
Expand Down
21 changes: 13 additions & 8 deletions sample/SendGrid-CSharp/run.csx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#r "SendGridMail"
#load "..\Shared\Message.csx"
#r "SendGrid"
#load "..\Shared\Order.csx"

using System;
using SendGrid;
using SendGrid.Helpers.Mail;
using Microsoft.Azure.WebJobs.Host;

public static SendGridMessage Run(Order order, TraceWriter log)
public static Mail Run(Order order, TraceWriter log)
{
log.Info($"C# Queue trigger function processed order: {order.OrderId}");

var message = new SendGridMessage()
var message = new Mail
{
Subject = string.Format("Thanks for your order (#{0})!", order.OrderId),
Text = string.Format("{0}, your order ({1}) is being processed!", order.CustomerName, order.OrderId)
Subject = $"Thanks for your order (#{order.OrderId})!"
};
message.AddTo(order.CustomerEmail);

Content content = new Content
{
Type = "text/plain",
Value = $"{order.CustomerName}, your order ({order.OrderId}) is being processed!"
};
message.AddContent(content);

return message;
}
1 change: 1 addition & 0 deletions sample/SendGrid-PowerShell/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"type": "sendGrid",
"name": "message",
"direction": "out",
"apiKey": "MySendGridKey",
"to": "{CustomerEmail}"
}
]
Expand Down
2 changes: 1 addition & 1 deletion sample/SendGrid-PowerShell/run.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$in = Get-Content $order

$order = $in | ConvertFrom-Json
$content = [string]::Format('{{ "Subject": "Thanks for your order (#{0})", "Text": "{1}, your order ({0}) is being processed!" }}', $order.OrderId, $order.CustomerName)
$content = [string]::Format('{{ "Subject": "Thanks for your order (#{0})", "Content": [ {{ "Type": "text/plain", "Value": "{1}, your order ({0}) is being processed!" }} ] }}', $order.OrderId, $order.CustomerName)

$content | Out-File -Encoding Ascii $message
1 change: 1 addition & 0 deletions sample/SendGrid/function.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"type": "sendGrid",
"name": "$return",
"direction": "out",
"apiKey" : "MySendGridKey",
"to": "{customerEmail}"
}
]
Expand Down
5 changes: 4 additions & 1 deletion sample/SendGrid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ module.exports = function (context, order) {

var message = {
subject: util.format('Thanks for your order (#%d)!', order.orderId),
text: util.format("%s, your order (%d) is being processed!", order.customerName, order.orderId)
content: [{
type: 'text/plain',
value: util.format("%s, your order (%d) is being processed!", order.customerName, order.orderId)
}]
};

context.done(null, message);
Expand Down
27 changes: 14 additions & 13 deletions src/WebJobs.Script.Host/WebJobs.Script.Host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,31 +87,31 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.ApiHub, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.ApiHub.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.ApiHub.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.ApiHub.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.ApiHub.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.DocumentDB, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.DocumentDB.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.DocumentDB.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.DocumentDB.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.DocumentDB.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.MobileApps, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.MobileApps.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.MobileApps.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.MobileApps.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.MobileApps.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.NotificationHubs, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.SendGrid, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.SendGrid.2.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.SendGrid.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.SendGrid.2.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.SendGrid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.Twilio, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.Twilio.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.Twilio.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.Twilio.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.Twilio.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Host, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -174,16 +174,16 @@
<HintPath>..\..\packages\RestSharp.105.2.2\lib\net46\RestSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGrid, Version=6.3.4.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sendgrid.6.3.4\lib\SendGrid.dll</HintPath>
<Reference Include="SendGrid, Version=8.0.4.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sendgrid.8.0.4\lib\SendGrid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
<HintPath>..\..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
<Reference Include="SendGrid.CSharp.HTTP.Client, Version=3.0.0.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
<HintPath>..\..\packages\SendGrid.CSharp.HTTP.Client.3.0.0\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGridMail, Version=6.3.4.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sendgrid.6.3.4\lib\SendGridMail.dll</HintPath>
<Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
<HintPath>..\..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down Expand Up @@ -212,6 +212,7 @@
<HintPath>..\..\packages\Microsoft.Tpl.Dataflow.4.5.24\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
Expand Down
17 changes: 9 additions & 8 deletions src/WebJobs.Script.Host/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<package id="Microsoft.Azure.ServiceBus.EventProcessorHost" version="2.2.5" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs" version="2.0.0-beta1-10410" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Core" version="2.0.0-beta1-10410" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions" version="2.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.ApiHub" version="1.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.DocumentDB" version="1.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.MobileApps" version="1.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.NotificationHubs" version="1.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.SendGrid" version="2.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.Twilio" version="1.0.0-beta1-10368" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions" version="2.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.ApiHub" version="1.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.DocumentDB" version="1.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.MobileApps" version="1.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.NotificationHubs" version="1.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.SendGrid" version="2.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Extensions.Twilio" version="1.0.0-beta1-10369" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.Script.Extensibility" version="1.0.0-beta1-10457" targetFramework="net46" />
<package id="Microsoft.Azure.WebJobs.ServiceBus" version="2.0.0-beta1-10410" targetFramework="net46" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net46" />
Expand All @@ -32,7 +32,8 @@
<package id="ncrontab" version="3.1.0" targetFramework="net46" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="RestSharp" version="105.2.2" targetFramework="net46" />
<package id="Sendgrid" version="6.3.4" targetFramework="net46" />
<package id="Sendgrid" version="8.0.4" targetFramework="net46" />
<package id="SendGrid.CSharp.HTTP.Client" version="3.0.0" targetFramework="net46" />
<package id="SendGrid.SmtpApi" version="1.3.1" targetFramework="net45" />
<package id="StyleCop.MSBuild" version="4.7.54.0" targetFramework="net46" developmentDependency="true" />
<package id="System.Spatial" version="5.7.0" targetFramework="net46" />
Expand Down
12 changes: 6 additions & 6 deletions src/WebJobs.Script.NuGet/WebJobs.Script.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<dependencies>
<dependency id="Microsoft.Azure.WebJobs" version="2.0.0-beta1-10410" />
<dependency id="Microsoft.Azure.WebJobs.ServiceBus" version="2.0.0-beta1-10410" />
<dependency id="Microsoft.Azure.WebJobs.Extensions" version="2.0.0-beta1-10368" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.SendGrid" version="2.0.0-beta1-10368" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.ApiHub" version="1.0.0-beta1-10368" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.DocumentDB" version="1.0.0-beta1-10368" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.MobileApps" version="1.0.0-beta1-10368" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.NotificationHubs" version="1.0.0-beta1-10368" />
<dependency id="Microsoft.Azure.WebJobs.Extensions" version="2.0.0-beta1-10369" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.SendGrid" version="2.0.0-beta1-10369" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.ApiHub" version="1.0.0-beta1-10369" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.DocumentDB" version="1.0.0-beta1-10369" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.MobileApps" version="1.0.0-beta1-10369" />
<dependency id="Microsoft.Azure.WebJobs.Extensions.NotificationHubs" version="1.0.0-beta1-10369" />
<dependency id="Edge.js" version="6.5.1" />
<dependency id="Microsoft.CodeAnalysis.CSharp.Scripting" version="1.3.2" />
<dependency id="Microsoft.AspNet.WebApi.Core" version="5.2.3" />
Expand Down
26 changes: 13 additions & 13 deletions src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,31 +140,31 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.2.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.ApiHub, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.ApiHub.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.ApiHub.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.ApiHub.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.ApiHub.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.DocumentDB, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.DocumentDB.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.DocumentDB.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.DocumentDB.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.DocumentDB.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.MobileApps, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.MobileApps.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.MobileApps.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.MobileApps.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.MobileApps.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.NotificationHubs, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.NotificationHubs.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.SendGrid, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.SendGrid.2.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.SendGrid.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.SendGrid.2.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.SendGrid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Extensions.Twilio, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.Twilio.1.0.0-beta1-10368\lib\net45\Microsoft.Azure.WebJobs.Extensions.Twilio.dll</HintPath>
<HintPath>..\..\packages\Microsoft.Azure.WebJobs.Extensions.Twilio.1.0.0-beta1-10369\lib\net45\Microsoft.Azure.WebJobs.Extensions.Twilio.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.WebJobs.Host, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand Down Expand Up @@ -236,16 +236,16 @@
<HintPath>..\..\packages\RestSharp.105.2.2\lib\net46\RestSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGrid, Version=6.3.4.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sendgrid.6.3.4\lib\SendGrid.dll</HintPath>
<Reference Include="SendGrid, Version=8.0.4.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sendgrid.8.0.4\lib\SendGrid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
<HintPath>..\..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
<Reference Include="SendGrid.CSharp.HTTP.Client, Version=3.0.0.0, Culture=neutral, PublicKeyToken=79219bf4e5ecaaca, processorArchitecture=MSIL">
<HintPath>..\..\packages\SendGrid.CSharp.HTTP.Client.3.0.0\lib\SendGrid.CSharp.HTTP.Client.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SendGridMail, Version=6.3.4.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\Sendgrid.6.3.4\lib\SendGridMail.dll</HintPath>
<Reference Include="SendGrid.SmtpApi, Version=1.3.1.0, Culture=neutral, PublicKeyToken=2ae73662c35d80e4, processorArchitecture=MSIL">
<HintPath>..\..\packages\SendGrid.SmtpApi.1.3.1\lib\net40\SendGrid.SmtpApi.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand Down
Loading

0 comments on commit a269bd3

Please sign in to comment.