@@ -35,12 +35,12 @@ public virtual AsyncCollectionResult GetContainersAsync(int? limit, string order
3535
3636 public virtual CollectionResult < ContainerResource > GetContainers ( ContainerCollectionOptions options = default , CancellationToken cancellationToken = default )
3737 {
38- return new ContainerClientGetContainersCollectionResultOfT ( this , options ? . PageSizeLimit , options ? . Order ? . ToString ( ) , options ? . AfterId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
38+ return new ContainerClientGetContainersCollectionResultOfT ( this , options ? . PageSizeLimit , options ? . Order ? . ToString ( ) , options ? . AfterId , cancellationToken . ToRequestOptions ( ) ) ;
3939 }
4040
4141 public virtual AsyncCollectionResult < ContainerResource > GetContainersAsync ( ContainerCollectionOptions options = default , CancellationToken cancellationToken = default )
4242 {
43- return new ContainerClientGetContainersAsyncCollectionResultOfT ( this , options ? . PageSizeLimit , options ? . Order ? . ToString ( ) , options ? . AfterId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
43+ return new ContainerClientGetContainersAsyncCollectionResultOfT ( this , options ? . PageSizeLimit , options ? . Order ? . ToString ( ) , options ? . AfterId , cancellationToken . ToRequestOptions ( ) ) ;
4444 }
4545
4646 public virtual ClientResult CreateContainer ( BinaryContent content , RequestOptions options = null )
@@ -63,15 +63,15 @@ public virtual ClientResult<ContainerResource> CreateContainer(CreateContainerBo
6363 {
6464 Argument . AssertNotNull ( body , nameof ( body ) ) ;
6565
66- ClientResult result = CreateContainer ( body , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
66+ ClientResult result = CreateContainer ( body , cancellationToken . ToRequestOptions ( ) ) ;
6767 return ClientResult . FromValue ( ( ContainerResource ) result , result . GetRawResponse ( ) ) ;
6868 }
6969
7070 public virtual async Task < ClientResult < ContainerResource > > CreateContainerAsync ( CreateContainerBody body , CancellationToken cancellationToken = default )
7171 {
7272 Argument . AssertNotNull ( body , nameof ( body ) ) ;
7373
74- ClientResult result = await CreateContainerAsync ( body , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) . ConfigureAwait ( false ) ;
74+ ClientResult result = await CreateContainerAsync ( body , cancellationToken . ToRequestOptions ( ) ) . ConfigureAwait ( false ) ;
7575 return ClientResult . FromValue ( ( ContainerResource ) result , result . GetRawResponse ( ) ) ;
7676 }
7777
@@ -95,15 +95,15 @@ public virtual ClientResult<ContainerResource> GetContainer(string containerId,
9595 {
9696 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
9797
98- ClientResult result = GetContainer ( containerId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
98+ ClientResult result = GetContainer ( containerId , cancellationToken . ToRequestOptions ( ) ) ;
9999 return ClientResult . FromValue ( ( ContainerResource ) result , result . GetRawResponse ( ) ) ;
100100 }
101101
102102 public virtual async Task < ClientResult < ContainerResource > > GetContainerAsync ( string containerId , CancellationToken cancellationToken = default )
103103 {
104104 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
105105
106- ClientResult result = await GetContainerAsync ( containerId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) . ConfigureAwait ( false ) ;
106+ ClientResult result = await GetContainerAsync ( containerId , cancellationToken . ToRequestOptions ( ) ) . ConfigureAwait ( false ) ;
107107 return ClientResult . FromValue ( ( ContainerResource ) result , result . GetRawResponse ( ) ) ;
108108 }
109109
@@ -127,15 +127,15 @@ public virtual ClientResult<DeleteContainerResponse> DeleteContainer(string cont
127127 {
128128 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
129129
130- ClientResult result = DeleteContainer ( containerId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
130+ ClientResult result = DeleteContainer ( containerId , cancellationToken . ToRequestOptions ( ) ) ;
131131 return ClientResult . FromValue ( ( DeleteContainerResponse ) result , result . GetRawResponse ( ) ) ;
132132 }
133133
134134 public virtual async Task < ClientResult < DeleteContainerResponse > > DeleteContainerAsync ( string containerId , CancellationToken cancellationToken = default )
135135 {
136136 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
137137
138- ClientResult result = await DeleteContainerAsync ( containerId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) . ConfigureAwait ( false ) ;
138+ ClientResult result = await DeleteContainerAsync ( containerId , cancellationToken . ToRequestOptions ( ) ) . ConfigureAwait ( false ) ;
139139 return ClientResult . FromValue ( ( DeleteContainerResponse ) result , result . GetRawResponse ( ) ) ;
140140 }
141141
@@ -193,7 +193,7 @@ public virtual CollectionResult<ContainerFileResource> GetContainerFiles(string
193193 options ? . PageSizeLimit ,
194194 options ? . Order ? . ToString ( ) ,
195195 options ? . AfterId ,
196- cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
196+ cancellationToken . ToRequestOptions ( ) ) ;
197197 }
198198
199199 public virtual AsyncCollectionResult < ContainerFileResource > GetContainerFilesAsync ( string containerId , ContainerFileCollectionOptions options = default , CancellationToken cancellationToken = default )
@@ -206,7 +206,7 @@ public virtual AsyncCollectionResult<ContainerFileResource> GetContainerFilesAsy
206206 options ? . PageSizeLimit ,
207207 options ? . Order ? . ToString ( ) ,
208208 options ? . AfterId ,
209- cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
209+ cancellationToken . ToRequestOptions ( ) ) ;
210210 }
211211
212212 public virtual ClientResult GetContainerFile ( string containerId , string fileId , RequestOptions options )
@@ -232,7 +232,7 @@ public virtual ClientResult<ContainerFileResource> GetContainerFile(string conta
232232 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
233233 Argument . AssertNotNullOrEmpty ( fileId , nameof ( fileId ) ) ;
234234
235- ClientResult result = GetContainerFile ( containerId , fileId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
235+ ClientResult result = GetContainerFile ( containerId , fileId , cancellationToken . ToRequestOptions ( ) ) ;
236236 return ClientResult . FromValue ( ( ContainerFileResource ) result , result . GetRawResponse ( ) ) ;
237237 }
238238
@@ -241,7 +241,7 @@ public virtual async Task<ClientResult<ContainerFileResource>> GetContainerFileA
241241 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
242242 Argument . AssertNotNullOrEmpty ( fileId , nameof ( fileId ) ) ;
243243
244- ClientResult result = await GetContainerFileAsync ( containerId , fileId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) . ConfigureAwait ( false ) ;
244+ ClientResult result = await GetContainerFileAsync ( containerId , fileId , cancellationToken . ToRequestOptions ( ) ) . ConfigureAwait ( false ) ;
245245 return ClientResult . FromValue ( ( ContainerFileResource ) result , result . GetRawResponse ( ) ) ;
246246 }
247247
@@ -268,7 +268,7 @@ public virtual ClientResult<DeleteContainerFileResponse> DeleteContainerFile(str
268268 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
269269 Argument . AssertNotNullOrEmpty ( fileId , nameof ( fileId ) ) ;
270270
271- ClientResult result = DeleteContainerFile ( containerId , fileId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
271+ ClientResult result = DeleteContainerFile ( containerId , fileId , cancellationToken . ToRequestOptions ( ) ) ;
272272 return ClientResult . FromValue ( ( DeleteContainerFileResponse ) result , result . GetRawResponse ( ) ) ;
273273 }
274274
@@ -277,7 +277,7 @@ public virtual async Task<ClientResult<DeleteContainerFileResponse>> DeleteConta
277277 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
278278 Argument . AssertNotNullOrEmpty ( fileId , nameof ( fileId ) ) ;
279279
280- ClientResult result = await DeleteContainerFileAsync ( containerId , fileId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) . ConfigureAwait ( false ) ;
280+ ClientResult result = await DeleteContainerFileAsync ( containerId , fileId , cancellationToken . ToRequestOptions ( ) ) . ConfigureAwait ( false ) ;
281281 return ClientResult . FromValue ( ( DeleteContainerFileResponse ) result , result . GetRawResponse ( ) ) ;
282282 }
283283
@@ -304,7 +304,7 @@ public virtual ClientResult<BinaryData> DownloadContainerFile(string containerId
304304 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
305305 Argument . AssertNotNullOrEmpty ( fileId , nameof ( fileId ) ) ;
306306
307- ClientResult result = DownloadContainerFile ( containerId , fileId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) ;
307+ ClientResult result = DownloadContainerFile ( containerId , fileId , cancellationToken . ToRequestOptions ( ) ) ;
308308 return ClientResult . FromValue ( result . GetRawResponse ( ) . Content , result . GetRawResponse ( ) ) ;
309309 }
310310
@@ -313,7 +313,7 @@ public virtual async Task<ClientResult<BinaryData>> DownloadContainerFileAsync(s
313313 Argument . AssertNotNullOrEmpty ( containerId , nameof ( containerId ) ) ;
314314 Argument . AssertNotNullOrEmpty ( fileId , nameof ( fileId ) ) ;
315315
316- ClientResult result = await DownloadContainerFileAsync ( containerId , fileId , cancellationToken . CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null ) . ConfigureAwait ( false ) ;
316+ ClientResult result = await DownloadContainerFileAsync ( containerId , fileId , cancellationToken . ToRequestOptions ( ) ) . ConfigureAwait ( false ) ;
317317 return ClientResult . FromValue ( result . GetRawResponse ( ) . Content , result . GetRawResponse ( ) ) ;
318318 }
319319 }
0 commit comments