/// <summary>
        /// Creates the specified TeamsDeviceUsageUserDetail using POST.
        /// </summary>
        /// <param name="teamsDeviceUsageUserDetailToCreate">The TeamsDeviceUsageUserDetail to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created TeamsDeviceUsageUserDetail.</returns>
        public async System.Threading.Tasks.Task <TeamsDeviceUsageUserDetail> CreateAsync(TeamsDeviceUsageUserDetail teamsDeviceUsageUserDetailToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <TeamsDeviceUsageUserDetail>(teamsDeviceUsageUserDetailToCreate, cancellationToken).ConfigureAwait(false);

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

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
Exemple #5
0
        /// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="teamsdeviceusageuserdetail">The TeamsDeviceUsageUserDetail 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 <IReportRootGetTeamsDeviceUsageUserDetailCollectionPage> PatchAsync(TeamsDeviceUsageUserDetail teamsdeviceusageuserdetail,
                                                                                                                     CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetTeamsDeviceUsageUserDetailCollectionResponse>(teamsdeviceusageuserdetail, 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);
        }
Exemple #6
0
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="teamsdeviceusageuserdetail">The TeamsDeviceUsageUserDetail object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetTeamsDeviceUsageUserDetailCollectionPage> PatchAsync(TeamsDeviceUsageUserDetail teamsdeviceusageuserdetail)
 {
     return(this.PatchAsync(teamsdeviceusageuserdetail, CancellationToken.None));
 }