xrpc 0.3.2 copy "xrpc: ^0.3.2" to clipboard
xrpc: ^0.3.2 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 'dart:convert';

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

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

  final session = jsonDecode(response.data);

  final currentSession = await xrpc.query<String>(
    xrpc.NSID.create(
      'server.atproto.com',
      'getSession',
    ),
    headers: {'Authorization': 'Bearer ${session['accessJwt']}'},
  );

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

Publisher

verified publisheratprotodart.com

Weekly Downloads

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

Homepage
Repository (GitHub)
View/report issues

Topics

#atproto #bluesky #http #xrpc

Documentation

Documentation

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