Skip to content

Commit 83ea184

Browse files
committed
Resolved Conflicts
2 parents 322a4c1 + 92f16b7 commit 83ea184

File tree

13 files changed

+90
-39
lines changed

13 files changed

+90
-39
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file.
33

44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [3.0.0] - 2016-07-22
7+
### BREAKING CHANGE
8+
- While your code may continue to work as before, the async behavior has changed, as we don't block on .Result anymore
9+
- Fixes [issue #259](https://github.com/sendgrid/sendgrid-csharp/issues/259) in the sendgrid-csharp library
10+
- Updated examples and README to demonstrate await usage
11+
12+
## [2.0.7] - 2016-07-19
13+
### Added
14+
- [Pull request #11](https://github.com/sendgrid/csharp-http-client/pull/11): Adding the option to set WebProxy object to be used on HttpClient
15+
- Big thanks to [Juliano Nunes](https://github.com/julianonunes) for the pull request!
16+
17+
## [2.0.6] - 2016-07-18
18+
### Added
19+
- Sign assembly with a strong name
20+
21+
## [2.0.5] - 2016-07-14
22+
### Fixed
23+
- Solves [issue #7](https://github.com/sendgrid/csharp-http-client/issues/7)
24+
- Solves [issue #256](https://github.com/sendgrid/sendgrid-csharp/issues/256) in the SendGrid C# Client
25+
- Do not try to encode the JSON request payload by replacing single quotes with double quotes
26+
- Updated examples and README to use JSON.NET to encode the payload
27+
- Thanks to [Gunnar Liljas](https://github.com/gliljas) for helping identify the issue!
28+
629
## [2.0.2] - 2016-06-16
730
### Added
831
- Fix async, per https://github.com/sendgrid/sendgrid-csharp/issues/235

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ We welcome direct contributions to the csharp-http-client code base. Thank you!
6464

6565
##### Prerequisites #####
6666

67+
- .NET version 4.5.2
6768
- Microsoft Visual Studio Community 2015 or greater
6869

6970
##### Initial setup: #####

CSharpHTTPClient/CSharpHTTPClient.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@
4545
<ItemGroup>
4646
<Reference Include="System" />
4747
<Reference Include="System.Core" />
48-
<Reference Include="System.Net.Http.Formatting">
49-
<HintPath>..\..\sendgrid-csharp\SendGrid\SendGrid\bin\Debug\System.Net.Http.Formatting.dll</HintPath>
50-
</Reference>
5148
<Reference Include="System.Web" />
5249
<Reference Include="System.Web.Extensions" />
5350
<Reference Include="System.Xml.Linq" />

CSharpHTTPClient/Client.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,4 +339,4 @@ private async Task<Response> RequestAsync(string method, String requestBody = nu
339339
}
340340
}
341341
}
342-
}
342+
}

CSharpHTTPClient/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("2.0.4")]
35-
[assembly: AssemblyFileVersion("2.0.4")]
34+
[assembly: AssemblyVersion("3.0.0")]
35+
[assembly: AssemblyFileVersion("3.0.0")]

Example/App.config

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
55
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
11+
</dependentAssembly>
12+
</assemblyBinding>
13+
</runtime>
614
</configuration>

Example/Example.cs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.Collections.Generic;
33
using SendGrid.CSharp.HTTP.Client;
44
using System.Web.Script.Serialization;
5+
using System.Threading.Tasks;
6+
using Newtonsoft.Json;
57

68
// This is a working example, using the SendGrid API
79
// You will need a SendGrid account and an active API Key
@@ -11,6 +13,11 @@ namespace Example
1113
class Example
1214
{
1315
static void Main(string[] args)
16+
{
17+
Execute().Wait();
18+
}
19+
20+
static async Task Execute()
1421
{
1522
String host = "https://e9sk3d3bfaikbpdq7.stoplight-proxy.io";
1623
Dictionary<String, String> globalRequestHeaders = new Dictionary<String, String>();
@@ -27,22 +34,10 @@ static void Main(string[] args)
2734
}";
2835
Dictionary<String, String> requestHeaders = new Dictionary<String, String>();
2936
requestHeaders.Add("X-Test", "test");
30-
dynamic response = client.api_keys.get(queryParams: queryParams, requestHeaders: requestHeaders);
31-
// Console.WriteLine(response.StatusCode);
32-
// Console.WriteLine(response.Body.ReadAsStringAsync().Result);
33-
// Console.WriteLine(response.Headers.ToString());
34-
35-
var dssResponseBody = response.DeserializeResponseBody(response.Body);
36-
foreach ( var value in dssResponseBody["result"])
37-
{
38-
Console.WriteLine("name: {0}, api_key_id: {1}",value["name"], value["api_key_id"]);
39-
}
40-
41-
var dssResponseHeaders = response.DeserializeResponseHeaders(response.Headers);
42-
foreach (var pair in dssResponseHeaders)
43-
{
44-
Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
45-
}
37+
dynamic response = await client.api_keys.get(queryParams: queryParams, requestHeaders: requestHeaders);
38+
Console.WriteLine(response.StatusCode);
39+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
40+
Console.WriteLine(response.Headers.ToString());
4641

4742
Console.WriteLine("\n\nPress any key to continue to POST.");
4843
Console.ReadLine();
@@ -56,9 +51,10 @@ static void Main(string[] args)
5651
'alerts.read'
5752
]
5853
}";
54+
Object json = JsonConvert.DeserializeObject<Object>(requestBody);
5955
requestHeaders.Clear();
6056
requestHeaders.Add("X-Test", "test2");
61-
response = client.api_keys.post(requestBody: requestBody, requestHeaders: requestHeaders);
57+
response = await client.api_keys.post(requestBody: json.ToString(), requestHeaders: requestHeaders);
6258
Console.WriteLine(response.StatusCode);
6359
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
6460
Console.WriteLine(response.Headers.ToString());
@@ -70,7 +66,7 @@ static void Main(string[] args)
7066
Console.ReadLine();
7167

