Add go sdk

This commit is contained in:
Oliver
2026-01-06 14:55:21 +01:00
parent 32bcd6db9e
commit e018bedca3
21 changed files with 1090 additions and 0 deletions

38
client/model.go Normal file
View File

@@ -0,0 +1,38 @@
package client
import "time"
type Event struct {
Name string `json:"name"`
Properties map[string]string `json:"properties"`
}
func (e *Event) WithProperty(key, value string) {
if e.Properties == nil {
e.Properties = make(map[string]string)
}
e.Properties[key] = value
}
type createEventDTO struct {
ProjectID string `json:"project_id"`
Name string `json:"name"`
Timestamp time.Time `json:"timestamp,omitempty"`
Properties map[string]string `json:"properties"`
WriteKey string `json:"write_key,omitempty"`
}
type RecordData struct {
Metric string `json:"metric"`
Label string `json:"label,omitempty"`
Value float64 `json:"value"`
}
type createMetricRecordDto struct {
SenderID string `json:"sender_id"`
ProjectID string `json:"project_id"`
Timestamp int64 `json:"timestamp,omitempty"`
WriteKey string `json:"write_key,omitempty"`
Data []RecordData `json:"data"`
}