< Summary

Class:Azure.DigitalTwins.Core.DigitalTwinsRestClient
Assembly:Azure.DigitalTwins.Core
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\DigitalTwinsRestClient.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\DigitalTwinsRestClient.cs
Covered lines:588
Uncovered lines:430
Coverable lines:1018
Total lines:1741
Line coverage:57.7% (588 of 1018)
Covered branches:138
Total branches:340
Branch coverage:40.5% (138 of 340)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CreateAddRequest(...)-100%100%
.ctor(...)-90.91%50%
AddAsync()-93.94%50%
CreateGetByIdRequest(...)-100%50%
CreateDeleteRequest(...)-84.62%50%
Add(...)-69.57%50%
DeleteAsync()-91.67%50%
GetByIdAsync()-69.57%50%
Delete(...)-80%66.67%
CreateUpdateRequest(...)-45%16.67%
GetById(...)-81.48%50%
CreateGetRelationshipByIdRequest(...)-100%100%
CreateAddRelationshipRequest(...)-35%33.33%
UpdateAsync()-63.64%41.67%
CreateDeleteRelationshipRequest(...)-81.25%50%
Update(...)-60.87%50%
DeleteRelationshipAsync()-71.43%50%
GetRelationshipByIdAsync()-70.37%58.33%
DeleteRelationship(...)-80%60%
CreateUpdateRelationshipRequest(...)-46.15%40%
GetRelationshipById(...)-74.07%60%
CreateListRelationshipsRequest(...)-100%100%
AddRelationshipAsync()-70.83%41.67%
ListRelationshipsAsync()-80%37.5%
AddRelationship(...)-80.77%41.67%
ListRelationships(...)-85.71%37.5%
CreateListIncomingRelationshipsRequest(...)-100%50%
UpdateRelationshipAsync()-73.68%50%
ListIncomingRelationshipsAsync()-76.47%50%
UpdateRelationship(...)-78.95%50%
ListIncomingRelationships(...)-73.33%50%
GetComponentAsync()-46.67%37.5%
CreateSendTelemetryRequest(...)-31.58%25%
CreateSendComponentTelemetryRequest(...)-33.33%37.5%
GetComponent(...)-62.5%37.5%
CreateGetComponentRequest(...)-100%100%
UpdateComponentAsync()-29.03%28.57%
CreateUpdateComponentRequest(...)-29.17%25%
CreateListRelationshipsNextPageRequest(...)-25%50%
UpdateComponent(...)-37.5%28.57%
ListRelationshipsNextPageAsync()-17.65%12.5%
SendTelemetryAsync()-52.63%28.57%
ListRelationshipsNextPage(...)-35.29%25%
SendTelemetry(...)-41.67%40%
CreateListIncomingRelationshipsNextPageRequest(...)-25%100%
ListIncomingRelationshipsNextPageAsync()-43.75%33.33%
SendComponentTelemetryAsync()-47.83%35.71%
ListIncomingRelationshipsNextPage(...)-37.5%28.57%
SendComponentTelemetry(...)-47.83%41.67%
CreateUpdateRequest(...)-100%100%
CreateAddRelationshipRequest(...)-100%100%
CreateUpdateRelationshipRequest(...)-94.12%75%
CreateUpdateComponentRequest(...)-94.12%75%
CreateSendTelemetryRequest(...)-100%100%
CreateSendComponentTelemetryRequest(...)-100%100%
AddAsync(...)-0%100%
Add(...)-0%100%
UpdateAsync(...)-0%100%
Update(...)-0%100%
AddRelationshipAsync(...)-0%100%
AddRelationship(...)-0%100%
UpdateRelationshipAsync(...)-0%100%
UpdateRelationship(...)-0%100%
UpdateComponentAsync(...)-0%100%
UpdateComponent(...)-0%100%
SendTelemetryAsync(...)-0%100%
SendTelemetry(...)-0%100%
SendComponentTelemetryAsync(...)-0%100%
SendComponentTelemetry(...)-0%100%
CreateAddRequest(...)-0%100%
.ctor(...)-88.89%50%
CreateGetByIdRequest(...)-100%100%
CreateDeleteRequest(...)-91.67%50%
DeleteAsync()-75%50%
Delete(...)-75%50%
CreateUpdateRequest(...)-0%0%
CreateGetRelationshipByIdRequest(...)-100%100%
CreateAddRelationshipRequest(...)-0%0%
CreateDeleteRelationshipRequest(...)-92.86%50%
DeleteRelationshipAsync()-70%50%
DeleteRelationship(...)-70%50%
CreateUpdateRelationshipRequest(...)-0%0%
CreateListRelationshipsRequest(...)-100%100%
ListRelationshipsAsync()-80%50%
ListRelationships(...)-80%50%
CreateListIncomingRelationshipsRequest(...)-100%100%
ListIncomingRelationshipsAsync()-80%50%
ListIncomingRelationships(...)-80%50%
CreateSendTelemetryRequest(...)-0%0%
CreateSendComponentTelemetryRequest(...)-0%0%
CreateGetComponentRequest(...)-100%100%
CreateUpdateComponentRequest(...)-0%0%
CreateListRelationshipsNextPageRequest(...)-0%100%
ListRelationshipsNextPageAsync()-0%0%
ListRelationshipsNextPage(...)-0%0%
CreateListIncomingRelationshipsNextPageRequest(...)-0%100%
ListIncomingRelationshipsNextPageAsync()-0%0%
ListIncomingRelationshipsNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\DigitalTwinsRestClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Text.Json;
 7using System.Threading;
 8using System.Threading.Tasks;
 9using Azure.Core;
 10using Azure.Core.Pipeline;
 11
 12namespace Azure.DigitalTwins.Core
 13{
 14    // Declaring this class here will make it so that we can force its methods to use strings instead of
 15    // objects for json inputs/return values
 16    internal partial class DigitalTwinsRestClient
 17    {
 18        private const string IfMatchHeaderKey = "If-Match";
 19
 20        internal HttpMessage CreateAddRequest(string id, string twin)
 21        {
 2822            HttpMessage message = _pipeline.CreateMessage();
 2823            Request request = message.Request;
 2824            request.Method = RequestMethod.Put;
 2825            var uri = new RawRequestUriBuilder();
 2826            uri.Reset(endpoint);
 2827            uri.AppendPath("/digitaltwins/", false);
 2828            uri.AppendPath(id, true);
 2829            uri.AppendQuery("api-version", apiVersion, true);
 2830            request.Uri = uri;
 2831            request.Headers.Add("Content-Type", "application/json; charset=utf-8");
 5832            request.Content = new StringRequestContent(twin);
 2833            return message;
 3034        }
 3035
 36        internal async Task<Response<string>> AddAsync(string id, string twin, CancellationToken cancellationToken = def
 037        {
 1438            if (id == null)
 39            {
 3040                throw new ArgumentNullException(nameof(id));
 3041            }
 4442            if (twin == null)
 3043            {
 3044                throw new ArgumentNullException(nameof(twin));
 45            }
 46
 1447            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.Add");
 4148            scope.Start();
 2749            try
 2750            {
 4151                using HttpMessage message = CreateAddRequest(id, twin);
 4152                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4153                switch (message.Response.Status)
 2754                {
 2755                    case 200:
 2756                    case 202:
 2757                        {
 58                            string value = default;
 1459                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 1460                            value = document.RootElement.GetRawText();
 1461                            return Response.FromValue(value, message.Response);
 1262                        }
 1263                    case 201:
 1264                        return Response.FromValue<string>(null, message.Response);
 1265
 1266                    default:
 1267                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 1268                }
 1269            }
 1270            catch (Exception e)
 1271            {
 072                scope.Failed(e);
 073                throw;
 74            }
 2675        }
 76
 77        internal Response<string> Add(string id, string twin, CancellationToken cancellationToken = default)
 78        {
 1479            if (id == null)
 80            {
 081                throw new ArgumentNullException(nameof(id));
 82            }
 1483            if (twin == null)
 84            {
 085                throw new ArgumentNullException(nameof(twin));
 86            }
 87
 1488            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.Add");
 1489            scope.Start();
 90            try
 691            {
 1492                using HttpMessage message = CreateAddRequest(id, twin);
 1493                _pipeline.Send(message, cancellationToken);
 1494                switch (message.Response.Status)
 95                {
 696                    case 200:
 697                    case 202:
 698                        {
 99                            string value = default;
 14100                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 20101                            value = document.RootElement.GetRawText();
 14102                            return Response.FromValue(value, message.Response);
 0103                        }
 104                    case 201:
 6105                        return Response.FromValue<string>(null, message.Response);
 106
 107                    default:
 0108                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 109                }
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 14116        }
 117
 118        internal async Task<Response<string>> GetByIdAsync(string id, CancellationToken cancellationToken = default)
 119        {
 34120            if (id == null)
 121            {
 0122                throw new ArgumentNullException(nameof(id));
 123            }
 124
 34125            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.GetById");
 34126            scope.Start();
 6127            try
 128            {
 28129                using HttpMessage message = CreateGetByIdRequest(id);
 34130                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 28131                switch (message.Response.Status)
 0132                {
 133                    case 200:
 6134                        {
 135                            string value = default;
 6136                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 6137                            value = document.RootElement.GetRawText();
 6138                            return Response.FromValue(value, message.Response);
 0139                        }
 0140                    default:
 22141                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 0142                }
 0143            }
 22144            catch (Exception e)
 0145            {
 22146                scope.Failed(e);
 22147                throw;
 148            }
 6149        }
 150
 0151        internal Response<string> GetById(string id, CancellationToken cancellationToken = default)
 0152        {
 26153            if (id == null)
 0154            {
 0155                throw new ArgumentNullException(nameof(id));
 0156            }
 157
 26158            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.GetById");
 26159            scope.Start();
 0160            try
 161            {
 26162                using HttpMessage message = CreateGetByIdRequest(id);
 26163                _pipeline.Send(message, cancellationToken);
 26164                switch (message.Response.Status)
 10165                {
 10166                    case 200:
 10167                        {
 10168                            string value = default;
 14169                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 14170                            value = document.RootElement.GetRawText();
 14171                            return Response.FromValue(value, message.Response);
 10172                        }
 10173                    default:
 32174                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 10175                }
 10176            }
 22177            catch (Exception e)
 178            {
 22179                scope.Failed(e);
 22180                throw;
 0181            }
 4182        }
 0183
 0184        internal async Task<Response<string>> UpdateAsync(string id, string patchDocument, string ifMatch = null, Cancel
 0185        {
 2186            if (id == null)
 0187            {
 0188                throw new ArgumentNullException(nameof(id));
 0189            }
 2190            if (patchDocument == null)
 0191            {
 0192                throw new ArgumentNullException(nameof(patchDocument));
 0193            }
 0194
 2195            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.Update");
 2196            scope.Start();
 0197            try
 0198            {
 2199                using HttpMessage message = CreateUpdateRequest(id, patchDocument, ifMatch);
 2200                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2201                switch (message.Response.Status)
 202                {
 203                    case 202:
 204                        {
 8205                            string value = default;
 8206                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 8207                            value = document.RootElement.GetRawText();
 8208                            return Response.FromValue(value, message.Response);
 8209                        }
 8210                    case 204:
 10211                        return Response.FromValue<string>(null, message.Response);
 8212
 8213                    default:
 8214                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 8215                }
 8216            }
 0217            catch (Exception e)
 0218            {
 0219                scope.Failed(e);
 8220                throw;
 221            }
 2222        }
 223
 224        internal Response<string> Update(string id, string patchDocument, string ifMatch = null, CancellationToken cance
 225        {
 2226            if (id == null)
 227            {
 0228                throw new ArgumentNullException(nameof(id));
 229            }
 2230            if (patchDocument == null)
 231            {
 0232                throw new ArgumentNullException(nameof(patchDocument));
 233            }
 234
 2235            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.Update");
 6236            scope.Start();
 237            try
 0238            {
 2239                using HttpMessage message = CreateUpdateRequest(id, patchDocument, ifMatch);
 6240                _pipeline.Send(message, cancellationToken);
 2241                switch (message.Response.Status)
 0242                {
 243                    case 202:
 244                        {
 4245                            string value = default;
 4246                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 4247                            value = document.RootElement.GetRawText();
 0248                            return Response.FromValue(value, message.Response);
 249                        }
 4250                    case 204:
 2251                        return Response.FromValue<string>(null, message.Response);
 0252
 253                    default:
 4254                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 255                }
 256            }
 0257            catch (Exception e)
 258            {
 0259                scope.Failed(e);
 0260                throw;
 261            }
 2262        }
 263
 264        internal async Task<Response<string>> GetRelationshipByIdAsync(string id, string relationshipId, CancellationTok
 265        {
 10266            if (id == null)
 267            {
 0268                throw new ArgumentNullException(nameof(id));
 4269            }
 10270            if (relationshipId == null)
 0271            {
 0272                throw new ArgumentNullException(nameof(relationshipId));
 4273            }
 274
 10275            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.GetRelationshipById");
 10276            scope.Start();
 277            try
 4278            {
 14279                using HttpMessage message = CreateGetRelationshipByIdRequest(id, relationshipId);
 14280                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 10281                switch (message.Response.Status)
 282                {
 4283                    case 200:
 284                        {
 0285                            string value = default;
 2286                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 6287                            value = document.RootElement.GetRawText();
 2288                            return Response.FromValue(value, message.Response);
 289                        }
 290                    default:
 8291                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 0292                }
 0293            }
 8294            catch (Exception e)
 0295            {
 8296                scope.Failed(e);
 8297                throw;
 0298            }
 2299        }
 0300
 0301        internal Response<string> GetRelationshipById(string id, string relationshipId, CancellationToken cancellationTo
 0302        {
 10303            if (id == null)
 0304            {
 0305                throw new ArgumentNullException(nameof(id));
 0306            }
 10307            if (relationshipId == null)
 308            {
 0309                throw new ArgumentNullException(nameof(relationshipId));
 0310            }
 0311
 10312            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.GetRelationshipById");
 10313            scope.Start();
 314            try
 0315            {
 10316                using HttpMessage message = CreateGetRelationshipByIdRequest(id, relationshipId);
 10317                _pipeline.Send(message, cancellationToken);
 10318                switch (message.Response.Status)
 319                {
 320                    case 200:
 321                        {
 322                            string value = default;
 6323                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 6324                            value = document.RootElement.GetRawText();
 6325                            return Response.FromValue(value, message.Response);
 4326                        }
 4327                    default:
 12328                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 4329                }
 4330            }
 12331            catch (Exception e)
 332            {
 10333                scope.Failed(e);
 8334                throw;
 4335            }
 6336        }
 4337
 338        internal async Task<Response<string>> AddRelationshipAsync(string id, string relationshipId, string relationship
 339        {
 8340            if (id == null)
 341            {
 0342                throw new ArgumentNullException(nameof(id));
 343            }
 8344            if (relationshipId == null)
 345            {
 0346                throw new ArgumentNullException(nameof(relationshipId));
 347            }
 348
 8349            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.AddRelationship");
 8350            scope.Start();
 351            try
 352            {
 10353                using HttpMessage message = CreateAddRelationshipRequest(id, relationshipId, relationship);
 8354                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 8355                switch (message.Response.Status)
 356                {
 357                    case 200:
 2358                        {
 2359                            string value = default;
 10360                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 8361                            value = document.RootElement.GetRawText();
 8362                            return Response.FromValue(value, message.Response);
 363                        }
 364                    case 204:
 2365                        return Response.FromValue<string>(null, message.Response);
 2366
 2367                    default:
 0368                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 369                }
 0370            }
 0371            catch (Exception e)
 2372            {
 0373                scope.Failed(e);
 0374                throw;
 375            }
 8376        }
 377
 378        internal Response<string> AddRelationship(string id, string relationshipId, string relationship = null, Cancella
 379        {
 8380            if (id == null)
 381            {
 0382                throw new ArgumentNullException(nameof(id));
 383            }
 8384            if (relationshipId == null)
 385            {
 0386                throw new ArgumentNullException(nameof(relationshipId));
 2387            }
 388
 8389            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.AddRelationship");
 8390            scope.Start();
 391            try
 2392            {
 10393                using HttpMessage message = CreateAddRelationshipRequest(id, relationshipId, relationship);
 10394                _pipeline.Send(message, cancellationToken);
 8395                switch (message.Response.Status)
 396                {
 397                    case 200:
 398                        {
 2399                            string value = default;
 10400                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 10401                            value = document.RootElement.GetRawText();
 8402                            return Response.FromValue(value, message.Response);
 403                        }
 0404                    case 204:
 0405                        return Response.FromValue<string>(null, message.Response);
 2406
 407                    default:
 0408                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 409                }
 2410            }
 2411            catch (Exception e)
 2412            {
 2413                scope.Failed(e);
 2414                throw;
 2415            }
 10416        }
 2417
 2418        internal async Task<Response> UpdateRelationshipAsync(string id, string relationshipId, string patchDocument = n
 2419        {
 4420            if (id == null)
 421            {
 0422                throw new ArgumentNullException(nameof(id));
 423            }
 2424            if (relationshipId == null)
 425            {
 0426                throw new ArgumentNullException(nameof(relationshipId));
 427            }
 428
 2429            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.UpdateRelationship");
 2430            scope.Start();
 431            try
 432            {
 2433                using HttpMessage message = CreateUpdateRelationshipRequest(id, relationshipId, patchDocument, ifMatch);
 2434                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 3435                return message.Response.Status switch
 2436                {
 4437                    204 => message.Response,
 0438                    _ => throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwa
 2439                };
 1440            }
 1441            catch (Exception e)
 1442            {
 0443                scope.Failed(e);
 0444                throw;
 445            }
 2446        }
 1447
 1448        internal Response UpdateRelationship(string id, string relationshipId, string patchDocument = null, string ifMat
 1449        {
 2450            if (id == null)
 451            {
 0452                throw new ArgumentNullException(nameof(id));
 453            }
 3454            if (relationshipId == null)
 455            {
 0456                throw new ArgumentNullException(nameof(relationshipId));
 457            }
 458
 2459            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.UpdateRelationship");
 2460            scope.Start();
 461            try
 462            {
 2463                using HttpMessage message = CreateUpdateRelationshipRequest(id, relationshipId, patchDocument, ifMatch);
 2464                _pipeline.Send(message, cancellationToken);
 2465                return message.Response.Status switch
 2466                {
 4467                    204 => message.Response,
 1468                    _ => throw _clientDiagnostics.CreateRequestFailedException(message.Response),
 2469                };
 0470            }
 0471            catch (Exception e)
 472            {
 1473                scope.Failed(e);
 1474                throw;
 1475            }
 2476        }
 477
 478        internal async Task<Response<string>> GetComponentAsync(string id, string componentPath, CancellationToken cance
 479        {
 3480            if (id == null)
 1481            {
 1482                throw new ArgumentNullException(nameof(id));
 483            }
 2484            if (componentPath == null)
 0485            {
 0486                throw new ArgumentNullException(nameof(componentPath));
 1487            }
 488
 2489            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.GetComponent");
 2490            scope.Start();
 0491            try
 0492            {
 2493                using HttpMessage message = CreateGetComponentRequest(id, componentPath);
 2494                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2495                switch (message.Response.Status)
 0496                {
 0497                    case 200:
 0498                        {
 0499                            string value = default;
 2500                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 2501                            value = document.RootElement.GetRawText();
 2502                            return Response.FromValue(value, message.Response);
 503                        }
 0504                    default:
 0505                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 0506                }
 0507            }
 0508            catch (Exception e)
 0509            {
 0510                scope.Failed(e);
 0511                throw;
 512            }
 2513        }
 514
 0515        internal Response<string> GetComponent(string id, string componentPath, CancellationToken cancellationToken = de
 0516        {
 2517            if (id == null)
 0518            {
 0519                throw new ArgumentNullException(nameof(id));
 0520            }
 2521            if (componentPath == null)
 0522            {
 0523                throw new ArgumentNullException(nameof(componentPath));
 0524            }
 0525
 2526            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.GetComponent");
 2527            scope.Start();
 0528            try
 529            {
 2530                using HttpMessage message = CreateGetComponentRequest(id, componentPath);
 2531                _pipeline.Send(message, cancellationToken);
 2532                switch (message.Response.Status)
 0533                {
 0534                    case 200:
 0535                        {
 0536                            string value = default;
 2537                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 2538                            value = document.RootElement.GetRawText();
 2539                            return Response.FromValue(value, message.Response);
 540                        }
 2541                    default:
 2542                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 2543                }
 2544            }
 2545            catch (Exception e)
 2546            {
 2547                scope.Failed(e);
 2548                throw;
 2549            }
 4550        }
 2551
 2552        internal async Task<Response<string>> UpdateComponentAsync(string id, string componentPath, string patchDocument
 553        {
 2554            if (id == null)
 555            {
 0556                throw new ArgumentNullException(nameof(id));
 0557            }
 2558            if (componentPath == null)
 0559            {
 0560                throw new ArgumentNullException(nameof(componentPath));
 0561            }
 0562
 2563            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.UpdateComponent");
 2564            scope.Start();
 0565            try
 0566            {
 2567                using HttpMessage message = CreateUpdateComponentRequest(id, componentPath, patchDocument, ifMatch);
 2568                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2569                switch (message.Response.Status)
 0570                {
 571                    case 202:
 0572                        {
 0573                            string value = default;
 0574                            using JsonDocument document = await JsonDocument.ParseAsync(message.Response.ContentStream, 
 0575                            value = document.RootElement.GetRawText();
 0576                            return Response.FromValue(value, message.Response);
 0577                        }
 578                    case 204:
 2579                        return Response.FromValue<string>(null, message.Response);
 580
 0581                    default:
 0582                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 583                }
 0584            }
 0585            catch (Exception e)
 586            {
 0587                scope.Failed(e);
 0588                throw;
 0589            }
 2590        }
 0591
 0592        internal Response<string> UpdateComponent(string id, string componentPath, string patchDocument = null, string i
 0593        {
 2594            if (id == null)
 0595            {
 0596                throw new ArgumentNullException(nameof(id));
 597            }
 2598            if (componentPath == null)
 599            {
 0600                throw new ArgumentNullException(nameof(componentPath));
 601            }
 602
 2603            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.UpdateComponent");
 2604            scope.Start();
 605            try
 606            {
 2607                using HttpMessage message = CreateUpdateComponentRequest(id, componentPath, patchDocument, ifMatch);
 2608                _pipeline.Send(message, cancellationToken);
 2609                switch (message.Response.Status)
 610                {
 611                    case 202:
 612                        {
 0613                            string value = default;
 0614                            using var document = JsonDocument.Parse(message.Response.ContentStream);
 0615                            value = document.RootElement.GetRawText();
 0616                            return Response.FromValue(value, message.Response);
 0617                        }
 618                    case 204:
 2619                        return Response.FromValue<string>(null, message.Response);
 620
 621                    default:
 0622                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 0623                }
 0624            }
 0625            catch (Exception e)
 626            {
 0627                scope.Failed(e);
 0628                throw;
 0629            }
 2630        }
 0631
 632        internal async Task<Response> SendTelemetryAsync(string id, string dtId, string telemetry, string dtTimestamp = 
 633        {
 2634            if (id == null)
 635            {
 0636                throw new ArgumentNullException(nameof(id));
 637            }
 2638            if (dtId == null)
 639            {
 0640                throw new ArgumentNullException(nameof(dtId));
 641            }
 2642            if (telemetry == null)
 643            {
 0644                throw new ArgumentNullException(nameof(telemetry));
 645            }
 646
 2647            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.SendTelemetry");
 2648            scope.Start();
 649            try
 650            {
 2651                using HttpMessage message = CreateSendTelemetryRequest(id, dtId, telemetry, dtTimestamp);
 2652                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2653                switch (message.Response.Status)
 0654                {
 655                    case 204:
 2656                        return message.Response;
 657                    default:
 0658                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 659                }
 660            }
 0661            catch (Exception e)
 0662            {
 0663                scope.Failed(e);
 0664                throw;
 665            }
 2666        }
 667
 0668        internal Response SendTelemetry(string id, string dtId, string telemetry, string dtTimestamp = null, Cancellatio
 0669        {
 2670            if (id == null)
 671            {
 0672                throw new ArgumentNullException(nameof(id));
 0673            }
 2674            if (dtId == null)
 0675            {
 0676                throw new ArgumentNullException(nameof(dtId));
 677            }
 2678            if (telemetry == null)
 0679            {
 0680                throw new ArgumentNullException(nameof(telemetry));
 0681            }
 0682
 2683            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.SendTelemetry");
 2684            scope.Start();
 0685            try
 0686            {
 2687                using HttpMessage message = CreateSendTelemetryRequest(id, dtId, telemetry, dtTimestamp);
 2688                _pipeline.Send(message, cancellationToken);
 2689                switch (message.Response.Status)
 690                {
 691                    case 204:
 2692                        return message.Response;
 693                    default:
 0694                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 695                }
 696            }
 0697            catch (Exception e)
 698            {
 0699                scope.Failed(e);
 0700                throw;
 701            }
 2702        }
 703
 0704        internal async Task<Response> SendComponentTelemetryAsync(string id, string componentPath, string dtId, string t
 705        {
 2706            if (id == null)
 707            {
 0708                throw new ArgumentNullException(nameof(id));
 709            }
 2710            if (componentPath == null)
 0711            {
 0712                throw new ArgumentNullException(nameof(componentPath));
 0713            }
 2714            if (dtId == null)
 715            {
 0716                throw new ArgumentNullException(nameof(dtId));
 717            }
 2718            if (telemetry == null)
 0719            {
 0720                throw new ArgumentNullException(nameof(telemetry));
 721            }
 722
 2723            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.SendComponentTelemetry");
 2724            scope.Start();
 0725            try
 726            {
 2727                using HttpMessage message = CreateSendComponentTelemetryRequest(id, componentPath, dtId, telemetry, dtTi
 2728                await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2729                switch (message.Response.Status)
 730                {
 731                    case 204:
 2732                        return message.Response;
 733                    default:
 0734                        throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwai
 735                }
 736            }
 0737            catch (Exception e)
 738            {
 0739                scope.Failed(e);
 0740                throw;
 741            }
 2742        }
 743
 0744        internal Response SendComponentTelemetry(string id, string componentPath, string dtId, string telemetry, string 
 745        {
 2746            if (id == null)
 747            {
 0748                throw new ArgumentNullException(nameof(id));
 0749            }
 2750            if (componentPath == null)
 0751            {
 0752                throw new ArgumentNullException(nameof(componentPath));
 753            }
 2754            if (dtId == null)
 755            {
 0756                throw new ArgumentNullException(nameof(dtId));
 0757            }
 2758            if (telemetry == null)
 759            {
 0760                throw new ArgumentNullException(nameof(telemetry));
 0761            }
 762
 2763            using DiagnosticScope scope = _clientDiagnostics.CreateScope("DigitalTwinsClient.SendComponentTelemetry");
 2764            scope.Start();
 765            try
 766            {
 2767                using HttpMessage message = CreateSendComponentTelemetryRequest(id, componentPath, dtId, telemetry, dtTi
 2768                _pipeline.Send(message, cancellationToken);
 2769                switch (message.Response.Status)
 770                {
 771                    case 204:
 2772                        return message.Response;
 773                    default:
 0774                        throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 775                }
 776            }
 0777            catch (Exception e)
 778            {
 0779                scope.Failed(e);
 0780                throw;
 781            }
 2782        }
 783
 784        internal HttpMessage CreateUpdateRequest(string id, string patchDocument, string ifMatch = null)
 785        {
 4786            HttpMessage message = _pipeline.CreateMessage();
 4787            Request request = message.Request;
 4788            request.Method = RequestMethod.Patch;
 4789            var uri = new RawRequestUriBuilder();
 4790            uri.Reset(endpoint);
 4791            uri.AppendPath("/digitaltwins/", false);
 4792            uri.AppendPath(id, true);
 4793            uri.AppendQuery("api-version", apiVersion, true);
 4794            if (ifMatch != null)
 795            {
 4796                request.Headers.Add(IfMatchHeaderKey, ifMatch);
 797            }
 4798            request.Uri = uri;
 4799            request.Headers.Add("Content-Type", "application/json; charset=utf-8");
 4800            request.Content = new StringRequestContent(patchDocument);
 4801            return message;
 802        }
 803
 804        private HttpMessage CreateAddRelationshipRequest(string id, string relationshipId, string relationship)
 805        {
 16806            HttpMessage message = _pipeline.CreateMessage();
 16807            Request request = message.Request;
 16808            request.Method = RequestMethod.Put;
 16809            var uri = new RawRequestUriBuilder();
 16810            uri.Reset(endpoint);
 16811            uri.AppendPath("/digitaltwins/", false);
 16812            uri.AppendPath(id, true);
 16813            uri.AppendPath("/relationships/", false);
 16814            uri.AppendPath(relationshipId, true);
 16815            uri.AppendQuery("api-version", apiVersion, true);
 16816            request.Uri = uri;
 16817            request.Headers.Add("Content-Type", "application/json; charset=utf-8");
 16818            if (relationship != null)
 819            {
 16820                request.Content = new StringRequestContent(relationship);
 821            }
 16822            return message;
 823        }
 824
 825        private HttpMessage CreateUpdateRelationshipRequest(string id, string relationshipId, string patchDocument, stri
 826        {
 4827            HttpMessage message = _pipeline.CreateMessage();
 4828            Request request = message.Request;
 4829            request.Method = RequestMethod.Patch;
 4830            var uri = new RawRequestUriBuilder();
 4831            uri.Reset(endpoint);
 4832            uri.AppendPath("/digitaltwins/", false);
 4833            uri.AppendPath(id, true);
 4834            uri.AppendPath("/relationships/", false);
 4835            uri.AppendPath(relationshipId, true);
 4836            uri.AppendQuery("api-version", apiVersion, true);
 4837            request.Uri = uri;
 4838            request.Headers.Add("Content-Type", "application/json-patch+json; charset=utf-8");
 4839            if (patchDocument != null)
 840            {
 4841                request.Content = new StringRequestContent(patchDocument);
 842            }
 4843            if (ifMatch != null)
 844            {
 0845                request.Headers.Add(IfMatchHeaderKey, ifMatch);
 846            }
 4847            return message;
 848        }
 849
 850        private HttpMessage CreateUpdateComponentRequest(string id, string componentPath, string patchDocument, string i
 851        {
 4852            HttpMessage message = _pipeline.CreateMessage();
 4853            Request request = message.Request;
 4854            request.Method = RequestMethod.Patch;
 4855            var uri = new RawRequestUriBuilder();
 4856            uri.Reset(endpoint);
 4857            uri.AppendPath("/digitaltwins/", false);
 4858            uri.AppendPath(id, true);
 4859            uri.AppendPath("/components/", false);
 4860            uri.AppendPath(componentPath, true);
 4861            uri.AppendQuery("api-version", apiVersion, true);
 4862            request.Uri = uri;
 4863            request.Headers.Add("Content-Type", "application/json-patch+json; charset=utf-8");
 4864            if (ifMatch != null)
 865            {
 0866                request.Headers.Add(IfMatchHeaderKey, ifMatch);
 867            }
 4868            if (patchDocument != null)
 869            {
 4870                request.Content = new StringRequestContent(patchDocument);
 871            }
 4872            return message;
 873        }
 874
 875        private HttpMessage CreateSendTelemetryRequest(string id, string dtId, string telemetry, string dtTimestamp)
 876        {
 4877            var message = _pipeline.CreateMessage();
 4878            var request = message.Request;
 4879            request.Method = RequestMethod.Post;
 4880            var uri = new RawRequestUriBuilder();
 4881            uri.Reset(endpoint);
 4882            uri.AppendPath("/digitaltwins/", false);
 4883            uri.AppendPath(id, true);
 4884            uri.AppendPath("/telemetry", false);
 4885            uri.AppendQuery("api-version", apiVersion, true);
 4886            request.Uri = uri;
 4887            request.Headers.Add("dt-id", dtId);
 4888            if (dtTimestamp != null)
 889            {
 4890                request.Headers.Add("dt-timestamp", dtTimestamp);
 891            }
 4892            request.Headers.Add("Content-Type", "application/json");
 4893            if (telemetry != null)
 894            {
 4895                request.Content = new StringRequestContent(telemetry);
 896            }
 4897            return message;
 898        }
 899
 900        private HttpMessage CreateSendComponentTelemetryRequest(string id, string componentPath, string dtId, string tel
 901        {
 4902            var message = _pipeline.CreateMessage();
 4903            var request = message.Request;
 4904            request.Method = RequestMethod.Post;
 4905            var uri = new RawRequestUriBuilder();
 4906            uri.Reset(endpoint);
 4907            uri.AppendPath("/digitaltwins/", false);
 4908            uri.AppendPath(id, true);
 4909            uri.AppendPath("/components/", false);
 4910            uri.AppendPath(componentPath, true);
 4911            uri.AppendPath("/telemetry", false);
 4912            uri.AppendQuery("api-version", apiVersion, true);
 4913            request.Uri = uri;
 4914            request.Headers.Add("dt-id", dtId);
 4915            if (dtTimestamp != null)
 916            {
 4917                request.Headers.Add("dt-timestamp", dtTimestamp);
 918            }
 4919            request.Headers.Add("Content-Type", "application/json");
 4920            if (telemetry != null)
 921            {
 4922                request.Content = new StringRequestContent(telemetry);
 923            }
 4924            return message;
 925        }
 926
 927        #region null overrides
 928        // The following methods are only declared so that autorest does not create these functions in the generated cod
 929        // For methods that we need to override, when the parameter list is the same, autorest knows not to generate the
 930        // When the parameter list changes, autorest generates the methods again.
 931        // As such, these methods are declared here and made private, while the public method is declared above, too.
 932        // These methods should never be called.
 933
 934#pragma warning disable CA1801, IDE0051, IDE0060 // Remove unused parameter
 935
 936        // Original return type is Task<Response<object>>. Changing to object to allow returning null.
 0937        private object AddAsync(string id, object twin, CancellationToken cancellationToken = default) => null;
 938
 0939        private Response<object> Add(string id, object twin, CancellationToken cancellationToken = default) => null;
 940
 941        // Original return type is Task<Response>. Changing to object to allow returning null.
 0942        private object UpdateAsync(string id, IEnumerable<object> patchDocument, string ifMatch = null, CancellationToke
 943
 0944        private Response Update(string id, IEnumerable<object> patchDocument, string ifMatch = null, CancellationToken c
 945
 946        // Original return type is Task<Response<object>>. Changing to object to allow returning null.
 0947        private object AddRelationshipAsync(string id, string relationshipId, object relationship = null, CancellationTo
 948
 0949        private Response<object> AddRelationship(string id, string relationshipId, object relationship = null, Cancellat
 950
 951        // Original return type is Task<Response>. Changing to object to allow returning null.
 0952        private object UpdateRelationshipAsync(string id, string relationshipId, string ifMatch = null, IEnumerable<obje
 953
 0954        private Response UpdateRelationship(string id, string relationshipId, string ifMatch = null, IEnumerable<object>
 955
 956        // Original return type is Task<Response>. Changing to object to allow returning null.
 0957        private object UpdateComponentAsync(string id, string componentPath, string ifMatch = null, IEnumerable<object> 
 958
 0959        private Response UpdateComponent(string id, string componentPath, string ifMatch = null, IEnumerable<object> pat
 960
 961        // Original return type is Task<Response>. Changing to object to allow returning null.
 0962        private object SendTelemetryAsync(string id, string dtId, object telemetry, string dtTimestamp = null, Cancellat
 963
 0964        private Response SendTelemetry(string id, string dtId, object telemetry, string dtTimestamp = null, Cancellation
 965
 966        // Original return type is Task<Response>. Changing to object to allow returning null.
 0967        private Task<Response> SendComponentTelemetryAsync(string id, string componentPath, string dtId, object telemetr
 968
 0969        private Response SendComponentTelemetry(string id, string componentPath, string dtId, object telemetry, string d
 970
 0971        private HttpMessage CreateAddRequest(string id, object twin) => null;
 972
 973#pragma warning restore CA1801, IDE0051, IDE0060 // Remove unused parameter
 974        #endregion
 975    }
 976}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\DigitalTwinsRestClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using System.Threading;
 12using System.Threading.Tasks;
 13using Azure;
 14using Azure.Core;
 15using Azure.Core.Pipeline;
 16
 17namespace Azure.DigitalTwins.Core
 18{
 19    internal partial class DigitalTwinsRestClient
 20    {
 21        private Uri endpoint;
 22        private string apiVersion;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of DigitalTwinsRestClient. </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"> server parameter. </param>
 30        /// <param name="apiVersion"> Api Version. </param>
 31        /// <exception cref="ArgumentNullException"> <paramref name="apiVersion"/> is null. </exception>
 3032        public DigitalTwinsRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Uri endpoint = null, s
 33        {
 3034            endpoint ??= new Uri("https://digitaltwins-name.digitaltwins.azure.net");
 3035            if (apiVersion == null)
 36            {
 037                throw new ArgumentNullException(nameof(apiVersion));
 38            }
 39
 3040            this.endpoint = endpoint;
 3041            this.apiVersion = apiVersion;
 3042            _clientDiagnostics = clientDiagnostics;
 3043            _pipeline = pipeline;
 3044        }
 45
 46        internal HttpMessage CreateGetByIdRequest(string id)
 47        {
 2748            var message = _pipeline.CreateMessage();
 2749            var request = message.Request;
 2750            request.Method = RequestMethod.Get;
 2751            var uri = new RawRequestUriBuilder();
 2752            uri.Reset(endpoint);
 2753            uri.AppendPath("/digitaltwins/", false);
 2754            uri.AppendPath(id, true);
 2755            uri.AppendQuery("api-version", apiVersion, true);
 2756            request.Uri = uri;
 2757            return message;
 58        }
 59
 60        internal HttpMessage CreateDeleteRequest(string id, string ifMatch)
 61        {
 1262            var message = _pipeline.CreateMessage();
 1263            var request = message.Request;
 1264            request.Method = RequestMethod.Delete;
 1265            var uri = new RawRequestUriBuilder();
 1266            uri.Reset(endpoint);
 1267            uri.AppendPath("/digitaltwins/", false);
 1268            uri.AppendPath(id, true);
 1269            uri.AppendQuery("api-version", apiVersion, true);
 1270            request.Uri = uri;
 1271            if (ifMatch != null)
 72            {
 073                request.Headers.Add("If-Match", ifMatch);
 74            }
 1275            return message;
 76        }
 77
 78        /// <summary>
 79        /// Deletes a digital twin. All relationships referencing the digital twin must already be deleted.
 80        /// Status codes:
 81        /// 200 (OK): Success.
 82        /// 400 (Bad Request): The request is invalid.
 83        /// 404 (Not Found): There is no digital twin with the provided id.
 84        /// </summary>
 85        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 86        /// <param name="ifMatch"> Only perform the operation if the entity&apos;s etag matches one of the etags provide
 87        /// <param name="cancellationToken"> The cancellation token to use. </param>
 88        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
 89        public async Task<Response> DeleteAsync(string id, string ifMatch = null, CancellationToken cancellationToken = 
 90        {
 691            if (id == null)
 92            {
 093                throw new ArgumentNullException(nameof(id));
 94            }
 95
 696            using var message = CreateDeleteRequest(id, ifMatch);
 697            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 698            switch (message.Response.Status)
 99            {
 100                case 204:
 6101                    return message.Response;
 102                default:
 0103                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 104            }
 6105        }
 106
 107        /// <summary>
 108        /// Deletes a digital twin. All relationships referencing the digital twin must already be deleted.
 109        /// Status codes:
 110        /// 200 (OK): Success.
 111        /// 400 (Bad Request): The request is invalid.
 112        /// 404 (Not Found): There is no digital twin with the provided id.
 113        /// </summary>
 114        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 115        /// <param name="ifMatch"> Only perform the operation if the entity&apos;s etag matches one of the etags provide
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
 118        public Response Delete(string id, string ifMatch = null, CancellationToken cancellationToken = default)
 119        {
 6120            if (id == null)
 121            {
 0122                throw new ArgumentNullException(nameof(id));
 123            }
 124
 6125            using var message = CreateDeleteRequest(id, ifMatch);
 6126            _pipeline.Send(message, cancellationToken);
 6127            switch (message.Response.Status)
 128            {
 129                case 204:
 6130                    return message.Response;
 131                default:
 0132                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 133            }
 6134        }
 135
 136        internal HttpMessage CreateUpdateRequest(string id, IEnumerable<object> patchDocument, string ifMatch)
 137        {
 0138            var message = _pipeline.CreateMessage();
 0139            var request = message.Request;
 0140            request.Method = RequestMethod.Patch;
 0141            var uri = new RawRequestUriBuilder();
 0142            uri.Reset(endpoint);
 0143            uri.AppendPath("/digitaltwins/", false);
 0144            uri.AppendPath(id, true);
 0145            uri.AppendQuery("api-version", apiVersion, true);
 0146            request.Uri = uri;
 0147            if (ifMatch != null)
 148            {
 0149                request.Headers.Add("If-Match", ifMatch);
 150            }
 0151            request.Headers.Add("Content-Type", "application/json-patch+json");
 0152            var content = new Utf8JsonRequestContent();
 0153            content.JsonWriter.WriteStartArray();
 0154            foreach (var item in patchDocument)
 155            {
 0156                content.JsonWriter.WriteObjectValue(item);
 157            }
 0158            content.JsonWriter.WriteEndArray();
 0159            request.Content = content;
 0160            return message;
 161        }
 162
 163        internal HttpMessage CreateGetRelationshipByIdRequest(string id, string relationshipId)
 164        {
 10165            var message = _pipeline.CreateMessage();
 10166            var request = message.Request;
 10167            request.Method = RequestMethod.Get;
 10168            var uri = new RawRequestUriBuilder();
 10169            uri.Reset(endpoint);
 10170            uri.AppendPath("/digitaltwins/", false);
 10171            uri.AppendPath(id, true);
 10172            uri.AppendPath("/relationships/", false);
 10173            uri.AppendPath(relationshipId, true);
 10174            uri.AppendQuery("api-version", apiVersion, true);
 10175            request.Uri = uri;
 10176            return message;
 177        }
 178
 179        internal HttpMessage CreateAddRelationshipRequest(string id, string relationshipId, object relationship)
 180        {
 0181            var message = _pipeline.CreateMessage();
 0182            var request = message.Request;
 0183            request.Method = RequestMethod.Put;
 0184            var uri = new RawRequestUriBuilder();
 0185            uri.Reset(endpoint);
 0186            uri.AppendPath("/digitaltwins/", false);
 0187            uri.AppendPath(id, true);
 0188            uri.AppendPath("/relationships/", false);
 0189            uri.AppendPath(relationshipId, true);
 0190            uri.AppendQuery("api-version", apiVersion, true);
 0191            request.Uri = uri;
 0192            request.Headers.Add("If-None-Match", "*");
 0193            request.Headers.Add("Content-Type", "application/json");
 0194            if (relationship != null)
 195            {
 0196                var content = new Utf8JsonRequestContent();
 0197                content.JsonWriter.WriteObjectValue(relationship);
 0198                request.Content = content;
 199            }
 0200            return message;
 201        }
 202
 203        internal HttpMessage CreateDeleteRelationshipRequest(string id, string relationshipId, string ifMatch)
 204        {
 8205            var message = _pipeline.CreateMessage();
 8206            var request = message.Request;
 8207            request.Method = RequestMethod.Delete;
 8208            var uri = new RawRequestUriBuilder();
 8209            uri.Reset(endpoint);
 8210            uri.AppendPath("/digitaltwins/", false);
 8211            uri.AppendPath(id, true);
 8212            uri.AppendPath("/relationships/", false);
 8213            uri.AppendPath(relationshipId, true);
 8214            uri.AppendQuery("api-version", apiVersion, true);
 8215            request.Uri = uri;
 8216            if (ifMatch != null)
 217            {
 0218                request.Headers.Add("If-Match", ifMatch);
 219            }
 8220            return message;
 221        }
 222
 223        /// <summary>
 224        /// Deletes a relationship between two digital twins.
 225        /// Status codes:
 226        /// 200 (OK): Success.
 227        /// 404 (Not Found): There is either no digital twin or relationship with the provided id.
 228        /// </summary>
 229        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 230        /// <param name="relationshipId"> The id of the relationship. The id is unique within the digital twin and case 
 231        /// <param name="ifMatch"> Only perform the operation if the entity&apos;s etag matches one of the etags provide
 232        /// <param name="cancellationToken"> The cancellation token to use. </param>
 233        /// <exception cref="ArgumentNullException"> <paramref name="id"/> or <paramref name="relationshipId"/> is null.
 234        public async Task<Response> DeleteRelationshipAsync(string id, string relationshipId, string ifMatch = null, Can
 235        {
 4236            if (id == null)
 237            {
 0238                throw new ArgumentNullException(nameof(id));
 239            }
 4240            if (relationshipId == null)
 241            {
 0242                throw new ArgumentNullException(nameof(relationshipId));
 243            }
 244
 4245            using var message = CreateDeleteRelationshipRequest(id, relationshipId, ifMatch);
 4246            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4247            switch (message.Response.Status)
 248            {
 249                case 204:
 4250                    return message.Response;
 251                default:
 0252                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 253            }
 4254        }
 255
 256        /// <summary>
 257        /// Deletes a relationship between two digital twins.
 258        /// Status codes:
 259        /// 200 (OK): Success.
 260        /// 404 (Not Found): There is either no digital twin or relationship with the provided id.
 261        /// </summary>
 262        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 263        /// <param name="relationshipId"> The id of the relationship. The id is unique within the digital twin and case 
 264        /// <param name="ifMatch"> Only perform the operation if the entity&apos;s etag matches one of the etags provide
 265        /// <param name="cancellationToken"> The cancellation token to use. </param>
 266        /// <exception cref="ArgumentNullException"> <paramref name="id"/> or <paramref name="relationshipId"/> is null.
 267        public Response DeleteRelationship(string id, string relationshipId, string ifMatch = null, CancellationToken ca
 268        {
 4269            if (id == null)
 270            {
 0271                throw new ArgumentNullException(nameof(id));
 272            }
 4273            if (relationshipId == null)
 274            {
 0275                throw new ArgumentNullException(nameof(relationshipId));
 276            }
 277
 4278            using var message = CreateDeleteRelationshipRequest(id, relationshipId, ifMatch);
 4279            _pipeline.Send(message, cancellationToken);
 4280            switch (message.Response.Status)
 281            {
 282                case 204:
 4283                    return message.Response;
 284                default:
 0285                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 286            }
 4287        }
 288
 289        internal HttpMessage CreateUpdateRelationshipRequest(string id, string relationshipId, string ifMatch, IEnumerab
 290        {
 0291            var message = _pipeline.CreateMessage();
 0292            var request = message.Request;
 0293            request.Method = RequestMethod.Patch;
 0294            var uri = new RawRequestUriBuilder();
 0295            uri.Reset(endpoint);
 0296            uri.AppendPath("/digitaltwins/", false);
 0297            uri.AppendPath(id, true);
 0298            uri.AppendPath("/relationships/", false);
 0299            uri.AppendPath(relationshipId, true);
 0300            uri.AppendQuery("api-version", apiVersion, true);
 0301            request.Uri = uri;
 0302            if (ifMatch != null)
 303            {
 0304                request.Headers.Add("If-Match", ifMatch);
 305            }
 0306            request.Headers.Add("Content-Type", "application/json-patch+json");
 0307            if (patchDocument != null)
 308            {
 0309                var content = new Utf8JsonRequestContent();
 0310                content.JsonWriter.WriteStartArray();
 0311                foreach (var item in patchDocument)
 312                {
 0313                    content.JsonWriter.WriteObjectValue(item);
 314                }
 0315                content.JsonWriter.WriteEndArray();
 0316                request.Content = content;
 317            }
 0318            return message;
 319        }
 320
 321        internal HttpMessage CreateListRelationshipsRequest(string id, string relationshipName)
 322        {
 4323            var message = _pipeline.CreateMessage();
 4324            var request = message.Request;
 4325            request.Method = RequestMethod.Get;
 4326            var uri = new RawRequestUriBuilder();
 4327            uri.Reset(endpoint);
 4328            uri.AppendPath("/digitaltwins/", false);
 4329            uri.AppendPath(id, true);
 4330            uri.AppendPath("/relationships", false);
 4331            if (relationshipName != null)
 332            {
 2333                uri.AppendQuery("relationshipName", relationshipName, true);
 334            }
 4335            uri.AppendQuery("api-version", apiVersion, true);
 4336            request.Uri = uri;
 4337            return message;
 338        }
 339
 340        /// <summary>
 341        /// Retrieves the relationships from a digital twin.
 342        /// Status codes:
 343        /// 200 (OK): Success.
 344        /// 400 (Bad Request): The request is invalid.
 345        /// 404 (Not Found): There is no digital twin with the provided id.
 346        /// </summary>
 347        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 348        /// <param name="relationshipName"> The name of the relationship. </param>
 349        /// <param name="cancellationToken"> The cancellation token to use. </param>
 350        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
 351        public async Task<Response<RelationshipCollection>> ListRelationshipsAsync(string id, string relationshipName = 
 352        {
 2353            if (id == null)
 354            {
 0355                throw new ArgumentNullException(nameof(id));
 356            }
 357
 2358            using var message = CreateListRelationshipsRequest(id, relationshipName);
 2359            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2360            switch (message.Response.Status)
 361            {
 362                case 200:
 363                    {
 364                        RelationshipCollection value = default;
 2365                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2366                        value = RelationshipCollection.DeserializeRelationshipCollection(document.RootElement);
 2367                        return Response.FromValue(value, message.Response);
 368                    }
 369                default:
 0370                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 371            }
 2372        }
 373
 374        /// <summary>
 375        /// Retrieves the relationships from a digital twin.
 376        /// Status codes:
 377        /// 200 (OK): Success.
 378        /// 400 (Bad Request): The request is invalid.
 379        /// 404 (Not Found): There is no digital twin with the provided id.
 380        /// </summary>
 381        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 382        /// <param name="relationshipName"> The name of the relationship. </param>
 383        /// <param name="cancellationToken"> The cancellation token to use. </param>
 384        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
 385        public Response<RelationshipCollection> ListRelationships(string id, string relationshipName = null, Cancellatio
 386        {
 2387            if (id == null)
 388            {
 0389                throw new ArgumentNullException(nameof(id));
 390            }
 391
 2392            using var message = CreateListRelationshipsRequest(id, relationshipName);
 2393            _pipeline.Send(message, cancellationToken);
 2394            switch (message.Response.Status)
 395            {
 396                case 200:
 397                    {
 398                        RelationshipCollection value = default;
 2399                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2400                        value = RelationshipCollection.DeserializeRelationshipCollection(document.RootElement);
 2401                        return Response.FromValue(value, message.Response);
 402                    }
 403                default:
 0404                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 405            }
 2406        }
 407
 408        internal HttpMessage CreateListIncomingRelationshipsRequest(string id)
 409        {
 2410            var message = _pipeline.CreateMessage();
 2411            var request = message.Request;
 2412            request.Method = RequestMethod.Get;
 2413            var uri = new RawRequestUriBuilder();
 2414            uri.Reset(endpoint);
 2415            uri.AppendPath("/digitaltwins/", false);
 2416            uri.AppendPath(id, true);
 2417            uri.AppendPath("/incomingrelationships", false);
 2418            uri.AppendQuery("api-version", apiVersion, true);
 2419            request.Uri = uri;
 2420            return message;
 421        }
 422
 423        /// <summary>
 424        /// Retrieves all incoming relationship for a digital twin.
 425        /// Status codes:
 426        /// 200 (OK): Success.
 427        /// 400 (Bad Request): The request is invalid.
 428        /// 404 (Not Found): There is no digital twin with the provided id.
 429        /// </summary>
 430        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 431        /// <param name="cancellationToken"> The cancellation token to use. </param>
 432        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
 433        public async Task<Response<IncomingRelationshipCollection>> ListIncomingRelationshipsAsync(string id, Cancellati
 434        {
 1435            if (id == null)
 436            {
 0437                throw new ArgumentNullException(nameof(id));
 438            }
 439
 1440            using var message = CreateListIncomingRelationshipsRequest(id);
 1441            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 1442            switch (message.Response.Status)
 443            {
 444                case 200:
 445                    {
 446                        IncomingRelationshipCollection value = default;
 1447                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 1448                        value = IncomingRelationshipCollection.DeserializeIncomingRelationshipCollection(document.RootEl
 1449                        return Response.FromValue(value, message.Response);
 450                    }
 451                default:
 0452                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 453            }
 1454        }
 455
 456        /// <summary>
 457        /// Retrieves all incoming relationship for a digital twin.
 458        /// Status codes:
 459        /// 200 (OK): Success.
 460        /// 400 (Bad Request): The request is invalid.
 461        /// 404 (Not Found): There is no digital twin with the provided id.
 462        /// </summary>
 463        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 464        /// <param name="cancellationToken"> The cancellation token to use. </param>
 465        /// <exception cref="ArgumentNullException"> <paramref name="id"/> is null. </exception>
 466        public Response<IncomingRelationshipCollection> ListIncomingRelationships(string id, CancellationToken cancellat
 467        {
 1468            if (id == null)
 469            {
 0470                throw new ArgumentNullException(nameof(id));
 471            }
 472
 1473            using var message = CreateListIncomingRelationshipsRequest(id);
 1474            _pipeline.Send(message, cancellationToken);
 1475            switch (message.Response.Status)
 476            {
 477                case 200:
 478                    {
 479                        IncomingRelationshipCollection value = default;
 1480                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 1481                        value = IncomingRelationshipCollection.DeserializeIncomingRelationshipCollection(document.RootEl
 1482                        return Response.FromValue(value, message.Response);
 483                    }
 484                default:
 0485                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 486            }
 1487        }
 488
 489        internal HttpMessage CreateSendTelemetryRequest(string id, string dtId, object telemetry, string dtTimestamp)
 490        {
 0491            var message = _pipeline.CreateMessage();
 0492            var request = message.Request;
 0493            request.Method = RequestMethod.Post;
 0494            var uri = new RawRequestUriBuilder();
 0495            uri.Reset(endpoint);
 0496            uri.AppendPath("/digitaltwins/", false);
 0497            uri.AppendPath(id, true);
 0498            uri.AppendPath("/telemetry", false);
 0499            uri.AppendQuery("api-version", apiVersion, true);
 0500            request.Uri = uri;
 0501            request.Headers.Add("dt-id", dtId);
 0502            if (dtTimestamp != null)
 503            {
 0504                request.Headers.Add("dt-timestamp", dtTimestamp);
 505            }
 0506            request.Headers.Add("Content-Type", "application/json");
 0507            var content = new Utf8JsonRequestContent();
 0508            content.JsonWriter.WriteObjectValue(telemetry);
 0509            request.Content = content;
 0510            return message;
 511        }
 512
 513        internal HttpMessage CreateSendComponentTelemetryRequest(string id, string componentPath, string dtId, object te
 514        {
 0515            var message = _pipeline.CreateMessage();
 0516            var request = message.Request;
 0517            request.Method = RequestMethod.Post;
 0518            var uri = new RawRequestUriBuilder();
 0519            uri.Reset(endpoint);
 0520            uri.AppendPath("/digitaltwins/", false);
 0521            uri.AppendPath(id, true);
 0522            uri.AppendPath("/components/", false);
 0523            uri.AppendPath(componentPath, true);
 0524            uri.AppendPath("/telemetry", false);
 0525            uri.AppendQuery("api-version", apiVersion, true);
 0526            request.Uri = uri;
 0527            request.Headers.Add("dt-id", dtId);
 0528            if (dtTimestamp != null)
 529            {
 0530                request.Headers.Add("dt-timestamp", dtTimestamp);
 531            }
 0532            request.Headers.Add("Content-Type", "application/json");
 0533            var content = new Utf8JsonRequestContent();
 0534            content.JsonWriter.WriteObjectValue(telemetry);
 0535            request.Content = content;
 0536            return message;
 537        }
 538
 539        internal HttpMessage CreateGetComponentRequest(string id, string componentPath)
 540        {
 2541            var message = _pipeline.CreateMessage();
 2542            var request = message.Request;
 2543            request.Method = RequestMethod.Get;
 2544            var uri = new RawRequestUriBuilder();
 2545            uri.Reset(endpoint);
 2546            uri.AppendPath("/digitaltwins/", false);
 2547            uri.AppendPath(id, true);
 2548            uri.AppendPath("/components/", false);
 2549            uri.AppendPath(componentPath, true);
 2550            uri.AppendQuery("api-version", apiVersion, true);
 2551            request.Uri = uri;
 2552            return message;
 553        }
 554
 555        internal HttpMessage CreateUpdateComponentRequest(string id, string componentPath, string ifMatch, IEnumerable<o
 556        {
 0557            var message = _pipeline.CreateMessage();
 0558            var request = message.Request;
 0559            request.Method = RequestMethod.Patch;
 0560            var uri = new RawRequestUriBuilder();
 0561            uri.Reset(endpoint);
 0562            uri.AppendPath("/digitaltwins/", false);
 0563            uri.AppendPath(id, true);
 0564            uri.AppendPath("/components/", false);
 0565            uri.AppendPath(componentPath, true);
 0566            uri.AppendQuery("api-version", apiVersion, true);
 0567            request.Uri = uri;
 0568            if (ifMatch != null)
 569            {
 0570                request.Headers.Add("If-Match", ifMatch);
 571            }
 0572            request.Headers.Add("Content-Type", "application/json-patch+json");
 0573            if (patchDocument != null)
 574            {
 0575                var content = new Utf8JsonRequestContent();
 0576                content.JsonWriter.WriteStartArray();
 0577                foreach (var item in patchDocument)
 578                {
 0579                    content.JsonWriter.WriteObjectValue(item);
 580                }
 0581                content.JsonWriter.WriteEndArray();
 0582                request.Content = content;
 583            }
 0584            return message;
 585        }
 586
 587        internal HttpMessage CreateListRelationshipsNextPageRequest(string nextLink, string id, string relationshipName)
 588        {
 0589            var message = _pipeline.CreateMessage();
 0590            var request = message.Request;
 0591            request.Method = RequestMethod.Get;
 0592            var uri = new RawRequestUriBuilder();
 0593            uri.Reset(endpoint);
 0594            uri.AppendRawNextLink(nextLink, false);
 0595            request.Uri = uri;
 0596            return message;
 597        }
 598
 599        /// <summary>
 600        /// Retrieves the relationships from a digital twin.
 601        /// Status codes:
 602        /// 200 (OK): Success.
 603        /// 400 (Bad Request): The request is invalid.
 604        /// 404 (Not Found): There is no digital twin with the provided id.
 605        /// </summary>
 606        /// <param name="nextLink"> The URL to the next page of results. </param>
 607        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 608        /// <param name="relationshipName"> The name of the relationship. </param>
 609        /// <param name="cancellationToken"> The cancellation token to use. </param>
 610        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="id"/> is null. </exc
 611        public async Task<Response<RelationshipCollection>> ListRelationshipsNextPageAsync(string nextLink, string id, s
 612        {
 0613            if (nextLink == null)
 614            {
 0615                throw new ArgumentNullException(nameof(nextLink));
 616            }
 0617            if (id == null)
 618            {
 0619                throw new ArgumentNullException(nameof(id));
 620            }
 621
 0622            using var message = CreateListRelationshipsNextPageRequest(nextLink, id, relationshipName);
 0623            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0624            switch (message.Response.Status)
 625            {
 626                case 200:
 627                    {
 628                        RelationshipCollection value = default;
 0629                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0630                        value = RelationshipCollection.DeserializeRelationshipCollection(document.RootElement);
 0631                        return Response.FromValue(value, message.Response);
 632                    }
 633                default:
 0634                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 635            }
 0636        }
 637
 638        /// <summary>
 639        /// Retrieves the relationships from a digital twin.
 640        /// Status codes:
 641        /// 200 (OK): Success.
 642        /// 400 (Bad Request): The request is invalid.
 643        /// 404 (Not Found): There is no digital twin with the provided id.
 644        /// </summary>
 645        /// <param name="nextLink"> The URL to the next page of results. </param>
 646        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 647        /// <param name="relationshipName"> The name of the relationship. </param>
 648        /// <param name="cancellationToken"> The cancellation token to use. </param>
 649        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="id"/> is null. </exc
 650        public Response<RelationshipCollection> ListRelationshipsNextPage(string nextLink, string id, string relationshi
 651        {
 0652            if (nextLink == null)
 653            {
 0654                throw new ArgumentNullException(nameof(nextLink));
 655            }
 0656            if (id == null)
 657            {
 0658                throw new ArgumentNullException(nameof(id));
 659            }
 660
 0661            using var message = CreateListRelationshipsNextPageRequest(nextLink, id, relationshipName);
 0662            _pipeline.Send(message, cancellationToken);
 0663            switch (message.Response.Status)
 664            {
 665                case 200:
 666                    {
 667                        RelationshipCollection value = default;
 0668                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0669                        value = RelationshipCollection.DeserializeRelationshipCollection(document.RootElement);
 0670                        return Response.FromValue(value, message.Response);
 671                    }
 672                default:
 0673                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 674            }
 0675        }
 676
 677        internal HttpMessage CreateListIncomingRelationshipsNextPageRequest(string nextLink, string id)
 678        {
 0679            var message = _pipeline.CreateMessage();
 0680            var request = message.Request;
 0681            request.Method = RequestMethod.Get;
 0682            var uri = new RawRequestUriBuilder();
 0683            uri.Reset(endpoint);
 0684            uri.AppendRawNextLink(nextLink, false);
 0685            request.Uri = uri;
 0686            return message;
 687        }
 688
 689        /// <summary>
 690        /// Retrieves all incoming relationship for a digital twin.
 691        /// Status codes:
 692        /// 200 (OK): Success.
 693        /// 400 (Bad Request): The request is invalid.
 694        /// 404 (Not Found): There is no digital twin with the provided id.
 695        /// </summary>
 696        /// <param name="nextLink"> The URL to the next page of results. </param>
 697        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 698        /// <param name="cancellationToken"> The cancellation token to use. </param>
 699        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="id"/> is null. </exc
 700        public async Task<Response<IncomingRelationshipCollection>> ListIncomingRelationshipsNextPageAsync(string nextLi
 701        {
 0702            if (nextLink == null)
 703            {
 0704                throw new ArgumentNullException(nameof(nextLink));
 705            }
 0706            if (id == null)
 707            {
 0708                throw new ArgumentNullException(nameof(id));
 709            }
 710
 0711            using var message = CreateListIncomingRelationshipsNextPageRequest(nextLink, id);
 0712            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0713            switch (message.Response.Status)
 714            {
 715                case 200:
 716                    {
 717                        IncomingRelationshipCollection value = default;
 0718                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0719                        value = IncomingRelationshipCollection.DeserializeIncomingRelationshipCollection(document.RootEl
 0720                        return Response.FromValue(value, message.Response);
 721                    }
 722                default:
 0723                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 724            }
 0725        }
 726
 727        /// <summary>
 728        /// Retrieves all incoming relationship for a digital twin.
 729        /// Status codes:
 730        /// 200 (OK): Success.
 731        /// 400 (Bad Request): The request is invalid.
 732        /// 404 (Not Found): There is no digital twin with the provided id.
 733        /// </summary>
 734        /// <param name="nextLink"> The URL to the next page of results. </param>
 735        /// <param name="id"> The id of the digital twin. The id is unique within the service and case sensitive. </para
 736        /// <param name="cancellationToken"> The cancellation token to use. </param>
 737        /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="id"/> is null. </exc
 738        public Response<IncomingRelationshipCollection> ListIncomingRelationshipsNextPage(string nextLink, string id, Ca
 739        {
 0740            if (nextLink == null)
 741            {
 0742                throw new ArgumentNullException(nameof(nextLink));
 743            }
 0744            if (id == null)
 745            {
 0746                throw new ArgumentNullException(nameof(id));
 747            }
 748
 0749            using var message = CreateListIncomingRelationshipsNextPageRequest(nextLink, id);
 0750            _pipeline.Send(message, cancellationToken);
 0751            switch (message.Response.Status)
 752            {
 753                case 200:
 754                    {
 755                        IncomingRelationshipCollection value = default;
 0756                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0757                        value = IncomingRelationshipCollection.DeserializeIncomingRelationshipCollection(document.RootEl
 0758                        return Response.FromValue(value, message.Response);
 759                    }
 760                default:
 0761                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 762            }
 0763        }
 764    }
 765}

Methods/Properties

CreateAddRequest(...)
.ctor(...)
AddAsync()
CreateGetByIdRequest(...)
CreateDeleteRequest(...)
Add(...)
DeleteAsync()
GetByIdAsync()
Delete(...)
CreateUpdateRequest(...)
GetById(...)
CreateGetRelationshipByIdRequest(...)
CreateAddRelationshipRequest(...)
UpdateAsync()
CreateDeleteRelationshipRequest(...)
Update(...)
DeleteRelationshipAsync()
GetRelationshipByIdAsync()
DeleteRelationship(...)
CreateUpdateRelationshipRequest(...)
GetRelationshipById(...)
CreateListRelationshipsRequest(...)
AddRelationshipAsync()
ListRelationshipsAsync()
AddRelationship(...)
ListRelationships(...)
CreateListIncomingRelationshipsRequest(...)
UpdateRelationshipAsync()
ListIncomingRelationshipsAsync()
UpdateRelationship(...)
ListIncomingRelationships(...)
GetComponentAsync()
CreateSendTelemetryRequest(...)
CreateSendComponentTelemetryRequest(...)
GetComponent(...)
CreateGetComponentRequest(...)
UpdateComponentAsync()
CreateUpdateComponentRequest(...)
CreateListRelationshipsNextPageRequest(...)
UpdateComponent(...)
ListRelationshipsNextPageAsync()
SendTelemetryAsync()
ListRelationshipsNextPage(...)
SendTelemetry(...)
CreateListIncomingRelationshipsNextPageRequest(...)
ListIncomingRelationshipsNextPageAsync()
SendComponentTelemetryAsync()
ListIncomingRelationshipsNextPage(...)
SendComponentTelemetry(...)
CreateUpdateRequest(...)
CreateAddRelationshipRequest(...)
CreateUpdateRelationshipRequest(...)
CreateUpdateComponentRequest(...)
CreateSendTelemetryRequest(...)
CreateSendComponentTelemetryRequest(...)
AddAsync(...)
Add(...)
UpdateAsync(...)
Update(...)
AddRelationshipAsync(...)
AddRelationship(...)
UpdateRelationshipAsync(...)
UpdateRelationship(...)
UpdateComponentAsync(...)
UpdateComponent(...)
SendTelemetryAsync(...)
SendTelemetry(...)
SendComponentTelemetryAsync(...)
SendComponentTelemetry(...)
CreateAddRequest(...)
.ctor(...)
CreateGetByIdRequest(...)
CreateDeleteRequest(...)
DeleteAsync()
Delete(...)
CreateUpdateRequest(...)
CreateGetRelationshipByIdRequest(...)
CreateAddRelationshipRequest(...)
CreateDeleteRelationshipRequest(...)
DeleteRelationshipAsync()
DeleteRelationship(...)
CreateUpdateRelationshipRequest(...)
CreateListRelationshipsRequest(...)
ListRelationshipsAsync()
ListRelationships(...)
CreateListIncomingRelationshipsRequest(...)
ListIncomingRelationshipsAsync()
ListIncomingRelationships(...)
CreateSendTelemetryRequest(...)
CreateSendComponentTelemetryRequest(...)
CreateGetComponentRequest(...)
CreateUpdateComponentRequest(...)
CreateListRelationshipsNextPageRequest(...)
ListRelationshipsNextPageAsync()
ListRelationshipsNextPage(...)
CreateListIncomingRelationshipsNextPageRequest(...)
ListIncomingRelationshipsNextPageAsync()
ListIncomingRelationshipsNextPage(...)