7
7
using System . Threading ;
8
8
using System . Threading . Tasks ;
9
9
using Azure . Core ;
10
+ using Azure . Core . Pipeline ;
10
11
11
12
namespace Azure . AI . VoiceLive
12
13
{
14
+ #pragma warning disable AZC0107
13
15
public partial class VoiceLiveSession
14
16
{
15
17
#region Audio Data Transmission
@@ -50,7 +52,7 @@ public virtual async Task SendInputAudioAsync(byte[] audio, CancellationToken ca
50
52
/// <exception cref="InvalidOperationException">Thrown when another audio stream is already being sent.</exception>
51
53
public virtual void SendInputAudio ( byte [ ] audio , CancellationToken cancellationToken = default )
52
54
{
53
- SendInputAudioAsync ( audio , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
55
+ SendInputAudioAsync ( audio , cancellationToken ) . EnsureCompleted ( ) ;
54
56
}
55
57
56
58
/// <summary>
@@ -89,7 +91,7 @@ public virtual async Task SendInputAudioAsync(BinaryData audio, CancellationToke
89
91
/// <exception cref="InvalidOperationException">Thrown when another audio stream is already being sent.</exception>
90
92
public virtual void SendInputAudio ( BinaryData audio , CancellationToken cancellationToken = default )
91
93
{
92
- SendInputAudioAsync ( audio , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
94
+ SendInputAudioAsync ( audio , cancellationToken ) . EnsureCompleted ( ) ;
93
95
}
94
96
95
97
/// <summary>
@@ -111,7 +113,7 @@ public virtual async Task ClearInputAudioAsync(CancellationToken cancellationTok
111
113
/// <param name="cancellationToken">An optional cancellation token.</param>
112
114
public virtual void ClearInputAudio ( CancellationToken cancellationToken = default )
113
115
{
114
- ClearInputAudioAsync ( cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
116
+ ClearInputAudioAsync ( cancellationToken ) . EnsureCompleted ( ) ;
115
117
}
116
118
117
119
/// <summary>
@@ -133,7 +135,7 @@ public virtual async Task CommitInputAudioAsync(CancellationToken cancellationTo
133
135
/// <param name="cancellationToken">An optional cancellation token.</param>
134
136
public virtual void CommitInputAudio ( CancellationToken cancellationToken = default )
135
137
{
136
- CommitInputAudioAsync ( cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
138
+ CommitInputAudioAsync ( cancellationToken ) . EnsureCompleted ( ) ;
137
139
}
138
140
139
141
#endregion
@@ -166,7 +168,7 @@ public virtual async Task ConfigureSessionAsync(VoiceLiveSessionOptions sessionO
166
168
/// <exception cref="ArgumentNullException">Thrown when <paramref name="sessionOptions"/> is null.</exception>
167
169
public virtual void ConfigureSession ( VoiceLiveSessionOptions sessionOptions , CancellationToken cancellationToken = default )
168
170
{
169
- ConfigureSessionAsync ( sessionOptions , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
171
+ ConfigureSessionAsync ( sessionOptions , cancellationToken ) . EnsureCompleted ( ) ;
170
172
}
171
173
172
174
/// <summary>
@@ -189,7 +191,7 @@ public virtual async Task ConfigureConversationSessionAsync(ConversationSessionO
189
191
/// <exception cref="ArgumentNullException">Thrown when <paramref name="sessionOptions"/> is null.</exception>
190
192
public virtual void ConfigureConversationSession ( ConversationSessionOptions sessionOptions , CancellationToken cancellationToken = default )
191
193
{
192
- ConfigureConversationSessionAsync ( sessionOptions , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
194
+ ConfigureConversationSessionAsync ( sessionOptions , cancellationToken ) . EnsureCompleted ( ) ;
193
195
}
194
196
195
197
/// <summary>
@@ -212,7 +214,7 @@ public virtual async Task ConfigureTranscriptionSessionAsync(TranscriptionSessio
212
214
/// <exception cref="ArgumentNullException">Thrown when <paramref name="sessionOptions"/> is null.</exception>
213
215
public virtual void ConfigureTranscriptionSession ( TranscriptionSessionOptions sessionOptions , CancellationToken cancellationToken = default )
214
216
{
215
- ConfigureTranscriptionSessionAsync ( sessionOptions , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
217
+ ConfigureTranscriptionSessionAsync ( sessionOptions , cancellationToken ) . EnsureCompleted ( ) ;
216
218
}
217
219
218
220
#endregion
@@ -278,7 +280,7 @@ public virtual async Task AddItemAsync(VoiceLiveConversationItem item, string pr
278
280
/// <exception cref="ArgumentNullException">Thrown when <paramref name="item"/> is null.</exception>
279
281
public virtual void AddItem ( VoiceLiveConversationItem item , string previousItemId , CancellationToken cancellationToken = default )
280
282
{
281
- AddItemAsync ( item , previousItemId , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
283
+ AddItemAsync ( item , previousItemId , cancellationToken ) . EnsureCompleted ( ) ;
282
284
}
283
285
284
286
/// <summary>
@@ -308,7 +310,7 @@ public virtual async Task RequestItemRetrievalAsync(string itemId, CancellationT
308
310
/// <exception cref="ArgumentException">Thrown when <paramref name="itemId"/> is empty.</exception>
309
311
public virtual void RequestItemRetrieval ( string itemId , CancellationToken cancellationToken = default )
310
312
{
311
- RequestItemRetrievalAsync ( itemId , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
313
+ RequestItemRetrievalAsync ( itemId , cancellationToken ) . EnsureCompleted ( ) ;
312
314
}
313
315
314
316
/// <summary>
@@ -338,7 +340,7 @@ public virtual async Task DeleteItemAsync(string itemId, CancellationToken cance
338
340
/// <exception cref="ArgumentException">Thrown when <paramref name="itemId"/> is empty.</exception>
339
341
public virtual void DeleteItem ( string itemId , CancellationToken cancellationToken = default )
340
342
{
341
- DeleteItemAsync ( itemId , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
343
+ DeleteItemAsync ( itemId , cancellationToken ) . EnsureCompleted ( ) ;
342
344
}
343
345
344
346
/// <summary>
@@ -377,9 +379,8 @@ public virtual async Task TruncateConversationAsync(string itemId, int contentIn
377
379
/// <exception cref="ArgumentException">Thrown when <paramref name="itemId"/> is empty.</exception>
378
380
public virtual void TruncateConversation ( string itemId , int contentIndex , CancellationToken cancellationToken = default )
379
381
{
380
- TruncateConversationAsync ( itemId , contentIndex , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
382
+ TruncateConversationAsync ( itemId , contentIndex , cancellationToken ) . EnsureCompleted ( ) ;
381
383
}
382
-
383
384
#endregion
384
385
385
386
#region Response Management
@@ -435,7 +436,7 @@ public virtual async Task StartResponseAsync(VoiceLiveResponseOptions responseOp
435
436
/// <param name="cancellationToken">An optional cancellation token.</param>
436
437
public virtual void StartResponse ( VoiceLiveResponseOptions responseOptions , CancellationToken cancellationToken = default )
437
438
{
438
- StartResponseAsync ( responseOptions , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
439
+ StartResponseAsync ( responseOptions , cancellationToken ) . EnsureCompleted ( ) ;
439
440
}
440
441
441
442
/// <summary>
@@ -468,7 +469,7 @@ public virtual async Task StartResponseAsync(string additionalInstructions, Canc
468
469
/// <exception cref="ArgumentNullException">Thrown when <paramref name="additionalInstructions"/> is null.</exception>
469
470
public virtual void StartResponse ( string additionalInstructions , CancellationToken cancellationToken = default )
470
471
{
471
- StartResponseAsync ( additionalInstructions , cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
472
+ StartResponseAsync ( additionalInstructions , cancellationToken ) . EnsureCompleted ( ) ;
472
473
}
473
474
474
475
/// <summary>
@@ -491,9 +492,10 @@ public virtual async Task CancelResponseAsync(CancellationToken cancellationToke
491
492
/// <param name="cancellationToken">An optional cancellation token.</param>
492
493
public virtual void CancelResponse ( CancellationToken cancellationToken = default )
493
494
{
494
- CancelResponseAsync ( cancellationToken ) . GetAwaiter ( ) . GetResult ( ) ;
495
+ CancelResponseAsync ( cancellationToken ) . EnsureCompleted ( ) ;
495
496
}
496
497
497
498
#endregion
498
499
}
499
- }
500
+ #pragma warning restore AZC0107
501
+ }
0 commit comments