Skip to content

Commit 7d04be3

Browse files
Version Bump v7.0.6: Update docs, unit tests and examples to include Sender ID
1 parent f56bb50 commit 7d04be3

File tree

8 files changed

+365
-14
lines changed

8 files changed

+365
-14
lines changed

CHANGELOG.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## [7.0.6] - 2016-07-12
5+
### Added
6+
- Update docs, unit tests and examples to include Sender ID
7+
48
## [7.0.5] - 2016-07-08
59
### Added
610
- Tests now mocked automatically against [prism](https://stoplight.io/prism/)
711

812
## [7.0.4] - 2016-07-05
9-
### Added
10-
- Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html
13+
### Added
14+
- Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html
1115

12-
### Updated
13-
- Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai)
16+
### Updated
17+
- Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai)
1418

1519
## [7.0.3] - 2016-06-28
1620
### Fixed
@@ -22,7 +26,7 @@ All notable changes to this project will be documented in this file.
2226

2327
## [7.0.1] - 2016-06-15
2428
### Fixed
25-
- Hard-coded subject in mail helper: https://github.com/sendgrid/sendgrid-csharp/issues/234
29+
- Hard-coded subject in mail helper: https://github.com/sendgrid/sendgrid-csharp/issues/234
2630
- Thanks [digime99](https://github.com/digime99)!
2731

2832
## [7.0.0] - 2016-06-13

SendGrid/Example/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
// by using the '*' as shown below:
3636
// [assembly: AssemblyVersion("1.0.*")]
3737

38-
[assembly: AssemblyVersion("7.0.5")]
39-
[assembly: AssemblyFileVersion("7.0.5")]
38+
[assembly: AssemblyVersion("7.0.6")]
39+
[assembly: AssemblyFileVersion("7.0.6")]

SendGrid/SendGrid/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("7.0.5")]
36-
[assembly: AssemblyFileVersion("7.0.5")]
35+
[assembly: AssemblyVersion("7.0.6")]
36+
[assembly: AssemblyFileVersion("7.0.6")]

SendGrid/UnitTest/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("7.0.5")]
36-
[assembly: AssemblyFileVersion("7.0.5")]
35+
[assembly: AssemblyVersion("7.0.6")]
36+
[assembly: AssemblyFileVersion("7.0.6")]

SendGrid/UnitTest/UnitTest.cs

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,6 @@ public void test_contactdb_recipients_count_get()
12221222
public void test_contactdb_recipients_search_get()
12231223
{
12241224
string queryParams = @"{
1225-
'%7Bfield_name%7D': 'test_string',
12261225
'{field_name}': 'test_string'
12271226
}";
12281227
Dictionary<String, String> headers = new Dictionary<String, String>();
@@ -2062,6 +2061,104 @@ public void test_scopes_get()
20622061
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
20632062
}
20642063

