Skip to content
Official Mux API wrapper for golang projects, supporting both Mux Data and Mux Video.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
examples
.gitignore
Gopkg.lock manage deps with dep Apr 11, 2019
Gopkg.toml
LICENSE Initial commit of mux-go Mar 6, 2019
README.md fixes contributing link May 14, 2019
api_assets.go
api_direct_uploads.go
api_errors.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
api_exports.go
api_filters.go
api_live_streams.go
api_metrics.go Swap to using custom Unmarshaler on GetMetricTimeseriesDataResponse May 1, 2019
api_url_signing_keys.go this isn't markdown Apr 12, 2019
api_video_views.go
client.go Move implementation May 1, 2019
configuration.go
model_abridged_video_view.go
model_asset.go
model_asset_errors.go gofmt Apr 11, 2019
model_asset_master.go
model_asset_response.go Repackage everything Mar 7, 2019
model_asset_static_renditions.go
model_asset_static_renditions_files.go gofmt Apr 11, 2019
model_breakdown_value.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
model_create_asset_request.go
model_create_live_stream_request.go
model_create_playback_id_request.go
model_create_playback_id_response.go
model_create_upload_request.go
model_error.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
model_filter_value.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
model_get_asset_input_info_response.go Repackage everything Mar 7, 2019
model_get_asset_playback_id_response.go
model_get_metric_timeseries_data_response.go Minor cleanup May 3, 2019
model_get_overall_values_response.go
model_input_file.go
model_input_info.go
model_input_settings.go
model_input_settings_overlay_settings.go
model_input_track.go
model_insight.go
model_list_all_metric_values_response.go
model_list_assets_response.go Repackage everything Mar 7, 2019
model_list_breakdown_values_response.go
model_list_errors_response.go
model_list_exports_response.go
model_list_filter_values_response.go
model_list_filters_response.go
model_list_filters_response_data.go gofmt Apr 11, 2019
model_list_insights_response.go
model_list_live_streams_response.go
model_list_signing_keys_response.go Repackage everything Mar 7, 2019
model_list_uploads_response.go Repackage everything Mar 7, 2019
model_list_video_views_response.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
model_live_stream.go gofmt Apr 11, 2019
model_live_stream_response.go Repackage everything Mar 7, 2019
model_metric.go
model_overall_values.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
model_playback_id.go
model_playback_policy.go
model_score.go Regenerate from updated OpenAPI defs, and pull in fix for multi type … Apr 30, 2019
model_signal_live_stream_complete_response.go Repackage everything Mar 7, 2019
model_signing_key.go
model_signing_key_response.go
model_track.go
model_update_asset_mp4_support_request.go
model_upload.go gofmt Apr 11, 2019
model_upload_error.go
model_upload_response.go
model_video_view.go
model_video_view_event.go
model_video_view_response.go

README.md

Mux Go Banner

Mux Go

Official Mux API wrapper for golang projects, supporting both Mux Data and Mux Video.

Mux Video is an API-first platform, powered by data and designed by video experts to make beautiful video possible for every development team.

Mux Data is a platform for monitoring your video streaming performance with just a few lines of code. Get in-depth quality of service analytics on web, mobile, and OTT devices.

Not familiar with Mux? Check out https://mux.com/ for more information.

Installation

go get github.com/muxinc/mux-go

Getting Started

Overview

Mux Go is a code generated lightweight wrapper around the Mux REST API and reflects them accurately. This has a few consequences you should watch out for:

  1. For almost all API responses, the object you're looking for will be in the data field on the API response object, as in the example below. This is because we designed our APIs with similar concepts to the JSON:API standard. This means we'll be able to return more metadata from our API calls (such as related entities) without the need to make breaking changes to our APIs. We've decided not to hide that in this library.

  2. We don't use a lot of object orientation. For example API calls that happen on a single asset don't exist in the asset class, but are API calls in the AssetsApi which require an asset ID.

Authentication

To use the Mux API, you'll need an access token and a secret. Details on obtaining these can be found here in the Mux documentation.

Its up to you to manage your token and secret. In our examples, we read them from MUX_TOKEN_ID and MUX_TOKEN_SECRET in your environment.

Example Usage

Below is a quick example of using mux-go to list the Video assets stored in your Mux account.

Be sure to also checkout the exmples directory.

package main

import (
	"fmt"
	"os"

	"github.com/muxinc/mux-go"
)

func main() {
	// API Client Init
	client := muxgo.NewAPIClient(
		muxgo.NewConfiguration(
			muxgo.WithBasicAuth(os.Getenv("MUX_TOKEN_ID"), os.Getenv("MUX_TOKEN_SECRET")),
		))

	// List Assets
	fmt.Println("Listing Assets...\n")
	r, err := client.AssetsApi.ListAssets()
	if err != nil {
		fmt.Printf("err: %s \n\n", err)
		os.Exit(255)
	}
	for _, asset := range r.Data {
		fmt.Printf("Asset ID: %s\n", asset.Id)
		fmt.Printf("Status: %s\n", asset.Status)
		fmt.Printf("Duration: %f\n\n", asset.Duration)
	}
}

Documentation

Be sure to check out the documentation in the docs directory.

Issues

If you run into problems, please raise a GitHub issue, filling in the issue template. We'll take a look as soon as possible.

Contributing

Please do not submit PRs against this package. It is generated from our OpenAPI definitions - Please open an issue instead!

License

MIT License. Copyright 2019 Mux, Inc.

You can’t perform that action at this time.