From 6aa7b9a97d5f42d09dd8cda1d71d2b742bd1517a Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 22 Jan 2018 22:41:46 -0500 Subject: [PATCH] [post] paginated api requests in Elm --- .../2018-01-22-recursive-http-with-elm.html | 31 +++++++++++-------- .../2018-01-22-recursive-http-with-elm.org | 6 +++- 2 files changed, 23 insertions(+), 14 deletions(-) rename {_drafts => _posts}/2018-01-22-recursive-http-with-elm.html (97%) rename {_drafts => _posts}/2018-01-22-recursive-http-with-elm.org (97%) diff --git a/_drafts/2018-01-22-recursive-http-with-elm.html b/_posts/2018-01-22-recursive-http-with-elm.html similarity index 97% rename from _drafts/2018-01-22-recursive-http-with-elm.html rename to _posts/2018-01-22-recursive-http-with-elm.html index d4d8032..51ac76a 100644 --- a/_drafts/2018-01-22-recursive-http-with-elm.html +++ b/_posts/2018-01-22-recursive-http-with-elm.html @@ -28,9 +28,9 @@ I had a handful of problems to solve. I needed to:
  • Combine all of the results, maintaining their order.
  • -
    -

    Are there more results?

    -
    +
    +

    Are there more results?

    +

    The first two bullet points can be dealt with by parsing and inspecting the response header. Both GitHub and GitLab embed @@ -98,9 +98,9 @@ A little bit of regular expression magic, tuples, and

    -
    -

    Time to make some requests

    -
    +
    +

    Time to make some requests

    +

    Now's the time to define some types. I'll need a Request, which will be similar to a standard Http.Request, with a slight difference. @@ -218,9 +218,9 @@ my Http.Request via a private fromResponse translator:

    -
    -

    Putting it together

    -
    +
    +

    Putting it together

    +

    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 @@ -342,9 +342,9 @@ when I've fetched them all:

    -
    -

    There's got to be a better way

    -
    +
    +

    There's got to be a better way

    +

    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 @@ -360,7 +360,12 @@ 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 here.

    diff --git a/_drafts/2018-01-22-recursive-http-with-elm.org b/_posts/2018-01-22-recursive-http-with-elm.org similarity index 97% rename from _drafts/2018-01-22-recursive-http-with-elm.org rename to _posts/2018-01-22-recursive-http-with-elm.org index 3815023..5671a7e 100644 --- a/_drafts/2018-01-22-recursive-http-with-elm.org +++ b/_posts/2018-01-22-recursive-http-with-elm.org @@ -312,5 +312,9 @@ app. 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]]./ +