<commit_before>Nap
========

## Disclaimer

Nap is in Beta, and not ready to be used on production projects yet.

## Summary

**Nap** is a short and sweet REST client.  It was made with the purpose of streamlining REST requests *as much as possible*.

## Short

**Nap** is short.

```c#
var nap = new Nap("http://example.com/");
var dogs = await nap.Get<Dogs>("/dogs").ExecuteAsync();
var cats = await nap.Get<Cats>("http://otherexample.com/cats").ExecuteAsync();
```

Or, even shorter!

```c#
var dogs = Nap.Lets.Get<Dogs>("http://example.com/dogs").ExecuteAsync()
```

## Sweet

**Nap** is sweet.

```c#
var ingredients = new { Flour = 10, Eggs = 2, CakeMix = 1 };
var cake = Nap.Lets.Post<Cake>("http://example.com/bake-cake")
                   .IncludeQueryParameter("temp", "425F")
                   .IncludeHeader("sugar", "100g")
                   .IncludeBody(ingredients)
                   .Execute();
```

## Configurable

**Nap** removes the need to configure stuff over and over again if you don't want to, or the need to create a client if you don't want one.  Your `App.config` or `Web.config` file can include:

```xml
<configuration>
  <configSections>
    <section 
      name="Nap" 
      type="Nap.Configuration.NapConfig" 
      allowLocation="true" 
      allowDefinition="Everywhere"
    />
  </configSections>
</configuration>
...
<Nap baseUrl="http://example.com" fillMetada="true">
  <Headers>
    <add key="sugar" value="100g" />
  </Headers>
  <QueryParameters>
    <add key="temp" value="425F" />
  </QueryParameters>
  <Advanced useSsl="true">
    <Proxy address="http://localhost:8080" />
    <Authentication username="jdoe" password="<PASSWORD>" />
  </Advanced>
</Nap>
```

Along with a simple Configuration declaration:
```c#
NapSetup.AddConfig(NapConfig.GetCurrent());
```

And make your **Naps** even easier:

```c#
var ingredients = new { Flour = 10, Eggs = 2, CakeMix = 1 };
Nap.Lets.Post<Cake>("/bake-cake")
        .IncludeBody(ingredients)
        .Execute();
```

And still fully malleable:

```c#
Nap.Lets.Get<Potato>("/potato")
        .DoNot.IncludeHeader("sugar")
        .Execute();
```

Nap supports 3 levels of cascading configuration: *.config < Nap() < Fluent.  In this example:

```xml
...
<Nap>
  <BaseUrl>http://example.com</BaseUrl>
  <Headers>
    <Header key="sugar" value="100g" />
  </Headers>
  <QueryParameters>
    <QueryParameter key="temp" value="425F" />
  </QueryParameters>
</Nap>
...
```

```c#
var nap = new Nap();
nap.Config.QueryParameters["temp"] = "300F";
var cake = nap.Get<Cake>("/cake")
              .IncludeHeader("sugar", "10g")
              .Execute();
```<commit_msg>Updated README for configuration additions.<commit_after>Nap
========

## Disclaimer

Nap is in Beta, and not ready to be used on production projects yet.

## Summary

**Nap** is a short and sweet REST client.  It was made with the purpose of streamlining REST requests *as much as possible*.

## Short

**Nap** is short.

```c#
var nap = new Nap("http://example.com/");
var dogs = await nap.Get<Dogs>("/dogs").ExecuteAsync();
var cats = await nap.Get<Cats>("http://otherexample.com/cats").ExecuteAsync();
```

Or, even shorter!

```c#
var dogs = Nap.Lets.Get<Dogs>("http://example.com/dogs").ExecuteAsync()
```

## Sweet

**Nap** is sweet.

```c#
var ingredients = new { Flour = 10, Eggs = 2, CakeMix = 1 };
var cake = Nap.Lets.Post<Cake>("http://example.com/bake-cake")
                   .IncludeQueryParameter("temp", "425F")
                   .IncludeHeader("sugar", "100g")
                   .IncludeBody(ingredients)
                   .Execute();
```

## Configurable

**Nap** removes the need to configure stuff over and over again if you don't want to, or the need to create a client if you don't want one.  Your `App.config` or `Web.config` file can include:

```xml
<configuration>
  <configSections>
    <section 
      name="nap" 
      type="Nap.Configuration.NapConfig" 
      allowLocation="true" 
      allowDefinition="Everywhere"
    />
  </configSections>
</configuration>
...
<Nap baseUrl="http://example.com" fillMetada="true">
  <Headers>
    <add key="sugar" value="100g" />
  </Headers>
  <QueryParameters>
    <add key="temp" value="425F" />
  </QueryParameters>
  <Advanced useSsl="true">
    <Proxy address="http://localhost:8080" />
    <Authentication username="jdoe" password="<PASSWORD>" />
  </Advanced>
</Nap>
```

Along with a simple Configuration declaration:
```c#
NapSetup.AddConfig(NapConfig.GetCurrent());
```

And make your **Naps** even easier:

```c#
var ingredients = new { Flour = 10, Eggs = 2, CakeMix = 1 };
Nap.Lets.Post<Cake>("/bake-cake")
        .IncludeBody(ingredients)
        .Execute();
```

And still fully malleable:

```c#
Nap.Lets.Get<Potato>("/potato")
        .DoNot.IncludeHeader("sugar")
        .Execute();
```

Nap supports 3 levels of cascading configuration: *.config < Nap() < Fluent.  In this example:

```xml
...
<nap baseUrl="http://example.com">
  <headers>
    <add key="sugar" value="100g" />
  </headers>
  <queryParameters>
    <add key="temp" value="425F" />
  </queryParameters>
</nap>
...
```

```c#
var nap = new Nap();
nap.Config.QueryParameters["temp"] = "300F";
var cake = nap.Get<Cake>("/cake")
              .IncludeHeader("sugar", "10g")
              .Execute();
```
{'fraction_non_alphanumeric': 0.1795064983989452, 'fraction_numerical': 0.013561876059521567, 'mean_word_length': 3.2719227674979887, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3644355', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1746, 'n_words': 462}