Skip to content

Commit

Permalink
Applying some of the comments from internal Azure Review (#18256)
Browse files Browse the repository at this point in the history
* Moving StartRecording optional elements to Options

* Moving optional parameters for Download to options

* Formatting

* Rebuilding
  • Loading branch information
cochi2 authored Oct 19, 2021
1 parent 5744997 commit 3a6fd3d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class CallingServerClient {
cancelMediaOperation(callLocator: CallLocator, mediaOperationId: string, options?: CancelMediaOperationOptions): Promise<void>;
cancelParticipantMediaOperation(callLocator: CallLocator, participant: CommunicationIdentifier, mediaOperationId: string, options?: CancelMediaOperationOptions): Promise<void>;
createCallConnection(source: CommunicationIdentifier, targets: CommunicationIdentifier[], options: CreateCallConnectionOptions): Promise<CallConnection>;
download(uri: string, offset?: number, count?: number, options?: DownloadOptions): Promise<ContentDownloadResponse>;
download(uri: string, offset?: number, options?: DownloadOptions): Promise<ContentDownloadResponse>;
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<CallRecordingProperties>;
Expand All @@ -99,11 +99,8 @@ export class CallingServerClient {
playAudioToParticipant(callLocator: CallLocator, participant: CommunicationIdentifier, audioFileUri: string, options: PlayAudioToParticipantOptions): Promise<PlayAudioResult>;
removeParticipant(callLocator: CallLocator, participant: CommunicationIdentifier, options?: RemoveParticipantOptions): Promise<void>;
resumeRecording(recordingId: string, options?: ResumeRecordingOptions): Promise<RestResponse>;
// 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<StartCallRecordingResult>;
startRecording(callLocator: CallLocator, recordingStateCallbackUri: string, options?: StartRecordingOptions): Promise<StartCallRecordingResult>;
stopRecording(recordingId: string, options?: StopRecordingOptions): Promise<RestResponse>;
}

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

Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import {
CancelParticipantMediaOperationWithCallLocatorRequest,
StartCallRecordingResult,
StartCallRecordingWithCallLocatorRequest,
CallRecordingProperties,
RecordingContentType,
KnownRecordingChannelType,
RecordingFormatType
CallRecordingProperties
} from "./generated/src/models";
import { TokenCredential } from "@azure/core-auth";

Expand Down Expand Up @@ -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<StartCallRecordingResult> {
const { span, updatedOptions } = createSpan("ServerCallRestClient-StartRecording", options);
Expand All @@ -555,9 +546,7 @@ export class CallingServerClient {
const startCallRecordingWithCallLocatorRequest: StartCallRecordingWithCallLocatorRequest = {
callLocator: serializeCallLocator(callLocator),
recordingStateCallbackUri: recordingStateCallbackUri,
recordingContentType: recordingContentType,
recordingChannelType: recordingChannelType,
recordingFormatType: recordingFormatType
...updatedOptions
};

try {
Expand Down Expand Up @@ -768,13 +757,13 @@ export class CallingServerClient {
public async download(
uri: string,
offset: number = 0,
count?: number,
options: DownloadOptions = {}
): Promise<ContentDownloadResponse> {
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: {
Expand Down
21 changes: 18 additions & 3 deletions sdk/communication/communication-callingserver/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -19,10 +25,13 @@ export {
CallConnectionsAddParticipantResponse,
CallConnectionsPlayAudioResponse,
PhoneNumberIdentifierModel,
RecordingChannelType,
RecordingContentType,
CommunicationIdentifierModel,
CommunicationUserIdentifierModel,
KnownToneValue,
KnownCallConnectionState
KnownCallConnectionState,
KnownRecordingChannelType
} from "./generated/src/models";

/**
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 3a6fd3d

Please sign in to comment.