Skip to content

Commit

Permalink
added get all pushes
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Jan 26, 2023
1 parent 7360000 commit ef31b23
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ovenmedia/ovenmedia.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type IOvenMediaClient interface {
// Push
StartPush(vHost string, appName string, body RequestBodyPush) (*ResponseStartPush, error)
StopPush(vHost string, appName string, body RequestBodyPush) (*resty.Response, error)
GetAllPushes(vHost string, appName string)()
GetAllPushes(vHost string, appName string) (*ResponsePushes, error)
// Recording
}

Expand Down
15 changes: 15 additions & 0 deletions ovenmedia/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,18 @@ func (o *OvenMedia) StopPush(vHost string, appName string, body RequestBodyPush)
fmt.Println("resp", resp)
return resp, nil
}


// Get all push lists for a specific application
func (o *OvenMedia) GetAllPushes(vHost string, appName string) (*ResponsePushes, error) {
//
resp, err := o.restyPost(GET_VHOSTS_PUSH_BY_NAME(vHost, appName), nil)
if err != nil {
return nil, err
}
pushes := resp.Result().(*ResponsePushes)
if pushes == nil {
return nil, errors.New("could not start the push")
}
return pushes, nil
}
6 changes: 6 additions & 0 deletions ovenmedia/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ type ResponsePush struct {
URL string `json:"url"`
Vhost string `json:"vhost"`
}
//
type ResponsePushes struct {
Message string `json:"message"`
Response []ResponsePush `json:"response"`
StatusCode int `json:"statusCode"`
}

0 comments on commit ef31b23

Please sign in to comment.