Skip to content

Commit

Permalink
updated the models need to fix the getRoutes method
Browse files Browse the repository at this point in the history
  • Loading branch information
allan committed Jan 31, 2023
1 parent 46cc734 commit fa3031c
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 6 deletions.
28 changes: 28 additions & 0 deletions haivision/hls/response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package hls

type ResponseSourceHls struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
Port int `json:"port" required:"true" validate:"nonnil,min=1"`
NetworkInterface string `json:"networkInterface" required:"true" validate:"nonnil,min=1"`
SrtPassPhrase string `json:"srtPassPhrase" required:"true" validate:"nonnil,min=1"`
SrtLatency int `json:"srtLatency" required:"true" validate:"nonnil,min=1"`
SrtRcvBuf int `json:"srtRcvBuf" required:"true" validate:"nonnil,min=1"`
SrtStreamId string `json:"srtStreamId" required:"true" validate:"nonnil,min=1"`
UseFec bool `json:"useFec" required:"true" validate:"nonnil,min=1"`
SrtFecCols int `json:"srtFecCols" required:"true" validate:"nonnil,min=1"`
SrtFecRows int `json:"srtFecRows" required:"true" validate:"nonnil,min=1"`
SrtFecArq string `json:"srtFecArq" required:"true" validate:"nonnil,min=1"`
}

type ResponseDestinationHls struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
SegmentDuration string `json:"segmentDuration" required:"true" validate:"nonnil,min=1"`
UseEncryption bool `json:"useEncryption" required:"true" validate:"nonnil,min=1"`
SegmentsPerKey int `json:"segmentsPerKey" required:"true" validate:"nonnil,min=1"`
}
9 changes: 9 additions & 0 deletions haivision/route/model.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package route

import (
"github.com/Allan-Nava/Haivision-go-sdk/haivision/hls"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/rtmp"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/rtsp"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/srt"
Expand Down Expand Up @@ -51,6 +52,14 @@ type RequestDestination interface {
srt.RequestDestinationModelSrt | udprtp.RequestDestinationModelUdpRtp | rtmp.RequestDestinationModelRtmp | rtsp.RequestDestinationModelRtsp
}

type ResponseSource interface {
udprtp.ResponseSourceUdpRtp | srt.ResponseSourceSrt | rtmp.ResponseSourceRtmp
}

type ResponseDestination interface {
udprtp.ResponseDestinationUdpRtp | srt.ResponseDestinationSrt | hls.ResponseDestinationHls
}

/*
type BaseSource struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
Expand Down
25 changes: 19 additions & 6 deletions haivision/route/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ package route
"pendingRouteCreates": 1
}
*/
type ResponseRoutes[TS RequestSource, TD RequestDestination] struct {
Data []RouteModel[TS, TD] `json:"data"`
NumPages int `json:"numPages"`
NumResults int `json:"numResults"`
NumActiveOutputConnections int `json:"numActiveOutputConnections"`
PendingRouteCreates int `json:"pendingRouteCreates"`
type ResponseRoutes[TS ResponseSource, TD ResponseDestination] struct {
Data []ResponseRouteModel[TS, TD] `json:"data"`
NumPages int `json:"numPages"`
NumResults int `json:"numResults"`
NumActiveOutputConnections int `json:"numActiveOutputConnections"`
PendingRouteCreates int `json:"pendingRouteCreates"`
}

type RouteModel[TS RequestSource, TD RequestDestination] struct {
Expand All @@ -32,6 +32,19 @@ type RouteModel[TS RequestSource, TD RequestDestination] struct {
HasPendingDelete bool `json:"hasPendingDelete"`
}

type ResponseRouteModel[TS ResponseSource, TD ResponseDestination] struct {
ID string `json:"id"`
Name string `json:"name"`
Source TS `json:"source"`
Destinations []TD `json:"destinations"`
ElapsedTime string `json:"elapsedTime"`
State string `json:"state"`
PendingUpdates int `json:"pendingUpdates"`
SummaryStatusCode string `json:"summaryStatusCode"`
SummaryStatusDetails string `json:"summaryStatusDetails"`
HasPendingDelete bool `json:"hasPendingDelete"`
}

// SRT
//type ResponseRoutesSRT struct {}

Expand Down
13 changes: 13 additions & 0 deletions haivision/rtmp/response.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
package rtmp

type ResponseSourceRtmp struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
Port int `json:"port" required:"true" validate:"nonnil,min=1"`
NetworkInterface string `json:"networkInterface" required:"true" validate:"nonnil,min=1"`
StreamName string `json:"streamName" required:"true" validate:"nonnil,min=1"`
RtmpMode string `json:"rtmpMode" required:"true" validate:"nonnil,min=1"`
State string `json:"state" required:"true" validate:"nonnil,min=1"`
SummaryStatusCode string `json:"summaryStatusCode" required:"true" validate:"nonnil,min=1"`
SummaryStatusDetails string `json:"summaryStatusDetails" required:"true" validate:"nonnil,min=1"`
}
32 changes: 32 additions & 0 deletions haivision/srt/response.go
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
package srt

// need to be finished
type ResponseSourceSrt struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
Port int `json:"port" required:"true" validate:"nonnil,min=1"`
NetworkInterface string `json:"networkInterface" required:"true" validate:"nonnil,min=1"`
SrtPassPhrase string `json:"srtPassPhrase" required:"true" validate:"nonnil,min=1"`
SrtLatency int `json:"srtLatency" required:"true" validate:"nonnil,min=1"`
SrtRcvBuf int `json:"srtRcvBuf" required:"true" validate:"nonnil,min=1"`
SrtStreamId string `json:"srtStreamId" required:"true" validate:"nonnil,min=1"`
UseFec bool `json:"useFec" required:"true" validate:"nonnil,min=1"`
}

type ResponseDestinationSrt struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
Port int `json:"port" required:"true" validate:"nonnil,min=1"`
NetworkInterface string `json:"networkInterface" required:"true" validate:"nonnil,min=1"`
RetainHeader string `json:"retainHeader" required:"true" validate:"nonnil,min=1"`
Mtu int `json:"mtu" required:"true" validate:"nonnil,min=1"`
Ttl string `json:"ttl" required:"true" validate:"nonnil,min=1"`
Tos string `json:"tos" required:"true" validate:"nonnil,min=1"`
SrtEncryption string `json:"srtEncryption" required:"true" validate:"nonnil,min=1"`
SrtPassPhrase string `json:"srtPassPhrase" required:"true" validate:"nonnil,min=1"`
UseFEC bool `json:"useFEC" required:"true" validate:"nonnil,min=1"`
SrtFecCols int `json:"srtFecCols" required:"true" validate:"nonnil,min=1"`
}
35 changes: 35 additions & 0 deletions haivision/udp_rtp/response.go
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
package udprtp

