Skip to content

Commit

Permalink
0.10.0 (muxinc#21)
Browse files Browse the repository at this point in the history
* 0.10

* Add test coverage
  • Loading branch information
philcluff authored Nov 11, 2020
1 parent edf5eab commit ac4e838
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 2 deletions.
150 changes: 150 additions & 0 deletions api_live_streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,156 @@ func (a *LiveStreamsApiService) DeleteLiveStreamSimulcastTarget(lIVESTREAMID str
return nil
}

func (a *LiveStreamsApiService) DisableLiveStream(lIVESTREAMID string, opts ...APIOption) (DisableLiveStreamResponse, error) {
var (
localVarAPIOptions = new(APIOptions)
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue DisableLiveStreamResponse
)

for _, opt := range opts {
opt(localVarAPIOptions)
}

// create path and map variables
localVarPath := a.client.cfg.basePath + "/video/v1/live-streams/{LIVE_STREAM_ID}/disable"
localVarPath = strings.Replace(localVarPath, "{"+"LIVE_STREAM_ID"+"}", fmt.Sprintf("%v", lIVESTREAMID), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

// to determine the Content-Type header
localVarHttpContentTypes := []string{}

// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}

// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}

// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}

r, err := a.client.prepareRequest(localVarAPIOptions, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, err
}

localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, err
}

// Check for common HTTP error status codes
err = CheckForHttpError(localVarHttpResponse.StatusCode, localVarBody)
if err != nil {
return localVarReturnValue, err
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, newErr
}

return localVarReturnValue, nil
}

func (a *LiveStreamsApiService) EnableLiveStream(lIVESTREAMID string, opts ...APIOption) (EnableLiveStreamResponse, error) {
var (
localVarAPIOptions = new(APIOptions)
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue EnableLiveStreamResponse
)

for _, opt := range opts {
opt(localVarAPIOptions)
}

// create path and map variables
localVarPath := a.client.cfg.basePath + "/video/v1/live-streams/{LIVE_STREAM_ID}/enable"
localVarPath = strings.Replace(localVarPath, "{"+"LIVE_STREAM_ID"+"}", fmt.Sprintf("%v", lIVESTREAMID), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

// to determine the Content-Type header
localVarHttpContentTypes := []string{}

// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}

// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}

// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}

r, err := a.client.prepareRequest(localVarAPIOptions, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, err
}

localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, err
}

localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, err
}

// Check for common HTTP error status codes
err = CheckForHttpError(localVarHttpResponse.StatusCode, localVarBody)
if err != nil {
return localVarReturnValue, err
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, newErr
}

return localVarReturnValue, nil
}

