Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/miquido/revolt-sdk-go
The project was made by Miquido. https://www.miquido.com/
https://github.com/miquido/revolt-sdk-go
Last synced: 20 days ago
JSON representation
The project was made by Miquido. https://www.miquido.com/
- Host: GitHub
- URL: https://github.com/miquido/revolt-sdk-go
- Owner: miquido
- License: apache-2.0
- Created: 2018-10-22T12:54:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-24T12:14:00.000Z (over 6 years ago)
- Last Synced: 2024-11-09T11:34:52.648Z (3 months ago)
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Revolt Golang SDK
Go SDK for event tracking with Revolt.## Installation
Use the go command:
```
go run -u bitbucket.org/miquido/revolt-sdk-go
```## Creating events
Event can be created with `revolt.NewEvent()` method.### Using struct
Example:
```
revolt.NewEvent("test.event.type", struct {
UserId int `json:"userId"`
CreationType string `json:"creationType"`
Description string `json:"description"`
}{
UserId: 1,
CreationType: "webbapp.test",
Description: "short description",
})
```
When using struct{} don't forget to set explicit json tags for format purposes.### Using map
Example:
```
revolt.NewEvent("test.event.type",
map[string]interface{}{
"userId": 5,
"description": "short description",
},
)
```## Example
Example usageclient, err := revolt.NewClient("trackingId", "app.code", "secret")
if err != nil {
panic(err)
}event, err := revolt.NewEvent("test.event.type", struct {
UserId int `json:"userId"`
}{
UserId: 1,
})event2, err := revolt.NewEvent("test.event.type",
map[string]interface{}{
"userId": 5,
},
)resp, err := client.SendEvents([]revolt.Event{event, event2})
## Async event sending
For async event sending use channels and goroutines.# Custom Parameters
There are few parameters which will be supported soon:- [x] endpoint - Specifies endpoint on which communication with Revolt service should take place.
- [ ] maxBatchSize - Specifies maximum batch size of events that can be sent to Revolt API.
- [ ] eventDelayMillis - Specifies maximum number of seconds for Event to be stored in queue. After delay is up, all events in queue will be sent automatically.
- [ ] offlineMaxSize - Specifies maximum size of events that can be stored in queue when service does not respond.
- [ ] retryIntervalSecs - Specifies first time interval in seconds to retry sending batch of events when any error occurs.
- [ ] maxRetryIntervalSecs - Specifies maximum time interval in seconds to retry sending batch of events when any error occurs.