2064+
[Test]
2065+
public void test_senders_post()
2066+
{
2067+
string data = @"{
2068+
'address': '123 Elm St.',
2069+
'address_2': 'Apt. 456',
2070+
'city': 'Denver',
2071+
'country': 'United States',
2072+
'from': {
2073+
'email': '[email protected]',
2074+
'name': 'Example INC'
2075+
},
2076+
'nickname': 'My Sender ID',
2077+
'reply_to': {
2078+
'email': '[email protected]',
2079+
'name': 'Example INC'
2080+
},
2081+
'state': 'Colorado',
2082+
'zip': '80202'
2083+
}";
2084+
Dictionary<String, String> headers = new Dictionary<String, String>();
2085+
headers.Clear();
2086+
headers.Add("X-Mock", "201");
2087+
dynamic response = sg.client.senders.post(requestBody: data, requestHeaders: headers);
2088+
Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
2089+
}
2090+
2091+
[Test]
2092+
public void test_senders_get()
2093+
{
2094+
Dictionary<String, String> headers = new Dictionary<String, String>();
2095+
headers.Clear();
2096+
headers.Add("X-Mock", "200");
2097+
dynamic response = sg.client.senders.get(requestHeaders: headers);
2098+
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
2099+
}
2100+
2101+
[Test]
2102+
public void test_senders__sender_id__patch()
2103+
{
2104+
string data = @"{
2105+
'address': '123 Elm St.',
2106+
'address_2': 'Apt. 456',
2107+
'city': 'Denver',
2108+
'country': 'United States',
2109+
'from': {
2110+
'email': '[email protected]',
2111+
'name': 'Example INC'
2112+
},
2113+
'nickname': 'My Sender ID',
2114+
'reply_to': {
2115+
'email': '[email protected]',
2116+
'name': 'Example INC'
2117+
},
2118+
'state': 'Colorado',
2119+
'zip': '80202'
2120+
}";
2121+
var sender_id = "test_url_param";
2122+
Dictionary<String, String> headers = new Dictionary<String, String>();
2123+
headers.Clear();
2124+
headers.Add("X-Mock", "200");
2125+
dynamic response = sg.client.senders._(sender_id).patch(requestBody: data, requestHeaders: headers);
2126+
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
2127+
}
2128+
2129+
[Test]
2130+
public void test_senders__sender_id__get()
2131+
{
2132+
var sender_id = "test_url_param";
2133+
Dictionary<String, String> headers = new Dictionary<String, String>();
2134+
headers.Clear();
2135+
headers.Add("X-Mock", "200");
2136+
dynamic response = sg.client.senders._(sender_id).get(requestHeaders: headers);
2137+
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
2138+
}
2139+
2140+
[Test]
2141+
public void test_senders__sender_id__delete()
2142+
{
2143+
var sender_id = "test_url_param";
2144+
Dictionary<String, String> headers = new Dictionary<String, String>();
2145+
headers.Clear();
2146+
headers.Add("X-Mock", "204");
2147+
dynamic response = sg.client.senders._(sender_id).delete(requestHeaders: headers);
2148+
Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
2149+
}
2150+
2151+
[Test]
2152+
public void test_senders__sender_id__resend_verification_post()
2153+
{
2154+
var sender_id = "test_url_param";
2155+
Dictionary<String, String> headers = new Dictionary<String, String>();
2156+
headers.Clear();
2157+
headers.Add("X-Mock", "204");
2158+
dynamic response = sg.client.senders._(sender_id).resend_verification.post(requestHeaders: headers);
2159+
Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
2160+
}
2161+
20652162
[Test]
20662163
public void test_stats_get()
20672164
{

USAGE.md

Lines changed: 148 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
2929
* [MAILBOX PROVIDERS](#mailbox_providers)
3030
* [PARTNER SETTINGS](#partner_settings)
3131
* [SCOPES](#scopes)
32+
* [SENDERS](#senders)
3233
* [STATS](#stats)
3334
* [SUBUSERS](#subusers)
3435
* [SUPPRESSION](#suppression)
@@ -1683,7 +1684,6 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](
16831684

16841685
```csharp
16851686
string queryParams = @"{
1686-
'%7Bfield_name%7D': 'test_string',
16871687
'{field_name}': 'test_string'
16881688
}";
16891689
dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams);
@@ -3063,6 +3063,153 @@ Console.WriteLine(response.Headers.ToString());
30633063
Console.ReadLine();
30643064
```
30653065

3066+
<a name="senders"></a>
3067+
# SENDERS
3068+
3069+
## Create a Sender Identity
3070+
3071+
**This endpoint allows you to create a new sender identity.**
3072+
3073+
*You may create up to 100 unique sender identities.*
3074+
3075+
Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
3076+
3077+
### POST /senders
3078+
3079+
3080+
```csharp
3081+
string data = @"{
3082+
'address': '123 Elm St.',
3083+
'address_2': 'Apt. 456',
3084+
'city': 'Denver',
3085+
'country': 'United States',
3086+
'from': {
3087+
'email': '[email protected]',
3088+
'name': 'Example INC'
3089+
},
3090+
'nickname': 'My Sender ID',
3091+
'reply_to': {
3092+
'email': '[email protected]',
3093+
'name': 'Example INC'
3094+
},
3095+
'state': 'Colorado',
3096+
'zip': '80202'
3097+
}";
3098+
dynamic response = sg.client.senders.post(requestBody: data);
3099+
Console.WriteLine(response.StatusCode);
3100+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3101+
Console.WriteLine(response.Headers.ToString());
3102+
Console.ReadLine();
3103+
```
3104+
3105+
## Get all Sender Identities
3106+
3107+
**This endpoint allows you to retrieve a list of all sender identities that have been created for your account.**
3108+
3109+
Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
3110+
3111+
### GET /senders
3112+
3113+
3114+
```csharp
3115+
dynamic response = sg.client.senders.get();
3116+
Console.WriteLine(response.StatusCode);
3117+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3118+
Console.WriteLine(response.Headers.ToString());
3119+
Console.ReadLine();
3120+
```
3121+
3122+
## Update a Sender Identity
3123+
3124+
**This endpoint allows you to update a sender identity.**
3125+
3126+
Updates to `from.email` require re-verification. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
3127+
3128+
Partial updates are allowed, but fields that are marked as "required" in the POST (create) endpoint must not be nil if that field is included in the PATCH request.
3129+
3130+
### PATCH /senders/{sender_id}
3131+
3132+
3133+
```csharp
3134+
string data = @"{
3135+
'address': '123 Elm St.',
3136+
'address_2': 'Apt. 456',
3137+
'city': 'Denver',
3138+
'country': 'United States',
3139+
'from': {
3140+
'email': '[email protected]',
3141+
'name': 'Example INC'
3142+
},
3143+
'nickname': 'My Sender ID',
3144+
'reply_to': {
3145+
'email': '[email protected]',
3146+
'name': 'Example INC'
3147+
},
3148+
'state': 'Colorado',
3149+
'zip': '80202'
3150+
}";
3151+
var sender_id = "test_url_param";
3152+
dynamic response = sg.client.senders._(sender_id).patch(requestBody: data);
3153+
Console.WriteLine(response.StatusCode);
3154+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3155+
Console.WriteLine(response.Headers.ToString());
3156+
Console.ReadLine();
3157+
```
3158+
3159+
## View a Sender Identity
3160+
3161+
**This endpoint allows you to retrieve a specific sender identity.**
3162+
3163+
Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
3164+
3165+
### GET /senders/{sender_id}
3166+
3167+
3168+
```csharp
3169+
var sender_id = "test_url_param";
3170+
dynamic response = sg.client.senders._(sender_id).get();
3171+
Console.WriteLine(response.StatusCode);
3172+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3173+
Console.WriteLine(response.Headers.ToString());
3174+
Console.ReadLine();
3175+
```
3176+
3177+
## Delete a Sender Identity
3178+
3179+
**This endoint allows you to delete one of your sender identities.**
3180+
3181+
Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
3182+
3183+
### DELETE /senders/{sender_id}
3184+
3185+
3186+
```csharp
3187+
var sender_id = "test_url_param";
3188+
dynamic response = sg.client.senders._(sender_id).delete();
3189+
Console.WriteLine(response.StatusCode);
3190+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3191+
Console.WriteLine(response.Headers.ToString());
3192+
Console.ReadLine();
3193+
```
3194+
3195+
## Resend Sender Identity Verification
3196+
3197+
**This enpdoint allows you to resend a sender identity verification email.**
3198+
3199+
Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
3200+
3201+
### POST /senders/{sender_id}/resend_verification
3202+
3203+
3204+
```csharp
3205+
var sender_id = "test_url_param";
3206+
dynamic response = sg.client.senders._(sender_id).resend_verification.post();
3207+
Console.WriteLine(response.StatusCode);
3208+
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
3209+
Console.WriteLine(response.Headers.ToString());
3210+
Console.ReadLine();
3211+
```
3212+
30663213
<a name="stats"></a>
30673214
# STATS
30683215

examples/contactdb/contactdb.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@
287287
// GET /contactdb/recipients/search
288288

289289
string queryParams = @"{
290-
'%7Bfield_name%7D': 'test_string',
291290
'{field_name}': 'test_string'
292291
}";
293292
dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams);

0 commit comments

Comments
 (0)