func (a *LiveStreamsApiService) GetLiveStream(lIVESTREAMID string, opts ...APIOption) (LiveStreamResponse, error) {
var (
localVarAPIOptions = new(APIOptions)
Expand Down
2 changes: 1 addition & 1 deletion configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ConfigurationOption func(*Configuration)
func NewConfiguration(opts ...ConfigurationOption) *Configuration {
cfg := &Configuration{
basePath: "https://api.mux.com",
userAgent: "Mux Go | 0.9.0",
userAgent: "Mux Go | 0.10.0",
}
for _, opt := range opts {
opt(cfg)
Expand Down
2 changes: 2 additions & 0 deletions docs/Asset.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Name | Type | Description | Notes
**Mp4Support** | **string** | | [optional] [default to MP4_SUPPORT_NONE]
**NormalizeAudio** | **bool** | | [optional] [default to false]
**StaticRenditions** | [**AssetStaticRenditions**](Asset_static_renditions.md) | | [optional]
**RecordingTimes** | [**[]AssetRecordingTimes**](Asset_recording_times.md) | An array of individual live stream recording sessions. A recording session is created on each encoder connection during the live stream | [optional]
**NonStandardInputReasons** | [**AssetNonStandardInputReasons**](Asset_non_standard_input_reasons.md) | | [optional]
**Test** | **bool** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
18 changes: 18 additions & 0 deletions docs/AssetNonStandardInputReasons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# AssetNonStandardInputReasons

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**VideoCodec** | **string** | The video codec used on the input file | [optional]
**AudioCodec** | **string** | The audio codec used on the input file | [optional]
**VideoGopSize** | **string** | The video key frame Interval (also called as Group of Picture or GOP) of the input file | [optional]
**VideoFrameRate** | **string** | The video frame rate of the input file | [optional]
**VideoResolution** | **string** | The video resolution of the input file | [optional]
**PixelAspectRatio** | **string** | The video pixel aspect ratio of the input file | [optional]
**VideoEditList** | **string** | Video Edit List reason indicates that the input file's video track contains a complex Edit Decision List | [optional]
**AudioEditList** | **string** | Audio Edit List reason indicates that the input file's audio track contains a complex Edit Decision List | [optional]
**UnexpectedMediaFileParameters** | **string** | A catch-all reason when the input file in created with non-standard encoding parameters | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


11 changes: 11 additions & 0 deletions docs/AssetRecordingTimes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# AssetRecordingTimes

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**StartedAt** | [**time.Time**](time.Time.md) | The time at which the recording for the live stream started. The time value is Unix epoch time represented in ISO 8601 format | [optional]
**Duration** | **float64** | The duration of the live stream recorded. The time value is in seconds | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


10 changes: 10 additions & 0 deletions docs/DisableLiveStreamResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# DisableLiveStreamResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Data** | [**map[string]interface{}**](.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


10 changes: 10 additions & 0 deletions docs/EnableLiveStreamResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# EnableLiveStreamResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Data** | [**map[string]interface{}**](.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


58 changes: 58 additions & 0 deletions docs/LiveStreamsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Method | HTTP request | Description
[**DeleteLiveStream**](LiveStreamsApi.md#DeleteLiveStream) | **Delete** /video/v1/live-streams/{LIVE_STREAM_ID} | Delete a live stream
[**DeleteLiveStreamPlaybackId**](LiveStreamsApi.md#DeleteLiveStreamPlaybackId) | **Delete** /video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID} | Delete a live stream playback ID
[**DeleteLiveStreamSimulcastTarget**](LiveStreamsApi.md#DeleteLiveStreamSimulcastTarget) | **Delete** /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} | Delete a Live Stream Simulcast Target
[**DisableLiveStream**](LiveStreamsApi.md#DisableLiveStream) | **Put** /video/v1/live-streams/{LIVE_STREAM_ID}/disable | Disable a live stream
[**EnableLiveStream**](LiveStreamsApi.md#EnableLiveStream) | **Put** /video/v1/live-streams/{LIVE_STREAM_ID}/enable | Enable a live stream
[**GetLiveStream**](LiveStreamsApi.md#GetLiveStream) | **Get** /video/v1/live-streams/{LIVE_STREAM_ID} | Retrieve a live stream
[**GetLiveStreamSimulcastTarget**](LiveStreamsApi.md#GetLiveStreamSimulcastTarget) | **Get** /video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID} | Retrieve a Live Stream Simulcast Target
[**ListLiveStreams**](LiveStreamsApi.md#ListLiveStreams) | **Get** /video/v1/live-streams | List live streams
Expand Down Expand Up @@ -181,6 +183,62 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **DisableLiveStream**
> DisableLiveStreamResponse DisableLiveStream(ctx, lIVESTREAMID)
Disable a live stream

Disables a live stream, making it reject incoming RTMP streams until re-enabled.

### Required Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**lIVESTREAMID** | **string**| The live stream ID |

### Return type

[**DisableLiveStreamResponse**](DisableLiveStreamResponse.md)

### Authorization

[accessToken](../README.md#accessToken)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **EnableLiveStream**
> EnableLiveStreamResponse EnableLiveStream(ctx, lIVESTREAMID)
Enable a live stream

Enables a live stream, allowing it to accept an incoming RTMP stream.

### Required Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**lIVESTREAMID** | **string**| The live stream ID |

### Return type

[**EnableLiveStreamResponse**](EnableLiveStreamResponse.md)

### Authorization

[accessToken](../README.md#accessToken)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **GetLiveStream**
> LiveStreamResponse GetLiveStream(ctx, lIVESTREAMID)
Retrieve a live stream
Expand Down
15 changes: 15 additions & 0 deletions examples/video/live-streams/exercise-live-streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,21 @@ func main() {
common.AssertNoError(err)
fmt.Println("signal-live-stream-complete OK ✅")


// ========== disable-live-stream ==========
_, err = client.LiveStreamsApi.DisableLiveStream(s.Data.Id)
common.AssertNoError(err)
dls, err := client.LiveStreamsApi.GetLiveStream(s.Data.Id)
common.AssertStringEqualsValue(dls.Data.Status, "disabled")
fmt.Println("disable-live-stream OK ✅")

// ========== enable-live-stream ==========
_, err = client.LiveStreamsApi.EnableLiveStream(s.Data.Id)
common.AssertNoError(err)
els, err := client.LiveStreamsApi.GetLiveStream(s.Data.Id)
common.AssertStringEqualsValue(els.Data.Status, "idle")
fmt.Println("enable-live-stream OK ✅")

// ========== delete-live-stream ==========
err = client.LiveStreamsApi.DeleteLiveStream(s.Data.Id)
common.AssertNoError(err)
Expand Down
5 changes: 4 additions & 1 deletion model_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ type Asset struct {
Mp4Support string `json:"mp4_support,omitempty"`
NormalizeAudio bool `json:"normalize_audio,omitempty"`
StaticRenditions AssetStaticRenditions `json:"static_renditions,omitempty"`
Test bool `json:"test,omitempty"`
// An array of individual live stream recording sessions. A recording session is created on each encoder connection during the live stream
RecordingTimes []AssetRecordingTimes `json:"recording_times,omitempty"`
NonStandardInputReasons AssetNonStandardInputReasons `json:"non_standard_input_reasons,omitempty"`
Test bool `json:"test,omitempty"`
}
25 changes: 25 additions & 0 deletions model_asset_non_standard_input_reasons.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Mux Go - Copyright 2019 Mux Inc.
// NOTE: This file is auto generated. Do not edit this file manually.

package muxgo

type AssetNonStandardInputReasons struct {
// The video codec used on the input file
VideoCodec string `json:"video_codec,omitempty"`
// The audio codec used on the input file
AudioCodec string `json:"audio_codec,omitempty"`
// The video key frame Interval (also called as Group of Picture or GOP) of the input file
VideoGopSize string `json:"video_gop_size,omitempty"`
// The video frame rate of the input file
VideoFrameRate string `json:"video_frame_rate,omitempty"`
// The video resolution of the input file
VideoResolution string `json:"video_resolution,omitempty"`
// The video pixel aspect ratio of the input file
PixelAspectRatio string `json:"pixel_aspect_ratio,omitempty"`
// Video Edit List reason indicates that the input file's video track contains a complex Edit Decision List
VideoEditList string `json:"video_edit_list,omitempty"`
// Audio Edit List reason indicates that the input file's audio track contains a complex Edit Decision List
AudioEditList string `json:"audio_edit_list,omitempty"`
// A catch-all reason when the input file in created with non-standard encoding parameters
UnexpectedMediaFileParameters string `json:"unexpected_media_file_parameters,omitempty"`
}
15 changes: 15 additions & 0 deletions model_asset_recording_times.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Mux Go - Copyright 2019 Mux Inc.
// NOTE: This file is auto generated. Do not edit this file manually.

package muxgo

import (
"time"
)

type AssetRecordingTimes struct {
// The time at which the recording for the live stream started. The time value is Unix epoch time represented in ISO 8601 format
StartedAt time.Time `json:"started_at,omitempty"`
// The duration of the live stream recorded. The time value is in seconds
Duration float64 `json:"duration,omitempty"`
}
8 changes: 8 additions & 0 deletions model_disable_live_stream_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Mux Go - Copyright 2019 Mux Inc.
// NOTE: This file is auto generated. Do not edit this file manually.

package muxgo

type DisableLiveStreamResponse struct {
Data map[string]interface{} `json:"data,omitempty"`
}
8 changes: 8 additions & 0 deletions model_enable_live_stream_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Mux Go - Copyright 2019 Mux Inc.
// NOTE: This file is auto generated. Do not edit this file manually.

package muxgo

type EnableLiveStreamResponse struct {
Data map[string]interface{} `json:"data,omitempty"`
}

0 comments on commit ac4e838

Please sign in to comment.