type ResponseSourceUdpRtp struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
Port int `json:"port" required:"true" validate:"nonnil,min=1"`
NetworkInterface string `json:"networkInterface" required:"true" validate:"nonnil,min=1"`
RetainHeader string `json:"retainHeader" required:"true" validate:"nonnil,min=1"`
SourceAddress string `json:"sourceAddress" required:"true" validate:"nonnil,min=1"`
State string `json:"state" required:"true" validate:"nonnil,min=1"`
SummaryStatusCode string `json:"summaryStatusCode" required:"true" validate:"nonnil,min=1"`
SummaryStatusDetails string `json:"summaryStatusDetails" required:"true" validate:"nonnil,min=1"`
}

type ResponseDestinationUdpRtp struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
ID string `json:"id" required:"true" validate:"nonnil,min=1"`
Address string `json:"address" required:"true" validate:"nonnil,min=1"`
Protocol string `json:"protocol" required:"true" validate:"nonnil,min=1"`
Port int `json:"port" required:"true" validate:"nonnil,min=1"`
NetworkInterface string `json:"networkInterface" required:"true" validate:"nonnil,min=1"`
RetainHeader string `json:"retainHeader" required:"true" validate:"nonnil,min=1"`
Action string `json:"action" required:"true" validate:"nonnil,min=1"`
Mtu int `json:"mtu" required:"true" validate:"nonnil,min=1"`
Ttl string `json:"ttl" required:"true" validate:"nonnil,min=1"`
Tos string `json:"tos" required:"true" validate:"nonnil,min=1"`
Fec string `json:"fec" required:"true" validate:"nonnil,min=1"`
PrompegFecLevel string `json:"prompegFecLevel"`
PrompegFeclsBlockAligned bool `json:"prompegFeclsBlockAligned"`
PrompegFecColumns int `json:"prompegFecColumns"`
PrompegFecRows int `json:"prompegFecRows"`
Shaping bool `json:"shaping"`
MaxBitrate int `json:"maxBitrate"`
}

0 comments on commit fa3031c

Please sign in to comment.