/// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="teamsuseractivityuserdetail">The TeamsUserActivityUserDetail 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 <IReportRootGetTeamsUserActivityUserDetailCollectionPage> PatchAsync(TeamsUserActivityUserDetail teamsuseractivityuserdetail,
                                                                                                                      CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetTeamsUserActivityUserDetailCollectionResponse>(teamsuseractivityuserdetail, 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);
        }
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="teamsuseractivityuserdetail">The TeamsUserActivityUserDetail object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetTeamsUserActivityUserDetailCollectionPage> PatchAsync(TeamsUserActivityUserDetail teamsuseractivityuserdetail)
 {
     return(this.PatchAsync(teamsuseractivityuserdetail, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified TeamsUserActivityUserDetail using POST.
        /// </summary>
        /// <param name="teamsUserActivityUserDetailToCreate">The TeamsUserActivityUserDetail to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created TeamsUserActivityUserDetail.</returns>
        public async System.Threading.Tasks.Task <TeamsUserActivityUserDetail> CreateAsync(TeamsUserActivityUserDetail teamsUserActivityUserDetailToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <TeamsUserActivityUserDetail>(teamsUserActivityUserDetailToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified TeamsUserActivityUserDetail using POST.
 /// </summary>
 /// <param name="teamsUserActivityUserDetailToCreate">The TeamsUserActivityUserDetail to create.</param>
 /// <returns>The created TeamsUserActivityUserDetail.</returns>
 public System.Threading.Tasks.Task <TeamsUserActivityUserDetail> CreateAsync(TeamsUserActivityUserDetail teamsUserActivityUserDetailToCreate)
 {
     return(this.CreateAsync(teamsUserActivityUserDetailToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="teamsUserActivityUserDetailToInitialize">The <see cref="TeamsUserActivityUserDetail"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(TeamsUserActivityUserDetail teamsUserActivityUserDetailToInitialize)
 {
 }
        /// <summary>
        /// Updates the specified TeamsUserActivityUserDetail using PATCH.
        /// </summary>
        /// <param name="teamsUserActivityUserDetailToUpdate">The TeamsUserActivityUserDetail 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 TeamsUserActivityUserDetail.</returns>
        public async System.Threading.Tasks.Task <TeamsUserActivityUserDetail> UpdateAsync(TeamsUserActivityUserDetail teamsUserActivityUserDetailToUpdate, CancellationToken cancellationToken)
        {
            if (teamsUserActivityUserDetailToUpdate.AdditionalData != null)
            {
                if (teamsUserActivityUserDetailToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    teamsUserActivityUserDetailToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, teamsUserActivityUserDetailToUpdate.GetType().Name)
                    });
                }
            }
            if (teamsUserActivityUserDetailToUpdate.AdditionalData != null)
            {
                if (teamsUserActivityUserDetailToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    teamsUserActivityUserDetailToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, teamsUserActivityUserDetailToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <TeamsUserActivityUserDetail>(teamsUserActivityUserDetailToUpdate, cancellationToken).ConfigureAwait(false);

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