Skip to content

Commit

Permalink
added api restreamer
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Jun 6, 2024
1 parent dc9d6db commit 077330e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
55 changes: 50 additions & 5 deletions compress/api_restreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (o *compress) RestreamerHlsStart(instanceName string, streamProtocol string
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
return nil, nil
return &obj, nil
}


Expand Down Expand Up @@ -174,15 +174,60 @@ func (o *compress) RestreamerHlsStop(instanceName string, streamProtocol string
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
return nil, nil
return &obj, nil
}


func (o *compress) RestreamerEventsHistory( startFrom int, amount int) ([]RestreamerEvent, error) {
return nil, nil
requestBody := &eventsHistoryRequest{
BaseModel: BaseModel{ClientId: o.GetCliendId(), ApiKey: o.apiKey},
StartFrom: startFrom,
amount: amount,

Check failure on line 185 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

unknown field amount in struct literal of type eventsHistoryRequest

Check failure on line 185 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

unknown field amount in struct literal of type eventsHistoryRequest

Check failure on line 185 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

unknown field amount in struct literal of type eventsHistoryRequest

Check failure on line 185 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

unknown field amount in struct literal of type eventsHistoryRequest
}
if errs := validator.Validate(requestBody); errs != nil {
// values not valid, deal with errors here
return nil, errs
}
resp, err := o.restyPost(EVENTS_HISTORY(), requestBody)
if err != nil {
return nil, err
}
o.debugPrint(resp)
if resp.IsError() {
return nil, fmt.Errorf("")
}
var obj []RestreamerEvent
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
return &obj, nil

Check failure on line 203 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

cannot use &obj (value of type *[]RestreamerEvent) as []RestreamerEvent value in return statement

Check failure on line 203 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

cannot use &obj (value of type *[]RestreamerEvent) as []RestreamerEvent value in return statement

Check failure on line 203 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

cannot use &obj (value of type *[]RestreamerEvent) as []RestreamerEvent value in return statement

Check failure on line 203 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

cannot use &obj (value of type *[]RestreamerEvent) as []RestreamerEvent value in return statement
}


func (o *compress) GenerateVodProxy(request generateVodRequest) (*generateVodResponse, error) {
return nil, nil
func (o *compress) GenerateVodProxy(eventId string, instanceName string, title string, ) (*generateVodResponse, error) {
requestBody := &generateVodRequest{
BaseModel: BaseModel{ClientId: o.GetCliendId(), ApiKey: o.apiKey},
ThumbnailsNumber:"0",
EventID: eventId,
CustomerID: o.customerId,

Check failure on line 212 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

cannot use o.customerId (variable of type int) as *int value in struct literal

Check failure on line 212 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

cannot use o.customerId (variable of type int) as *int value in struct literal

Check failure on line 212 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

cannot use o.customerId (variable of type int) as *int value in struct literal

Check failure on line 212 in compress/api_restreamer.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

cannot use o.customerId (variable of type int) as *int value in struct literal
Title: title,
Instance: instanceName,
}
if errs := validator.Validate(requestBody); errs != nil {
// values not valid, deal with errors here
return nil, errs
}
resp, err := o.restyPost(LIVE_TO_VOD(), requestBody)
if err != nil {
return nil, err
}
o.debugPrint(resp)
if resp.IsError() {
return nil, fmt.Errorf("")
}
var obj generateVodResponse
if err := json.Unmarshal(resp.Body(), &obj); err != nil {
return nil, err
}
return &obj, nil
}
2 changes: 1 addition & 1 deletion compress/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type ICompress interface {
RestreamerHlsStop(instanceName string, streamProtocol string) (*HlsResponse, error)
RestreamerEventsHistory( startFrom int, amount int) ([]RestreamerEvent, error)
GetCustomerS3Zone() (*CustomerS3, error)
GenerateVodProxy(request generateVodRequest) (*generateVodResponse, error)
GenerateVodProxy(eventId string, instanceName string, title string) (*generateVodResponse, error)
//
}

Expand Down

0 comments on commit 077330e

Please sign in to comment.