Skip to content

Commit

Permalink
Version Bump v7.0.6: Update docs, unit tests and examples to include …
Browse files Browse the repository at this point in the history
…Sender ID
  • Loading branch information
thinkingserious committed Jul 12, 2016
1 parent f56bb50 commit 7d04be3
Show file tree
Hide file tree
Showing 8 changed files with 365 additions and 14 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# Change Log
All notable changes to this project will be documented in this file.

## [7.0.6] - 2016-07-12
### Added
- Update docs, unit tests and examples to include Sender ID

## [7.0.5] - 2016-07-08
### Added
- Tests now mocked automatically against [prism](https://stoplight.io/prism/)

## [7.0.4] - 2016-07-05
### Added
- Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html
### Added
- Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html

### Updated
- Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai)
### Updated
- Content based on our updated [Swagger/OAI doc](https://github.com/sendgrid/sendgrid-oai)

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

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

## [7.0.0] - 2016-06-13
Expand Down
4 changes: 2 additions & 2 deletions SendGrid/Example/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("7.0.5")]
[assembly: AssemblyFileVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6")]
[assembly: AssemblyFileVersion("7.0.6")]
4 changes: 2 additions & 2 deletions SendGrid/SendGrid/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.5")]
[assembly: AssemblyFileVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6")]
[assembly: AssemblyFileVersion("7.0.6")]
4 changes: 2 additions & 2 deletions SendGrid/UnitTest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.0.5")]
[assembly: AssemblyFileVersion("7.0.5")]
[assembly: AssemblyVersion("7.0.6")]
[assembly: AssemblyFileVersion("7.0.6")]
99 changes: 98 additions & 1 deletion SendGrid/UnitTest/UnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,6 @@ public void test_contactdb_recipients_count_get()
public void test_contactdb_recipients_search_get()
{
string queryParams = @"{
'%7Bfield_name%7D': 'test_string',
'{field_name}': 'test_string'
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
Expand Down Expand Up @@ -2062,6 +2061,104 @@ public void test_scopes_get()
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}

[Test]
public void test_senders_post()
{
string data = @"{
'address': '123 Elm St.',
'address_2': 'Apt. 456',
'city': 'Denver',
'country': 'United States',
'from': {
'email': '[email protected]',
'name': 'Example INC'
},
'nickname': 'My Sender ID',
'reply_to': {
'email': '[email protected]',
'name': 'Example INC'
},
'state': 'Colorado',
'zip': '80202'
}";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "201");
dynamic response = sg.client.senders.post(requestBody: data, requestHeaders: headers);
Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
}

[Test]
public void test_senders_get()
{
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
dynamic response = sg.client.senders.get(requestHeaders: headers);
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}

[Test]
public void test_senders__sender_id__patch()
{
string data = @"{
'address': '123 Elm St.',
'address_2': 'Apt. 456',
'city': 'Denver',
'country': 'United States',
'from': {
'email': '[email protected]',
'name': 'Example INC'
},
'nickname': 'My Sender ID',
'reply_to': {
'email': '[email protected]',
'name': 'Example INC'
},
'state': 'Colorado',
'zip': '80202'
}";
var sender_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
dynamic response = sg.client.senders._(sender_id).patch(requestBody: data, requestHeaders: headers);
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}

[Test]
public void test_senders__sender_id__get()
{
var sender_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "200");
dynamic response = sg.client.senders._(sender_id).get(requestHeaders: headers);
Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
}

[Test]
public void test_senders__sender_id__delete()
{
var sender_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
dynamic response = sg.client.senders._(sender_id).delete(requestHeaders: headers);
Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}

[Test]
public void test_senders__sender_id__resend_verification_post()
{
var sender_id = "test_url_param";
Dictionary<String, String> headers = new Dictionary<String, String>();
headers.Clear();
headers.Add("X-Mock", "204");
dynamic response = sg.client.senders._(sender_id).resend_verification.post(requestHeaders: headers);
Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
}

[Test]
public void test_stats_get()
{
Expand Down
149 changes: 148 additions & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dynamic sg = new SendGrid.SendGridAPIClient(_apiKey);
* [MAILBOX PROVIDERS](#mailbox_providers)
* [PARTNER SETTINGS](#partner_settings)
* [SCOPES](#scopes)
* [SENDERS](#senders)
* [STATS](#stats)
* [SUBUSERS](#subusers)
* [SUPPRESSION](#suppression)
Expand Down Expand Up @@ -1683,7 +1684,6 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](

```csharp
string queryParams = @"{
'%7Bfield_name%7D': 'test_string',
'{field_name}': 'test_string'
}";
dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams);
Expand Down Expand Up @@ -3063,6 +3063,153 @@ Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

<a name="senders"></a>
# SENDERS

## Create a Sender Identity

**This endpoint allows you to create a new sender identity.**

*You may create up to 100 unique sender identities.*

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`.

### POST /senders


```csharp
string data = @"{
'address': '123 Elm St.',
'address_2': 'Apt. 456',
'city': 'Denver',
'country': 'United States',
'from': {
'email': '[email protected]',
'name': 'Example INC'
},
'nickname': 'My Sender ID',
'reply_to': {
'email': '[email protected]',
'name': 'Example INC'
},
'state': 'Colorado',
'zip': '80202'
}";
dynamic response = sg.client.senders.post(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

## Get all Sender Identities

**This endpoint allows you to retrieve a list of all sender identities that have been created for your account.**

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`.

### GET /senders


```csharp
dynamic response = sg.client.senders.get();
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

## Update a Sender Identity

**This endpoint allows you to update a sender identity.**

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`.

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.

### PATCH /senders/{sender_id}


```csharp
string data = @"{
'address': '123 Elm St.',
'address_2': 'Apt. 456',
'city': 'Denver',
'country': 'United States',
'from': {
'email': '[email protected]',
'name': 'Example INC'
},
'nickname': 'My Sender ID',
'reply_to': {
'email': '[email protected]',
'name': 'Example INC'
},
'state': 'Colorado',
'zip': '80202'
}";
var sender_id = "test_url_param";
dynamic response = sg.client.senders._(sender_id).patch(requestBody: data);
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

## View a Sender Identity

**This endpoint allows you to retrieve a specific sender identity.**

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`.

### GET /senders/{sender_id}


```csharp
var sender_id = "test_url_param";
dynamic response = sg.client.senders._(sender_id).get();
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

## Delete a Sender Identity

**This endoint allows you to delete one of your sender identities.**

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`.

### DELETE /senders/{sender_id}


```csharp
var sender_id = "test_url_param";
dynamic response = sg.client.senders._(sender_id).delete();
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

## Resend Sender Identity Verification

**This enpdoint allows you to resend a sender identity verification email.**

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`.

### POST /senders/{sender_id}/resend_verification


```csharp
var sender_id = "test_url_param";
dynamic response = sg.client.senders._(sender_id).resend_verification.post();
Console.WriteLine(response.StatusCode);
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Console.WriteLine(response.Headers.ToString());
Console.ReadLine();
```

<a name="stats"></a>
# STATS

Expand Down
1 change: 0 additions & 1 deletion examples/contactdb/contactdb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@
// GET /contactdb/recipients/search

string queryParams = @"{
'%7Bfield_name%7D': 'test_string',
'{field_name}': 'test_string'
}";
dynamic response = sg.client.contactdb.recipients.search.get(queryParams: queryParams);
Expand Down
Loading

0 comments on commit 7d04be3

Please sign in to comment.