Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 8.4.0 #372

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "8.3.1"
".": "8.4.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 94
configured_endpoints: 95
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Methods:
- <code title="get /video/v1/playback-restrictions">client.video.playbackRestrictions.<a href="./src/resources/video/playback-restrictions.ts">list</a>({ ...params }) -> PlaybackRestrictionsBasePage</code>
- <code title="delete /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}">client.video.playbackRestrictions.<a href="./src/resources/video/playback-restrictions.ts">delete</a>(playbackRestrictionId) -> void</code>
- <code title="put /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/referrer">client.video.playbackRestrictions.<a href="./src/resources/video/playback-restrictions.ts">updateReferrer</a>(playbackRestrictionId, { ...params }) -> PlaybackRestriction</code>
- <code title="put /video/v1/playback-restrictions/{PLAYBACK_RESTRICTION_ID}/user_agent">client.video.playbackRestrictions.<a href="./src/resources/video/playback-restrictions.ts">updateUserAgent</a>(playbackRestrictionId, { ...params }) -> PlaybackRestriction</code>

## Spaces

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <devex@mux.com>",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/resources/video/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export {
PlaybackRestrictionCreateParams,
PlaybackRestrictionListParams,
PlaybackRestrictionUpdateReferrerParams,
PlaybackRestrictionUpdateUserAgentParams,
PlaybackRestrictionsBasePage,
PlaybackRestrictions,
} from './playback-restrictions';
Expand Down
36 changes: 36 additions & 0 deletions src/resources/video/live-streams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
83 changes: 83 additions & 0 deletions src/resources/video/playback-restrictions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PlaybackRestriction> {
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<PlaybackRestriction> {}
Expand All @@ -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 {
Expand All @@ -136,6 +162,24 @@ export namespace PlaybackRestriction {
*/
allowed_domains?: Array<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.
*/
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 {
Expand All @@ -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 {
Expand All @@ -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 {}
Expand All @@ -198,11 +267,25 @@ 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;
export import PlaybackRestrictionsBasePage = PlaybackRestrictionsAPI.PlaybackRestrictionsBasePage;
export import PlaybackRestrictionCreateParams = PlaybackRestrictionsAPI.PlaybackRestrictionCreateParams;
export import PlaybackRestrictionListParams = PlaybackRestrictionsAPI.PlaybackRestrictionListParams;
export import PlaybackRestrictionUpdateReferrerParams = PlaybackRestrictionsAPI.PlaybackRestrictionUpdateReferrerParams;
export import PlaybackRestrictionUpdateUserAgentParams = PlaybackRestrictionsAPI.PlaybackRestrictionUpdateUserAgentParams;
}
1 change: 1 addition & 0 deletions src/resources/video/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '8.3.1'; // x-release-please-version
export const VERSION = '8.4.0'; // x-release-please-version
23 changes: 23 additions & 0 deletions tests/api-resources/video/playback-restrictions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 },
});
});

Expand Down Expand Up @@ -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,
});
});
});
Loading