From 50a859a9075231e666cfa1cdb1020b3a78ff1e54 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 10 Apr 2024 11:25:21 +0000
Subject: [PATCH 1/3] feat(api): updates (#371)
---
src/resources/video/live-streams.ts | 36 +++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/src/resources/video/live-streams.ts b/src/resources/video/live-streams.ts
index 1b766e7d..a63d7ecd 100644
--- a/src/resources/video/live-streams.ts
+++ b/src/resources/video/live-streams.ts
@@ -775,6 +775,12 @@ export interface LiveStreamUpdateParams {
*/
max_continuous_duration?: number;
+ /**
+ * Updates the new asset settings to use to generate a new asset for this live
+ * stream. Only the `mp4_support` setting may be updated.
+ */
+ new_asset_settings?: LiveStreamUpdateParams.NewAssetSettings;
+
/**
* Arbitrary user-supplied metadata set for the live stream. Max 255 characters. In
* order to clear this value, the field should be included with an empty-string
@@ -818,6 +824,36 @@ export interface LiveStreamUpdateParams {
use_slate_for_standard_latency?: boolean;
}
+export namespace LiveStreamUpdateParams {
+ /**
+ * Updates the new asset settings to use to generate a new asset for this live
+ * stream. Only the `mp4_support` setting may be updated.
+ */
+ export interface NewAssetSettings {
+ /**
+ * Specify what level of support for mp4 playback should be added to new assets
+ * generated from this live stream.
+ *
+ * - The `none` option disables MP4 support for new assets. MP4 files will not be
+ * produced for an asset generated from this live stream.
+ * - The `capped-1080p` option produces a single MP4 file, called
+ * `capped-1080p.mp4`, with the video resolution capped at 1080p. This option
+ * produces an `audio.m4a` file for an audio-only asset.
+ * - The `audio-only` option produces a single M4A file, called `audio.m4a` for a
+ * video or an audio-only asset. MP4 generation will error when this option is
+ * specified for a video-only asset.
+ * - The `audio-only,capped-1080p` option produces both the `audio.m4a` and
+ * `capped-1080p.mp4` files. Only the `capped-1080p.mp4` file is produced for a
+ * video-only asset, while only the `audio.m4a` file is produced for an
+ * audio-only asset.
+ * - The `standard`(deprecated) option produces up to three MP4 files with
+ * different levels of resolution (`high.mp4`, `medium.mp4`, `low.mp4`, or
+ * `audio.m4a` for an audio-only asset).
+ */
+ mp4_support?: 'none' | 'standard' | 'capped-1080p' | 'audio-only' | 'audio-only,capped-1080p';
+ }
+}
+
export interface LiveStreamListParams extends BasePageParams {
/**
* Filter response to return live streams with the specified status only
From 5dac48b99add9699d09f440d3410fc10ee176377 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 11 Apr 2024 10:56:21 +0000
Subject: [PATCH 2/3] feat(api): add user agent playback restrictions (#373)
---
.stats.yml | 2 +-
api.md | 1 +
src/resources/video/index.ts | 1 +
src/resources/video/playback-restrictions.ts | 83 +++++++++++++++++++
src/resources/video/video.ts | 1 +
.../video/playback-restrictions.test.ts | 23 +++++
6 files changed, 110 insertions(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 3f58c743..d9434dbd 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 94
+configured_endpoints: 95
diff --git a/api.md b/api.md
index dd52ee0e..c0499135 100644
--- a/api.md
+++ b/api.md
@@ -96,6 +96,7 @@ Methods:
- client.video.playbackRestrictions.list({ ...params }) -> PlaybackRestrictionsBasePage
- client.video.playbackRestrictions.delete(playbackRestrictionId) -> void
- client.video.playbackRestrictions.updateReferrer(playbackRestrictionId, { ...params }) -> PlaybackRestriction
+- client.video.playbackRestrictions.updateUserAgent(playbackRestrictionId, { ...params }) -> PlaybackRestriction
## Spaces
diff --git a/src/resources/video/index.ts b/src/resources/video/index.ts
index c5e5baa4..7c1e6dbd 100644
--- a/src/resources/video/index.ts
+++ b/src/resources/video/index.ts
@@ -60,6 +60,7 @@ export {
PlaybackRestrictionCreateParams,
PlaybackRestrictionListParams,
PlaybackRestrictionUpdateReferrerParams,
+ PlaybackRestrictionUpdateUserAgentParams,
PlaybackRestrictionsBasePage,
PlaybackRestrictions,
} from './playback-restrictions';
diff --git a/src/resources/video/playback-restrictions.ts b/src/resources/video/playback-restrictions.ts
index 10082fa4..c8ca5fed 100644
--- a/src/resources/video/playback-restrictions.ts
+++ b/src/resources/video/playback-restrictions.ts
@@ -84,6 +84,25 @@ export class PlaybackRestrictions extends APIResource {
}) as Core.APIPromise<{ data: PlaybackRestriction }>
)._thenUnwrap((obj) => obj.data);
}
+
+ /**
+ * Allows you to modify how Mux validates playback requests with different user
+ * agents. Please see
+ * [Using User-Agent HTTP header for validation](https://docs.mux.com/guides/secure-video-playback#using-user-agent-http-header-for-validation)
+ * for more details on this feature.
+ */
+ updateUserAgent(
+ playbackRestrictionId: string,
+ body: PlaybackRestrictionUpdateUserAgentParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return (
+ this._client.put(`/video/v1/playback-restrictions/${playbackRestrictionId}/user_agent`, {
+ body,
+ ...options,
+ }) as Core.APIPromise<{ data: PlaybackRestriction }>
+ )._thenUnwrap((obj) => obj.data);
+ }
}
export class PlaybackRestrictionsBasePage extends BasePage {}
@@ -110,6 +129,13 @@ export interface PlaybackRestriction {
* (seconds since epoch).
*/
updated_at: string;
+
+ /**
+ * Rules that control what user agents are allowed to play your videos. Please see
+ * [Using User-Agent HTTP header for validation](https://docs.mux.com/guides/secure-video-playback#using-user-agent-http-header-for-validation)
+ * for more details on this feature.
+ */
+ user_agent: PlaybackRestriction.UserAgent;
}
export namespace PlaybackRestriction {
@@ -136,6 +162,24 @@ export namespace PlaybackRestriction {
*/
allowed_domains?: Array;
}
+
+ /**
+ * Rules that control what user agents are allowed to play your videos. Please see
+ * [Using User-Agent HTTP header for validation](https://docs.mux.com/guides/secure-video-playback#using-user-agent-http-header-for-validation)
+ * for more details on this feature.
+ */
+ export interface UserAgent {
+ /**
+ * Whether or not to allow high risk user agents. The high risk user agents are
+ * defined by Mux.
+ */
+ allow_high_risk_user_agent?: boolean;
+
+ /**
+ * Whether or not to allow views without a `User-Agent` HTTP request header.
+ */
+ allow_no_user_agent?: boolean;
+ }
}
export interface PlaybackRestrictionResponse {
@@ -147,6 +191,13 @@ export interface PlaybackRestrictionCreateParams {
* A list of domains allowed to play your videos.
*/
referrer: PlaybackRestrictionCreateParams.Referrer;
+
+ /**
+ * Rules that control what user agents are allowed to play your videos. Please see
+ * [Using User-Agent HTTP header for validation](https://docs.mux.com/guides/secure-video-playback#using-user-agent-http-header-for-validation)
+ * for more details on this feature.
+ */
+ user_agent: PlaybackRestrictionCreateParams.UserAgent;
}
export namespace PlaybackRestrictionCreateParams {
@@ -173,6 +224,24 @@ export namespace PlaybackRestrictionCreateParams {
*/
allow_no_referrer?: boolean;
}
+
+ /**
+ * Rules that control what user agents are allowed to play your videos. Please see
+ * [Using User-Agent HTTP header for validation](https://docs.mux.com/guides/secure-video-playback#using-user-agent-http-header-for-validation)
+ * for more details on this feature.
+ */
+ export interface UserAgent {
+ /**
+ * Whether or not to allow high risk user agents. The high risk user agents are
+ * defined by Mux.
+ */
+ allow_high_risk_user_agent?: boolean;
+
+ /**
+ * Whether or not to allow views without a `User-Agent` HTTP request header.
+ */
+ allow_no_user_agent?: boolean;
+ }
}
export interface PlaybackRestrictionListParams extends BasePageParams {}
@@ -198,6 +267,19 @@ export interface PlaybackRestrictionUpdateReferrerParams {
allow_no_referrer?: boolean;
}
+export interface PlaybackRestrictionUpdateUserAgentParams {
+ /**
+ * Whether or not to allow high risk user agents. The high risk user agents are
+ * defined by Mux.
+ */
+ allow_high_risk_user_agent: boolean;
+
+ /**
+ * Whether or not to allow views without a `User-Agent` HTTP request header.
+ */
+ allow_no_user_agent: boolean;
+}
+
export namespace PlaybackRestrictions {
export import PlaybackRestriction = PlaybackRestrictionsAPI.PlaybackRestriction;
export import PlaybackRestrictionResponse = PlaybackRestrictionsAPI.PlaybackRestrictionResponse;
@@ -205,4 +287,5 @@ export namespace PlaybackRestrictions {
export import PlaybackRestrictionCreateParams = PlaybackRestrictionsAPI.PlaybackRestrictionCreateParams;
export import PlaybackRestrictionListParams = PlaybackRestrictionsAPI.PlaybackRestrictionListParams;
export import PlaybackRestrictionUpdateReferrerParams = PlaybackRestrictionsAPI.PlaybackRestrictionUpdateReferrerParams;
+ export import PlaybackRestrictionUpdateUserAgentParams = PlaybackRestrictionsAPI.PlaybackRestrictionUpdateUserAgentParams;
}
diff --git a/src/resources/video/video.ts b/src/resources/video/video.ts
index a2c858d5..a2a99cf2 100644
--- a/src/resources/video/video.ts
+++ b/src/resources/video/video.ts
@@ -64,6 +64,7 @@ export namespace Video {
export import PlaybackRestrictionCreateParams = PlaybackRestrictionsAPI.PlaybackRestrictionCreateParams;
export import PlaybackRestrictionListParams = PlaybackRestrictionsAPI.PlaybackRestrictionListParams;
export import PlaybackRestrictionUpdateReferrerParams = PlaybackRestrictionsAPI.PlaybackRestrictionUpdateReferrerParams;
+ export import PlaybackRestrictionUpdateUserAgentParams = PlaybackRestrictionsAPI.PlaybackRestrictionUpdateUserAgentParams;
export import Spaces = SpacesAPI.Spaces;
export import Broadcast = SpacesAPI.Broadcast;
export import BroadcastLayout = SpacesAPI.BroadcastLayout;
diff --git a/tests/api-resources/video/playback-restrictions.test.ts b/tests/api-resources/video/playback-restrictions.test.ts
index c5220f8f..b793e2f5 100644
--- a/tests/api-resources/video/playback-restrictions.test.ts
+++ b/tests/api-resources/video/playback-restrictions.test.ts
@@ -13,6 +13,7 @@ describe('resource playbackRestrictions', () => {
test('create: only required params', async () => {
const responsePromise = mux.video.playbackRestrictions.create({
referrer: { allowed_domains: ['*.example.com'] },
+ user_agent: {},
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -26,6 +27,7 @@ describe('resource playbackRestrictions', () => {
test('create: required and optional params', async () => {
const response = await mux.video.playbackRestrictions.create({
referrer: { allowed_domains: ['*.example.com'], allow_no_referrer: true },
+ user_agent: { allow_no_user_agent: false, allow_high_risk_user_agent: false },
});
});
@@ -109,4 +111,25 @@ describe('resource playbackRestrictions', () => {
allow_no_referrer: true,
});
});
+
+ test('updateUserAgent: only required params', async () => {
+ const responsePromise = mux.video.playbackRestrictions.updateUserAgent('string', {
+ allow_high_risk_user_agent: false,
+ allow_no_user_agent: false,
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('updateUserAgent: required and optional params', async () => {
+ const response = await mux.video.playbackRestrictions.updateUserAgent('string', {
+ allow_high_risk_user_agent: false,
+ allow_no_user_agent: false,
+ });
+ });
});
From 367a9a43b4ae8596f37b1139e0781d7d873ca530 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 11 Apr 2024 10:56:56 +0000
Subject: [PATCH 3/3] release: 8.4.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 9 +++++++++
package.json | 2 +-
src/version.ts | 2 +-
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b0034f9d..818c5627 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "8.3.1"
+ ".": "8.4.0"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15a1ac76..3a8c9fe7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## 8.4.0 (2024-04-11)
+
+Full Changelog: [v8.3.1...v8.4.0](https://github.com/muxinc/mux-node-sdk/compare/v8.3.1...v8.4.0)
+
+### Features
+
+* **api:** add user agent playback restrictions ([#373](https://github.com/muxinc/mux-node-sdk/issues/373)) ([5dac48b](https://github.com/muxinc/mux-node-sdk/commit/5dac48b99add9699d09f440d3410fc10ee176377))
+* **api:** updates ([#371](https://github.com/muxinc/mux-node-sdk/issues/371)) ([50a859a](https://github.com/muxinc/mux-node-sdk/commit/50a859a9075231e666cfa1cdb1020b3a78ff1e54))
+
## 8.3.1 (2024-04-09)
Full Changelog: [v8.3.0...v8.3.1](https://github.com/muxinc/mux-node-sdk/compare/v8.3.0...v8.3.1)
diff --git a/package.json b/package.json
index 8fd849fa..5deefb79 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@mux/mux-node",
- "version": "8.3.1",
+ "version": "8.4.0",
"description": "The official TypeScript library for the Mux API",
"author": "Mux ",
"types": "dist/index.d.ts",
diff --git a/src/version.ts b/src/version.ts
index 8ba58bcd..72d53180 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '8.3.1'; // x-release-please-version
+export const VERSION = '8.4.0'; // x-release-please-version