{"id":19614343,"url":"https://github.com/fpapado/elm-flickr-gallery","last_synced_at":"2025-04-28T01:32:09.061Z","repository":{"id":96504891,"uuid":"80113339","full_name":"fpapado/elm-flickr-gallery","owner":"fpapado","description":"Gallery app demonstrating chained HTTP requests in Elm 0.18","archived":false,"fork":false,"pushed_at":"2017-09-08T19:49:41.000Z","size":37,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T04:41:15.322Z","etag":null,"topics":["elm"],"latest_commit_sha":null,"homepage":"https://elmflickrgallery.now.sh","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fpapado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-26T12:38:57.000Z","updated_at":"2018-03-06T12:15:14.000Z","dependencies_parsed_at":"2023-04-26T22:12:54.480Z","dependency_job_id":null,"html_url":"https://github.com/fpapado/elm-flickr-gallery","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Felm-flickr-gallery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Felm-flickr-gallery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Felm-flickr-gallery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpapado%2Felm-flickr-gallery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fpapado","download_url":"https://codeload.github.com/fpapado/elm-flickr-gallery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251234025,"owners_count":21556774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elm"],"created_at":"2024-11-11T10:51:28.992Z","updated_at":"2025-04-28T01:32:09.049Z","avatar_url":"https://github.com/fpapado.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm Gallery for Flickr\nThis project was initially created to demonstrate Elm Tasks and their relation to the revamped elm-lang/http library in 0.18.\n\nAfter that, it is being modified to serve as an example of:\n  - [ ] RemoteData modelling\n  - [ ] Error messages\n  - [ ] Quick grid layout, with fallback\nSee todo.md for more :)\n\n## Chaining Tasks\nThe application tries to find a user's id by their username, and then gets all their photos.\n\nThese are the main steps that I came up with for this version of Elm:\n - `Http.send` now performs the task described in the request and sends a message on success. The message has the `Result` type, so the `Ok`, and `Err` cases have to be handled (cf. two success/fail messages in 0.17).\n - In order to chain tasks, we use `Task.andThen`;\n   - `Task.andThen` uses, as you can imagine, `Task`s.\n   - Thus, `Http.toTask` can be called on each `Request` `Http.get`. [\\[1\\]](http://package.elm-lang.org/packages/elm-lang/http/1.0.0/Http#toTask)\n   - The tasks are then chained by piping into `Task.andThen`, which after 0.18 has its arguments flipped. [\\[2\\]](https://github.com/elm-lang/elm-platform/blob/master/upgrade-docs/0.18.md#backticks-and-andthen)\n - `Task.perform` is now only used for tasks that can't fail. [\\[3\\]](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Task#perform)\n  - `Task.attempt` is now used for Tasks that can fail [\\[4\\]](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Task#attempt). The message sent also handles the `Result` type's `Ok` and `Err` cases.\n    - You can see how this aligns with `Http.send`.\n\nIn the example, note that there is a separate function `findUserAndPhotos` that internally uses the declared `Http.Request` functions coalesced into Tasks.\nThis allows each `Http.Request` (`findUserId`, `getPicturesByUID`) to be used either as a task individually or through the new `Http.send`\n\n## API Key\nIf you want to try this out on your own machine, you would need to add an API key, as string, in the respective parts of `findUserId` and `getPicturesByUID`.\n[You can do this via the flickr website](https://www.flickr.com/services/api/misc.api_keys.html).\n\n## Running\n### Development\nIf you don't already have `elm` and `elm-live`:\n\n```shell\nnpm install -g elm elm-live\n```\n\nThen, to build everything:\n\n```shell\nelm-live --output=elm.js src/Main.elm --open --debug\n```\n\n### Deployment\nServe `index.html` and `elm.js` however you want :)\n\n## References\n*Flickr API use inspired by:*\n[https://github.com/toastal/elm-flickr-photo-gallery-demo](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Task#attempt)\n\n[Elm Task Docs](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/Task)\n\n[Elm Http Docs](http://package.elm-lang.org/packages/elm-lang/http/latest)\n\n## License\n\nMIT © Fotis Papadogeorgopoulos\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpapado%2Felm-flickr-gallery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffpapado%2Felm-flickr-gallery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpapado%2Felm-flickr-gallery/lists"}