Skip to content

Commit 6432c3c

Browse files
Updating usage docs and examples based on testing against deployed Nuget
1 parent e9dfa87 commit 6432c3c

File tree

25 files changed

+70
-93
lines changed

25 files changed

+70
-93
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Add the following namespaces to use the library:
4646
using System;
4747
using System.Web.Script.Serialization;
4848
using SendGrid;
49+
using SendGrid.Helpers.Mail; // Include if you want to use the Mail Helper
4950
```
5051

5152
## Dependencies
@@ -60,6 +61,7 @@ using SendGrid;
6061
```csharp
6162
using System;
6263
using SendGrid;
64+
using SendGrid.Helpers.Mail;
6365

6466
namespace Example
6567
{
@@ -68,7 +70,7 @@ namespace Example
6870
private static void Main()
6971
{
7072
String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
71-
dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
73+
dynamic sg = new SendGridAPIClient(apiKey);
7274

7375
Email from = new Email("[email protected]");
7476
String subject = "Hello World from the SendGrid CSharp Library";
@@ -86,7 +88,6 @@ namespace Example
8688

8789
```csharp
8890
using System;
89-
using SendGrid;
9091

9192
namespace Example
9293
{
@@ -96,7 +97,7 @@ namespace Example
9697
{
9798
String apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
9899
dynamic sg = new SendGrid.SendGridAPIClient(apiKey);
99-
dynamic response = sg.client.api_keys.get(queryParams: queryParams);
100+
dynamic response = sg.client.api_keys.get();
100101
}
101102
}
102103
}

USAGE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ This documentation is based on our [OAI specification](https://github.com/sendgr
44

55
```csharp
66
using System;
7-
using SendGrid.Helpers.Mail;
8-
using System.Collections.Generic;
7+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
98
109
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
1110
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/accesssettings/accesssettings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/apikeys/apikeys.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/asm/asm.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/browsers/browsers.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/campaigns/campaigns.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/categories/categories.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/clients/clients.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/contactdb/contactdb.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/devices/devices.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/geo/geo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/ips/ips.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/mail/mail.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -29,7 +28,7 @@
2928
////////////////////////////////////////////////////////
3029
// v3 Mail Send
3130
// POST /mail/send
32-
# This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/SendGrid/Helpers/Mail/README.md).
31+
// This endpoint has a helper, check it out [here](https://github.com/sendgrid/sendgrid-csharp/blob/master/SendGrid/SendGrid/Helpers/Mail/README.md).
3332

3433
string data = @"{
3534
'asm': {

examples/mailboxproviders/mailboxproviders.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/mailsettings/mailsettings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/partnersettings/partnersettings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/scopes/scopes.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/stats/stats.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/subusers/subusers.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/suppression/suppression.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/templates/templates.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/trackingsettings/trackingsettings.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);

examples/user/user.cs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
2-
using SendGrid.Helpers.Mail;
3-
using System.Collections.Generic;
2+
using SendGrid.Helpers.Mail; // If you are using the Mail Helper
43

54
string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User);
65
dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
@@ -53,7 +52,7 @@
5352
// PUT /user/password
5453

5554
string data = @"{
56-
'new_password': 'new_password',
55+
'new_password': 'new_password',
5756
'old_password': 'old_password'
5857
}";
5958
dynamic response = sg.client.user.password.put(requestBody: data);
@@ -67,8 +66,8 @@
6766
// PATCH /user/profile
6867

6968
string data = @"{
70-
'city': 'Orange',
71-
'first_name': 'Example',
69+
'city': 'Orange',
70+
'first_name': 'Example',
7271
'last_name': 'User'
7372
}";
7473
dynamic response = sg.client.user.profile.patch(requestBody: data);
@@ -92,7 +91,7 @@
9291
// POST /user/scheduled_sends
9392

9493
string data = @"{
95-
'batch_id': 'YOUR_BATCH_ID',
94+
'batch_id': 'YOUR_BATCH_ID',
9695
'status': 'pause'
9796
}";
9897
dynamic response = sg.client.user.scheduled_sends.post(requestBody: data);
@@ -152,7 +151,7 @@
152151
// PATCH /user/settings/enforced_tls
153152

154153
string data = @"{
155-
'require_tls': true,
154+
'require_tls': true,
156155
'require_valid_cert': false
157156
}";
158157
dynamic response = sg.client.user.settings.enforced_tls.patch(requestBody: data);
@@ -199,18 +198,18 @@
199198
// PATCH /user/webhooks/event/settings
200199

201200
string data = @"{
202-
'bounce': true,
203-
'click': true,
204-
'deferred': true,
205-
'delivered': true,
206-
'dropped': true,
207-
'enabled': true,
208-
'group_resubscribe': true,
209-
'group_unsubscribe': true,
210-
'open': true,
211-
'processed': true,
212-
'spam_report': true,
213-
'unsubscribe': true,
201+
'bounce': true,
202+
'click': true,
203+
'deferred': true,
204+
'delivered': true,
205+
'dropped': true,
206+
'enabled': true,
207+
'group_resubscribe': true,
208+
'group_unsubscribe': true,
209+
'open': true,
210+
'processed': true,
211+
'spam_report': true,
212+
'unsubscribe': true,
214213
'url': 'url'
215214
}";
216215
dynamic response = sg.client.user.webhooks._("event").settings.patch(requestBody: data);
@@ -230,7 +229,7 @@
230229
Console.ReadLine();
231230

232231
////////////////////////////////////////////////////////
233-
// Test Event Notification Settings
232+
// Test Event Notification Settings
234233
// POST /user/webhooks/event/test
235234

236235
string data = @"{
@@ -257,10 +256,10 @@
257256
// GET /user/webhooks/parse/stats
258257

259258
string queryParams = @"{
260-
'aggregated_by': 'day',
261-
'end_date': '2016-04-01',
262-
'limit': 'test_string',
263-
'offset': 'test_string',
259+
'aggregated_by': 'day',
260+
'end_date': '2016-04-01',
261+
'limit': 'test_string',
262+
'offset': 'test_string',
264263
'start_date': '2016-01-01'
265264
}";
266265
dynamic response = sg.client.user.webhooks.parse.stats.get(queryParams: queryParams);

0 commit comments

Comments
 (0)