Skip to content

Commit

Permalink
updated iOS API doc after the API.md integration
Browse files Browse the repository at this point in the history
  • Loading branch information
cvasilak committed Mar 11, 2013
1 parent 4ee3e1f commit a72ebd7
Show file tree
Hide file tree
Showing 21 changed files with 1,117 additions and 558 deletions.
99 changes: 84 additions & 15 deletions docs/specs/aerogear-ios/Categories/NSMutableArray+AGPaging.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ <h1 class="hideInXcode">NSMutableArray(AGPaging) Category Reference</h1>
<select id="jumpTo">
<option value="top">Jump To&#133;</option>

<option value="overview">Overview</option>




Expand Down Expand Up @@ -55,6 +57,8 @@ <h1 class="hideInXcode">NSMutableArray(AGPaging) Category Reference</h1>
<nav id="tocContainer" class="isShowingTOC">
<ul id="toc" role="tree">

<li role="treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#overview">Overview</a></span></li>




Expand Down Expand Up @@ -107,6 +111,75 @@ <h1 class="title title-header">NSMutableArray(AGPaging) Category Reference</h1>



<div class="section section-overview">
<a title="Overview" name="overview"></a>
<h2 class="subtitle subtitle-overview">Overview</h2>
<p>The library has built-in paging support, enabling the scrolling to either forward or backwards through a result set returned from the server. Paging metadata located in the server response (either in the headers, in the body or using <a href="http://tools.ietf.org/html/rfc5988">webLinking</a>) are used to identify the <em>next</em> or the <em>previous</em> result set. For example, in Twitter case, paging metadata are located in the body of the response, using <em>&ldquo;next_page&rdquo;</em> or <em>&ldquo;previous_page&rdquo;</em> to identify the next or previous result set respectively. The location of this metadata as well as naming, is fully configurable during the creation of the <a href="../Protocols/AGPipe.html">Pipe</a>, thus enabling greater flexibility in supporting several different paging strategies.</p>

<p>Below is an example that goes against the AeroGear Controller Server:</p>

<pre><code>NSURL* baseURL = [NSURL URLWithString:@"https://controller-aerogear.rhcloud.com/aerogear-controller-demo"]https://controller-aerogear.rhcloud.com/aerogear-controller-demo"];
AGPipeline* agPipeline = [AGPipeline pipelineWithBaseURL:baseURL];

id&lt;AGPipe&gt; cars = [agPipeline pipe:^(id&lt;AGPipeConfig&gt; config) {
[config setName:@"cars-custom"];
[config setNextIdentifier:@"AG-Links-Next"];
[config setPreviousIdentifier:@"AG-Links-Previous"];
[config setMetadataLocation:@"header"];
}];
</code></pre>

<p>First we create our <a href="../Classes/AGPipeline.html">Pipeline</a> object. Notice that in the Pipe configuration object, we explicitely declare the name of the paging identifiers supported by the server, as well as the the location of these identifiers in the response. Note that If not specified, the library will assume the server is using Web Linking paging strategy.</p>

<h2>Start Paging</h2>

<p>To kick-start pagination, you use the method <code>readWithParams</code> of the underlying <a href="../Protocols/AGPipe.html">Pipe</a>, passing your desired query parameters to the server. Upon successfully completion, the <em>pagedResultSet</em> (an enchached category of NSArray) will allow you to scroll through the result set.</p>

<pre><code>__block NSMutableArray *pagedResultSet;

// fetch the first page
[cars readWithParams:@{@"color" : @"black", @"offset" : @"0", @"limit" : @1} success:^(id responseObject) {
pagedResultSet = responseObject;

// do something

} failure:^(NSError *error) {
//handle error
}];
</code></pre>

<h2>Move Forward in the result set</h2>

<p>To move forward in the result set, you simple call <code>next</code> on the <em>pagedResultSet</em> :</p>

<pre><code>// move to the next page
[pagedResultSet next:^(id responseObject) {
// do something

} failure:^(NSError *error) {
// handle error
}];
</code></pre>

<h2>Move Backwards in the result set</h2>

<p>To move backwards in the result set, you simple call <code>previous</code> on the <em>pagedResultSet</em> :</p>

