Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iconica-development/dart_api_service
A basic rest api interaction service to streamline API communication based on the http package
https://github.com/iconica-development/dart_api_service
Last synced: 2 days ago
JSON representation
A basic rest api interaction service to streamline API communication based on the http package
- Host: GitHub
- URL: https://github.com/iconica-development/dart_api_service
- Owner: Iconica-Development
- License: bsd-3-clause
- Created: 2024-04-19T08:56:18.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-11-28T08:56:53.000Z (2 months ago)
- Last Synced: 2024-11-28T09:34:22.293Z (2 months ago)
- Language: Dart
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
A simple API service that follows a FirebaseFirestore-like definition of resource endpoints.
## Features
- Call endpoints with Put, Patch, Delete, Post and Get http methods
- Use converters for type safe interaction with endpoints.
- Allow authentication due to an auth credentials service.## Getting started
To use the this API service in your Dart or Flutter, add the following to the pubspec
```yaml
flutter_start:
git:
url: https://github.com/Iconica-Development/dart_api_service
ref:
```## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.```dart
var authService = MockAuthService();
var apiService = HttpApiService(
baseUrl: Uri.parse("https://jsonplaceholder.typicode.com"),
authenticationService: authService,
);var converter = ApiConverter.fromSerializable(PostComment.fromMap);
var endPoint = apiService.endpoint("/posts/:post");
var comments = endPoint
.child("/comments")
.withConverter(
converter.list(),
)
.authenticate()
.addHeaders({
"accept": "application/json",
}).withVariables({
"post": 1,
});try {
var post = await comments.get();
print(post.result);
} on ApiException catch (e) {
print(e.statusCode);
print(e.inner.body);
}
```## Issues
Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/Iconica-Development/dart_api_service) page. Commercial support is available if you need help with integration with your app or services. You can contact us at [[email protected]](mailto:[email protected]).
## Want to contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](./CONTRIBUTING.md) and send us your [pull request](https://github.com/Iconica-Development/dart_api_service/pulls).
## Author
This dart_api_service for Flutter and Dart is developed by [Iconica](https://iconica.nl). You can contact us at