-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version Bump v7.0.6: Update docs, unit tests and examples to include …
…Sender ID
- Loading branch information
1 parent
f56bb50
commit 7d04be3
Showing
8 changed files
with
365 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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>(); | ||
|
@@ -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() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
@@ -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); | ||
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.