{"id":28559973,"url":"https://github.com/teixeirazeus/hequest","last_synced_at":"2025-10-25T23:39:33.440Z","repository":{"id":62458985,"uuid":"531690540","full_name":"teixeirazeus/hequest","owner":"teixeirazeus","description":"Simple and hackable request for dart.","archived":false,"fork":false,"pushed_at":"2023-05-15T17:30:36.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-10T09:07:01.738Z","etag":null,"topics":["dart","hacktoberfest","http"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/teixeirazeus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-09-01T21:23:39.000Z","updated_at":"2024-07-03T06:54:38.000Z","dependencies_parsed_at":"2022-11-02T00:18:22.657Z","dependency_job_id":null,"html_url":"https://github.com/teixeirazeus/hequest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/teixeirazeus/hequest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teixeirazeus%2Fhequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teixeirazeus%2Fhequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teixeirazeus%2Fhequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teixeirazeus%2Fhequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teixeirazeus","download_url":"https://codeload.github.com/teixeirazeus/hequest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teixeirazeus%2Fhequest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269948859,"owners_count":24501821,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dart","hacktoberfest","http"],"created_at":"2025-06-10T09:06:59.883Z","updated_at":"2025-10-25T23:39:28.387Z","avatar_url":"https://github.com/teixeirazeus.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"![banner](https://raw.githubusercontent.com/teixeirazeus/hequest/master/readme_assets/banner.png)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ca9452a2e4a745718e59fc8ca54de6e2)](https://www.codacy.com/gh/teixeirazeus/hequest/dashboard?utm_source=github.com\\\u0026utm_medium=referral\\\u0026utm_content=teixeirazeus/hequest\\\u0026utm_campaign=Badge_Grade)[![License](https://raw.githubusercontent.com/teixeirazeus/hequest/3bb5c5adb73020d036563be2a155210562789f22/readme_assets/mit.svg)](https://github.com/teixeirazeus/hequest)\n\nSimple and hackable request for dart.\n\n## Installing\n\n1.  Add dependencies to `pubspec.yaml`\n\n    ```yaml\n    dependencies:\n        hequest:\n            git:\n                url: https://github.com/teixeirazeus/hequest\n    ```\n\n2.  Run pub get.\n\n    ```shell\n    flutter pub get\n    ```\n\n3.  Import package.\n\n    ```dart\n    import 'package:hequest/hequest.dart';\n    ```\n\n## Using\n\nHequest was created with simplicity in mind to handle multiple API requests.\n\nYou start by declaring an object of type `Hequest` and passing the `baseUrl` of your api.\n\n```dart\nfinal githubApi = Hequest(baseUrl: 'https://api.github.com');\n```\n\n### GET\n\n```dart\nfinal response = await githubApi.get('/users/teixeirazeus');\n```\n\n### POST\n\n```dart\nfinal response = await githubApi.post('/users/teixeirazeus', body: {\n    'name': 'Zeus Teixeira',\n    });\n```\n\n### PUT\n\n```dart\nfinal response = await githubApi.put('/users/teixeirazeus', body: {\n    'name': 'Zeus Teixeira',\n    });\n```\n\n### DELETE\n\n```dart\nfinal response = await githubApi.delete('/users/teixeirazeus');\n```\n\n### JWT\n\nAll requests support sending jwt token.\n\nTo use to use the `WithToken` postfix and pass the token as a parameter.\n\n```dart\nfinal response = await githubApi.getWithToken('/users/teixeirazeus', token);\n```\n\n### Tips\n\nIt is highly recommended that you use `try catch` to handle errors. Along with a larger abstraction with a class for each endpoint of your api.\n\n```dart\nclass GithubApi {\n  final Hequest _hequest;\n\n  GithubApi(this._hequest);\n\n  Future\u003cMap\u003e getUser(String username) async {\n    try {\n      final response = await _hequest.get('/users/$username');\n      if (response.statusCode == 200) {\n        return json.decode(response.body);\n      } else if (response.statusCode == 404) {\n        throw Exception('User not found');\n      } else {\n        throw Exception('Failed to load user');\n      }\n    } catch (e) {\n      throw Exception('Error getting user');\n    }\n  }\n}\n```\n\n```dart\nfinal hequest = Hequest(baseUrl: 'https://api.github.com');\nfinal githubApi = GithubApi(hequest);\n\nfinal user = await githubApi.getUser('teixeirazeus');\nprint(user.toString());\n```\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteixeirazeus%2Fhequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteixeirazeus%2Fhequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteixeirazeus%2Fhequest/lists"}