7268
// GET Single
73-
response = client.api_keys._(api_key_id).get();
69+
response = await client.api_keys._(api_key_id).get();
7470
Console.WriteLine(response.StatusCode);
7571
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
7672
Console.WriteLine(response.Headers.ToString());
@@ -82,7 +78,8 @@ static void Main(string[] args)
8278
requestBody = @"{
8379
'name': 'A New Hope'
8480
}";
85-
response = client.api_keys._(api_key_id).patch(requestBody: requestBody);
81+
json = JsonConvert.DeserializeObject<Object>(requestBody);
82+
response = await client.api_keys._(api_key_id).patch(requestBody: json.ToString());
8683
Console.WriteLine(response.StatusCode);
8784
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
8885
Console.WriteLine(response.Headers.ToString());
@@ -98,7 +95,8 @@ static void Main(string[] args)
9895
'user.profile.update'
9996
]
10097
}";
101-
response = client.api_keys._(api_key_id).put(requestBody: requestBody);
98+
json = JsonConvert.DeserializeObject<Object>(requestBody);
99+
response = await client.api_keys._(api_key_id).put(requestBody: json.ToString());
102100
Console.WriteLine(response.StatusCode);
103101
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
104102
Console.WriteLine(response.Headers.ToString());
@@ -107,7 +105,7 @@ static void Main(string[] args)
107105
Console.ReadLine();
108106

109107
// DELETE
110-
response = client.api_keys._(api_key_id).delete();
108+
response = await client.api_keys._(api_key_id).delete();
111109
Console.WriteLine(response.StatusCode);
112110
Console.WriteLine(response.Headers.ToString());
113111

Example/Example.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@
3434
<WarningLevel>4</WarningLevel>
3535
</PropertyGroup>
3636
<ItemGroup>
37+
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
38+
<HintPath>..\CSharpHTTPClient\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
39+
<Private>True</Private>
40+
</Reference>
3741
<Reference Include="System" />
3842
<Reference Include="System.Core" />
43+
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
44+
<HintPath>..\CSharpHTTPClient\packages\Microsoft.AspNet.WebApi.Client.4.0.20710.0\lib\net40\System.Net.Http.Formatting.dll</HintPath>
45+
<Private>True</Private>
46+
</Reference>
47+
<Reference Include="System.Net.Http.WebRequest" />
3948
<Reference Include="System.Web.Extensions" />
4049
<Reference Include="System.Xml.Linq" />
4150
<Reference Include="System.Data.DataSetExtensions" />
@@ -50,6 +59,7 @@
5059
</ItemGroup>
5160
<ItemGroup>
5261
<None Include="App.config" />
62+
<None Include="packages.config" />
5363
</ItemGroup>
5464
<ItemGroup>
5565
<ProjectReference Include="..\CSharpHTTPClient\CSharpHTTPClient.csproj">

Example/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.0.4")]
36-
[assembly: AssemblyFileVersion("2.0.4")]
35+
[assembly: AssemblyVersion("3.0.0")]
36+
[assembly: AssemblyFileVersion("3.0.0")]

Example/packages.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net45" />
4+
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
5+
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
6+
</packages>

0 commit comments

Comments
 (0)