-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple API to send and read messages
Prepare docker image for tests Use make build in dockerfile Add mailservers to transport object Add readme with example how to use API Forgot to add a stream for contact Rewrite correct variable Apply suggestions
- Loading branch information
Showing
7 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.git | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
RPC API | ||
====== | ||
Start service with configuration file that enables API: | ||
|
||
``` | ||
./bin/status-term-client -node-config ./_assets/api.conf -no-ui --keyhex=0x123 | ||
``` | ||
|
||
Configuration example: | ||
|
||
```json | ||
{ | ||
"HTTPHost": "localhost", | ||
"HTTPPort": 8777, | ||
"HTTPEnabled": true, | ||
"APIModules": "ssm" | ||
} | ||
``` | ||
|
||
Add contact | ||
=========== | ||
|
||
``` | ||
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"ssm_addContact","params":[{"name": "222"}],"id":1}' http://localhost:8777 | ||
``` | ||
|
||
|
||
Returns error if failed otherwise null. | ||
|
||
Send to contact | ||
=============== | ||
|
||
``` | ||
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"ssm_sendToContact","params":[{"name": "222"}, "plain text"],"id":1}' http://localhost:8777 | ||
``` | ||
|
||
Returns error if failed otherwise null. | ||
|
||
Read all (including ours) from contact | ||
====================================== | ||
|
||
|
||
To read all messages use 0 as offset: | ||
|
||
``` | ||
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"ssm_readContactMessages","params":[{"name": "222"}, 0],"id":1}' http://localhost:8777 | ||
``` | ||
|
||
To read new messages use last known offset: | ||
|
||
``` | ||
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"ssm_readContactMessages","params":[{"name": "222"}, 2],"id":1}' http://localhost:8777 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Build status-go in a Go builder container | ||
FROM golang:1.12.5-alpine as builder | ||
|
||
RUN apk add --no-cache make gcc musl-dev linux-headers | ||
|
||
RUN mkdir -p /go/src/github.com/status-im/status-console-client | ||
ADD . /go/src/github.com/status-im/status-console-client | ||
WORKDIR /go/src/github.com/status-im/status-console-client | ||
RUN make build | ||
|
||
# Copy the binary to the second image | ||
FROM alpine:latest | ||
|
||
LABEL maintainer="support@status.im" | ||
LABEL source="https://github.com/status-im/status-console-client" | ||
|
||
COPY --from=builder /go/src/github.com/status-im/status-console-client/bin/status-term-client /usr/local/bin/ | ||
|
||
# 30304 is used for Discovery v5 | ||
EXPOSE 8080 8545 30303 30303/udp 30304/udp | ||
|
||
ENTRYPOINT ["/usr/local/bin/status-term-client", "-no-ui"] | ||
CMD ["--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"HTTPHost": "localhost", | ||
"HTTPPort": 8777, | ||
"HTTPEnabled": true, | ||
"APIModules": "ssm" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters