paylike_dart_request 1.0.10 copy "paylike_dart_request: ^1.0.10" to clipboard
paylike_dart_request: ^1.0.10 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);
  });
}
1
likes
150
points
122
downloads

Publisher

verified publisherpaylike.io

Weekly Downloads

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)

More

Packages that depend on paylike_dart_request