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

Zihzhan/fix #21905

Merged
merged 22 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dee33cf
Update Snippet and Export-API.
zihzhan-msft Jun 9, 2021
818dc1b
remove calloption override in servercall client.
zihzhan-msft Jun 9, 2021
3b3d50e
Nit for params and arguments handling.
zihzhan-msft Jun 9, 2021
aa107fc
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 9, 2021
8b69016
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-net i…
zihzhan-msft Jun 9, 2021
c6baf82
Merge Downloader updates.
zihzhan-msft Jun 10, 2021
3aa15a0
Merge Downloader updates test cases.
zihzhan-msft Jun 10, 2021
fcdae81
Update AutoGen Content.
zihzhan-msft Jun 10, 2021
65ba2cd
Resolve merge conflict.
zihzhan-msft Jun 10, 2021
f62e7cd
Nit clean on Unit Tests.
zihzhan-msft Jun 10, 2021
3e56bef
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 10, 2021
31daa0f
Updating and renaming.
zihzhan-msft Jun 10, 2021
fe9f344
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 11, 2021
b4c8dbb
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 15, 2021
0777d49
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 15, 2021
794122e
Test update.
zihzhan-msft Jun 15, 2021
f156c31
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 15, 2021
0525b42
Add Call Connection Live Tests.
zihzhan-msft Jun 16, 2021
7c0519f
Add ServerCall Live Tests
zihzhan-msft Jun 16, 2021
9e7a022
Merge branch 'feature/callingServer-preview1-enhancement' of https://…
zihzhan-msft Jun 16, 2021
1200e75
Increase Test Coverage.
zihzhan-msft Jun 16, 2021
1b67012
Reenable sample tests.
zihzhan-msft Jun 16, 2021
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 @@ -65,6 +65,12 @@ protected CallingServerClient() { }
public CallingServerClient(string connectionString, Azure.Communication.CallingServer.CallingServerClientOptions options = null) { }
public virtual Azure.Response<Azure.Communication.CallingServer.CallConnection> CreateCallConnection(Azure.Communication.CommunicationIdentifier source, System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> targets, Azure.Communication.CallingServer.CreateCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.CallingServer.CallConnection>> CreateCallConnectionAsync(Azure.Communication.CommunicationIdentifier source, System.Collections.Generic.IEnumerable<Azure.Communication.CommunicationIdentifier> targets, Azure.Communication.CallingServer.CreateCallOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.IO.Stream> DownloadStreaming(System.Uri sourceEndpoint, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.IO.Stream>> DownloadStreamingAsync(System.Uri sourceEndpoint, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DownloadTo(System.Uri sourceEndpoint, System.IO.Stream destinationStream, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response DownloadTo(System.Uri sourceEndpoint, string destinationPath, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DownloadToAsync(System.Uri sourceEndpoint, System.IO.Stream destinationStream, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response> DownloadToAsync(System.Uri sourceEndpoint, string destinationPath, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Communication.CallingServer.CallConnection GetCallConnection(string callConnectionId) { throw null; }
public virtual Azure.Communication.CallingServer.ServerCall InitializeServerCall(string serverCallId) { throw null; }
public virtual Azure.Response<Azure.Communication.CallingServer.CallConnection> JoinCall(string serverCallId, Azure.Communication.CommunicationIdentifier source, Azure.Communication.CallingServer.JoinCallOptions callOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Expand Down Expand Up @@ -204,15 +210,6 @@ public partial class CreateCallResult
internal CreateCallResult() { }
public string CallConnectionId { get { throw null; } }
}
public static partial class DownloadExtentions
{
public static Azure.Response<System.IO.Stream> DownloadStreaming(this Azure.Communication.CallingServer.CallingServerClient callingServerClient, System.Uri sourceEndpoint, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<Azure.Response<System.IO.Stream>> DownloadStreamingAsync(this Azure.Communication.CallingServer.CallingServerClient callingServerClient, System.Uri sourceEndpoint, Azure.HttpRange range = default(Azure.HttpRange), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static Azure.Response DownloadTo(this Azure.Communication.CallingServer.CallingServerClient callingServerClient, System.Uri sourceEndpoint, System.IO.Stream destinationStream, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static Azure.Response DownloadTo(this Azure.Communication.CallingServer.CallingServerClient callingServerClient, System.Uri sourceEndpoint, string destinationPath, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<Azure.Response> DownloadToAsync(this Azure.Communication.CallingServer.CallingServerClient callingServerClient, System.Uri sourceEndpoint, System.IO.Stream destinationStream, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<Azure.Response> DownloadToAsync(this Azure.Communication.CallingServer.CallingServerClient callingServerClient, System.Uri sourceEndpoint, string destinationPath, Azure.Communication.CallingServer.ContentTransferOptions transferOptions = default(Azure.Communication.CallingServer.ContentTransferOptions), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct EventSubscriptionType : System.IEquatable<Azure.Communication.CallingServer.EventSubscriptionType>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -44,14 +45,6 @@ private CallingServerClient(ConnectionString connectionString, CallingServerClie
: this(connectionString.GetRequired("endpoint"), options.BuildHttpPipeline(connectionString), options)
{ }

private CallingServerClient(string endpoint, TokenCredential tokenCredential, CallingServerClientOptions options)
: this(endpoint, options.BuildHttpPipeline(tokenCredential), options)
{ }

private CallingServerClient(string endpoint, AzureKeyCredential keyCredential, CallingServerClientOptions options)
: this(endpoint, options.BuildHttpPipeline(keyCredential), options)
{ }

private CallingServerClient(string endpoint, HttpPipeline httpPipeline, CallingServerClientOptions options)
{
_pipeline = httpPipeline;
Expand Down Expand Up @@ -275,5 +268,202 @@ public virtual ServerCall InitializeServerCall(string serverCallId)
throw;
}
}

/// <summary>
/// The <see cref="DownloadStreamingAsync(Uri, HttpRange, CancellationToken)"/>
/// operation downloads the recording's content.
///
/// </summary>
/// <param name="sourceEndpoint">
/// Recording's content's url location.
/// </param>
/// <param name="range">
/// If provided, only download the bytes of the content in the specified range.
/// If not provided, download the entire content.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{Stream}"/> containing the
/// downloaded content.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual async Task<Response<Stream>> DownloadStreamingAsync(
Uri sourceEndpoint,
HttpRange range = default,
CancellationToken cancellationToken = default) =>
await _contentDownloader.DownloadStreamingInternal(
sourceEndpoint,
range,
async: true,
cancellationToken)
.ConfigureAwait(false);

/// <summary>
/// The <see cref="DownloadStreaming(Uri, HttpRange, CancellationToken)"/>
/// operation downloads the recording's content.
///
/// </summary>
/// <param name="sourceEndpoint">
/// Recording's content's url location.
/// </param>
/// <param name="range">
/// If provided, only download the bytes of the content in the specified range.
/// If not provided, download the entire content.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response{Stream}"/> containing the
/// downloaded content.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual Response<Stream> DownloadStreaming(
Uri sourceEndpoint,
HttpRange range = default,
CancellationToken cancellationToken = default) =>
_contentDownloader.DownloadStreamingInternal(
sourceEndpoint,
range,
async: false,
cancellationToken)
.EnsureCompleted();

/// <summary>
/// The <see cref="DownloadTo(Uri, Stream, ContentTransferOptions, CancellationToken)"/>
/// operation downloads the specified content using parallel requests,
/// and writes the content to <paramref name="destinationStream"/>.
/// </summary>
/// <param name="sourceEndpoint">
/// A <see cref="Uri"/> with the Recording's content's url location.
/// </param>
/// <param name="destinationStream">
/// A <see cref="Stream"/> to write the downloaded content to.
/// </param>
/// <param name="transferOptions">
/// Optional <see cref="ContentTransferOptions"/> to configure
/// parallel transfer behavior.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response"/> describing the operation.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual Response DownloadTo(Uri sourceEndpoint, Stream destinationStream,
ContentTransferOptions transferOptions = default, CancellationToken cancellationToken = default) =>
_contentDownloader.StagedDownloadAsync(sourceEndpoint, destinationStream, transferOptions, async: false, cancellationToken: cancellationToken).EnsureCompleted();

/// <summary>
/// The <see cref="DownloadToAsync(Uri, Stream, ContentTransferOptions, CancellationToken)"/>
/// operation downloads the specified content using parallel requests,
/// and writes the content to <paramref name="destinationStream"/>.
/// </summary>
/// <param name="sourceEndpoint">
/// A <see cref="Uri"/> with the Recording's content's url location.
/// </param>
/// <param name="destinationStream">
/// A <see cref="Stream"/> to write the downloaded content to.
/// </param>
/// <param name="transferOptions">
/// Optional <see cref="ContentTransferOptions"/> to configure
/// parallel transfer behavior.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response"/> describing the operation.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual async Task<Response> DownloadToAsync(Uri sourceEndpoint, Stream destinationStream, ContentTransferOptions transferOptions = default, CancellationToken cancellationToken = default) =>
await _contentDownloader.StagedDownloadAsync(sourceEndpoint, destinationStream, transferOptions, async: true, cancellationToken: cancellationToken).ConfigureAwait(false);

/// <summary>
/// The <see cref="DownloadTo(Uri, string, ContentTransferOptions, CancellationToken)"/>
/// operation downloads the specified content using parallel requests,
/// and writes the content to <paramref name="destinationPath"/>.
/// </summary>
/// <param name="sourceEndpoint">
/// A <see cref="Uri"/> with the Recording's content's url location.
/// </param>
/// <param name="destinationPath">
/// A file path to write the downloaded content to.
/// </param>
/// <param name="transferOptions">
/// Optional <see cref="ContentTransferOptions"/> to configure
/// parallel transfer behavior.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response"/> describing the operation.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual Response DownloadTo(Uri sourceEndpoint, string destinationPath,
ContentTransferOptions transferOptions = default, CancellationToken cancellationToken = default)
{
using Stream destination = File.Create(destinationPath);
return _contentDownloader.StagedDownloadAsync(sourceEndpoint, destination, transferOptions,
async: false, cancellationToken: cancellationToken).EnsureCompleted();
}

/// <summary>
/// The <see cref="DownloadToAsync(Uri, string, ContentTransferOptions, CancellationToken)"/>
/// operation downloads the specified content using parallel requests,
/// and writes the content to <paramref name="destinationPath"/>.
/// </summary>
/// <param name="sourceEndpoint">
/// A <see cref="Uri"/> with the Recording's content's url location.
/// </param>
/// <param name="destinationPath">
/// A file path to write the downloaded content to.
/// </param>
/// <param name="transferOptions">
/// Optional <see cref="ContentTransferOptions"/> to configure
/// parallel transfer behavior.
/// </param>
/// <param name="cancellationToken">
/// Optional <see cref="CancellationToken"/> to propagate
/// notifications that the operation should be cancelled.
/// </param>
/// <returns>
/// A <see cref="Response"/> describing the operation.
/// </returns>
/// <remarks>
/// A <see cref="RequestFailedException"/> will be thrown if
/// a failure occurs.
/// </remarks>
public virtual async Task<Response> DownloadToAsync(Uri sourceEndpoint, string destinationPath,
ContentTransferOptions transferOptions = default, CancellationToken cancellationToken = default)
{
using Stream destination = File.Create(destinationPath);
return await _contentDownloader.StagedDownloadAsync(sourceEndpoint, destination, transferOptions,
async: true, cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
}
Loading