paylike_dart_request 1.0.7
paylike_dart_request: ^1.0.7 copied to clipboard

Low level API client for Paylike which helps executing requests in a similiar way as in the JS version

example/paylike_dart_request_example.dart

import 'package:paylike_dart_request/paylike_dart_request.dart';

Future<void> fetchBodyAsStream(
    PaylikeRequester requester, RequestOptions opts) async {
  var response = await requester.request('http://foo', opts);
  var reader = await response.getBodyReader();
  await reader.forEach((element) {
    print(element);
  });
}

void main() {
  var requester = PaylikeRequester().setLog((dynamic o) => print(o));
  var opts = RequestOptions.fromClientId('dart-1')
      .setQuery({
        'foo': 'bar',
      })
      .setVersion(1)
      .setData({
        'foo': 'bar',
      });
  requester.request('http://foo', opts).then((response) {
    return response.getBody();
  }).then((body) {
    print(body);
  }).catchError((error) {
    print(error);
  });

  fetchBodyAsStream(requester, opts).catchError((error) {
    print(error);
  });
}
0
likes
110
pub points
33%
popularity

Publisher

paylike.io

Low level API client for Paylike which helps executing requests in a similiar way as in the JS version

Homepage

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

sprintf

More

Packages that depend on paylike_dart_request