api_client 1.0.2 copy "api_client: ^1.0.2" to clipboard
api_client: ^1.0.2 copied to clipboard

outdated

A simple schema api client. Helps to deal with API calls via an API specification

example/README.md

Example #

Define Specification #

import 'package:api_client/api_client.dart';

Spec spec = Spec(endpoints: {
  "get_item": {
    "url": "{{api_url}}/items",
    "method": "get"
  }
}, parameters: {
   "api_url": "https://api.domain.com"
});

Middlewares #

import 'package:api_client/api_client.dart';
Spec spec = Spec();
spec.middlewares.add((Request request) {
  request.headers[Constants.HEADER_CONTENT_TYPE] =
    Constants.CONTENT_TYPE_JSON_UTF8;
});

Call APIs #

spec.call("get_item").then((response) {
  // do something with response
  // response.statusCode == 200
  // var body = json.decode(utf8.decode(response.bodyBytes));
});
1
likes
40
pub points
55%
popularity

Publisher

unverified uploader

A simple schema api client. Helps to deal with API calls via an API specification

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

Dependencies

http

More

Packages that depend on api_client