Skip to content

Commit

Permalink
feat: added the response pushes and the app pushes endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxx committed Apr 12, 2023
1 parent b6289bc commit 8387e20
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
14 changes: 14 additions & 0 deletions ovenmedia/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,17 @@ func (o *ovenMedia) GetApplications(host string) (*ResponseVirtualList, error) {
}
return &obj, nil
}

func (o *ovenMedia) GetApplicationPushes(host string, application string) (*ResponsePushes, error) {
url := fmt.Sprintf("%s/%s/apps/%s", V1_HOSTS, host, application)
resp, err := o.restyPost(url, nil)
if err != nil {
return nil, err
}

var obj ResponsePushes
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
return &obj, nil
}
30 changes: 25 additions & 5 deletions ovenmedia/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@ type ResponseVirtualList struct {
Response []string `json:"response"`
}

type ResponsePushes struct {
BaseResponseOK
Response []struct {
App string `json:"app"`
CreatedTime time.Time `json:"createdTime"`
FinishTime time.Time `json:"finishTime"`
Id string `json:"id"`
Protocol string `json:"protocol"`
SentBytes int `json:"sentBytes"`
SentTime int `json:"sentTime"`
Sequence int `json:"sequence"`
StartTime time.Time `json:"startTime"`
State string `json:"state"`
Stream struct {
Name string `json:"name"`
Tracks []int `json:"tracks"`
} `json:"stream"`
StreamKey string `json:"streamKey"`
TotalsentBytes int `json:"totalsentBytes"`
TotalsentTime int `json:"totalsentTime"`
Url string `json:"url"`
Vhost string `json:"vhost"`
} `json:"response"`
}

type ResponseStreamInfo struct {
BaseResponseOK
Response struct {
Expand Down Expand Up @@ -100,11 +125,6 @@ type ResponsePush struct {
Vhost string `json:"vhost"`
}

type ResponsePushes struct {
BaseResponseOK
Response []ResponsePush `json:"response"`
}

/*
{
"createdTime": "2021-01-11T02:52:22.013+09:00",
Expand Down

0 comments on commit 8387e20

Please sign in to comment.