xrpc 0.1.3 copy "xrpc: ^0.1.3" to clipboard
xrpc: ^0.1.3 copied to clipboard

Provide an HTTP client specialized for XRPC communication in AT Protocol.

example/example.dart

// Copyright 2023 Shinya Kato. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided the conditions.

import 'package:atproto/atproto.dart' as atproto;
import 'package:xrpc/xrpc.dart' as xrpc;

Future<void> main() async {
  final response = await xrpc.procedure(
    xrpc.NSID.create(
      'server.atproto.com',
      'createSession',
    ),
    body: {
      'identifier': 'HANDLE_OR_EMAIL',
      'password': 'PASSWORD',
    },
    to: atproto.Session.fromJson,
  );

  final session = await xrpc.query(
    xrpc.NSID.create(
      'server.atproto.com',
      'getSession',
    ),
    headers: {'Authorization': 'Bearer ${response.data.accessJwt}'},
    to: atproto.CurrentSession.fromJson,
  );

  print(session);
}
2
likes
0
points
2.81k
downloads

Publisher

verified publisheratprotodart.com

Weekly Downloads

Provide an HTTP client specialized for XRPC communication in AT Protocol.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

freezed_annotation, http, json_annotation, meta, mime, nsid, web_socket_channel

More

Packages that depend on xrpc