threads_client 0.1.7 threads_client: ^0.1.7 copied to clipboard
Dart client for Textile threads (https://textile.io) a database built on IPFS.
dart-threads-client #
Textile's Dart client for interacting with remote Threads
Join us on our public Slack channel for news, discussions, and status updates. Check out our blog for the latest posts and announcements.
Table of Contents #
Getting Started #
In the pubspec.yaml
of your project, add the following dependency:
See latest version in badge at top of README.
dependencies:
...
threads_client: "^0.x.x"
Run Threads Daemon #
You need to run a threads daemon available to the client.
git clone git@github.com:textileio/go-threads.git
cd go-threads
go run threadsd/main.go -debug
Usage #
You can see complete usage examples in the provided test suite:
https://github.com/textileio/dart-threads-client/blob/master/test/threads_client.dart#L41
Development #
Install #
Run the daemon, as above. Next, install and run the Dart threads_client
:
git clone git@github.com:textileio/dart-threads-client.git
cd dart-threads-client
pub get
Run tests #
dart test/threads_client_test.dart
Run example #
dart examples/helloworld.dart
Usage #
Start Client & Create a Store #
import 'package:threads_client/threads_client.dart' as threads;
void main(List<String> args) async {
final client = threads.Client();
final store = await client.newStore();
print('New store $store');
}
Run Threads using hosted Textile API #
import 'package:textile/textile.dart' as textile;
import 'package:threads_client/threads_client.dart' as threads;
const APP_TOKEN = '<app token>';
const DEVICE_ID = '<uuid>';
void main(List<String> args) async {
final config = textile.ThreadsConfig(APP_TOKEN, DEVICE_ID);
final client = threads.Client(config: config);
final store = await client.newStore();
print('New store $store');
}
Further examples #
You can find a good overview of Client methods in the test suite.
Add custom metadata to requests #
For example, add a custom auth token to the header of each request.
final config = ThreadsConfig(
host: '127.0.0.1',
port: 6006,
callOptionsMetaData: {
'authorization': 'Bearer 3f2950d0-5522-4425-829f-75894e233442'
}
);
// Create a new threads client
client = Client(config);
Contributing #
This project is a work in progress. As such, there's a few things you can do right now to help out:
- Ask questions! We'll try to help. Be sure to drop a note (on the above issue) if there is anything you'd like to work on and we'll update the issue to let others know. Also get in touch on Slack.
- Open issues, file issues, submit pull requests!
- Perform code reviews. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
- Take a look at the code. Contributions here that would be most helpful are top-level comments about how it should look based on your understanding. Again, the more eyes the better.
- Add tests. There can never be enough tests.
Before you get started, be sure to read our contributors guide and our contributor covenant code of conduct.
Changelog #
Changelog is published to Releases.