{"id":16702185,"url":"https://github.com/vkatsuba/shot","last_synced_at":"2025-04-10T04:21:41.600Z","repository":{"id":54319338,"uuid":"173819404","full_name":"vkatsuba/shot","owner":"vkatsuba","description":":rocket: Shot is a small HTTP client library for Erlang","archived":false,"fork":false,"pushed_at":"2021-10-29T21:27:56.000Z","size":984,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T05:36:40.483Z","etag":null,"topics":["erlang","functional","http","https","library","rest"],"latest_commit_sha":null,"homepage":"https://github.com/vkatsuba/shot","language":"Erlang","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/vkatsuba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-04T20:51:11.000Z","updated_at":"2022-01-27T07:24:24.000Z","dependencies_parsed_at":"2022-08-13T11:50:58.436Z","dependency_job_id":null,"html_url":"https://github.com/vkatsuba/shot","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkatsuba%2Fshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vkatsuba","download_url":"https://codeload.github.com/vkatsuba/shot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247993898,"owners_count":21030045,"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":["erlang","functional","http","https","library","rest"],"created_at":"2024-10-12T18:47:07.488Z","updated_at":"2025-04-10T04:21:41.578Z","avatar_url":"https://github.com/vkatsuba.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shot\n**shot** is a small `HTTP` client library for Erlang\n\n[![Hex.pm Version](https://img.shields.io/hexpm/v/shot.svg?style=flat-square)](https://hex.pm/packages/shot)\n[![Coverage Status](https://img.shields.io/coveralls/github/vkatsuba/shot.svg?style=flat-square)](https://coveralls.io/github/vkatsuba/shot)\n[![Build Status][gh badge]][gh]\n\n## Goals\nShot aims to provide a simple way for `REST` calls\n\n## Documentation\nFor examples will be used **shot** and test services for requests:\n* [http://ptsv2.com](http://ptsv2.com) - for testing upload files\n* [http://httpbin.org](http://httpbin.org) - for testing `GET`, `POST`, `PUT` etc.\n\n### Build \u0026 Run\n```sh\n$ git clone https://github.com/vkatsuba/shot.git\n$ cd shot\n$ wget https://s3.amazonaws.com/rebar3/rebar3\n$ chmod u+x ./rebar3\n$ ./rebar3 shell\n```\n### Dialyzer\n```sh\n$ ./rebar3 dialyzer\n```\n### Run Common Tests\n```sh\n# See result in _build/test/logs after tests pass\n$ ./rebar3 do xref, ct\n```\n### Clean Project\n```sh\n$ ./rebar3 clean\n```\n### Add `shot` to project: [Rebar3](https://www.rebar3.org/)\n* Edit file **rebar.config**:\n```erlang\n{deps, [\n    {shot, \"1.1.0\"},\n]}.\n```\n### PUT\n```erlang\n% PUT without headers\nshot:put(\"http://httpbin.org/put\").\n```\n```erlang\n% PUT with headers\nData = #{\n    u =\u003e \"https://httpbin.org/anything\",              % URL string, eg: \"http://test.com\"\n    h =\u003e #{\"Authorization\" =\u003e \"Bearer dXNlcjpwYXNz\"}  % Headers\n}.\nshot:put(Data).\n```\n### GET\n```erlang\n% GET without headers\nshot:get(\"http://httpbin.org/get\").\n```\n```erlang\n% GET with headers\nData = #{\n    u =\u003e \"https://httpbin.org/bearer\",                % URL string, eg: \"http://test.com\"\n    h =\u003e #{\"Authorization\" =\u003e \"Bearer dXNlcjpwYXNz\"}  % Headers\n}.\nshot:get(Data).\n```\n### POST\n```erlang\n% POST without headers\nshot:post(\"http://httpbin.org/post\").\n```\n```erlang\n% POST with headers\nData = #{\n    u =\u003e \"https://httpbin.org/anything\",                        % URL string, eg: \"http://test.com\"\n    b =\u003e \"{\\\"foo\\\":[\\\"bing\\\",2.3,true]}\",                       % Body data\n    ct =\u003e \"application/json\",                                   % Content-Type, eg: \"text/html\"\n    h =\u003e #{\"Authorization\" =\u003e \"Basic dmthdHN1YmE6JDFxMnczZTQk\"} % Headers\n}.\nshot:post(Data).\n```\n### DELETE\n```erlang\n% DELETE without headers\nshot:delete(\"http://httpbin.org/delete\").\n```\n```erlang\n% DELETE with headers\nData = #{\n    u =\u003e \"https://httpbin.org/anything\",              % URL string, eg: \"http://test.com\"\n    h =\u003e #{\"Authorization\" =\u003e \"Bearer dXNlcjpwYXNz\"}  % Headers\n}.\nshot:delete(Data).\n```\n### multipart/form-data\n* Create file file **test.dat** with any data\n* Go to the [http://ptsv2.com](http://ptsv2.com)\n* Click to the button **New Random Toilet**\n* Find on page field **Post URL** and copy **Post URL**\n* Prepare and create request:\n```erlang\nReqMap = #{\n    m =\u003e post,                       % Method, can be POST, PUT atom only, eg: post, put\n    u =\u003e \"http://ptsv2.com/ID/post\", % URL string, eg: \"http://test.com\"\n    p =\u003e \"/path/to/test.dat\",        % Full path to file, eg: \"/path/to/file.dat\"\n    o =\u003e [],                         % Options, eg: [{ssl,[[{ciphers,[{rsa,aes_128_cbc,sha}]}]]}]\n    cd =\u003e \"test-data\",               % Content-Disposition, eg: \"dat-model\"\n    ct =\u003e \"\"                         % Content-Type, eg: \"application/json\"\n}.\n\nshot:multipart(ReqMap).\n```\n```sh\n% Response\n{ok,{{\"HTTP/1.1\",200,\"OK\"},\n     [{\"date\",\"Tue, 05 Mar 2019 20:38:51 GMT\"},\n      {\"server\",\"Google Frontend\"},\n      {\"content-length\",\"54\"},\n      {\"content-type\",\"text/html; charset=utf-8\"},\n      {\"x-cloud-trace-context\",\n       \"801e26cb1bec64bbf24fd1e9259893e9\"}],\n     \"Thank you for this dump. I hope you have a lovely day!\"}}\n```\n* Back to **Toilet** page, refresh page and see block **Dumps**\n\n### To be continued ...\n\n## Support\nv.katsuba.dev@gmail.com\n\n\u003c!-- Badges --\u003e\n[gh]: https://github.com/vkatsuba/shot/actions/workflows/main.yml\n[gh badge]: https://img.shields.io/github/workflow/status/vkatsuba/shot/CI?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkatsuba%2Fshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvkatsuba%2Fshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkatsuba%2Fshot/lists"}