Skip to content

Commit

Permalink
simplified the relay to accept message in the body (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
mristin committed Mar 18, 2019
1 parent fa52ecd commit 28032c8
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 349 deletions.
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,37 +74,46 @@ Sending requests
to create a mailing channel and authorization token:

```bash
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X PUT \
--data '
{
"descriptor": "some-channel",
"token": "oqiwdJKNsdKIUwezd92DNQsndkDERDFKJNQWSwq3rODIU",
"sender": {
"email": "your-name@company.com",
"name": "Sender"
},
"recipients":[
{
"email": "your-client@client.com",
"name":"Recipient"
}
],
"cc": [],
"bcc": [],
"min_period": 1.2,
"max_size":10000
"domain": "company.com"
}' \
curl -i \
-X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
--data '{
"descriptor": "some-channel",
"token": "oqiwdJKNsdK",
"sender": {
"email": "your-name@company.com",
"name":"Some Sender"
},
"recipients":[
{
"email": "your-client@client.com",
"name": "Recipient"
}
],
"cc": [],
"bcc": [],
"min_period":0.1,
"max_size":10000000
}' \
"localhost:8300/api/channel"
```
* Use the [Relay Server API](https://github.com/Parquery/mailgun-relayery/swagger/relay/swagger.yaml)
to relay a message:

```bash
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST \
--data '{"message":"hello there", "subject": "a message from your friend"}' \
"localhost:8200/api/message?descriptor=some-channel&token=oqiwdJKNsdKIUwezd92DNQsndkDERDFKJNQWSwq3rODIU"
curl -i \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Descriptor: some-channel" \
-H "X-Token: oqiwdJKNsdK" \
--data '{
"message": "hello there",
"subject": "a message from your friend"
}' \
"localhost:8200/api/message
```
Development
Expand Down
2 changes: 1 addition & 1 deletion database/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ func TestTxn_PutTimestamp(t *testing.T) {
}

func TestTxn_RemoveChannel(t *testing.T) {
d, err := emptyDatabase(ControlAccess) //TODO test with put timestamp as well
d, err := emptyDatabase(ControlAccess)
if err != nil {
t.Fatal(err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion mailgun-relayery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func main() {
ReadHeaderTimeout: 60 * time.Second}

go func() {
h := &relay.HandlerImpl{
h := &relay.Handler{
Env: env,
MailgunData: mailgunData,
LogOut: logOut,
Expand Down
22 changes: 0 additions & 22 deletions mailgun-relayery/relay/handler.go

This file was deleted.

175 changes: 0 additions & 175 deletions mailgun-relayery/relay/handler_impl.go

This file was deleted.

0 comments on commit 28032c8

Please sign in to comment.