From 3a6fd3d7aaedbf2d65c83f7458ad44b7b0d1f456 Mon Sep 17 00:00:00 2001 From: Franko Morales <67804607+cochi2@users.noreply.github.com> Date: Tue, 19 Oct 2021 10:02:45 -0700 Subject: [PATCH] Applying some of the comments from internal Azure Review (#18256) * Moving StartRecording optional elements to Options * Moving optional parameters for Download to options * Formatting * Rebuilding --- .../review/communication-callingserver.api.md | 34 +++++++++++++++---- .../src/callingServerClient.ts | 17 ++-------- .../communication-callingserver/src/models.ts | 21 ++++++++++-- 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/sdk/communication/communication-callingserver/review/communication-callingserver.api.md b/sdk/communication/communication-callingserver/review/communication-callingserver.api.md index 9acecf5c3855..d6c1f190931f 100644 --- a/sdk/communication/communication-callingserver/review/communication-callingserver.api.md +++ b/sdk/communication/communication-callingserver/review/communication-callingserver.api.md @@ -85,7 +85,7 @@ export class CallingServerClient { cancelMediaOperation(callLocator: CallLocator, mediaOperationId: string, options?: CancelMediaOperationOptions): Promise; cancelParticipantMediaOperation(callLocator: CallLocator, participant: CommunicationIdentifier, mediaOperationId: string, options?: CancelMediaOperationOptions): Promise; createCallConnection(source: CommunicationIdentifier, targets: CommunicationIdentifier[], options: CreateCallConnectionOptions): Promise; - download(uri: string, offset?: number, count?: number, options?: DownloadOptions): Promise; + download(uri: string, offset?: number, options?: DownloadOptions): Promise; getCallConnection(callConnectionId: string): CallConnection; // Warning: (ae-forgotten-export) The symbol "CallRecordingProperties" needs to be exported by the entry point index.d.ts getRecordingProperties(recordingId: string, options?: GetRecordingPropertiesOptions): Promise; @@ -99,11 +99,8 @@ export class CallingServerClient { playAudioToParticipant(callLocator: CallLocator, participant: CommunicationIdentifier, audioFileUri: string, options: PlayAudioToParticipantOptions): Promise; removeParticipant(callLocator: CallLocator, participant: CommunicationIdentifier, options?: RemoveParticipantOptions): Promise; resumeRecording(recordingId: string, options?: ResumeRecordingOptions): Promise; - // Warning: (ae-forgotten-export) The symbol "RecordingContentType" needs to be exported by the entry point index.d.ts - // Warning: (ae-forgotten-export) The symbol "KnownRecordingChannelType" needs to be exported by the entry point index.d.ts - // Warning: (ae-forgotten-export) The symbol "RecordingFormatType" needs to be exported by the entry point index.d.ts // Warning: (ae-forgotten-export) The symbol "StartCallRecordingResult" needs to be exported by the entry point index.d.ts - startRecording(callLocator: CallLocator, recordingStateCallbackUri: string, recordingContentType?: RecordingContentType, recordingChannelType?: KnownRecordingChannelType, recordingFormatType?: RecordingFormatType, options?: StartRecordingOptions): Promise; + startRecording(callLocator: CallLocator, recordingStateCallbackUri: string, options?: StartRecordingOptions): Promise; stopRecording(recordingId: string, options?: StopRecordingOptions): Promise; } @@ -175,6 +172,8 @@ export interface DownloadContentOptions extends DownloadOptions { // @public (undocumented) export interface DownloadOptions extends OperationOptions { abortSignal?: AbortSignalLike; + // (undocumented) + count?: number; maxRetryRequests?: number; onProgress?: (progress: TransferProgressEvent) => void; } @@ -246,6 +245,14 @@ export class KnownCallingServerEventType { static TONE_RECEIVED_EVENT: string | null; } +// @public +export const enum KnownRecordingChannelType { + // (undocumented) + Mixed = "mixed", + // (undocumented) + Unmixed = "unmixed" +} + // @public export const enum KnownToneValue { // (undocumented) @@ -321,6 +328,12 @@ export type PlayAudioToParticipantOptions = PlayAudioOptions; // @public (undocumented) export const range: OperationParameter; +// @public +export type RecordingChannelType = string; + +// @public +export type RecordingContentType = string; + // @public export type RemoveParticipantOptions = OperationOptions; @@ -338,7 +351,16 @@ export interface ServerCallLocatorKind extends ServerCallLocator { } // @public -export type StartRecordingOptions = OperationOptions; +export interface StartRecordingOptions extends OperationOptions { + // (undocumented) + recordingChannelType?: KnownRecordingChannelType; + // (undocumented) + recordingContentType?: RecordingContentType; + // Warning: (ae-forgotten-export) The symbol "RecordingFormatType" needs to be exported by the entry point index.d.ts + // + // (undocumented) + recordingFormatType?: RecordingFormatType; +} // @public export type StopRecordingOptions = OperationOptions; diff --git a/sdk/communication/communication-callingserver/src/callingServerClient.ts b/sdk/communication/communication-callingserver/src/callingServerClient.ts index 9deceea57307..fd1dc24e4466 100644 --- a/sdk/communication/communication-callingserver/src/callingServerClient.ts +++ b/sdk/communication/communication-callingserver/src/callingServerClient.ts @@ -33,10 +33,7 @@ import { CancelParticipantMediaOperationWithCallLocatorRequest, StartCallRecordingResult, StartCallRecordingWithCallLocatorRequest, - CallRecordingProperties, - RecordingContentType, - KnownRecordingChannelType, - RecordingFormatType + CallRecordingProperties } from "./generated/src/models"; import { TokenCredential } from "@azure/core-auth"; @@ -525,17 +522,11 @@ export class CallingServerClient { * * @param callLocator - The callLocator contains server call id. * @param recordingStateCallbackUri - The call back uri for recording state. - * @param recordingContentType - Content type of call recording. - * @param recordingChannelType - Channel type of call recording. - * @param recordingFormatType - Format type of call recording. * @param options - Additional request options contains StartRecording api options. */ public async startRecording( callLocator: CallLocator, recordingStateCallbackUri: string, - recordingContentType?: RecordingContentType, - recordingChannelType?: KnownRecordingChannelType, - recordingFormatType?: RecordingFormatType, options: StartRecordingOptions = {} ): Promise { const { span, updatedOptions } = createSpan("ServerCallRestClient-StartRecording", options); @@ -555,9 +546,7 @@ export class CallingServerClient { const startCallRecordingWithCallLocatorRequest: StartCallRecordingWithCallLocatorRequest = { callLocator: serializeCallLocator(callLocator), recordingStateCallbackUri: recordingStateCallbackUri, - recordingContentType: recordingContentType, - recordingChannelType: recordingChannelType, - recordingFormatType: recordingFormatType + ...updatedOptions }; try { @@ -768,13 +757,13 @@ export class CallingServerClient { public async download( uri: string, offset: number = 0, - count?: number, options: DownloadOptions = {} ): Promise { const { span, updatedOptions } = createSpan("ServerCallRestClient-download", options); const DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = 3; const contentDownloader = this.initializeContentDownloader(); try { + const count = updatedOptions.count; const res = await contentDownloader.downloadContent(uri, { abortSignal: options.abortSignal, requestOptions: { diff --git a/sdk/communication/communication-callingserver/src/models.ts b/sdk/communication/communication-callingserver/src/models.ts index e08338ebb4e0..2d7df30f097a 100644 --- a/sdk/communication/communication-callingserver/src/models.ts +++ b/sdk/communication/communication-callingserver/src/models.ts @@ -4,7 +4,13 @@ import { AbortSignalLike } from "@azure/abort-controller"; import { OperationOptions, TransferProgressEvent } from "@azure/core-http"; import { PhoneNumberIdentifier } from "@azure/communication-common"; -import { CallMediaType, CallingEventSubscriptionType } from "./generated/src/models"; +import { + CallMediaType, + CallingEventSubscriptionType, + RecordingContentType, + KnownRecordingChannelType, + RecordingFormatType +} from "./generated/src/"; export { CallMediaType, @@ -19,10 +25,13 @@ export { CallConnectionsAddParticipantResponse, CallConnectionsPlayAudioResponse, PhoneNumberIdentifierModel, + RecordingChannelType, + RecordingContentType, CommunicationIdentifierModel, CommunicationUserIdentifierModel, KnownToneValue, - KnownCallConnectionState + KnownCallConnectionState, + KnownRecordingChannelType } from "./generated/src/models"; /** @@ -101,7 +110,11 @@ export type TransferCallOptions = OperationOptions; /** * Options to start recording. */ -export type StartRecordingOptions = OperationOptions; +export interface StartRecordingOptions extends OperationOptions { + recordingContentType?: RecordingContentType; + recordingChannelType?: KnownRecordingChannelType; + recordingFormatType?: RecordingFormatType; +} /** * Options to pause recording. */ @@ -247,6 +260,8 @@ export interface DownloadOptions extends OperationOptions { * Default value is 5, please set a larger value when loading large files in poor network. */ maxRetryRequests?: number; + + count?: number; } export interface DownloadContentOptions extends DownloadOptions {