Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fixing naming for Download returning methods. #18703

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"browser": {
"stream": "./node_modules/stream-browserify/index.js",
"./dist-esm/src/credentials/cryptoUtils.js": "./dist-esm/src/credentials/cryptoUtils.browser.js",
"./dist-esm/src/RepeatableContentDownloadResponse.js": "./dist-esm/src/RepeatableContentDownloadResponse.browser.js",
"./dist-esm/src/RepeatableContentDownloadResult.js": "./dist-esm/src/RepeatableContentDownloadResult.browser.js",
"./dist-esm/src/utils/utils.node.js": "./dist-esm/src/utils/utils.browser.js",
"./dist-esm/test/public/utils/index.js": "./dist-esm/test/public/utils/index.browser.js"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import { AbortSignalLike } from '@azure/abort-controller';
import { CommunicationIdentifier } from '@azure/communication-common';
import * as coreHttp from '@azure/core-http';
import { HttpResponse } from '@azure/core-http';
import { OperationOptions } from '@azure/core-http';
import { OperationParameter } from '@azure/core-http';
import { PhoneNumberIdentifier } from '@azure/communication-common';
Expand Down Expand Up @@ -54,22 +52,6 @@ export interface CallConnection {
transfer(targetParticipant: CommunicationIdentifier, userToUserInformation: string, options?: TransferCallOptions): Promise<void>;
}

// @public
export type CallConnectionsAddParticipantResponse = AddParticipantResult & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: AddParticipantResult;
};
};

// @public
export type CallConnectionsPlayAudioResponse = PlayAudioResult & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: PlayAudioResult;
};
};

// @public
export type CallConnectionState = string;

