threads_client 0.0.2 threads_client: ^0.0.2 copied to clipboard
Dart client for Textile threads (https://textile.io) a database built on IPFS.
threads_client #
Credit #
This example draws from the threads and RouteGuide examples provided in https://github.com/grpc/grpc-dart.git.
Run #
Run Threads Daemon
You need to run the local threads daemon.
git clone git@github.com:textileio/go-threads.git
cd go-threads
go run threadsd/main.go -debug
Run dart threads
In a second terminal window, run the dart client example
git clone git@github.com:textileio/dart-threads-client.git
cd dart-threads-client
pub get
Run tests
dart test/threads_client.dart
Run example
dart examples/helloworld.dart
If successfully setup, you should see New store ID: <new id>
Develop #
examples/helloworld.dart
This shows a simple use of the dart client.
lib/src/generated/
Contains all the protobufs generated by protoc
. See updating instructions below.
lib/src/client.dart
This contains the client which wraps the gRPC API. Here, dart-native helper APIs could wrap each client endpoint to give the app a nice way to use the typed requests and responses.
Update protobufs #
dart-threads
depends on protobufs built in go-threads. Until CI is setup, you can manually generate and update the protobufs in this project.
git clone git@github.com:textileio/go-threads.git
cd api/pb
make clean
make all
ls
The result should include,
api.pb.dart
api.pbenum.dart
api.pbgrpc.dart
api.pbjson.dart
Copy those files into, dart-threads-client/lib/src/generated/
.