{"id":19063280,"url":"https://github.com/kpurdon/apir","last_synced_at":"2025-02-22T02:40:35.918Z","repository":{"id":47092728,"uuid":"312021353","full_name":"kpurdon/apir","owner":"kpurdon","description":"A simple package for making/consuming api[r] requests/responses.","archived":false,"fork":false,"pushed_at":"2024-06-24T22:06:08.000Z","size":37,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T13:28:02.749Z","etag":null,"topics":["api","go","http"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kpurdon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-11T16:07:06.000Z","updated_at":"2021-09-13T21:42:23.000Z","dependencies_parsed_at":"2024-11-09T00:29:38.941Z","dependency_job_id":"3a6bdaf3-5ea1-476f-8cb9-2a531dfc5fbc","html_url":"https://github.com/kpurdon/apir","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpurdon%2Fapir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpurdon%2Fapir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpurdon%2Fapir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpurdon%2Fapir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpurdon","download_url":"https://codeload.github.com/kpurdon/apir/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240118332,"owners_count":19750470,"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":["api","go","http"],"created_at":"2024-11-09T00:29:31.905Z","updated_at":"2025-02-22T02:40:35.901Z","avatar_url":"https://github.com/kpurdon.png","language":"Go","readme":"![go](https://github.com/kpurdon/apir/workflows/go/badge.svg)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/kpurdon/apir)](https://pkg.go.dev/github.com/kpurdon/apir)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kpurdon/apir)](https://goreportcard.com/report/github.com/kpurdon/apir)\n[![codecov](https://codecov.io/gh/kpurdon/apir/branch/main/graph/badge.svg?token=XA8RTRD2SU)](https://codecov.io/gh/kpurdon/apir)\n\napir\n-----\n\nA simple package for making/consuming api[r] requests/responses.\n\n## Installation\n\n`go get github.com/kpurdon/apir`\n\n## Getting Started\n\n\n### Initialize a Client\n\n```go\nclient := requester.NewClient(\"myservice\")\nclient.MustAddAPI(\"otherservice\", discoverer.NewDirect(\"http://foo.com/api\"),\n\trequester.WithRetry(),\n\trequester.WithContentType(requester.ApplicationJSON),\n)\n```\n\n### Create a Request\n\n```go\nreq, err := client.NewRequest(ctx, \"otherservice\", http.MethodGet, \"/\", nil)\nif err != nil {\n    // an error occured trying to make the request\n    // handle the error\n}\n```\n\n### Execute the Request\n\n```go\nvar (\n   data struct{}\n   errData struct{}\n)\nok, err := client.Execute(req, \u0026data, \u0026errData)\nif err != nil {\n    // an error occured trying to executre the request\n    // handle the error\n    return\n}\nif !ok {\n    // we made the request, but got a \u003e= 400 status code\n    // examine errData for error details\n    return\n}\n\n// the request was made and returned a \u003c 400 status code\n// examine data for the response\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpurdon%2Fapir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpurdon%2Fapir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpurdon%2Fapir/lists"}