<commit_before>Providers
=========

When using Moya, you make all API requests through a `MoyaProvider` instance,
passing in a value of your enum that specifies which endpoint you want to call.
After setting up your [Endpoint](Endpoints.md), you're basically all set for
basic usage:

```swift
let provider = MoyaProvider<MyService>()
```

After that simple setup, you're off to the races:

```swift
provider.request(.zen) { result in
    // `result` is either .Success(response) or .Failure(error)
}
```

That's it! The `request()` method returns a `Cancellable`, which has
only one public function, `cancel()`, which you can use to cancel the
request.  See [Examples](Examples) for more information about the `Result`
type.

Remember, *where* you put your target and the provider, are completely up
to you. You can check out [Artsy's implementation](https://github.com/artsy/eidolon/blob/master/Kiosk/App/Networking/ArtsyAPI.swift)
for an example.

But don't forget to keep a reference for it in property. If it gets deallocated you'll see `-999 "cancelled"` error on response.

Advanced Usage
------------

To explain all configuration options you have with a `MoyaProvider` we will cover each parameter one by one in the following sections.

### endpointClosure:

The first (optional) parameter for the `MoyaProvider` initializer is an<commit_msg>Lowercase some more enums in documentation<commit_after>Providers
=========

When using Moya, you make all API requests through a `MoyaProvider` instance,
passing in a value of your enum that specifies which endpoint you want to call.
After setting up your [Endpoint](Endpoints.md), you're basically all set for
basic usage:

```swift
let provider = MoyaProvider<MyService>()
```

After that simple setup, you're off to the races:

```swift
provider.request(.zen) { result in
    // `result` is either .success(response) or .failure(error)
}
```

That's it! The `request()` method returns a `Cancellable`, which has
only one public function, `cancel()`, which you can use to cancel the
request.  See [Examples](Examples) for more information about the `Result`
type.

Remember, *where* you put your target and the provider, are completely up
to you. You can check out [Artsy's implementation](https://github.com/artsy/eidolon/blob/master/Kiosk/App/Networking/ArtsyAPI.swift)
for an example.

But don't forget to keep a reference for it in property. If it gets deallocated you'll see `-999 "cancelled"` error on response.

Advanced Usage
------------

To explain all configuration options you have with a `MoyaProvider` we will cover each parameter one by one in the following sections.

### endpointClosure:

The first (optional) parameter for the `MoyaProvider` initializer is an
{'fraction_non_alphanumeric': 0.10252654705236178, 'fraction_numerical': 0.0021969974368363236, 'mean_word_length': 4.644628099173554, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '4846757', 'n_tokens_mistral': 796, 'n_tokens_neox': 741, 'n_words': 354}