diff --git a/api_live_streams.go b/api_live_streams.go index bdf166d..583bb3a 100644 --- a/api_live_streams.go +++ b/api_live_streams.go @@ -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) diff --git a/configuration.go b/configuration.go index 71e6516..2bd86b6 100644 --- a/configuration.go +++ b/configuration.go @@ -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) diff --git a/docs/Asset.md b/docs/Asset.md index e2e7b6c..17eef11 100644 --- a/docs/Asset.md +++ b/docs/Asset.md @@ -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) diff --git a/docs/AssetNonStandardInputReasons.md b/docs/AssetNonStandardInputReasons.md new file mode 100644 index 0000000..c9b1d43 --- /dev/null +++ b/docs/AssetNonStandardInputReasons.md @@ -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) + + diff --git a/docs/AssetRecordingTimes.md b/docs/AssetRecordingTimes.md new file mode 100644 index 0000000..c474f9b --- /dev/null +++ b/docs/AssetRecordingTimes.md @@ -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) + + diff --git a/docs/DisableLiveStreamResponse.md b/docs/DisableLiveStreamResponse.md new file mode 100644 index 0000000..cc77449 --- /dev/null +++ b/docs/DisableLiveStreamResponse.md @@ -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) + + diff --git a/docs/EnableLiveStreamResponse.md b/docs/EnableLiveStreamResponse.md new file mode 100644 index 0000000..5cc4047 --- /dev/null +++ b/docs/EnableLiveStreamResponse.md @@ -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) + + diff --git a/docs/LiveStreamsApi.md b/docs/LiveStreamsApi.md index 12e5d1f..15b64dc 100644 --- a/docs/LiveStreamsApi.md +++ b/docs/LiveStreamsApi.md @@ -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 @@ -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 diff --git a/examples/video/live-streams/exercise-live-streams.go b/examples/video/live-streams/exercise-live-streams.go index 2646fbe..86e7cc2 100644 --- a/examples/video/live-streams/exercise-live-streams.go +++ b/examples/video/live-streams/exercise-live-streams.go @@ -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) diff --git a/model_asset.go b/model_asset.go index 5fcde11..fb5ae9e 100644 --- a/model_asset.go +++ b/model_asset.go @@ -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"` } diff --git a/model_asset_non_standard_input_reasons.go b/model_asset_non_standard_input_reasons.go new file mode 100644 index 0000000..9be494a --- /dev/null +++ b/model_asset_non_standard_input_reasons.go @@ -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"` +} diff --git a/model_asset_recording_times.go b/model_asset_recording_times.go new file mode 100644 index 0000000..6fd5058 --- /dev/null +++ b/model_asset_recording_times.go @@ -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"` +} diff --git a/model_disable_live_stream_response.go b/model_disable_live_stream_response.go new file mode 100644 index 0000000..938260b --- /dev/null +++ b/model_disable_live_stream_response.go @@ -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"` +} diff --git a/model_enable_live_stream_response.go b/model_enable_live_stream_response.go new file mode 100644 index 0000000..8410637 --- /dev/null +++ b/model_enable_live_stream_response.go @@ -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"` +}