summaryrefslogtreecommitdiff
path: root/src/hub/src/spreadspace.org/sfive/s5typesApi.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/hub/src/spreadspace.org/sfive/s5typesApi.go')
-rw-r--r--src/hub/src/spreadspace.org/sfive/s5typesApi.go69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5typesApi.go b/src/hub/src/spreadspace.org/sfive/s5typesApi.go
new file mode 100644
index 0000000..7b0fb52
--- /dev/null
+++ b/src/hub/src/spreadspace.org/sfive/s5typesApi.go
@@ -0,0 +1,69 @@
+package sfive
+
+import "time"
+
+const (
+ QualityLow = "low"
+ QualityMedium = "medium"
+ QualityHigh = "high"
+)
+
+type StreamId struct {
+ ContentId string `json:"content-id"`
+ Format string `json:"format"`
+ Quality string `json:"quality"`
+}
+
+type SourceId struct {
+ Version uint `json:"version" db:"-"`
+ Hostname string `json:"hostname"`
+ StreamId StreamId `json:"streamer-id" db:"-"`
+ Tags []string `json:"tags" db:"-"`
+}
+
+type ClientData struct {
+ Ip string `json:"ip"`
+ BytesSent uint `json:"bytes-sent"`
+ UserAgent string `json:"user-agent"`
+}
+
+type SourceData struct {
+ ClientCount uint `json:"client-count"`
+ BytesReceived uint `json:"bytes-received"`
+ BytesSent uint `json:"bytes-sent"`
+ Clients []ClientData `json:"clients"`
+}
+
+type DataUpdate struct {
+ StartTime time.Time `json:"start-time"`
+ Duration time.Duration `json:"duration-ms"`
+ Data SourceData `json:"data"`
+}
+
+type StatisticsData struct {
+ SourceId
+ DataUpdate
+}
+
+type StatsFilter struct {
+ start *time.Time
+ end *time.Time
+ hostname *string
+ contentId *string
+ format *string
+ quality *string
+ tagsAny []string
+}
+
+func (self *StatisticsData) CopyFromSourceId(id *SourceId) {
+ self.Hostname = id.Hostname
+ self.StreamId = id.StreamId
+ self.Tags = id.Tags
+ self.Version = id.Version
+}
+
+func (self *StatisticsData) CopyFromUpdate(id *DataUpdate) {
+ self.StartTime = id.StartTime
+ self.Duration = id.Duration
+ self.Data = id.Data
+}