[post] paginated api requests in Elm

This commit is contained in:
Correl Roush 2018-01-22 22:41:46 -05:00
parent e099b891a6
commit 6aa7b9a97d
2 changed files with 23 additions and 14 deletions

View file

@ -28,9 +28,9 @@ I had a handful of problems to solve. I needed to:
<li>Combine all of the results, maintaining their order.</li> <li>Combine all of the results, maintaining their order.</li>
</ul> </ul>
<div id="outline-container-orgdd8b642" class="outline-2"> <div id="outline-container-org74ec6f4" class="outline-2">
<h2 id="orgdd8b642">Are there more results?</h2> <h2 id="org74ec6f4">Are there more results?</h2>
<div class="outline-text-2" id="text-orgdd8b642"> <div class="outline-text-2" id="text-org74ec6f4">
<p> <p>
The first two bullet points can be dealt with by parsing and The first two bullet points can be dealt with by parsing and
inspecting the response header. Both GitHub and GitLab embed inspecting the response header. Both GitHub and GitLab embed
@ -98,9 +98,9 @@ A little bit of regular expression magic, tuples, and
</div> </div>
</div> </div>
<div id="outline-container-orgf761d84" class="outline-2"> <div id="outline-container-org37fcbcb" class="outline-2">
<h2 id="orgf761d84">Time to make some requests</h2> <h2 id="org37fcbcb">Time to make some requests</h2>
<div class="outline-text-2" id="text-orgf761d84"> <div class="outline-text-2" id="text-org37fcbcb">
<p> <p>
Now's the time to define some types. I'll need a <code>Request</code>, which will Now's the time to define some types. I'll need a <code>Request</code>, which will
be similar to a standard <code>Http.Request</code>, with a <i>slight</i> difference. be similar to a standard <code>Http.Request</code>, with a <i>slight</i> difference.
@ -218,9 +218,9 @@ my <code>Http.Request</code> via a private <code>fromResponse</code> translator:
</div> </div>
</div> </div>
<div id="outline-container-org89bb0e9" class="outline-2"> <div id="outline-container-org0bb2b9b" class="outline-2">
<h2 id="org89bb0e9">Putting it together</h2> <h2 id="org0bb2b9b">Putting it together</h2>
<div class="outline-text-2" id="text-org89bb0e9"> <div class="outline-text-2" id="text-org0bb2b9b">
<p> <p>
Now, I can make my API request, and get back a response with Now, I can make my API request, and get back a response with
potentially partial results. All that needs to be done now is to make potentially partial results. All that needs to be done now is to make
@ -342,9 +342,9 @@ when I've fetched them all:
</div> </div>
</div> </div>
<div id="outline-container-orgc9f526b" class="outline-2"> <div id="outline-container-org6da6934" class="outline-2">
<h2 id="orgc9f526b">There's got to be a better way</h2> <h2 id="org6da6934">There's got to be a better way</h2>
<div class="outline-text-2" id="text-orgc9f526b"> <div class="outline-text-2" id="text-org6da6934">
<p> <p>
I've got it working, and it's working well. However, it's kind of a I've got it working, and it's working well. However, it's kind of a
pain to use. It's nice that I can play with the results as they come pain to use. It's nice that I can play with the results as they come
@ -360,7 +360,12 @@ It just so happens that, with Tasks, I can.
</p> </p>
<p> <p>
<i>To be continued.</i> <i>To be continued&#x2026;</i>
</p>
<p>
<i>For now, feel free to check out the full library documentation and
code referenced in this post <a href="http://package.elm-lang.org/packages/correl/elm-paginated/1.0.1">here</a>.</i>
</p> </p>
</div> </div>
</div> </div>

View file

@ -312,5 +312,9 @@ app.
It just so happens that, with Tasks, I can. It just so happens that, with Tasks, I can.
/To be continued./ /To be continued.../
/For now, feel free to check out the full library documentation and
code referenced in this post [[http://package.elm-lang.org/packages/correl/elm-paginated/1.0.1][here]]./