/// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="mobileAppTroubleshootingEventToInitialize">The <see cref="MobileAppTroubleshootingEvent"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(MobileAppTroubleshootingEvent mobileAppTroubleshootingEventToInitialize)
        {
            if (mobileAppTroubleshootingEventToInitialize != null && mobileAppTroubleshootingEventToInitialize.AdditionalData != null)
            {
                if (mobileAppTroubleshootingEventToInitialize.AppLogCollectionRequests != null && mobileAppTroubleshootingEventToInitialize.AppLogCollectionRequests.CurrentPage != null)
                {
                    mobileAppTroubleshootingEventToInitialize.AppLogCollectionRequests.AdditionalData = mobileAppTroubleshootingEventToInitialize.AdditionalData;

                    object nextPageLink;
                    mobileAppTroubleshootingEventToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink);
                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        mobileAppTroubleshootingEventToInitialize.AppLogCollectionRequests.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Adds the specified MobileAppTroubleshootingEvent to the collection via POST.
 /// </summary>
 /// <param name="mobileAppTroubleshootingEvent">The MobileAppTroubleshootingEvent to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created MobileAppTroubleshootingEvent.</returns>
 public System.Threading.Tasks.Task <MobileAppTroubleshootingEvent> AddAsync(MobileAppTroubleshootingEvent mobileAppTroubleshootingEvent, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <MobileAppTroubleshootingEvent>(mobileAppTroubleshootingEvent, cancellationToken));
 }
Esempio n. 3
0
 /// <summary>
 /// Adds the specified MobileAppTroubleshootingEvent to the collection via POST.
 /// </summary>
 /// <param name="mobileAppTroubleshootingEvent">The MobileAppTroubleshootingEvent to add.</param>
 /// <returns>The created MobileAppTroubleshootingEvent.</returns>
 public System.Threading.Tasks.Task <MobileAppTroubleshootingEvent> AddAsync(MobileAppTroubleshootingEvent mobileAppTroubleshootingEvent)
 {
     return(this.AddAsync(mobileAppTroubleshootingEvent, CancellationToken.None));
 }
        /// <summary>
        /// Creates the specified MobileAppTroubleshootingEvent using POST.
        /// </summary>
        /// <param name="mobileAppTroubleshootingEventToCreate">The MobileAppTroubleshootingEvent to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created MobileAppTroubleshootingEvent.</returns>
        public async System.Threading.Tasks.Task <MobileAppTroubleshootingEvent> CreateAsync(MobileAppTroubleshootingEvent mobileAppTroubleshootingEventToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <MobileAppTroubleshootingEvent>(mobileAppTroubleshootingEventToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified MobileAppTroubleshootingEvent using POST.
 /// </summary>
 /// <param name="mobileAppTroubleshootingEventToCreate">The MobileAppTroubleshootingEvent to create.</param>
 /// <returns>The created MobileAppTroubleshootingEvent.</returns>
 public System.Threading.Tasks.Task <MobileAppTroubleshootingEvent> CreateAsync(MobileAppTroubleshootingEvent mobileAppTroubleshootingEventToCreate)
 {
     return(this.CreateAsync(mobileAppTroubleshootingEventToCreate, CancellationToken.None));
 }
        /// <summary>
        /// Updates the specified MobileAppTroubleshootingEvent using PATCH.
        /// </summary>
        /// <param name="mobileAppTroubleshootingEventToUpdate">The MobileAppTroubleshootingEvent 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 MobileAppTroubleshootingEvent.</returns>
        public async System.Threading.Tasks.Task <MobileAppTroubleshootingEvent> UpdateAsync(MobileAppTroubleshootingEvent mobileAppTroubleshootingEventToUpdate, CancellationToken cancellationToken)
        {
            if (mobileAppTroubleshootingEventToUpdate.AdditionalData != null)
            {
                if (mobileAppTroubleshootingEventToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    mobileAppTroubleshootingEventToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileAppTroubleshootingEventToUpdate.GetType().Name)
                    });
                }
            }
            if (mobileAppTroubleshootingEventToUpdate.AdditionalData != null)
            {
                if (mobileAppTroubleshootingEventToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    mobileAppTroubleshootingEventToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, mobileAppTroubleshootingEventToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <MobileAppTroubleshootingEvent>(mobileAppTroubleshootingEventToUpdate, cancellationToken).ConfigureAwait(false);

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