{"id":13509604,"url":"https://github.com/Raynes/reap","last_synced_at":"2025-03-30T13:32:37.139Z","repository":{"id":57541101,"uuid":"11808335","full_name":"Raynes/reap","owner":"Raynes","description":"A refheap API client library in Elixir.","archived":false,"fork":false,"pushed_at":"2014-10-27T22:53:40.000Z","size":179,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-28T12:00:21.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Raynes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-01T04:57:56.000Z","updated_at":"2022-08-26T09:36:39.000Z","dependencies_parsed_at":"2022-09-18T00:00:45.437Z","dependency_job_id":null,"html_url":"https://github.com/Raynes/reap","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raynes%2Freap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raynes%2Freap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raynes%2Freap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raynes%2Freap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Raynes","download_url":"https://codeload.github.com/Raynes/reap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222552959,"owners_count":17002160,"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":[],"created_at":"2024-08-01T02:01:10.216Z","updated_at":"2024-11-01T09:31:54.866Z","avatar_url":"https://github.com/Raynes.png","language":"Elixir","funding_links":[],"categories":["Third Party APIs"],"sub_categories":[],"readme":"# Reap\n\nReap is a simple Elixir library for working with the\n[refheap](https://www.refheap.com) API. It uses the excellent\n[hackney](https://github.com/benoitc/hackney) HTTP client and\n[JSEX](https://github.com/talentdeficit/jsex) JSON encoder/decoder.\n\n## Usage\n\nReap only has one function you should care about: `request/2`, `request/3`.\nHere's some examples:\n\n```elixir\niex(1)\u003e Reap.start\n:ok\niex(2)\u003e Reap.request(:post, \"/paste\", [contents: \"foo\"])\n{:ok,\n [{\"lines\", 1}, {\"date\", \"2013-08-01T04:42:44.155Z\"}, {\"paste-id\", \"17091\"},\n  {\"fork\", nil}, {\"random-id\", \"6249eaf9c9c8186230243bb46\"},\n  {\"language\", \"Plain Text\"}, {\"private\", false}, {\"views\", 0},\n  {\"url\", \"https://www.refheap.com/17091\"}, {\"user\", nil}, {\"contents\", \"foo\"}]}\niex(3)\u003e Reap.request(:get, \"/paste/17091\")\n{:ok,\n [{\"lines\", 1}, {\"date\", \"2013-08-01T04:42:44.155Z\"}, {\"paste-id\", \"17091\"},\n  {\"fork\", nil}, {\"random-id\", \"6249eaf9c9c8186230243bb46\"},\n  {\"language\", \"Plain Text\"}, {\"private\", false}, {\"views\", 0},\n  {\"url\", \"https://www.refheap.com/17091\"}, {\"user\", nil}, {\"contents\", \"foo\"}]}\n```\n\nAs you can see, if the request and json decode is successful we get back `{:ok,\nbody}`. Let's see what happens if things go wrong:\n\n```elixir\niex(11)\u003e Reap.request(:post, \"/paste\")\n{:error, :refheap, [{\"error\", \"Your paste cannot be empty.\"}]}\n```\n\nIn this case, something went wrong on refheap and it gave us back an error. The\nsecond element of the tuple is the type of the error, and it can be `:refheap`\nif something bad happens on refheap, `:json` if JSON parsing of the body fails\nfor some reason, or `:http` if we fail to make an http request at all. In the\nlatter two cases, the entire hackney response gets returned as the third element\nof the tuple.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRaynes%2Freap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRaynes%2Freap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRaynes%2Freap/lists"}