Merge pull request #149 from status-im/146-status-go-sdk

[#IDEA-146] : Status GO SDK
This commit is contained in:
Adrià Cidre 2018-04-12 07:37:05 +02:00 committed by GitHub
commit 36acaed2db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 160 additions and 2 deletions

View File

@ -23,7 +23,6 @@ Ideas looking for people
An idea can be in the following states: draft, in progress, completed, or
aborted. Additionally, it can be in limbo which is when it isn't clear what
<<<<<<< HEAD
state it is in. An idea that has been in limbo for more than a week or so gets
aborted.
@ -44,6 +43,7 @@ aborted.
| [34-react-native-qt](ideas/34-react-native-qt.md) | :walking_man: In Progress | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes |
| [140-sob-improve-onboarding](ideas/140-sob-improve-onboarding/) | :walking_man: In Progress | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes |
| [122-sob-metrics](ideas/122-sob-metrics.md) | :walking_man: In Progress | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes |
| [146-status-go-sdk](ideas/146-status-go-sdk/) | :seedling: Draft | :x: no | :x: no | :x: no | :x: no |
| [154-support-web3.js-library](ideas/154-support-web3.js-library.md) | :walking_man: In Progress | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes |
## Draft :seedling: and limbo :question:
@ -56,6 +56,7 @@ aborted.
| [99-confidence](ideas/99-confidence.md) | :seedling: Draft | :x: no | :x: no | :x: no | :x: no |
| [95-les-service-model](ideas/095-les-service-model/) | :seedling: Draft | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes | :x: no |
| [86-push-notif-v2](ideas/86-push-notif-v2.md) | :seedling: Draft | :x: no | :x: no | :x: no | :x: no |
| [146-status-go-sdk](ideas/146-status-go-sdk/) | :seedling: Draft | :x: no | :x: no | :x: no | :x: no |
| [76-smooth-ui](ideas/smooth-ui.md) | :question: Limbo | :white_check_mark: Yes | :x: No | :x: No | :white_check_mark: Yes :question: |
| [71-low-traffic](ideas/71-low-traffic.md) | :question: Limbo | :white_check_mark: Yes | :x: No | :x: No | :white_check_mark: Yes :question: |
| [101-extensions](ideas/101-extensions) | :seedling: Draft | :white_check_mark: Yes | :white_check_mark: Yes | :white_check_mark: Yes | - |
@ -80,7 +81,7 @@ progress again. This ensures the registry is kept up to date.
| Contributor | Ideas |
|---------------|--------|
| @anna | 58, 80, 87, 127 |
| @adriacidre | 63 |
| @adriacidre | 63, 146 |
| @andmironov | 68, 80, 134 |
| @adambabik | 58, 63, 68, 92 |
| @alwx | 134 |

View File

@ -0,0 +1,114 @@
## Preamble
Idea: 146-status-go-sdk
Title: Status GO-SDK
Status: Draft
Created: 2018-04-03
## Summary
Provide an easy to use GO-SDK library to allow community developers easily interact with status messaging.
## Swarm Participants
- Lead Contributor: @adriacidre
- Contributor:
- Contributor:
- Testing & Evaluation:
## Product Overview
### Product Description
One of the main goals of status is to grow its community, however is not easy to work on status-go project as a community developer.
Is not easy to set up an environment
- Identify where to start
- Interact with status messaging system.
- Test your changes
The idea behind this swarm is to simplify this by allowing community developers to interact with status, based uniquely on status-go library.
### Requirements & Dependencies
- *Easy to use SDK* : Using a sdk should be as easy as using any other messaging system, allowing you to subscribe or publish to specific chats.
- *The less dependencies the better* : ATM and in order to interact with status messaging system we need to interact with code on status-go and status-react repos. This should be simplified to allow devs work only on top of status-go
- *Quick dev environment setup* : Following the previous point, if were only based on status-go, dev environment should be trivial. Should be easy to build apps and distribute them as binaries for different platforms.
### Minimum Viable Product
MVP should allow a developer to accomplish some minimal actions:
- Connect : creates a new connection
- Close : closes active connection
- Auth : login as a specific user
- Subscribe : subscribe to a channel
- Unsubscribe : unsubscribe from a channel
- Publish : send a message.
_All methods should work for 1to1, groups and public chats._
With this methods building a simple `autoresponder bot` should be as simple as:
**TO BE DEFINED**
```go
// Connect to the default status url and defer closing the connection
st, _ := status.Connect(st.DefaultAddr) // -> localhost:51515
defer st.Close()
// Authenticate as an specific user
st, _ = status.Auth([]byte(“S3cretT0ken”))
// Subscribes to any message on chat chatID
sub, _ := st.Subscribe("chatID", func(m *st.Msg) {
// Replies the received message
m.Reply([]byte("I can help!”))
sub.Unsubscribe()
})
// Simple message publisher
st.Publish(“buddy_token", []byte("Hello World"))
```
SDK should be provided with different, easy to follow and well documented examples _(TBD)_:
- Autoresponder bot (nice for testing)
- Google assistant integration
- Slack proxy (use status from slack)
- Reminders (set and get reminders)
Description: <!-- Description of Deliverables-->
### Useful links & Dependencies
- https://github.com/mandrigin/status-go-bots — http://offsite.chat and #humans-need-not-apply bots.
- Pre-existing issue - https://github.com/status-im/ideas/issues/131
### Blockers
New Status App communication protocol - https://github.com/status-im/ideas/issues/87
## Dates
Goal Date: TBD
Description: TBD
Testing Days required: TBD
## Success Metrics
- A dev who is unfamiliar with the SDK is able to set up his environment and build a simple chatbot in under 2 hours, just by following the documentation.
#### Exit criteria:
Same as success metrics.
## Supporting Role Communication
<!-- Once Requirements and Goals are fleshed out, then it should be communicated to supporting organelles if required -->
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

View File

@ -0,0 +1,43 @@
## SDK Iterations
### Protocol messages
[New protocol spec](https://docs.google.com/document/d/1Qh2h07T_qepzEJ7IytmxwIdQAOsGHrvhXwZxuZtbwgc/edit#) clearly defines all message types with examples. It's based on [transit-format](https://github.com/cognitect/transit-format), so it makes sense to evaluate its [go implementation](https://github.com/russolsen/transit)
Use cases:
### General
#### [ ] Message
##### Parameters:
- content: the content of the message (a map or a string for now)
- content-type: the content-type of the message
- message-type: the type of the message
- to-clock-value : the clock of the sender for message ordering
- timestamp: the timestamp of message
*Where does the destination/s of the message is defined?*
#### Private groups
##### [ ] NewGroupKey
- [ ] GroupAdminUpdate
- [ ] GroupLeave
#### Contact management
- [ ] NewContactKey
- [ ] ContactRequest
- [ ] ContactRequestConfirmed
- [ ] ContactUpdate
#### Not needed for first iteration
- [ ] Seen
##### Message
### Define final SDK UI based on different messages