<pre><code>[pagedResultSet previous:^(id responseObject) {
// do something

} failure:^(NSError *error) {
// handle error
}];
</code></pre>

<h2>Exception cases</h2>

<p>Moving beyond last or first page is left on the behaviour of the specific server implementation, that is the library will not treat it differently. Some servers can throw an error (like Twitter or AeroGear Controller does) by respondng with an http error response, or simply return an empty list. The user is responsible to cater for exception cases like this.</p>
</div>





<div class="section section-tasks">
Expand All @@ -121,14 +194,14 @@ <h2 class="subtitle subtitle-tasks">Tasks</h2>
<li>
<span class="tooltip">
<code><a href="#//api/name/next:failure:">&ndash;&nbsp;next:failure:</a></code>
<span class="tooltip"><p>Reads the next &lsquo;page&rsquo;, based on the current position, of the paging result, from the server.</p></span>
<span class="tooltip"><p>Reads the next &lsquo;page&rsquo;, based on the current position of the paging result from the server.</p></span>
</span>


</li><li>
<span class="tooltip">
<code><a href="#//api/name/previous:failure:">&ndash;&nbsp;previous:failure:</a></code>
<span class="tooltip"><p>Reads the previous &lsquo;page&rsquo;, based on the current position, of the paging result, from the server.</p></span>
<span class="tooltip"><p>Reads the previous &lsquo;page&rsquo;, based on the current position of the paging result from the server.</p></span>
</span>


Expand Down Expand Up @@ -156,14 +229,12 @@ <h3 class="subsubtitle method-title">next:failure:</h3>


<div class="method-subsection brief-description">
<p>Reads the next &lsquo;page&rsquo;, based on the current position, of the paging result, from the server.</p>
<p>Reads the next &lsquo;page&rsquo;, based on the current position of the paging result from the server.</p>
</div>




<div class="method-subsection method-declaration"><code>- (void)next:(void ( ^ ) ( id responseObject ))<em>success</em> failure:(void ( ^ ) ( NSError *error ))<em>failure</em></code></div>




<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
Expand Down Expand Up @@ -193,7 +264,7 @@ <h4 class="method-subtitle parameter-title">Parameters</h4>

<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Reads the next &lsquo;page&rsquo;, based on the current position, of the paging result, from the server.</p>
<p>Reads the next &lsquo;page&rsquo;, based on the current position of the paging result from the server.</p>
</div>


Expand All @@ -217,14 +288,12 @@ <h3 class="subsubtitle method-title">previous:failure:</h3>


<div class="method-subsection brief-description">
<p>Reads the previous &lsquo;page&rsquo;, based on the current position, of the paging result, from the server.</p>
<p>Reads the previous &lsquo;page&rsquo;, based on the current position of the paging result from the server.</p>
</div>




<div class="method-subsection method-declaration"><code>- (void)previous:(void ( ^ ) ( id responseObject ))<em>success</em> failure:(void ( ^ ) ( NSError *error ))<em>failure</em></code></div>




<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
Expand Down Expand Up @@ -254,7 +323,7 @@ <h4 class="method-subtitle parameter-title">Parameters</h4>

<div class="method-subsection discussion-section">
<h4 class="method-subtitle">Discussion</h4>
<p>Reads the previous &lsquo;page&rsquo;, based on the current position, of the paging result, from the server.</p>
<p>Reads the previous &lsquo;page&rsquo;, based on the current position of the paging result from the server.</p>
</div>


Expand Down Expand Up @@ -284,7 +353,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Red Hat. All rights reserved. (Last updated: 2013-02-28)</span><br />
<p><span class="copyright">&copy; 2013 Red Hat. All rights reserved. (Last updated: 2013-03-11)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 840)</a>.</span></p>

Expand Down
2 changes: 1 addition & 1 deletion docs/specs/aerogear-ios/Classes/AGAuthConfiguration.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h2 class="subtitle subtitle-overview">Overview</h2>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Red Hat. All rights reserved. (Last updated: 2013-02-28)</span><br />
<p><span class="copyright">&copy; 2013 Red Hat. All rights reserved. (Last updated: 2013-03-11)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 840)</a>.</span></p>

