# presentation-request

Augmented.js Presentation Request Module

# API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [Configuration](#configuration)
    -   [uri](#uri)
        -   [Properties](#properties)
    -   [url](#url)
        -   [Properties](#properties-1)
    -   [contentType](#contenttype)
        -   [Properties](#properties-2)
    -   [dataType](#datatype)
        -   [Properties](#properties-3)
    -   [method](#method)
        -   [Properties](#properties-4)
    -   [method](#method-1)
        -   [Properties](#properties-5)
    -   [cache](#cache)
        -   [Properties](#properties-6)
    -   [timeout](#timeout)
        -   [Properties](#properties-7)
    -   [crossDomain](#crossdomain)
        -   [Properties](#properties-8)
    -   [withCredentials](#withcredentials)
        -   [Properties](#properties-9)
    -   [user](#user)
        -   [Properties](#properties-10)
    -   [password](#password)
        -   [Properties](#properties-11)
    -   [allowOrigins](#alloworigins)
        -   [Properties](#properties-12)
    -   [allowMethods](#allowmethods)
        -   [Properties](#properties-13)
    -   [headers](#headers)
        -   [Properties](#properties-14)
    -   [success](#success)
        -   [Properties](#properties-15)
    -   [error](#error)
        -   [Properties](#properties-16)
    -   [complete](#complete)
        -   [Properties](#properties-17)
    -   [beforeSend](#beforesend)
        -   [Properties](#properties-18)
    -   [mock](#mock)
        -   [Properties](#properties-19)
-   [xhrFields](#xhrfields)
-   [request](#request)
    -   [Parameters](#parameters)
    -   [Examples](#examples)
-   [sync](#sync)
    -   [Parameters](#parameters-1)

## Configuration

Object of configuration properties and callbacks.  Pass this to the request call to setup configutation

### uri

uri property

#### Properties

-   `uri` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the uri

### url

url property

#### Properties

-   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the url

**Meta**

-   **deprecated**: This is deprecated.


### contentType

contentType property

#### Properties

-   `contentType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the content type (default is text/plain)

### dataType

dataType property

#### Properties

-   `dataType` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the data type (default is text)

### method

async property - no longer supported

#### Properties

-   `async` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** set async (default true)

### method

method property

#### Properties

-   `method` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the ajax method (default GET)

### cache

cache property

#### Properties

-   `cache` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** the cache toggle (default true)

### timeout

timeout property

#### Properties

-   `timeout` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** the timeout property

### crossDomain

crossDomain property - sets withCredentials to true

#### Properties

-   `crossDomain` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** the cross domain property

### withCredentials

withCredentials property

#### Properties

-   `withCredentials` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** the setting for credentails

### user

user property

#### Properties

-   `user` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the username for credentials

### password

password property

#### Properties

-   `password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the password for credentials

### allowOrigins

allowOrigins property

#### Properties

-   `allowOrigins` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the allowed origins for crossDomain

### allowMethods

allowMethods property

#### Properties

-   `allowMethods` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the allowed methods for crossDomain

### headers

headers property

#### Properties

-   `headers` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** an object of headers (key, value)

### success

success callback

#### Properties

-   `success` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** a callback for success

### error

error callback

#### Properties

-   `error` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** a callback for error

### complete

complete callback

#### Properties

-   `complete` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** a callback after the ajax call

### beforeSend

beforeSend callback

#### Properties

-   `beforeSend` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** a callback before the ajax call

### mock

mock

#### Properties

-   `mock` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** a toggle to mock the ajax call

## xhrFields

xhrFields property

## request

AJAX capability using simple jQuery-like API<br/>
Supports the following object properties and features:

<ul>
<li>method</li>
<li>uri</li>
<li>contentType</li>
<li>dataType</li>
<li>beforeSend function</li>
<li>success callback</li>
<li>failure callback</li>
<li>complete callback</li>
<li>user</li>
<li>password</li>
<li>withCredentials</li>
<li>cache</li>
<li>timeout</li>
<li>mock - special flag for mocking response</li>
</ul>

### Parameters

-   `configuration` **[Configuration](#configuration)** object of configuration properties and callbacks.

### Examples

```javascript
request({
        uri: uri,
        contentType: "text/plain",
        dataType: "text",
        success: function (data, status) { ... },
        error: function (data, status) { ... }
    });
```

Returns **any** success or failure callback

**Meta**

-   **deprecated**: Use fetch or sync


## sync

Base sync method that can pass special augmented features

### Parameters

-   `method`   (optional, default `METHOD_MAP.READ`)
-   `model`  
-   `options`   (optional, default `{}`)
