blob: 9162b714267d0edf57fb8adbc26a8c4d469a182a [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>ParameterEncoding Enum Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script type="text/javascript">
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
</script>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body id="reference" class="Swift">
<a name="//apple_ref/swift/Enum/ParameterEncoding" class="dashAnchor"></a>
<a title="ParameterEncoding Enum Reference"></a>
<header>
<div class="content-wrapper">
<p class="header-text"><a href="../index.html"> Docs</a> (41% documented)</p>
<p id="header-links"><a href=""><img id="header-icon" src="../img/gh.png" height="16px" width="16px" />View on GitHub</a></p>
</div>
</header>
<section id="valence">
<div class="content-wrapper">
<p id="hierarchial_navigation">
<a href="../index.html" id="design_resources_link"> Reference</a>
<img id="carat" src="../img/carat.png" height="10px" width="6px" />
ParameterEncoding Enum Reference
</p>
</div>
</section>
<div class="content-wrapper">
<nav class="book-parts">
<ul class="nav-parts">
<li class="part-name tasks">
<a href="../Classes.html">Classes</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Classes/BaseClient.html">BaseClient</a>
</li>
<li class="nav-chapter">
<a href="../Classes/EngineClient.html">EngineClient</a>
</li>
<li class="nav-chapter">
<a href="../Classes/EventClient.html">EventClient</a>
</li>
<li class="nav-chapter">
<a href="../Classes/Manager.html">Manager</a>
</li>
<li class="nav-chapter">
<a href="../Classes/Request.html">Request</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Global Variables.html">Global Variables</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Global Variables.html#/s:v15PredictionIOSDK20AlamofireErrorDomainSS">AlamofireErrorDomain</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Enums.html">Enums</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Enums.html#/s:O15PredictionIOSDK6Method">Method</a>
</li>
<li class="nav-chapter">
<a href="../Enums/ParameterEncoding.html">ParameterEncoding</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Extensions/EventClient.html">EventClient</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/Manager.html">Manager</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/NSURL.html">NSURL</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/NSURLComponents.html">NSURLComponents</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/NSURLRequest.html">NSURLRequest</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/Request.html">Request</a>
</li>
<li class="nav-chapter">
<a href="../Extensions/String.html">String</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Functions.html">Functions</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK8downloadFTPS_21URLRequestConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK8downloadFTOS_6MethodPS_20URLStringConvertible_FTCSo5NSURLCSo17NSHTTPURLResponse_S2__CS_7Request">download(_:_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK8downloadFT10resumeDataCSo6NSDataFTCSo5NSURLCSo17NSHTTPURLResponse_S1__CS_7Request">download(resumeData:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK7requestFPS_21URLRequestConvertible_CS_7Request">request(_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK7requestFTOS_6MethodPS_20URLStringConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject___8encodingOS_17ParameterEncoding_CS_7Request">request(_:_:parameters:encoding:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTPS_21URLRequestConvertible_CSo6NSData_CS_7Request">upload(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTPS_21URLRequestConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTPS_21URLRequestConvertible_CSo5NSURL_CS_7Request">upload(_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTOS_6MethodPS_20URLStringConvertible_CSo13NSInputStream_CS_7Request">upload(_:_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTOS_6MethodPS_20URLStringConvertible_CSo5NSURL_CS_7Request">upload(_:_:_:)</a>
</li>
<li class="nav-chapter">
<a href="../Functions.html#/s:F15PredictionIOSDK6uploadFTOS_6MethodPS_20URLStringConvertible_CSo6NSData_CS_7Request">upload(_:_:_:)</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Protocols/URLRequestConvertible.html">URLRequestConvertible</a>
</li>
<li class="nav-chapter">
<a href="../Protocols/URLStringConvertible.html">URLStringConvertible</a>
</li>
</ul>
</li>
<li class="part-name tasks">
<a href="../Structs.html">Structs</a>
<ul class="nav-chapters">
<li class="nav-chapter">
<a href="../Structs/Event.html">Event</a>
</li>
</ul>
</li>
</ul>
</nav>
<div class="pixel-line"></div>
<div class="rubber-band-gap"></div>
<article class="chapter">
<a name="/"></a>
<h1 class="chapter-name">ParameterEncoding</h1>
<section>
<section class="section">
<p class="para">Used to specify the way in which a set of parameters are applied to a URL request.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Unnamed"></a>
</div>
<ul class="task-group-list">
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding6encodeFS0_FTPS_21URLRequestConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject____TCSo12NSURLRequestGSqCSo7NSError__">
<a name="//apple_ref/swift/Method/encode(_:parameters:)" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding6encodeFS0_FTPS_21URLRequestConvertible_10parametersGSqGVSs10DictionarySSPSs9AnyObject____TCSo12NSURLRequestGSqCSo7NSError__">encode(_:parameters:)</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Creates a URL request by encoding parameters and applying them onto an existing request.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">encode</span><span class="p">(</span><span class="kt">URLRequest</span><span class="p">:</span> <span class="kt">URLRequestConvertible</span><span class="p">,</span> <span class="nv">parameters</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?)</span> <span class="o">-&gt;</span> <span class="p">(</span><span class="kt">NSURLRequest</span><span class="p">,</span> <span class="kt">NSError</span><span class="p">?)</span></code></pre>
</div>
</div>
<div class="parameters">
<h4>Parameters</h4>
<table class="graybox" border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td scope="row">
<code>
<em class="term">URLRequest</em>
</code>
</td>
<td>
<div class="definition">
<p class="para">The request to have parameters applied</p>
</div>
</td>
</tr>
<tr>
<td scope="row">
<code>
<em class="term">parameters</em>
</code>
</td>
<td>
<div class="definition">
<p class="para">The parameters to apply</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="result-description">
<h4>Return Value</h4>
<p class="para">A tuple containing the constructed request and the error that occurred during parameter encoding, if any.</p>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding4JSONFMS0_S0_">
<a name="//apple_ref/swift/Element/JSON" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding4JSONFMS0_S0_">JSON</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Uses <code>NSJSONSerialization</code> to create a JSON representation of the parameters object, which is set as the body of the request. The <code>Content-Type</code> HTTP header field of an encoded request is set to <code>application/json</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="kt">JSON</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding3URLFMS0_S0_">
<a name="//apple_ref/swift/Element/URL" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding3URLFMS0_S0_">URL</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">A query string to be set as or appended to any existing URL query for <code>GET</code>, <code>HEAD</code>, and <code>DELETE</code> requests, or set as the body for requests with any other HTTP method. The <code>Content-Type</code> HTTP header field of an encoded request with HTTP body is set to <code>application/x-www-form-urlencoded</code>. Since there is no published specification for how to encode collection types, the convention of appending <code>[]</code> to the key for array values (<code>foo[]=1&amp;foo[]=2</code>), and appending the key surrounded by square brackets for nested dictionary values (<code>foo[bar]=baz</code>).</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="kt">URL</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding12PropertyListFMS0_FTOSC20NSPropertyListFormatSi_S0_">
<a name="//apple_ref/swift/Element/PropertyList" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding12PropertyListFMS0_FTOSC20NSPropertyListFormatSi_S0_">PropertyList</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Uses <code>NSPropertyListSerialization</code> to create a plist representation of the parameters object, according to the associated format and write options values, which is set as the body of the request. The <code>Content-Type</code> HTTP header field of an encoded request is set to <code>application/x-plist</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="kt">PropertyList</span><span class="p">(</span><span class="kt">NSPropertyListFormat</span><span class="p">,</span> <span class="kt">NSPropertyListWriteOptions</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding6CustomFMS0_FFTPS_21URLRequestConvertible_GSqGVSs10DictionarySSPSs9AnyObject____TCSo12NSURLRequestGSqCSo7NSError__S0_">
<a name="//apple_ref/swift/Element/Custom" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding6CustomFMS0_FFTPS_21URLRequestConvertible_GSqGVSs10DictionarySSPSs9AnyObject____TCSo12NSURLRequestGSqCSo7NSError__S0_">Custom</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Uses the associated closure value to construct a new request given an existing request and parameters.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="Swift">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="kt">Custom</span><span class="p">((</span><span class="kt">URLRequestConvertible</span><span class="p">,</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?)</span> <span class="o">-&gt;</span> <span class="p">(</span><span class="kt">NSURLRequest</span><span class="p">,</span> <span class="kt">NSError</span><span class="p">?))</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding15queryComponentsFS0_FTSSPSs9AnyObject__GSaTSSSS__">
<a name="//apple_ref/swift/Method/queryComponents(_:_:)" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding15queryComponentsFS0_FTSSPSs9AnyObject__GSaTSSSS__">queryComponents(_:_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Undocumented</p>
</div>
</section>
</div>
</li>
<li class="item symbol">
<div class="task-group-term">
<code>
<a name="/s:FO15PredictionIOSDK17ParameterEncoding6escapeFS0_FSSSS">
<a name="//apple_ref/swift/Method/escape(_:)" class="dashAnchor"></a>
<a class="x-instance-method Swift" href="#/s:FO15PredictionIOSDK17ParameterEncoding6escapeFS0_FSSSS">escape(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointy-thing-container"></div>
<section class="section instance-method">
<div class="pointy-thing"></div>
<div class="abstract">
<p class="para">Undocumented</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p class="copyright">&copy; 2015 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2015-02-24)</p>
<p class="copyright">Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.1.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>