Expand Down
49 changes: 29 additions & 20 deletions docs/specs/aerogear-ios/Classes/AGAuthenticator.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,26 @@ <h1 class="title title-header">AGAuthenticator Class Reference</h1>
<div class="section section-overview">
<a title="Overview" name="overview"></a>
<h2 class="subtitle subtitle-overview">Overview</h2>
<p>AGAuthenticator manages different <a href="../Protocols/AGAuthenticationModule.html">AGAuthenticationModule</a> implementations. It is basically a
factory that hides the concrete instantiation of a specific <a href="../Protocols/AGAuthenticationModule.html">AGAuthenticationModule</a> implementation.
The class offers simple APIs to add, remove, or get access to a &lsquo;authentication module&rsquo;.</p>
<p> AGAuthenticator manages different <a href="../Protocols/AGAuthenticationModule.html">AGAuthenticationModule</a> implementations. It is basically a
factory that hides the concrete instantiation of a specific <a href="../Protocols/AGAuthenticationModule.html">AGAuthenticationModule</a> implementation.
The class offers simple APIs to add, remove, or get access to a &lsquo;authentication module&rsquo;.</p>

<h2>Creating an Authenticator with an Authentication module</h2>

<p>Below is an example that creates an Authenticator that points to the remote AeroGear TODO server application.</p>

<pre><code>// create an authenticator object
AGAuthenticator* authenticator = [AGAuthenticator authenticator];

// the base URL of the application we want to authenticate to
NSString* baseURL = @"http://todo-aerogear.rhcloud.com/todo-server/";

// add a new auth module and the required 'base URL':
id&lt;AGAuthenticationModule&gt; myMod = [authenticator auth:^(id&lt;AGAuthConfig&gt; config) {
[config setName:@"authMod"];
[config setBaseURL:[NSURL URLWithString:baseURL]];
}];
</code></pre>
</div>


Expand Down Expand Up @@ -204,11 +221,9 @@ <h3 class="subsubtitle method-title">authenticator</h3>
<p>A factory method to instantiate an empty AGAuthenticator.</p>
</div>




<div class="method-subsection method-declaration"><code>+ (id)authenticator</code></div>






Expand Down Expand Up @@ -258,11 +273,9 @@ <h3 class="subsubtitle method-title">auth:</h3>
<p>Adds a new <a href="../Protocols/AGAuthenticationModule.html">AGAuthenticationModule</a> object, based on the given configuration object.</p>
</div>




<div class="method-subsection method-declaration"><code>- (id&lt;AGAuthenticationModule&gt;)auth:(void ( ^ ) ( id&lt;AGAuthConfig&gt; config ))<em>config</em></code></div>




<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
Expand Down Expand Up @@ -315,11 +328,9 @@ <h3 class="subsubtitle method-title">authModuleWithName:</h3>
<p>Loads a given <a href="../Protocols/AGAuthenticationModule.html">AGAuthenticationModule</a> implementation, based on the given moduleName argument.</p>
</div>




<div class="method-subsection method-declaration"><code>- (id&lt;AGAuthenticationModule&gt;)authModuleWithName:(NSString *)<em>moduleName</em></code></div>




<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
Expand Down Expand Up @@ -367,11 +378,9 @@ <h3 class="subsubtitle method-title">remove:</h3>
to be removed is determined by the moduleName argument.</p>
</div>




<div class="method-subsection method-declaration"><code>- (id&lt;AGAuthenticationModule&gt;)remove:(NSString *)<em>moduleName</em></code></div>




<div class="method-subsection arguments-section parameters">
<h4 class="method-subtitle parameter-title">Parameters</h4>
Expand Down Expand Up @@ -422,7 +431,7 @@ <h4 class="method-subtitle">Declared In</h4>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Red Hat. All rights reserved. (Last updated: 2013-02-28)</span><br />
<p><span class="copyright">&copy; 2013 Red Hat. All rights reserved. (Last updated: 2013-03-11)</span><br />

<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.1 (build 840)</a>.</span></p>

Expand Down
Loading

0 comments on commit a72ebd7

Please sign in to comment.