threads_client 0.0.1 copy "threads_client: ^0.0.1" to clipboard
threads_client: ^0.0.1 copied to clipboard

outdated

Dart client for Textile threads

@textile/dart-threads-client example #

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
dart bin/client.dart

If successfully setup, you should see New store ID: <new id>

Develop #

bin/client.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.

So far, only client.newStore() has been implemented.

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/.