| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Analytics.Synapse.Artifacts.Models; |
| | 14 | | using Azure.Core; |
| | 15 | | using Azure.Core.Pipeline; |
| | 16 | |
|
| | 17 | | namespace Azure.Analytics.Synapse.Artifacts |
| | 18 | | { |
| | 19 | | internal partial class NotebookRestClient |
| | 20 | | { |
| | 21 | | private string endpoint; |
| | 22 | | private string apiVersion; |
| | 23 | | private ClientDiagnostics _clientDiagnostics; |
| | 24 | | private HttpPipeline _pipeline; |
| | 25 | |
|
| | 26 | | /// <summary> Initializes a new instance of NotebookRestClient. </summary> |
| | 27 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 28 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 29 | | /// <param name="endpoint"> The workspace development endpoint, for example https://myworkspace.dev.azuresynapse |
| | 30 | | /// <param name="apiVersion"> Api Version. </param> |
| | 31 | | /// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="apiVersion"/> is nul |
| 8 | 32 | | public NotebookRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string ap |
| | 33 | | { |
| 8 | 34 | | if (endpoint == null) |
| | 35 | | { |
| 0 | 36 | | throw new ArgumentNullException(nameof(endpoint)); |
| | 37 | | } |
| 8 | 38 | | if (apiVersion == null) |
| | 39 | | { |
| 0 | 40 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 41 | | } |
| | 42 | |
|
| 8 | 43 | | this.endpoint = endpoint; |
| 8 | 44 | | this.apiVersion = apiVersion; |
| 8 | 45 | | _clientDiagnostics = clientDiagnostics; |
| 8 | 46 | | _pipeline = pipeline; |
| 8 | 47 | | } |
| | 48 | |
|
| | 49 | | internal HttpMessage CreateGetNotebooksByWorkspaceRequest() |
| | 50 | | { |
| 4 | 51 | | var message = _pipeline.CreateMessage(); |
| 4 | 52 | | var request = message.Request; |
| 4 | 53 | | request.Method = RequestMethod.Get; |
| 4 | 54 | | var uri = new RawRequestUriBuilder(); |
| 4 | 55 | | uri.AppendRaw(endpoint, false); |
| 4 | 56 | | uri.AppendPath("/notebooks", false); |
| 4 | 57 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 58 | | request.Uri = uri; |
| 4 | 59 | | return message; |
| | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> Lists Notebooks. </summary> |
| | 63 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 64 | | public async Task<Response<NotebookListResponse>> GetNotebooksByWorkspaceAsync(CancellationToken cancellationTok |
| | 65 | | { |
| 2 | 66 | | using var message = CreateGetNotebooksByWorkspaceRequest(); |
| 2 | 67 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 68 | | switch (message.Response.Status) |
| | 69 | | { |
| | 70 | | case 200: |
| | 71 | | { |
| | 72 | | NotebookListResponse value = default; |
| 2 | 73 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 74 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 2 | 75 | | return Response.FromValue(value, message.Response); |
| | 76 | | } |
| | 77 | | default: |
| 0 | 78 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 79 | | } |
| 2 | 80 | | } |
| | 81 | |
|
| | 82 | | /// <summary> Lists Notebooks. </summary> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public Response<NotebookListResponse> GetNotebooksByWorkspace(CancellationToken cancellationToken = default) |
| | 85 | | { |
| 2 | 86 | | using var message = CreateGetNotebooksByWorkspaceRequest(); |
| 2 | 87 | | _pipeline.Send(message, cancellationToken); |
| 2 | 88 | | switch (message.Response.Status) |
| | 89 | | { |
| | 90 | | case 200: |
| | 91 | | { |
| | 92 | | NotebookListResponse value = default; |
| 2 | 93 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 94 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 2 | 95 | | return Response.FromValue(value, message.Response); |
| | 96 | | } |
| | 97 | | default: |
| 0 | 98 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 99 | | } |
| 2 | 100 | | } |
| | 101 | |
|
| | 102 | | internal HttpMessage CreateGetNotebookSummaryByWorkSpaceRequest() |
| | 103 | | { |
| 0 | 104 | | var message = _pipeline.CreateMessage(); |
| 0 | 105 | | var request = message.Request; |
| 0 | 106 | | request.Method = RequestMethod.Get; |
| 0 | 107 | | var uri = new RawRequestUriBuilder(); |
| 0 | 108 | | uri.AppendRaw(endpoint, false); |
| 0 | 109 | | uri.AppendPath("/notebooks/summary", false); |
| 0 | 110 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 111 | | request.Uri = uri; |
| 0 | 112 | | return message; |
| | 113 | | } |
| | 114 | |
|
| | 115 | | /// <summary> Lists a summary of Notebooks. </summary> |
| | 116 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 117 | | public async Task<Response<NotebookListResponse>> GetNotebookSummaryByWorkSpaceAsync(CancellationToken cancellat |
| | 118 | | { |
| 0 | 119 | | using var message = CreateGetNotebookSummaryByWorkSpaceRequest(); |
| 0 | 120 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 121 | | switch (message.Response.Status) |
| | 122 | | { |
| | 123 | | case 200: |
| | 124 | | { |
| | 125 | | NotebookListResponse value = default; |
| 0 | 126 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 127 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 0 | 128 | | return Response.FromValue(value, message.Response); |
| | 129 | | } |
| | 130 | | default: |
| 0 | 131 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 132 | | } |
| 0 | 133 | | } |
| | 134 | |
|
| | 135 | | /// <summary> Lists a summary of Notebooks. </summary> |
| | 136 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 137 | | public Response<NotebookListResponse> GetNotebookSummaryByWorkSpace(CancellationToken cancellationToken = defaul |
| | 138 | | { |
| 0 | 139 | | using var message = CreateGetNotebookSummaryByWorkSpaceRequest(); |
| 0 | 140 | | _pipeline.Send(message, cancellationToken); |
| 0 | 141 | | switch (message.Response.Status) |
| | 142 | | { |
| | 143 | | case 200: |
| | 144 | | { |
| | 145 | | NotebookListResponse value = default; |
| 0 | 146 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 147 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 0 | 148 | | return Response.FromValue(value, message.Response); |
| | 149 | | } |
| | 150 | | default: |
| 0 | 151 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 152 | | } |
| 0 | 153 | | } |
| | 154 | |
|
| | 155 | | internal HttpMessage CreateCreateOrUpdateNotebookRequest(string notebookName, NotebookResource notebook, string |
| | 156 | | { |
| 0 | 157 | | var message = _pipeline.CreateMessage(); |
| 0 | 158 | | var request = message.Request; |
| 0 | 159 | | request.Method = RequestMethod.Put; |
| 0 | 160 | | var uri = new RawRequestUriBuilder(); |
| 0 | 161 | | uri.AppendRaw(endpoint, false); |
| 0 | 162 | | uri.AppendPath("/notebooks/", false); |
| 0 | 163 | | uri.AppendPath(notebookName, true); |
| 0 | 164 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 165 | | request.Uri = uri; |
| 0 | 166 | | if (ifMatch != null) |
| | 167 | | { |
| 0 | 168 | | request.Headers.Add("If-Match", ifMatch); |
| | 169 | | } |
| 0 | 170 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 171 | | var content = new Utf8JsonRequestContent(); |
| 0 | 172 | | content.JsonWriter.WriteObjectValue(notebook); |
| 0 | 173 | | request.Content = content; |
| 0 | 174 | | return message; |
| | 175 | | } |
| | 176 | |
|
| | 177 | | /// <summary> Creates or updates a Note Book. </summary> |
| | 178 | | /// <param name="notebookName"> The notebook name. </param> |
| | 179 | | /// <param name="notebook"> Note book resource definition. </param> |
| | 180 | | /// <param name="ifMatch"> ETag of the Note book entity. Should only be specified for update, for which it shou |
| | 181 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 182 | | /// <exception cref="ArgumentNullException"> <paramref name="notebookName"/> or <paramref name="notebook"/> is n |
| | 183 | | public async Task<Response<NotebookResource>> CreateOrUpdateNotebookAsync(string notebookName, NotebookResource |
| | 184 | | { |
| 0 | 185 | | if (notebookName == null) |
| | 186 | | { |
| 0 | 187 | | throw new ArgumentNullException(nameof(notebookName)); |
| | 188 | | } |
| 0 | 189 | | if (notebook == null) |
| | 190 | | { |
| 0 | 191 | | throw new ArgumentNullException(nameof(notebook)); |
| | 192 | | } |
| | 193 | |
|
| 0 | 194 | | using var message = CreateCreateOrUpdateNotebookRequest(notebookName, notebook, ifMatch); |
| 0 | 195 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 196 | | switch (message.Response.Status) |
| | 197 | | { |
| | 198 | | case 200: |
| | 199 | | { |
| | 200 | | NotebookResource value = default; |
| 0 | 201 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 202 | | value = NotebookResource.DeserializeNotebookResource(document.RootElement); |
| 0 | 203 | | return Response.FromValue(value, message.Response); |
| | 204 | | } |
| | 205 | | default: |
| 0 | 206 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 207 | | } |
| 0 | 208 | | } |
| | 209 | |
|
| | 210 | | /// <summary> Creates or updates a Note Book. </summary> |
| | 211 | | /// <param name="notebookName"> The notebook name. </param> |
| | 212 | | /// <param name="notebook"> Note book resource definition. </param> |
| | 213 | | /// <param name="ifMatch"> ETag of the Note book entity. Should only be specified for update, for which it shou |
| | 214 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 215 | | /// <exception cref="ArgumentNullException"> <paramref name="notebookName"/> or <paramref name="notebook"/> is n |
| | 216 | | public Response<NotebookResource> CreateOrUpdateNotebook(string notebookName, NotebookResource notebook, string |
| | 217 | | { |
| 0 | 218 | | if (notebookName == null) |
| | 219 | | { |
| 0 | 220 | | throw new ArgumentNullException(nameof(notebookName)); |
| | 221 | | } |
| 0 | 222 | | if (notebook == null) |
| | 223 | | { |
| 0 | 224 | | throw new ArgumentNullException(nameof(notebook)); |
| | 225 | | } |
| | 226 | |
|
| 0 | 227 | | using var message = CreateCreateOrUpdateNotebookRequest(notebookName, notebook, ifMatch); |
| 0 | 228 | | _pipeline.Send(message, cancellationToken); |
| 0 | 229 | | switch (message.Response.Status) |
| | 230 | | { |
| | 231 | | case 200: |
| | 232 | | { |
| | 233 | | NotebookResource value = default; |
| 0 | 234 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 235 | | value = NotebookResource.DeserializeNotebookResource(document.RootElement); |
| 0 | 236 | | return Response.FromValue(value, message.Response); |
| | 237 | | } |
| | 238 | | default: |
| 0 | 239 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 240 | | } |
| 0 | 241 | | } |
| | 242 | |
|
| | 243 | | internal HttpMessage CreateGetNotebookRequest(string notebookName, string ifNoneMatch) |
| | 244 | | { |
| 12 | 245 | | var message = _pipeline.CreateMessage(); |
| 12 | 246 | | var request = message.Request; |
| 12 | 247 | | request.Method = RequestMethod.Get; |
| 12 | 248 | | var uri = new RawRequestUriBuilder(); |
| 12 | 249 | | uri.AppendRaw(endpoint, false); |
| 12 | 250 | | uri.AppendPath("/notebooks/", false); |
| 12 | 251 | | uri.AppendPath(notebookName, true); |
| 12 | 252 | | uri.AppendQuery("api-version", apiVersion, true); |
| 12 | 253 | | request.Uri = uri; |
| 12 | 254 | | if (ifNoneMatch != null) |
| | 255 | | { |
| 0 | 256 | | request.Headers.Add("If-None-Match", ifNoneMatch); |
| | 257 | | } |
| 12 | 258 | | return message; |
| | 259 | | } |
| | 260 | |
|
| | 261 | | /// <summary> Gets a Note Book. </summary> |
| | 262 | | /// <param name="notebookName"> The notebook name. </param> |
| | 263 | | /// <param name="ifNoneMatch"> ETag of the Notebook entity. Should only be specified for get. If the ETag matche |
| | 264 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 265 | | /// <exception cref="ArgumentNullException"> <paramref name="notebookName"/> is null. </exception> |
| | 266 | | public async Task<Response<NotebookResource>> GetNotebookAsync(string notebookName, string ifNoneMatch = null, C |
| | 267 | | { |
| 6 | 268 | | if (notebookName == null) |
| | 269 | | { |
| 0 | 270 | | throw new ArgumentNullException(nameof(notebookName)); |
| | 271 | | } |
| | 272 | |
|
| 6 | 273 | | using var message = CreateGetNotebookRequest(notebookName, ifNoneMatch); |
| 6 | 274 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 275 | | switch (message.Response.Status) |
| | 276 | | { |
| | 277 | | case 200: |
| | 278 | | { |
| | 279 | | NotebookResource value = default; |
| 6 | 280 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 281 | | value = NotebookResource.DeserializeNotebookResource(document.RootElement); |
| 6 | 282 | | return Response.FromValue(value, message.Response); |
| | 283 | | } |
| | 284 | | case 304: |
| 0 | 285 | | return Response.FromValue<NotebookResource>(null, message.Response); |
| | 286 | | default: |
| 0 | 287 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 288 | | } |
| 6 | 289 | | } |
| | 290 | |
|
| | 291 | | /// <summary> Gets a Note Book. </summary> |
| | 292 | | /// <param name="notebookName"> The notebook name. </param> |
| | 293 | | /// <param name="ifNoneMatch"> ETag of the Notebook entity. Should only be specified for get. If the ETag matche |
| | 294 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 295 | | /// <exception cref="ArgumentNullException"> <paramref name="notebookName"/> is null. </exception> |
| | 296 | | public Response<NotebookResource> GetNotebook(string notebookName, string ifNoneMatch = null, CancellationToken |
| | 297 | | { |
| 6 | 298 | | if (notebookName == null) |
| | 299 | | { |
| 0 | 300 | | throw new ArgumentNullException(nameof(notebookName)); |
| | 301 | | } |
| | 302 | |
|
| 6 | 303 | | using var message = CreateGetNotebookRequest(notebookName, ifNoneMatch); |
| 6 | 304 | | _pipeline.Send(message, cancellationToken); |
| 6 | 305 | | switch (message.Response.Status) |
| | 306 | | { |
| | 307 | | case 200: |
| | 308 | | { |
| | 309 | | NotebookResource value = default; |
| 6 | 310 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 311 | | value = NotebookResource.DeserializeNotebookResource(document.RootElement); |
| 6 | 312 | | return Response.FromValue(value, message.Response); |
| | 313 | | } |
| | 314 | | case 304: |
| 0 | 315 | | return Response.FromValue<NotebookResource>(null, message.Response); |
| | 316 | | default: |
| 0 | 317 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 318 | | } |
| 6 | 319 | | } |
| | 320 | |
|
| | 321 | | internal HttpMessage CreateDeleteNotebookRequest(string notebookName) |
| | 322 | | { |
| 0 | 323 | | var message = _pipeline.CreateMessage(); |
| 0 | 324 | | var request = message.Request; |
| 0 | 325 | | request.Method = RequestMethod.Delete; |
| 0 | 326 | | var uri = new RawRequestUriBuilder(); |
| 0 | 327 | | uri.AppendRaw(endpoint, false); |
| 0 | 328 | | uri.AppendPath("/notebooks/", false); |
| 0 | 329 | | uri.AppendPath(notebookName, true); |
| 0 | 330 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 331 | | request.Uri = uri; |
| 0 | 332 | | return message; |
| | 333 | | } |
| | 334 | |
|
| | 335 | | /// <summary> Deletes a Note book. </summary> |
| | 336 | | /// <param name="notebookName"> The notebook name. </param> |
| | 337 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 338 | | /// <exception cref="ArgumentNullException"> <paramref name="notebookName"/> is null. </exception> |
| | 339 | | public async Task<Response> DeleteNotebookAsync(string notebookName, CancellationToken cancellationToken = defau |
| | 340 | | { |
| 0 | 341 | | if (notebookName == null) |
| | 342 | | { |
| 0 | 343 | | throw new ArgumentNullException(nameof(notebookName)); |
| | 344 | | } |
| | 345 | |
|
| 0 | 346 | | using var message = CreateDeleteNotebookRequest(notebookName); |
| 0 | 347 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 348 | | switch (message.Response.Status) |
| | 349 | | { |
| | 350 | | case 200: |
| | 351 | | case 204: |
| 0 | 352 | | return message.Response; |
| | 353 | | default: |
| 0 | 354 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 355 | | } |
| 0 | 356 | | } |
| | 357 | |
|
| | 358 | | /// <summary> Deletes a Note book. </summary> |
| | 359 | | /// <param name="notebookName"> The notebook name. </param> |
| | 360 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 361 | | /// <exception cref="ArgumentNullException"> <paramref name="notebookName"/> is null. </exception> |
| | 362 | | public Response DeleteNotebook(string notebookName, CancellationToken cancellationToken = default) |
| | 363 | | { |
| 0 | 364 | | if (notebookName == null) |
| | 365 | | { |
| 0 | 366 | | throw new ArgumentNullException(nameof(notebookName)); |
| | 367 | | } |
| | 368 | |
|
| 0 | 369 | | using var message = CreateDeleteNotebookRequest(notebookName); |
| 0 | 370 | | _pipeline.Send(message, cancellationToken); |
| 0 | 371 | | switch (message.Response.Status) |
| | 372 | | { |
| | 373 | | case 200: |
| | 374 | | case 204: |
| 0 | 375 | | return message.Response; |
| | 376 | | default: |
| 0 | 377 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 378 | | } |
| 0 | 379 | | } |
| | 380 | |
|
| | 381 | | internal HttpMessage CreateGetNotebooksByWorkspaceNextPageRequest(string nextLink) |
| | 382 | | { |
| 0 | 383 | | var message = _pipeline.CreateMessage(); |
| 0 | 384 | | var request = message.Request; |
| 0 | 385 | | request.Method = RequestMethod.Get; |
| 0 | 386 | | var uri = new RawRequestUriBuilder(); |
| 0 | 387 | | uri.AppendRaw(endpoint, false); |
| 0 | 388 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 389 | | request.Uri = uri; |
| 0 | 390 | | return message; |
| | 391 | | } |
| | 392 | |
|
| | 393 | | /// <summary> Lists Notebooks. </summary> |
| | 394 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 395 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 396 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 397 | | public async Task<Response<NotebookListResponse>> GetNotebooksByWorkspaceNextPageAsync(string nextLink, Cancella |
| | 398 | | { |
| 0 | 399 | | if (nextLink == null) |
| | 400 | | { |
| 0 | 401 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 402 | | } |
| | 403 | |
|
| 0 | 404 | | using var message = CreateGetNotebooksByWorkspaceNextPageRequest(nextLink); |
| 0 | 405 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 406 | | switch (message.Response.Status) |
| | 407 | | { |
| | 408 | | case 200: |
| | 409 | | { |
| | 410 | | NotebookListResponse value = default; |
| 0 | 411 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 412 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 0 | 413 | | return Response.FromValue(value, message.Response); |
| | 414 | | } |
| | 415 | | default: |
| 0 | 416 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 417 | | } |
| 0 | 418 | | } |
| | 419 | |
|
| | 420 | | /// <summary> Lists Notebooks. </summary> |
| | 421 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 422 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 423 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 424 | | public Response<NotebookListResponse> GetNotebooksByWorkspaceNextPage(string nextLink, CancellationToken cancell |
| | 425 | | { |
| 0 | 426 | | if (nextLink == null) |
| | 427 | | { |
| 0 | 428 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 429 | | } |
| | 430 | |
|
| 0 | 431 | | using var message = CreateGetNotebooksByWorkspaceNextPageRequest(nextLink); |
| 0 | 432 | | _pipeline.Send(message, cancellationToken); |
| 0 | 433 | | switch (message.Response.Status) |
| | 434 | | { |
| | 435 | | case 200: |
| | 436 | | { |
| | 437 | | NotebookListResponse value = default; |
| 0 | 438 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 439 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 0 | 440 | | return Response.FromValue(value, message.Response); |
| | 441 | | } |
| | 442 | | default: |
| 0 | 443 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 444 | | } |
| 0 | 445 | | } |
| | 446 | |
|
| | 447 | | internal HttpMessage CreateGetNotebookSummaryByWorkSpaceNextPageRequest(string nextLink) |
| | 448 | | { |
| 0 | 449 | | var message = _pipeline.CreateMessage(); |
| 0 | 450 | | var request = message.Request; |
| 0 | 451 | | request.Method = RequestMethod.Get; |
| 0 | 452 | | var uri = new RawRequestUriBuilder(); |
| 0 | 453 | | uri.AppendRaw(endpoint, false); |
| 0 | 454 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 455 | | request.Uri = uri; |
| 0 | 456 | | return message; |
| | 457 | | } |
| | 458 | |
|
| | 459 | | /// <summary> Lists a summary of Notebooks. </summary> |
| | 460 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 461 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 462 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 463 | | public async Task<Response<NotebookListResponse>> GetNotebookSummaryByWorkSpaceNextPageAsync(string nextLink, Ca |
| | 464 | | { |
| 0 | 465 | | if (nextLink == null) |
| | 466 | | { |
| 0 | 467 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 468 | | } |
| | 469 | |
|
| 0 | 470 | | using var message = CreateGetNotebookSummaryByWorkSpaceNextPageRequest(nextLink); |
| 0 | 471 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 472 | | switch (message.Response.Status) |
| | 473 | | { |
| | 474 | | case 200: |
| | 475 | | { |
| | 476 | | NotebookListResponse value = default; |
| 0 | 477 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 478 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 0 | 479 | | return Response.FromValue(value, message.Response); |
| | 480 | | } |
| | 481 | | default: |
| 0 | 482 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 483 | | } |
| 0 | 484 | | } |
| | 485 | |
|
| | 486 | | /// <summary> Lists a summary of Notebooks. </summary> |
| | 487 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 488 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 489 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 490 | | public Response<NotebookListResponse> GetNotebookSummaryByWorkSpaceNextPage(string nextLink, CancellationToken c |
| | 491 | | { |
| 0 | 492 | | if (nextLink == null) |
| | 493 | | { |
| 0 | 494 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 495 | | } |
| | 496 | |
|
| 0 | 497 | | using var message = CreateGetNotebookSummaryByWorkSpaceNextPageRequest(nextLink); |
| 0 | 498 | | _pipeline.Send(message, cancellationToken); |
| 0 | 499 | | switch (message.Response.Status) |
| | 500 | | { |
| | 501 | | case 200: |
| | 502 | | { |
| | 503 | | NotebookListResponse value = default; |
| 0 | 504 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 505 | | value = NotebookListResponse.DeserializeNotebookListResponse(document.RootElement); |
| 0 | 506 | | return Response.FromValue(value, message.Response); |
| | 507 | | } |
| | 508 | | default: |
| 0 | 509 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 510 | | } |
| 0 | 511 | | } |
| | 512 | | } |
| | 513 | | } |