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

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        temporaryAccessPassAuthenticationMethodConfigurationToInitialize.IncludeTargets.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Creates the specified TemporaryAccessPassAuthenticationMethodConfiguration using POST.
        /// </summary>
        /// <param name="temporaryAccessPassAuthenticationMethodConfigurationToCreate">The TemporaryAccessPassAuthenticationMethodConfiguration to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created TemporaryAccessPassAuthenticationMethodConfiguration.</returns>
        public async System.Threading.Tasks.Task <TemporaryAccessPassAuthenticationMethodConfiguration> CreateAsync(TemporaryAccessPassAuthenticationMethodConfiguration temporaryAccessPassAuthenticationMethodConfigurationToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <TemporaryAccessPassAuthenticationMethodConfiguration>(temporaryAccessPassAuthenticationMethodConfigurationToCreate, cancellationToken).ConfigureAwait(false);

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

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