Skip to content

Commit

Permalink
added all types
Browse files Browse the repository at this point in the history
  • Loading branch information
allan committed Jan 27, 2023
1 parent ff61451 commit e552116
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
6 changes: 4 additions & 2 deletions haivision/haivision.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"fmt"
"strings"

"github.com/Allan-Nava/Haivision-go-sdk/haivision/route"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/device"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/srt"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/route"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/rtmp"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/session"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/srt"
"github.com/go-resty/resty/v2"
)

Expand All @@ -28,6 +29,7 @@ type IHaivisionClient interface {
// Streaming
//GetRoutes(deviceId string) (route.ResponseRoutes[TS, TD], error)
GetRoutesSRT(deviceId string) (route.ResponseRoutes[srt.RequestSourceModelSRT, srt.RequestDestinationModelSrt], error)
GetRoutesRTMP(deviceId string) (route.ResponseRoutes[rtmp.RequestSourceModelRTMP, rtmp.RequestDestinationModelRtmp], error)
// CreateRoute() error
//
}
Expand Down
11 changes: 8 additions & 3 deletions haivision/route/model.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package route

import (
"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"
udprtp "github.com/Allan-Nava/Haivision-go-sdk/haivision/udp_rtp"
"github.com/Allan-Nava/Haivision-go-sdk/haivision/rtmp"
)

/*
Expand Down Expand Up @@ -40,10 +41,14 @@ type RequestCreateRoute[TS RequestSource, TD RequestDestination] struct {
}
}

// request source
type RequestSource interface {
srt.RequestSourceModelSRT | udprtp.RequestSourceModelUdpRtp | rtmp.RequestSourceModelRTMP
srt.RequestSourceModelSRT | udprtp.RequestSourceModelUdpRtp | rtmp.RequestSourceModelRTMP | rtsp.RequestSourceModelRTSP
}

// request destination
type RequestDestination interface {
srt.RequestDestinationModelSrt | udprtp.RequestDestinationModelUdpRtp
srt.RequestDestinationModelSrt | udprtp.RequestDestinationModelUdpRtp | rtmp.RequestDestinationModelRtmp | rtsp.RequestDestinationModelRtsp
}

//
22 changes: 19 additions & 3 deletions haivision/rtmp/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ type RequestSourceModelRTMP struct {
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"`
}
StreamName string `json:"streamName" required:"true" validate:"nonnil,min=1"`
RtmpMode string `json:"RtmpMode" required:"true" validate:"nonnil,min=1"`
}

/*
Use the following destinations model when issuing the Create a Route, Update a Route, and Start or Stop a Route's Destination API requests. Definition of each destination depends on the protocol.
*/
type RequestDestinationModelRtmp struct {
Name string `json:"name" validate:"nonnil,min=1" required:"true"`
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"`
Ttl string `json:"ttl" required:"true" validate:"nonnil,min=1"`
Tos string `json:"tos" required:"true" validate:"nonnil,min=1"`
}
20 changes: 18 additions & 2 deletions haivision/rtsp/request.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package rtsp
package rtsp

type RequestSourceModelRTSP struct {
Name string `json:"name" required:"true" validate:"nonnil,min=1"`
Expand All @@ -7,4 +7,20 @@ type RequestSourceModelRTSP struct {
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"`
}
}

/*
Use the following destinations model when issuing the Create a Route, Update a Route, and Start or Stop a Route's Destination API requests. Definition of each destination depends on the protocol.
*/
type RequestDestinationModelRtsp struct {
Name string `json:"name" validate:"nonnil,min=1" required:"true"`
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"`
Ttl string `json:"ttl" required:"true" validate:"nonnil,min=1"`
Tos string `json:"tos" required:"true" validate:"nonnil,min=1"`
}

0 comments on commit e552116

Please sign in to comment.