Ejemplo n.º 1
0
        /// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="relyingpartydetailedsummary">The RelyingPartyDetailedSummary object set with the properties to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The task to await for async call.</returns>
        public async System.Threading.Tasks.Task <IReportRootGetRelyingPartyDetailedSummaryCollectionPage> PatchAsync(RelyingPartyDetailedSummary relyingpartydetailedsummary,
                                                                                                                      CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetRelyingPartyDetailedSummaryCollectionResponse>(relyingpartydetailedsummary, cancellationToken).ConfigureAwait(false);

            if (response != null && response.Value != null && response.Value.CurrentPage != null)
            {
                if (response.AdditionalData != null)
                {
                    response.Value.AdditionalData = response.AdditionalData;

                    object nextPageLink;
                    response.AdditionalData.TryGetValue("@odata.nextLink", out nextPageLink);

                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        response.Value.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                return(response.Value);
            }

            return(null);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="relyingpartydetailedsummary">The RelyingPartyDetailedSummary object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetRelyingPartyDetailedSummaryCollectionPage> PatchAsync(RelyingPartyDetailedSummary relyingpartydetailedsummary)
 {
     return(this.PatchAsync(relyingpartydetailedsummary, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified RelyingPartyDetailedSummary using POST.
        /// </summary>
        /// <param name="relyingPartyDetailedSummaryToCreate">The RelyingPartyDetailedSummary to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created RelyingPartyDetailedSummary.</returns>
        public async System.Threading.Tasks.Task <RelyingPartyDetailedSummary> CreateAsync(RelyingPartyDetailedSummary relyingPartyDetailedSummaryToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <RelyingPartyDetailedSummary>(relyingPartyDetailedSummaryToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified RelyingPartyDetailedSummary using POST.
 /// </summary>
 /// <param name="relyingPartyDetailedSummaryToCreate">The RelyingPartyDetailedSummary to create.</param>
 /// <returns>The created RelyingPartyDetailedSummary.</returns>
 public System.Threading.Tasks.Task <RelyingPartyDetailedSummary> CreateAsync(RelyingPartyDetailedSummary relyingPartyDetailedSummaryToCreate)
 {
     return(this.CreateAsync(relyingPartyDetailedSummaryToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="relyingPartyDetailedSummaryToInitialize">The <see cref="RelyingPartyDetailedSummary"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(RelyingPartyDetailedSummary relyingPartyDetailedSummaryToInitialize)
 {
 }
        /// <summary>
        /// Updates the specified RelyingPartyDetailedSummary using PATCH.
        /// </summary>
        /// <param name="relyingPartyDetailedSummaryToUpdate">The RelyingPartyDetailedSummary to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <exception cref="ClientException">Thrown when an object returned in a response is used for updating an object in Microsoft Graph.</exception>
        /// <returns>The updated RelyingPartyDetailedSummary.</returns>
        public async System.Threading.Tasks.Task <RelyingPartyDetailedSummary> UpdateAsync(RelyingPartyDetailedSummary relyingPartyDetailedSummaryToUpdate, CancellationToken cancellationToken)
        {
            if (relyingPartyDetailedSummaryToUpdate.AdditionalData != null)
            {
                if (relyingPartyDetailedSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    relyingPartyDetailedSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, relyingPartyDetailedSummaryToUpdate.GetType().Name)
                    });
                }
            }
            if (relyingPartyDetailedSummaryToUpdate.AdditionalData != null)
            {
                if (relyingPartyDetailedSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    relyingPartyDetailedSummaryToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, relyingPartyDetailedSummaryToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <RelyingPartyDetailedSummary>(relyingPartyDetailedSummaryToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }