diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 87c0de96af4b..05a4accb4501 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -12506,7 +12506,7 @@ packages: dev: false file:projects/arm-mediaservices.tgz: - resolution: {integrity: sha512-D4fH76ZHXQaogbhhdLLBBHInkXfBqOq2JFnAEtieD5ttWUBFeBCnS0p1X1AI23ji8fLfCPtHx0aeCCvNjDUq2Q==, tarball: file:projects/arm-mediaservices.tgz} + resolution: {integrity: sha512-e7tH2i0JEu29LhgsAbx9oqfLu+4xms2No7ZkjDTrNKJtwd4RGNhEOIFGQj352L/JugxEBmbiIbIMtD5Lqz86aQ==, tarball: file:projects/arm-mediaservices.tgz} name: '@rush-temp/arm-mediaservices' version: 0.0.0 dependencies: @@ -12518,18 +12518,18 @@ packages: '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 '@types/chai': 4.3.4 + '@types/node': 14.18.36 chai: 4.3.7 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 - rollup-plugin-sourcemaps: 0.6.3_rollup@2.79.1 + rollup-plugin-sourcemaps: 0.6.3_7e8d81808a761355f6c3da2f25cfe887 tslib: 2.4.1 - typescript: 4.6.4 + typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: - - '@types/node' - supports-color dev: false @@ -16129,7 +16129,7 @@ packages: dev: false file:projects/digital-twins-core.tgz: - resolution: {integrity: sha512-Kx88rkD/kud2yFLn3hEDNVPiEmu/C3WEPClkK1Hr/RXWU32WOYlMJdE6SNt4EA4i8VgzwWFRHXxo6UMRdTjUrA==, tarball: file:projects/digital-twins-core.tgz} + resolution: {integrity: sha512-zpmdHAAYYxRxrTiSoRX+PAHpl6CVW7fgY2nbRTlj7GgQEtlDFlm7JrQ+0ASkEK2gPYHhT5YxoVof7MgLt9I8HA==, tarball: file:projects/digital-twins-core.tgz} name: '@rush-temp/digital-twins-core' version: 0.0.0 dependencies: @@ -16173,7 +16173,6 @@ packages: transitivePeerDependencies: - bufferutil - debug - - encoding - supports-color - utf-8-validate dev: false diff --git a/sdk/mediaservices/arm-mediaservices/CHANGELOG.md b/sdk/mediaservices/arm-mediaservices/CHANGELOG.md index 4fb8f166730b..db3f04ca4190 100644 --- a/sdk/mediaservices/arm-mediaservices/CHANGELOG.md +++ b/sdk/mediaservices/arm-mediaservices/CHANGELOG.md @@ -1,15 +1,41 @@ # Release History + +## 14.0.0 (2023-01-12) + +**Features** -## 13.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added Interface DDAudio + - Added Interface Fade + - Interface Filters has a new optional parameter fadeIn + - Interface Filters has a new optional parameter fadeOut + - Interface StandardEncoderPreset has a new optional parameter experimentalOptions + - Enum KnownEncoderNamedPreset has a new value DDGoodQualityAudio + - Enum KnownJobErrorCategory has a new value Account + - Enum KnownJobErrorCode has a new value IdentityUnsupported + - Added function getContinuationToken -### Other Changes +**Breaking Changes** + - Interface AssetsListNextOptionalParams no longer has parameter filter + - Interface AssetsListNextOptionalParams no longer has parameter orderby + - Interface AssetsListNextOptionalParams no longer has parameter top + - Interface ContentKeyPoliciesListNextOptionalParams no longer has parameter filter + - Interface ContentKeyPoliciesListNextOptionalParams no longer has parameter orderby + - Interface ContentKeyPoliciesListNextOptionalParams no longer has parameter top + - Interface JobsListNextOptionalParams no longer has parameter filter + - Interface JobsListNextOptionalParams no longer has parameter orderby + - Interface StreamingLocatorsListNextOptionalParams no longer has parameter filter + - Interface StreamingLocatorsListNextOptionalParams no longer has parameter orderby + - Interface StreamingLocatorsListNextOptionalParams no longer has parameter top + - Interface StreamingPoliciesListNextOptionalParams no longer has parameter filter + - Interface StreamingPoliciesListNextOptionalParams no longer has parameter orderby + - Interface StreamingPoliciesListNextOptionalParams no longer has parameter top + - Interface TransformsListNextOptionalParams no longer has parameter filter + - Interface TransformsListNextOptionalParams no longer has parameter orderby + - Type of parameter odataType of interface Audio_2 is changed from "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" to "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" | "#Microsoft.Media.DDAudio" + - Type of parameter odataType of interface Codec is changed from "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" | "#Microsoft.Media.Video" | "#Microsoft.Media.H265Video" | "#Microsoft.Media.CopyVideo" | "#Microsoft.Media.Image" | "#Microsoft.Media.CopyAudio" | "#Microsoft.Media.H264Video" | "#Microsoft.Media.JpgImage" | "#Microsoft.Media.PngImage" to "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" | "#Microsoft.Media.DDAudio" | "#Microsoft.Media.Video" | "#Microsoft.Media.H265Video" | "#Microsoft.Media.CopyVideo" | "#Microsoft.Media.Image" | "#Microsoft.Media.CopyAudio" | "#Microsoft.Media.H264Video" | "#Microsoft.Media.JpgImage" | "#Microsoft.Media.PngImage" + + ## 13.0.0 (2022-09-06) **Features** diff --git a/sdk/mediaservices/arm-mediaservices/LICENSE b/sdk/mediaservices/arm-mediaservices/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/mediaservices/arm-mediaservices/LICENSE +++ b/sdk/mediaservices/arm-mediaservices/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/mediaservices/arm-mediaservices/_meta.json b/sdk/mediaservices/arm-mediaservices/_meta.json index 577f3ab082d5..fe01046dd47a 100644 --- a/sdk/mediaservices/arm-mediaservices/_meta.json +++ b/sdk/mediaservices/arm-mediaservices/_meta.json @@ -1,8 +1,8 @@ { - "commit": "5caa1523d49057d1a011bf0bdd1857dca7f9ab6b", + "commit": "9107a590b9d26d770098c9d6b351f2940adfaad9", "readme": "specification/mediaservices/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\mediaservices\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1.20220727.1 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/mediaservices/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.5", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.1.20220727.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.0", + "use": "@autorest/typescript@6.0.0-rc.5" } \ No newline at end of file diff --git a/sdk/mediaservices/arm-mediaservices/package.json b/sdk/mediaservices/arm-mediaservices/package.json index b2ad89b93e44..05e1e8c7bb36 100644 --- a/sdk/mediaservices/arm-mediaservices/package.json +++ b/sdk/mediaservices/arm-mediaservices/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureMediaServices.", - "version": "13.0.1", + "version": "14.0.0", "engines": { "node": ">=14.0.0" }, @@ -11,7 +11,7 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.5.0", + "@azure/core-client": "^1.6.1", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -36,7 +36,7 @@ "mkdirp": "^1.0.4", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", - "typescript": "~4.6.0", + "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", @@ -46,8 +46,8 @@ "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", - "@azure/dev-tool": "^1.0.0", - "@azure/arm-storage": "^17.2.1" + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/mediaservices/arm-mediaservices", "repository": { @@ -110,13 +110,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-mediaservices?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/mediaservices/arm-mediaservices/review/arm-mediaservices.api.md b/sdk/mediaservices/arm-mediaservices/review/arm-mediaservices.api.md index f6e6ca48d3af..3f8d4cb3f058 100644 --- a/sdk/mediaservices/arm-mediaservices/review/arm-mediaservices.api.md +++ b/sdk/mediaservices/arm-mediaservices/review/arm-mediaservices.api.md @@ -291,9 +291,6 @@ export type AssetsListContainerSasResponse = AssetContainerSas; // @public export interface AssetsListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; - top?: number; } // @public @@ -376,7 +373,7 @@ export type AttributeFilter = string; interface Audio_2 extends Codec { bitrate?: number; channels?: number; - odataType: "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio"; + odataType: "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" | "#Microsoft.Media.DDAudio"; samplingRate?: number; } export { Audio_2 as Audio } @@ -424,7 +421,7 @@ export interface AudioTrackDescriptor extends TrackDescriptor { export type AudioTrackDescriptorUnion = AudioTrackDescriptor | SelectAudioTrackByAttribute | SelectAudioTrackById; // @public (undocumented) -export type AudioUnion = Audio_2 | AacAudio; +export type AudioUnion = Audio_2 | AacAudio | DDAudio; // @public (undocumented) export class AzureMediaServices extends coreClient.ServiceClient { @@ -531,7 +528,7 @@ export type ClipTimeUnion = ClipTime | AbsoluteClipTime | UtcClipTime; // @public export interface Codec { label?: string; - odataType: "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" | "#Microsoft.Media.Video" | "#Microsoft.Media.H265Video" | "#Microsoft.Media.CopyVideo" | "#Microsoft.Media.Image" | "#Microsoft.Media.CopyAudio" | "#Microsoft.Media.H264Video" | "#Microsoft.Media.JpgImage" | "#Microsoft.Media.PngImage"; + odataType: "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" | "#Microsoft.Media.DDAudio" | "#Microsoft.Media.Video" | "#Microsoft.Media.H265Video" | "#Microsoft.Media.CopyVideo" | "#Microsoft.Media.Image" | "#Microsoft.Media.CopyAudio" | "#Microsoft.Media.H264Video" | "#Microsoft.Media.JpgImage" | "#Microsoft.Media.PngImage"; } // @public (undocumented) @@ -595,9 +592,6 @@ export type ContentKeyPoliciesGetResponse = ContentKeyPolicy; // @public export interface ContentKeyPoliciesListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; - top?: number; } // @public @@ -860,6 +854,11 @@ export interface DashSettings { role?: string; } +// @public +export interface DDAudio extends Audio_2 { + odataType: "#Microsoft.Media.DDAudio"; +} + // @public export type DefaultAction = string; @@ -968,10 +967,19 @@ export interface FaceDetectorPreset extends Preset { // @public export type FaceRedactorMode = string; +// @public +export interface Fade { + duration: string; + fadeColor: string; + start?: string; +} + // @public export interface Filters { crop?: Rectangle; deinterlace?: Deinterlace; + fadeIn?: Fade; + fadeOut?: Fade; overlays?: OverlayUnion[]; rotation?: Rotation; } @@ -1018,6 +1026,9 @@ export interface FromEachInputFile extends InputDefinition { odataType: "#Microsoft.Media.FromEachInputFile"; } +// @public +export function getContinuationToken(page: unknown): string | undefined; + // @public export type H264Complexity = string; @@ -1291,8 +1302,6 @@ export type JobsGetResponse = Job; // @public export interface JobsListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; } // @public @@ -1504,6 +1513,7 @@ export enum KnownEncoderNamedPreset { ContentAwareEncoding = "ContentAwareEncoding", ContentAwareEncodingExperimental = "ContentAwareEncodingExperimental", CopyAllBitrateNonInterleaved = "CopyAllBitrateNonInterleaved", + DDGoodQualityAudio = "DDGoodQualityAudio", H264MultipleBitrate1080P = "H264MultipleBitrate1080p", H264MultipleBitrate720P = "H264MultipleBitrate720p", H264MultipleBitrateSD = "H264MultipleBitrateSD", @@ -1607,6 +1617,7 @@ export enum KnownInterleaveOutput { // @public export enum KnownJobErrorCategory { + Account = "Account", Configuration = "Configuration", Content = "Content", Download = "Download", @@ -1621,6 +1632,7 @@ export enum KnownJobErrorCode { ContentUnsupported = "ContentUnsupported", DownloadNotAccessible = "DownloadNotAccessible", DownloadTransientError = "DownloadTransientError", + IdentityUnsupported = "IdentityUnsupported", ServiceError = "ServiceError", ServiceTransientError = "ServiceTransientError", UploadNotAccessible = "UploadNotAccessible", @@ -2723,6 +2735,9 @@ export interface ServiceSpecification { // @public export interface StandardEncoderPreset extends Preset { codecs: CodecUnion[]; + experimentalOptions?: { + [propertyName: string]: string; + }; filters?: Filters; formats: FormatUnion[]; odataType: "#Microsoft.Media.StandardEncoderPreset"; @@ -2973,9 +2988,6 @@ export type StreamingLocatorsListContentKeysResponse = ListContentKeysResponse; // @public export interface StreamingLocatorsListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; - top?: number; } // @public @@ -3033,9 +3045,6 @@ export type StreamingPoliciesGetResponse = StreamingPolicy; // @public export interface StreamingPoliciesListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; - top?: number; } // @public @@ -3321,8 +3330,6 @@ export type TransformsGetResponse = Transform; // @public export interface TransformsListNextOptionalParams extends coreClient.OperationOptions { - filter?: string; - orderby?: string; } // @public diff --git a/sdk/mediaservices/arm-mediaservices/src/azureMediaServices.ts b/sdk/mediaservices/arm-mediaservices/src/azureMediaServices.ts index 8fcdfce0df58..992054fe7638 100644 --- a/sdk/mediaservices/arm-mediaservices/src/azureMediaServices.ts +++ b/sdk/mediaservices/arm-mediaservices/src/azureMediaServices.ts @@ -88,22 +88,19 @@ export class AzureMediaServices extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-mediaservices/13.0.1`; + const packageDetails = `azsdk-js-arm-mediaservices/14.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`; - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } const optionsWithDefaults = { ...defaults, ...options, userAgentOptions: { userAgentPrefix }, - baseUri: + endpoint: options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); @@ -129,7 +126,9 @@ export class AzureMediaServices extends coreClient.ServiceClient { this.pipeline.addPolicy( coreRestPipeline.bearerTokenAuthenticationPolicy({ credential: credentials, - scopes: `${optionsWithDefaults.credentialScopes}`, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge diff --git a/sdk/mediaservices/arm-mediaservices/src/index.ts b/sdk/mediaservices/arm-mediaservices/src/index.ts index 1e8ea496bee9..33dc2a556bd8 100644 --- a/sdk/mediaservices/arm-mediaservices/src/index.ts +++ b/sdk/mediaservices/arm-mediaservices/src/index.ts @@ -7,6 +7,7 @@ */ /// +export { getContinuationToken } from "./pagingHelper"; export * from "./models"; export { AzureMediaServices } from "./azureMediaServices"; export * from "./operationsInterfaces"; diff --git a/sdk/mediaservices/arm-mediaservices/src/models/index.ts b/sdk/mediaservices/arm-mediaservices/src/models/index.ts index e56b6bc94bc4..ef617f5b2606 100644 --- a/sdk/mediaservices/arm-mediaservices/src/models/index.ts +++ b/sdk/mediaservices/arm-mediaservices/src/models/index.ts @@ -64,7 +64,7 @@ export type AudioAnalyzerPresetUnion = | AudioAnalyzerPreset | VideoAnalyzerPreset; export type JobInputClipUnion = JobInputClip | JobInputAsset | JobInputHttp; -export type AudioUnion = Audio | AacAudio; +export type AudioUnion = Audio | AacAudio | DDAudio; export type VideoUnion = Video | H265Video | ImageUnion | H264Video; export type AudioTrackDescriptorUnion = | AudioTrackDescriptor @@ -1487,6 +1487,7 @@ export interface Codec { odataType: | "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio" + | "#Microsoft.Media.DDAudio" | "#Microsoft.Media.Video" | "#Microsoft.Media.H265Video" | "#Microsoft.Media.CopyVideo" @@ -1499,6 +1500,16 @@ export interface Codec { label?: string; } +/** Describes the properties of a Fade effect applied to the input media. */ +export interface Fade { + /** The Duration of the fade effect in the video. The value can be in ISO 8601 format (For example, PT05S to fade In/Out a color during 5 seconds), or a frame count (For example, 10 to fade 10 frames from the start time), or a relative value to stream duration (For example, 10% to fade 10% of stream duration) */ + duration: string; + /** The Color for the fade In/Out. it can be on the CSS Level1 colors https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color_keywords or an RGB/hex value: e.g: rgb(255,0,0), 0xFF0000 or #FF0000 */ + fadeColor: string; + /** The position in the input video from where to start fade. The value can be in ISO 8601 format (For example, PT05S to start at 5 seconds), or a frame count (For example, 10 to start at the 10th frame), or a relative value to stream duration (For example, 10% to start at 10% of stream duration). Default is 0 */ + start?: string; +} + /** The encoder can be configured to produce video and/or images (thumbnails) at different resolutions, by specifying a layer for each desired resolution. A layer represents the properties for the video or image at a resolution. */ export interface Layer { /** The width of the output video for this layer. The value can be absolute (in pixels) or relative (in percentage). For example 50% means the output video has half as many pixels in width as the input. */ @@ -1560,7 +1571,7 @@ export interface Format { | "#Microsoft.Media.MultiBitrateFormat" | "#Microsoft.Media.Mp4Format" | "#Microsoft.Media.TransportStreamFormat"; - /** The pattern of the file names for the generated output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {Bitrate} - The audio/video bitrate. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed from the filename. */ + /** The file naming pattern used for the creation of output files. The following macros are supported in the file name: {Basename} - An expansion macro that will use the name of the input video file. If the base name(the file suffix is not included) of the input video file is less than 32 characters long, the base name of input video files will be used. If the length of base name of the input video file exceeds 32 characters, the base name is truncated to the first 32 characters in total length. {Extension} - The appropriate extension for this format. {Label} - The label assigned to the codec/layer. {Index} - A unique index for thumbnails. Only applicable to thumbnails. {AudioStream} - string "Audio" plus audio stream number(start from 1). {Bitrate} - The audio/video bitrate in kbps. Not applicable to thumbnails. {Codec} - The type of the audio/video codec. {Resolution} - The video resolution. Any unsubstituted macros will be collapsed and removed from the filename. */ filenamePattern: string; } @@ -1592,6 +1603,10 @@ export interface Filters { rotation?: Rotation; /** The parameters for the rectangular window with which to crop the input video. */ crop?: Rectangle; + /** Describes the properties of a Fade effect applied to the input media. */ + fadeIn?: Fade; + /** Describes the properties of a Fade effect applied to the input media. */ + fadeOut?: Fade; /** The properties of overlays to be applied to the input video. These could be audio, image or video overlays. */ overlays?: OverlayUnion[]; } @@ -1757,7 +1772,7 @@ export interface ContentKeyPolicyFairPlayConfiguration extends ContentKeyPolicyConfiguration { /** Polymorphic discriminator, which specifies the different types this object can be */ odataType: "#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration"; - /** The key that must be used as FairPlay Application Secret key. */ + /** The key that must be used as FairPlay Application Secret key. This needs to be base64 encoded. */ ask: Uint8Array | null; /** The password encrypting FairPlay certificate in PKCS 12 (pfx) format. */ fairPlayPfxPassword: string | null; @@ -1848,6 +1863,8 @@ export interface BuiltInStandardEncoderPreset extends Preset { export interface StandardEncoderPreset extends Preset { /** Polymorphic discriminator, which specifies the different types this object can be */ odataType: "#Microsoft.Media.StandardEncoderPreset"; + /** Dictionary containing key value pairs for parameters not exposed in the preset itself */ + experimentalOptions?: { [propertyName: string]: string }; /** One or more filtering operations that are applied to the input media before encoding. */ filters?: Filters; /** The list of codecs to be used when encoding the input video. */ @@ -1947,7 +1964,10 @@ export interface ContentKeyPolicyX509CertificateTokenKey /** Defines the common properties for all audio codecs. */ export interface Audio extends Codec { /** Polymorphic discriminator, which specifies the different types this object can be */ - odataType: "#Microsoft.Media.Audio" | "#Microsoft.Media.AacAudio"; + odataType: + | "#Microsoft.Media.Audio" + | "#Microsoft.Media.AacAudio" + | "#Microsoft.Media.DDAudio"; /** The number of channels in the audio. */ channels?: number; /** The sampling rate to use for encoding in hertz. */ @@ -2568,6 +2588,12 @@ export interface AacAudio extends Audio { profile?: AacAudioProfile; } +/** Describes Dolby Digital Audio Codec (AC3) audio encoding settings. The current implementation for Dolby Digital Audio support are: Audio channel numbers at 1((mono), 2(stereo), 6(5.1side); Audio sampling frequency rates at: 32K/44.1K/48K Hz; Audio bitrate values as AC3 specification supports: 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000, 448000, 512000, 576000, 640000 bps. */ +export interface DDAudio extends Audio { + /** Polymorphic discriminator, which specifies the different types this object can be */ + odataType: "#Microsoft.Media.DDAudio"; +} + /** Describes all the properties for encoding a video with the H.265 codec. */ export interface H265Video extends Video { /** Polymorphic discriminator, which specifies the different types this object can be */ @@ -3216,7 +3242,9 @@ export enum KnownJobErrorCode { /** There was a problem with the input content (for example: zero byte files, or corrupt/non-decodable files), check the input files. */ ContentMalformed = "ContentMalformed", /** There was a problem with the format of the input (not valid media file, or an unsupported file/codec), check the validity of the input files. */ - ContentUnsupported = "ContentUnsupported" + ContentUnsupported = "ContentUnsupported", + /** There was an error verifying to the account identity. Check and fix the identity configurations and retry. If unsuccessful, please contact support. */ + IdentityUnsupported = "IdentityUnsupported" } /** @@ -3232,7 +3260,8 @@ export enum KnownJobErrorCode { * **UploadTransientError**: While trying to upload the output files, there was an issue during transfer (storage service, network errors), see details and check your destination. \ * **ConfigurationUnsupported**: There was a problem with the combination of input files and the configuration settings applied, fix the configuration settings and retry with the same input, or change input to match the configuration. \ * **ContentMalformed**: There was a problem with the input content (for example: zero byte files, or corrupt\/non-decodable files), check the input files. \ - * **ContentUnsupported**: There was a problem with the format of the input (not valid media file, or an unsupported file\/codec), check the validity of the input files. + * **ContentUnsupported**: There was a problem with the format of the input (not valid media file, or an unsupported file\/codec), check the validity of the input files. \ + * **IdentityUnsupported**: There was an error verifying to the account identity. Check and fix the identity configurations and retry. If unsuccessful, please contact support. */ export type JobErrorCode = string; @@ -3247,7 +3276,9 @@ export enum KnownJobErrorCategory { /** The error is configuration related. */ Configuration = "Configuration", /** The error is related to data in the input files. */ - Content = "Content" + Content = "Content", + /** The error is related to account information. */ + Account = "Account" } /** @@ -3259,7 +3290,8 @@ export enum KnownJobErrorCategory { * **Download**: The error is download related. \ * **Upload**: The error is upload related. \ * **Configuration**: The error is configuration related. \ - * **Content**: The error is related to data in the input files. + * **Content**: The error is related to data in the input files. \ + * **Account**: The error is related to account information. */ export type JobErrorCategory = string; @@ -3832,7 +3864,7 @@ export enum KnownChannelMapping { FrontRight = "FrontRight", /** The Center Channel. */ Center = "Center", - /** Low Frequency Effects Channel. Sometimes referred to as the Subwoofer. */ + /** Low Frequency Effects Channel. Sometimes referred to as the subwoofer. */ LowFrequencyEffects = "LowFrequencyEffects", /** The Back Left Channel. Sometimes referred to as the Left Surround Channel. */ BackLeft = "BackLeft", @@ -3852,7 +3884,7 @@ export enum KnownChannelMapping { * **FrontLeft**: The Front Left Channel. \ * **FrontRight**: The Front Right Channel. \ * **Center**: The Center Channel. \ - * **LowFrequencyEffects**: Low Frequency Effects Channel. Sometimes referred to as the Subwoofer. \ + * **LowFrequencyEffects**: Low Frequency Effects Channel. Sometimes referred to as the subwoofer. \ * **BackLeft**: The Back Left Channel. Sometimes referred to as the Left Surround Channel. \ * **BackRight**: The Back Right Channel. Sometimes referred to as the Right Surround Channel. \ * **StereoLeft**: The Left Stereo channel. Sometimes referred to as Down Mix Left. \ @@ -4194,8 +4226,10 @@ export enum KnownEncoderNamedPreset { H264SingleBitrate1080P = "H264SingleBitrate1080p", /** Produces a set of GOP aligned MP4 files with H.264 video and stereo AAC audio. Auto-generates a bitrate ladder based on the input resolution, bitrate and frame rate. The auto-generated preset will never exceed the input resolution. For example, if the input is 720p, output will remain 720p at best. */ AdaptiveStreaming = "AdaptiveStreaming", - /** Produces a single MP4 file containing only stereo audio encoded at 192 kbps. */ + /** Produces a single MP4 file containing only AAC stereo audio encoded at 192 kbps. */ AACGoodQualityAudio = "AACGoodQualityAudio", + /** Produces a single MP4 file containing only DD(Digital Dolby) stereo audio encoded at 192 kbps. */ + DDGoodQualityAudio = "DDGoodQualityAudio", /** Exposes an experimental preset for content-aware encoding. Given any input content, the service attempts to automatically determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. The underlying algorithms will continue to evolve over time. The output will contain MP4 files with video and audio interleaved. */ ContentAwareEncodingExperimental = "ContentAwareEncodingExperimental", /** Produces a set of GOP-aligned MP4s by using content-aware encoding. Given any input content, the service performs an initial lightweight analysis of the input content, and uses the results to determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. This preset is particularly effective for low and medium complexity videos, where the output files will be at lower bitrates but at a quality that still delivers a good experience to viewers. The output will contain MP4 files with video and audio interleaved. */ @@ -4229,7 +4263,8 @@ export enum KnownEncoderNamedPreset { * **H264SingleBitrate720p**: Produces an MP4 file where the video is encoded with H.264 codec at 4500 kbps and a picture height of 720 pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. \ * **H264SingleBitrate1080p**: Produces an MP4 file where the video is encoded with H.264 codec at 6750 kbps and a picture height of 1080 pixels, and the stereo audio is encoded with AAC-LC codec at 128 kbps. \ * **AdaptiveStreaming**: Produces a set of GOP aligned MP4 files with H.264 video and stereo AAC audio. Auto-generates a bitrate ladder based on the input resolution, bitrate and frame rate. The auto-generated preset will never exceed the input resolution. For example, if the input is 720p, output will remain 720p at best. \ - * **AACGoodQualityAudio**: Produces a single MP4 file containing only stereo audio encoded at 192 kbps. \ + * **AACGoodQualityAudio**: Produces a single MP4 file containing only AAC stereo audio encoded at 192 kbps. \ + * **DDGoodQualityAudio**: Produces a single MP4 file containing only DD(Digital Dolby) stereo audio encoded at 192 kbps. \ * **ContentAwareEncodingExperimental**: Exposes an experimental preset for content-aware encoding. Given any input content, the service attempts to automatically determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. The underlying algorithms will continue to evolve over time. The output will contain MP4 files with video and audio interleaved. \ * **ContentAwareEncoding**: Produces a set of GOP-aligned MP4s by using content-aware encoding. Given any input content, the service performs an initial lightweight analysis of the input content, and uses the results to determine the optimal number of layers, appropriate bitrate and resolution settings for delivery by adaptive streaming. This preset is particularly effective for low and medium complexity videos, where the output files will be at lower bitrates but at a quality that still delivers a good experience to viewers. The output will contain MP4 files with video and audio interleaved. \ * **CopyAllBitrateNonInterleaved**: Copy all video and audio streams from the input asset as non-interleaved video and audio output files. This preset can be used to clip an existing asset or convert a group of key frame (GOP) aligned MP4 files as an asset that can be streamed. \ @@ -4507,14 +4542,7 @@ export type AssetsListStreamingLocatorsResponse = ListStreamingLocatorsResponse; /** Optional parameters. */ export interface AssetsListNextOptionalParams - extends coreClient.OperationOptions { - /** Restricts the set of items returned. */ - filter?: string; - /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ - top?: number; - /** Specifies the key by which the result collection should be ordered. */ - orderby?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type AssetsListNextResponse = AssetCollection; @@ -4681,14 +4709,7 @@ export type ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse = ContentKe /** Optional parameters. */ export interface ContentKeyPoliciesListNextOptionalParams - extends coreClient.OperationOptions { - /** Restricts the set of items returned. */ - filter?: string; - /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ - top?: number; - /** Specifies the key by which the result collection should be ordered. */ - orderby?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type ContentKeyPoliciesListNextResponse = ContentKeyPolicyCollection; @@ -4732,12 +4753,7 @@ export type TransformsUpdateResponse = Transform; /** Optional parameters. */ export interface TransformsListNextOptionalParams - extends coreClient.OperationOptions { - /** Restricts the set of items returned. */ - filter?: string; - /** Specifies the key by which the result collection should be ordered. */ - orderby?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type TransformsListNextResponse = TransformCollection; @@ -4780,12 +4796,7 @@ export interface JobsCancelJobOptionalParams /** Optional parameters. */ export interface JobsListNextOptionalParams - extends coreClient.OperationOptions { - /** Restricts the set of items returned. */ - filter?: string; - /** Specifies the key by which the result collection should be ordered. */ - orderby?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type JobsListNextResponse = JobCollection; @@ -4824,14 +4835,7 @@ export interface StreamingPoliciesDeleteOptionalParams /** Optional parameters. */ export interface StreamingPoliciesListNextOptionalParams - extends coreClient.OperationOptions { - /** Restricts the set of items returned. */ - filter?: string; - /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ - top?: number; - /** Specifies the key by which the result collection should be ordered. */ - orderby?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type StreamingPoliciesListNextResponse = StreamingPolicyCollection; @@ -4884,14 +4888,7 @@ export type StreamingLocatorsListPathsResponse = ListPathsResponse; /** Optional parameters. */ export interface StreamingLocatorsListNextOptionalParams - extends coreClient.OperationOptions { - /** Restricts the set of items returned. */ - filter?: string; - /** Specifies a non-negative integer n that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value n. */ - top?: number; - /** Specifies the key by which the result collection should be ordered. */ - orderby?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type StreamingLocatorsListNextResponse = StreamingLocatorCollection; diff --git a/sdk/mediaservices/arm-mediaservices/src/models/mappers.ts b/sdk/mediaservices/arm-mediaservices/src/models/mappers.ts index 9462d46c7caf..50d3183382ed 100644 --- a/sdk/mediaservices/arm-mediaservices/src/models/mappers.ts +++ b/sdk/mediaservices/arm-mediaservices/src/models/mappers.ts @@ -3713,6 +3713,35 @@ export const Codec: coreClient.CompositeMapper = { } }; +export const Fade: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Fade", + modelProperties: { + duration: { + serializedName: "duration", + required: true, + type: { + name: "TimeSpan" + } + }, + fadeColor: { + serializedName: "fadeColor", + required: true, + type: { + name: "String" + } + }, + start: { + serializedName: "start", + type: { + name: "String" + } + } + } + } +}; + export const Layer: coreClient.CompositeMapper = { type: { name: "Composite", @@ -3959,6 +3988,20 @@ export const Filters: coreClient.CompositeMapper = { className: "Rectangle" } }, + fadeIn: { + serializedName: "fadeIn", + type: { + name: "Composite", + className: "Fade" + } + }, + fadeOut: { + serializedName: "fadeOut", + type: { + name: "Composite", + className: "Fade" + } + }, overlays: { serializedName: "overlays", type: { @@ -4646,6 +4689,13 @@ export const StandardEncoderPreset: coreClient.CompositeMapper = { polymorphicDiscriminator: Preset.type.polymorphicDiscriminator, modelProperties: { ...Preset.type.modelProperties, + experimentalOptions: { + serializedName: "experimentalOptions", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, filters: { serializedName: "filters", type: { @@ -6377,6 +6427,19 @@ export const AacAudio: coreClient.CompositeMapper = { } }; +export const DDAudio: coreClient.CompositeMapper = { + serializedName: "#Microsoft.Media.DDAudio", + type: { + name: "Composite", + className: "DDAudio", + uberParent: "Audio", + polymorphicDiscriminator: Audio.type.polymorphicDiscriminator, + modelProperties: { + ...Audio.type.modelProperties + } + } +}; + export const H265Video: coreClient.CompositeMapper = { serializedName: "#Microsoft.Media.H265Video", type: { @@ -7070,6 +7133,7 @@ export let discriminators = { "JobInputClip.#Microsoft.Media.JobInputAsset": JobInputAsset, "JobInputClip.#Microsoft.Media.JobInputHttp": JobInputHttp, "Audio.#Microsoft.Media.AacAudio": AacAudio, + "Audio.#Microsoft.Media.DDAudio": DDAudio, "Video.#Microsoft.Media.H265Video": H265Video, "Video.#Microsoft.Media.Image": Image, "Video.#Microsoft.Media.H264Video": H264Video, diff --git a/sdk/mediaservices/arm-mediaservices/src/models/parameters.ts b/sdk/mediaservices/arm-mediaservices/src/models/parameters.ts index cf0d39025861..20f265ef9557 100644 --- a/sdk/mediaservices/arm-mediaservices/src/models/parameters.ts +++ b/sdk/mediaservices/arm-mediaservices/src/models/parameters.ts @@ -307,6 +307,18 @@ export const parameters11: OperationParameter = { mapper: ContentKeyPolicyMapper }; +export const apiVersion2: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-07-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + export const transformName: OperationURLParameter = { parameterPath: "transformName", mapper: { diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/accountFilters.ts b/sdk/mediaservices/arm-mediaservices/src/operations/accountFilters.ts index f7e6b0066517..01b72d1e1ce2 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/accountFilters.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/accountFilters.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AccountFilters } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -59,8 +60,16 @@ export class AccountFiltersImpl implements AccountFilters { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -68,11 +77,18 @@ export class AccountFiltersImpl implements AccountFilters { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: AccountFiltersListOptionalParams + options?: AccountFiltersListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: AccountFiltersListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -81,7 +97,9 @@ export class AccountFiltersImpl implements AccountFilters { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -349,7 +367,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/assetFilters.ts b/sdk/mediaservices/arm-mediaservices/src/operations/assetFilters.ts index 815b0bae49a3..062c9ed2a767 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/assetFilters.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/assetFilters.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { AssetFilters } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -66,12 +67,16 @@ export class AssetFiltersImpl implements AssetFilters { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, assetName, - options + options, + settings ); } }; @@ -81,16 +86,23 @@ export class AssetFiltersImpl implements AssetFilters { resourceGroupName: string, accountName: string, assetName: string, - options?: AssetFiltersListOptionalParams + options?: AssetFiltersListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - accountName, - assetName, - options - ); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: AssetFiltersListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + accountName, + assetName, + options + ); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -100,7 +112,9 @@ export class AssetFiltersImpl implements AssetFilters { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -401,7 +415,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/assets.ts b/sdk/mediaservices/arm-mediaservices/src/operations/assets.ts index 0c374c50dc93..dae84c659055 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/assets.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/assets.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Assets } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -66,8 +67,16 @@ export class AssetsImpl implements Assets { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -75,11 +84,18 @@ export class AssetsImpl implements Assets { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: AssetsListOptionalParams + options?: AssetsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: AssetsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -88,7 +104,9 @@ export class AssetsImpl implements Assets { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -493,12 +511,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.orderby - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/contentKeyPolicies.ts b/sdk/mediaservices/arm-mediaservices/src/operations/contentKeyPolicies.ts index 976c90abb56e..cb9a5d6901ce 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/contentKeyPolicies.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/contentKeyPolicies.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { ContentKeyPolicies } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -61,8 +62,16 @@ export class ContentKeyPoliciesImpl implements ContentKeyPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -70,11 +79,18 @@ export class ContentKeyPoliciesImpl implements ContentKeyPolicies { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: ContentKeyPoliciesListOptionalParams + options?: ContentKeyPoliciesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: ContentKeyPoliciesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -83,7 +99,9 @@ export class ContentKeyPoliciesImpl implements ContentKeyPolicies { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -410,12 +428,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.orderby - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/jobs.ts b/sdk/mediaservices/arm-mediaservices/src/operations/jobs.ts index ed939dec2ebf..bba7a2c0415e 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/jobs.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/jobs.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Jobs } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -67,12 +68,16 @@ export class JobsImpl implements Jobs { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, transformName, - options + options, + settings ); } }; @@ -82,16 +87,23 @@ export class JobsImpl implements Jobs { resourceGroupName: string, accountName: string, transformName: string, - options?: JobsListOptionalParams + options?: JobsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - accountName, - transformName, - options - ); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: JobsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + accountName, + transformName, + options + ); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -101,7 +113,9 @@ export class JobsImpl implements Jobs { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -301,9 +315,9 @@ const listOperationSpec: coreClient.OperationSpec = { } }, queryParameters: [ - Parameters.apiVersion1, Parameters.filter, - Parameters.orderby + Parameters.orderby, + Parameters.apiVersion2 ], urlParameters: [ Parameters.$host, @@ -327,7 +341,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -352,7 +366,7 @@ const createOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.parameters13, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -376,7 +390,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -401,7 +415,7 @@ const updateOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.parameters13, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -424,7 +438,7 @@ const cancelJobOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -447,11 +461,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion1, - Parameters.filter, - Parameters.orderby - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/liveEvents.ts b/sdk/mediaservices/arm-mediaservices/src/operations/liveEvents.ts index 196dd029d5ca..d505b03bb3c3 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/liveEvents.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/liveEvents.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { LiveEvents } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -70,8 +71,16 @@ export class LiveEventsImpl implements LiveEvents { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -79,11 +88,18 @@ export class LiveEventsImpl implements LiveEvents { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: LiveEventsListOptionalParams + options?: LiveEventsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: LiveEventsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -92,7 +108,9 @@ export class LiveEventsImpl implements LiveEvents { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1142,7 +1160,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/liveOutputs.ts b/sdk/mediaservices/arm-mediaservices/src/operations/liveOutputs.ts index d02de2d016b3..6bd6c7742cb3 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/liveOutputs.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/liveOutputs.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { LiveOutputs } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -70,12 +71,16 @@ export class LiveOutputsImpl implements LiveOutputs { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, liveEventName, - options + options, + settings ); } }; @@ -85,16 +90,23 @@ export class LiveOutputsImpl implements LiveOutputs { resourceGroupName: string, accountName: string, liveEventName: string, - options?: LiveOutputsListOptionalParams + options?: LiveOutputsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( - resourceGroupName, - accountName, - liveEventName, - options - ); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: LiveOutputsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + accountName, + liveEventName, + options + ); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -104,7 +116,9 @@ export class LiveOutputsImpl implements LiveOutputs { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -619,7 +633,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/mediaservices.ts b/sdk/mediaservices/arm-mediaservices/src/operations/mediaservices.ts index 9bc87d7bb655..47bf9ebca395 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/mediaservices.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/mediaservices.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Mediaservices } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -18,9 +19,10 @@ import { MediaService, MediaservicesListNextOptionalParams, MediaservicesListOptionalParams, + MediaservicesListResponse, MediaservicesListBySubscriptionNextOptionalParams, MediaservicesListBySubscriptionOptionalParams, - MediaservicesListResponse, + MediaservicesListBySubscriptionResponse, MediaservicesGetOptionalParams, MediaservicesGetResponse, MediaservicesCreateOrUpdateOptionalParams, @@ -34,7 +36,6 @@ import { ListEdgePoliciesInput, MediaservicesListEdgePoliciesOptionalParams, MediaservicesListEdgePoliciesResponse, - MediaservicesListBySubscriptionResponse, MediaservicesListNextResponse, MediaservicesListBySubscriptionNextResponse } from "../models"; @@ -69,19 +70,29 @@ export class MediaservicesImpl implements Mediaservices { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(resourceGroupName, options, settings); } }; } private async *listPagingPage( resourceGroupName: string, - options?: MediaservicesListOptionalParams + options?: MediaservicesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: MediaservicesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -89,7 +100,9 @@ export class MediaservicesImpl implements Mediaservices { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -117,22 +130,34 @@ export class MediaservicesImpl implements Mediaservices { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listBySubscriptionPagingPage(options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); } }; } private async *listBySubscriptionPagingPage( - options?: MediaservicesListBySubscriptionOptionalParams + options?: MediaservicesListBySubscriptionOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._listBySubscription(options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: MediaservicesListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listBySubscriptionNext(continuationToken, options); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -675,7 +700,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -696,7 +720,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/streamingEndpoints.ts b/sdk/mediaservices/arm-mediaservices/src/operations/streamingEndpoints.ts index ab20f3f408fb..ab677fd3bc45 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/streamingEndpoints.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/streamingEndpoints.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { StreamingEndpoints } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -71,8 +72,16 @@ export class StreamingEndpointsImpl implements StreamingEndpoints { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -80,11 +89,18 @@ export class StreamingEndpointsImpl implements StreamingEndpoints { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: StreamingEndpointsListOptionalParams + options?: StreamingEndpointsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: StreamingEndpointsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -93,7 +109,9 @@ export class StreamingEndpointsImpl implements StreamingEndpoints { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -1092,7 +1110,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/streamingLocators.ts b/sdk/mediaservices/arm-mediaservices/src/operations/streamingLocators.ts index 6e8d47a1f1fe..8e47a78e889a 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/streamingLocators.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/streamingLocators.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { StreamingLocators } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -61,8 +62,16 @@ export class StreamingLocatorsImpl implements StreamingLocators { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -70,11 +79,18 @@ export class StreamingLocatorsImpl implements StreamingLocators { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: StreamingLocatorsListOptionalParams + options?: StreamingLocatorsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: StreamingLocatorsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -83,7 +99,9 @@ export class StreamingLocatorsImpl implements StreamingLocators { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -397,12 +415,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.orderby - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/streamingPolicies.ts b/sdk/mediaservices/arm-mediaservices/src/operations/streamingPolicies.ts index 2ed5c44dcd34..3a5908411437 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/streamingPolicies.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/streamingPolicies.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { StreamingPolicies } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -57,8 +58,16 @@ export class StreamingPoliciesImpl implements StreamingPolicies { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -66,11 +75,18 @@ export class StreamingPoliciesImpl implements StreamingPolicies { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: StreamingPoliciesListOptionalParams + options?: StreamingPoliciesListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: StreamingPoliciesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -79,7 +95,9 @@ export class StreamingPoliciesImpl implements StreamingPolicies { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -309,12 +327,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.filter, - Parameters.top, - Parameters.orderby - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/tracks.ts b/sdk/mediaservices/arm-mediaservices/src/operations/tracks.ts index e891b7f35b1f..a3e3789ca3fe 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/tracks.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/tracks.ts @@ -6,7 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { Tracks } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -69,12 +69,16 @@ export class TracksImpl implements Tracks { [Symbol.asyncIterator]() { return this; }, - byPage: () => { + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } return this.listPagingPage( resourceGroupName, accountName, assetName, - options + options, + settings ); } }; @@ -84,9 +88,11 @@ export class TracksImpl implements Tracks { resourceGroupName: string, accountName: string, assetName: string, - options?: TracksListOptionalParams + options?: TracksListOptionalParams, + _settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list( + let result: TracksListResponse; + result = await this._list( resourceGroupName, accountName, assetName, diff --git a/sdk/mediaservices/arm-mediaservices/src/operations/transforms.ts b/sdk/mediaservices/arm-mediaservices/src/operations/transforms.ts index 91c26b41736f..7366d5efa5d6 100644 --- a/sdk/mediaservices/arm-mediaservices/src/operations/transforms.ts +++ b/sdk/mediaservices/arm-mediaservices/src/operations/transforms.ts @@ -6,7 +6,8 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; import { Transforms } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; @@ -59,8 +60,16 @@ export class TransformsImpl implements Transforms { [Symbol.asyncIterator]() { return this; }, - byPage: () => { - return this.listPagingPage(resourceGroupName, accountName, options); + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + accountName, + options, + settings + ); } }; } @@ -68,11 +77,18 @@ export class TransformsImpl implements Transforms { private async *listPagingPage( resourceGroupName: string, accountName: string, - options?: TransformsListOptionalParams + options?: TransformsListOptionalParams, + settings?: PageSettings ): AsyncIterableIterator { - let result = await this._list(resourceGroupName, accountName, options); - yield result.value || []; - let continuationToken = result.odataNextLink; + let result: TransformsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, accountName, options); + let page = result.value || []; + continuationToken = result.odataNextLink; + setContinuationToken(page, continuationToken); + yield page; + } while (continuationToken) { result = await this._listNext( resourceGroupName, @@ -81,7 +97,9 @@ export class TransformsImpl implements Transforms { options ); continuationToken = result.odataNextLink; - yield result.value || []; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; } } @@ -231,9 +249,9 @@ const listOperationSpec: coreClient.OperationSpec = { } }, queryParameters: [ - Parameters.apiVersion1, Parameters.filter, - Parameters.orderby + Parameters.orderby, + Parameters.apiVersion2 ], urlParameters: [ Parameters.$host, @@ -256,7 +274,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -283,7 +301,7 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.parameters12, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -306,7 +324,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -330,7 +348,7 @@ const updateOperationSpec: coreClient.OperationSpec = { } }, requestBody: Parameters.parameters12, - queryParameters: [Parameters.apiVersion1], + queryParameters: [Parameters.apiVersion2], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -353,11 +371,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - queryParameters: [ - Parameters.apiVersion1, - Parameters.filter, - Parameters.orderby - ], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/mediaservices/arm-mediaservices/src/pagingHelper.ts b/sdk/mediaservices/arm-mediaservices/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/mediaservices/arm-mediaservices/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/mediaservices/arm-mediaservices/test/sampleTest.ts b/sdk/mediaservices/arm-mediaservices/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/mediaservices/arm-mediaservices/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/mediaservices/arm-mediaservices/tsconfig.json b/sdk/mediaservices/arm-mediaservices/tsconfig.json index d8c4700a1028..3e6ae96443f3 100644 --- a/sdk/mediaservices/arm-mediaservices/tsconfig.json +++ b/sdk/mediaservices/arm-mediaservices/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-mediaservices": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"