<commit_before>SendWithUs.Client
=================

A .NET client implementation over the SendWithUs REST API.

Currently, the client only covers a small portion of the API surface--namely, sending email and batch operations.

## Installation via NuGet

SendWithUs.Client is [available from nuget.org](https://www.nuget.org/packages/SendWithUs.Client/). If you are using 
Visual Studio, install the package using the Package Manager Console as follows: 

```
PM> Install-Package SendWithUs.Client
```

## Usage

The following  description of the  API should be enough to get you started. See the comments in the code (available as
Intellisense documentation in Visual Studio) for more information.

### Sending Email

To send email, you must instantiate a `SendRequest` object to pass to `SendWithUsClient.SendAsync`. A `SendRequest` must 
have a `TemplateId` and a `RecipientAddress`. All other properties are optional.

#### Minimal Example

```csharp
using SendWithUs.Client;

var request = new SendRequest("template123", "<EMAIL>");
var client = new SendWithUsClient("my-api-key");
var response = await client.SendAsync(request);
```

#### More Realistic Example

The data passed to SendRequest can be any CLR object, as long as it serializes as a JSON object.

```csharp
using SendWithUs.Client;

var sheriff = new Person { ... };
var wristslap = new Punishment { ... };
var data = new Dictionary<string, object> { { "who", sheriff }, { "what", wristslap } };
var request = new SendRequest
{
    TemplateId = "disciplinary-form",
    SenderName = "<NAME>",
    SenderAddress = "<EMAIL>",
    RecipientAddress = "<EMAIL>",
    Data = data
};
var client = new SendWithUsClient("my-api-key");
var response = await client.SendAsync(request);
```
<commit_msg>Update README.<commit_after>SendWithUs.Client
=================

A .NET client implementation over the SendWithUs REST API.

Currently, the client only covers a small portion of the API surface--namely, sending email and batch operations.

## Installation via NuGet

SendWithUs.Client is [available from nuget.org](https://www.nuget.org/packages/SendWithUs.Client/). If you are using 
Visual Studio, install the package using the Package Manager Console as follows: 

```
PM> Install-Package SendWithUs.Client
```

## Usage

The following  description of the  API should be enough to get you started. See the comments in the code (available as
Intellisense documentation in Visual Studio) for more information.

### Sending Email

To send email, you must instantiate a `SendRequest` object to pass to `SendWithUsClient.SendAsync`. A `SendRequest` must 
have a `TemplateId` and a `RecipientAddress`. All other properties are optional.

#### Minimal Example

```csharp
using SendWithUs.Client;

var request = new SendRequest("template123", "<EMAIL>");
var client = new SendWithUsClient("my-api-key");
var response = await client.SendAsync(request);
```

#### More Realistic Example

The data passed to SendRequest can be any CLR object, as long as it serializes as a JSON object.

```csharp
using SendWithUs.Client;

var sheriff = new Person { ... };
var wristslap = new Punishment { ... };
var data = new Dictionary<string, object> { { "who", sheriff }, { "what", wristslap } };
var request = new SendRequest
{
    TemplateId = "disciplinary-form",
    SenderName = "<NAME>",
    SenderAddress = "<EMAIL>",
    RecipientAddress = "<EMAIL>",
    Data = data
};
var client = new SendWithUsClient("my-api-key");
var response = await client.SendAsync(request);
```

#### Typed Request Data

The type of the `Data` property on SendRequest is plain old object. If you want a strongly-typed Data property, use
SendRequest<TData> in lieu of SendRequest. This is merely a developer convenience. SendRequest<TData> shadows the 
Data property of SendRequest and casts it to the specified type.

{'fraction_non_alphanumeric': 0.11064826868003125, 'fraction_numerical': 0.0015620932048945586, 'mean_word_length': 4.568115942028985, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2690228', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1044, 'n_words': 439}