Expand Down Expand Up @@ -104,8 +86,8 @@ export class CallingServerClient {
cancelParticipantMediaOperation(callLocator: CallLocator, participant: CommunicationIdentifier, mediaOperationId: string, options?: CancelMediaOperationOptions): Promise<void>;
createCallConnection(source: CommunicationIdentifier, targets: CommunicationIdentifier[], options: CreateCallConnectionOptions): Promise<CallConnection>;
delete(deleteUrl: string, options?: DeleteOptions): Promise<RestResponse>;
download(url: string, offset?: number, options?: DownloadOptions): Promise<ContentDownloadResponse>;
downloadToFile(filePath: string, contentUrl: string, offset?: number, options?: DownloadOptions): Promise<ContentDownloadResponse>;
download(url: string, offset?: number, options?: DownloadOptions): Promise<ContentDownloadResult>;
downloadToFile(filePath: string, contentUrl: string, offset?: number, options?: DownloadOptions): Promise<ContentDownloadResult>;
getCallConnection(callConnectionId: string): CallConnection;
getRecordingProperties(recordingId: string, options?: GetRecordingPropertiesOptions): Promise<CallRecordingProperties>;
initializeContentDownloader(): ContentDownloader;
Expand Down Expand Up @@ -173,7 +155,7 @@ export type CancelMediaOperationOptions = OperationOptions;

// @public
export interface ContentDownloader {
downloadContent(contentUrl: string, options: DownloadContentOptions): Promise<ContentDownloadResponse>;
downloadContent(contentUrl: string, options: DownloadContentOptions): Promise<ContentDownloadResult>;
}

// @public
Expand All @@ -186,12 +168,9 @@ export interface ContentDownloadHeaders {
}

// @public
export type ContentDownloadResponse = ContentDownloadHeaders & {
export type ContentDownloadResult = ContentDownloadHeaders & {
blobBody?: Promise<Blob>;
readableStreamBody?: NodeJS.ReadableStream;
_response: HttpResponse & {
parsedHeaders: ContentDownloadHeaders;
};
};

// @public
Expand Down Expand Up @@ -322,14 +301,6 @@ export interface ServerCallLocatorKind extends ServerCallLocator {
kind: "serverCall";
}

// @public
export type ServerCallsAddParticipantResponse = AddParticipantResult & {
_response: coreHttp.HttpResponse & {
bodyAsText: string;
parsedBody: AddParticipantResult;
};
};

// @public
export interface StartCallRecordingResult {
recordingId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
Serializer,
OperationSpec
} from "@azure/core-http";
import { ContentDownloadResponse } from ".";
import { ContentDownloadResult } from ".";
import { CallingServerUtils } from "./utils/utils.common";

/**
Expand All @@ -32,7 +32,7 @@ export interface ContentDownloader {
downloadContent(
contentUrl: string,
options: DownloadContentOptions
): Promise<ContentDownloadResponse>;
): Promise<ContentDownloadResult>;
}

/**
Expand All @@ -53,7 +53,7 @@ export class ContentDownloaderImpl implements ContentDownloader {
public async downloadContent(
contentUrl: string,
options: DownloadContentOptions = {}
): Promise<ContentDownloadResponse> {
): Promise<ContentDownloadResult> {
const { span, updatedOptions } = createSpan(
"ContentDownloaderRestClient-downloadContent",
options
Expand All @@ -80,18 +80,15 @@ export class ContentDownloaderImpl implements ContentDownloader {
* @param contentUrl - The content Url.
* @param options - The options parameters.
*/
download_content(
contentUrl: string,
options?: OperationOptions
): Promise<ContentDownloadResponse> {
download_content(contentUrl: string, options?: OperationOptions): Promise<ContentDownloadResult> {
const operationArguments: OperationArguments = {
options: operationOptionsToRequestOptionsBase(options || {})
};
const stringToSign = CallingServerUtils.getStringToSign(this.client.endpoint, contentUrl);
return this.client.sendOperationRequest(
operationArguments,
getDownloadContentOperationSpec(contentUrl, stringToSign)
) as Promise<ContentDownloadResponse>;
) as Promise<ContentDownloadResult>;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
// This file is used as a shim of "RepeatableContentDownloadResponse" for some browser bundlers
// when trying to bundle "RepeatableContentDownloadResponse"
// "RepeatableContentDownloadResponse" class is only available in Node.js runtime
export const RepeatableContentDownloadResponse = 1;
export const RepeatableContentDownloadResult = 1;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { HttpResponse, isNode } from "@azure/core-http";
import { ContentDownloadHeaders, ContentDownloadResponse } from ".";
import { isNode } from "@azure/core-http";
import { ContentDownloadResult } from ".";
import {
ReadableStreamGetter,
RetriableReadableStream,
Expand All @@ -18,7 +18,7 @@ import {
* The {@link readableStreamBody} stream will retry underlayer, you can just use it as a normal Node.js
* Readable stream.
*/
export class RepeatableContentDownloadResponse implements ContentDownloadResponse {
export class RepeatableContentDownloadResult implements ContentDownloadResult {
/**
* The number of bytes present in the
* response body.
Expand Down Expand Up @@ -91,16 +91,7 @@ export class RepeatableContentDownloadResponse implements ContentDownloadRespons
return isNode ? this.blobDownloadStream : undefined;
}

/**
* The HTTP response.
*/
public get _response(): HttpResponse & {
parsedHeaders: ContentDownloadHeaders;
} {
return this.originalResponse._response;
}

private originalResponse: ContentDownloadResponse;
private originalResponse: ContentDownloadResult;
private blobDownloadStream?: RetriableReadableStream;

/**
Expand All @@ -113,7 +104,7 @@ export class RepeatableContentDownloadResponse implements ContentDownloadRespons
* @param options -
*/
public constructor(
originalResponse: ContentDownloadResponse,
originalResponse: ContentDownloadResult,
getter: ReadableStreamGetter,
offset: number,
count: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.
/// <reference lib="esnext.asynciterable" />

import { CallConnection, ContentDownloadResponse } from ".";
import { CallConnection, ContentDownloadResult } from ".";
import { CallConnectionImpl } from "./callConnection";
import {
CreateCallConnectionOptions,
Expand Down Expand Up @@ -73,7 +73,7 @@ import { convertTracingToRequestOptionsBase, createSpan } from "./tracing";
import { logger } from "./logger";
import { ContentDownloader, ContentDownloaderImpl } from "./ContentDownloader";
import { rangeToString } from "./Range";
import { RepeatableContentDownloadResponse } from "./RepeatableContentDownloadResponse";
import { RepeatableContentDownloadResult } from "./RepeatableContentDownloadResult";
import { extractOperationOptions } from "./extractOperationOptions";
import { CallingServerUtils } from "./utils/utils.common";
import { serializeCallLocator } from "./callLocatorModelSerializer";
Expand Down Expand Up @@ -846,7 +846,7 @@ export class CallingServerClient {
url: string,
offset: number = 0,
options: DownloadOptions = {}
): Promise<ContentDownloadResponse> {
): Promise<ContentDownloadResult> {
const { span, updatedOptions } = createSpan("ServerCallRestClient-download", options);
const DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = 3;
const contentDownloader = this.initializeContentDownloader();
Expand Down Expand Up @@ -874,7 +874,7 @@ export class CallingServerClient {
if (res.contentLength === undefined) {
throw new RangeError(`File download response doesn't contain valid content length header`);
}
return new RepeatableContentDownloadResponse(
return new RepeatableContentDownloadResult(
res,
async (start: number): Promise<NodeJS.ReadableStream> => {
// Debug purpose only
Expand Down Expand Up @@ -935,7 +935,7 @@ export class CallingServerClient {
contentUrl: string,
offset: number = 0,
options: DownloadOptions = {}
): Promise<ContentDownloadResponse> {
): Promise<ContentDownloadResult> {
const { span, updatedOptions } = createSpan("ServerCallRestClient-DownloadToFile", options);
try {
const response = await this.download(contentUrl, offset, {
Expand Down
9 changes: 1 addition & 8 deletions sdk/communication/communication-calling-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { HttpResponse } from "@azure/core-http";

export * from "./models";
export * from "./parameters";
Expand All @@ -24,7 +23,7 @@ export interface ContentDownloadHeaders {
}

/** Contains response data for the download operation. */
export type ContentDownloadResponse = ContentDownloadHeaders & {
export type ContentDownloadResult = ContentDownloadHeaders & {
/**
* BROWSER ONLY
*
Expand All @@ -39,10 +38,4 @@ export type ContentDownloadResponse = ContentDownloadHeaders & {
* Always `undefined` in the browser.
*/
readableStreamBody?: NodeJS.ReadableStream;

/** The underlying HTTP response. */
_response: HttpResponse & {
/** The parsed HTTP response headers. */
parsedHeaders: ContentDownloadHeaders;
};
};