forked from muxinc/mux-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delivery Usage, Simulcasting, Audio Normalization, and a variety of b…
…ugfixes. (muxinc#9) * Delivery Usage, Simulcasting, and Audio Normalization * Test Simulcast * Test Delivery Usage * Test normalize audio * Reinstate delete asset step * Support master access on asset creation * Pull in latest fixes for reduced latency * Typo
- Loading branch information
Showing
29 changed files
with
716 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// Mux Go - Copyright 2019 Mux Inc. | ||
// NOTE: This file is auto generated. Do not edit this file manually. | ||
|
||
package muxgo | ||
|
||
import ( | ||
"io/ioutil" | ||
"net/url" | ||
"strings" | ||
) | ||
|
||
type DeliveryUsageApiService service | ||
|
||
type ListDeliveryUsageParams struct { | ||
Page int32 | ||
Limit int32 | ||
AssetId string | ||
Timeframe []string | ||
} | ||
|
||
// ListDeliveryUsage optionally accepts the APIOption of WithParams(*ListDeliveryUsageParams). | ||
func (a *DeliveryUsageApiService) ListDeliveryUsage(opts ...APIOption) (ListDeliveryUsageResponse, error) { | ||
var ( | ||
localVarAPIOptions = new(APIOptions) | ||
localVarHttpMethod = strings.ToUpper("Get") | ||
localVarPostBody interface{} | ||
localVarFormFileName string | ||
localVarFileName string | ||
localVarFileBytes []byte | ||
localVarReturnValue ListDeliveryUsageResponse | ||
) | ||
|
||
for _, opt := range opts { | ||
opt(localVarAPIOptions) | ||
} | ||
|
||
localVarOptionals, ok := localVarAPIOptions.params.(*ListDeliveryUsageParams) | ||
if localVarAPIOptions.params != nil && !ok { | ||
return localVarReturnValue, reportError("provided params were not of type *ListDeliveryUsageParams") | ||
} | ||
|
||
// create path and map variables | ||
localVarPath := a.client.cfg.basePath + "/video/v1/delivery-usage" | ||
|
||
localVarHeaderParams := make(map[string]string) | ||
localVarQueryParams := url.Values{} | ||
localVarFormParams := url.Values{} | ||
|
||
if localVarOptionals != nil && isSet(localVarOptionals.Page) { | ||
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page, "")) | ||
} | ||
if localVarOptionals != nil && isSet(localVarOptionals.Limit) { | ||
localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit, "")) | ||
} | ||
if localVarOptionals != nil && isSet(localVarOptionals.AssetId) { | ||
localVarQueryParams.Add("asset_id", parameterToString(localVarOptionals.AssetId, "")) | ||
} | ||
if localVarOptionals != nil && isSet(localVarOptionals.Timeframe) { | ||
// This will "always work" for Mux's use case, since we always treat collections in query params as "multi" types. | ||
// The first version of this code checked the collectionFormat, but that's just wasted CPU cycles right now. | ||
for _, v := range localVarOptionals.Timeframe { | ||
localVarQueryParams.Add("timeframe[]", v) | ||
} | ||
} | ||
// 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.