示例#1
0
        /// <summary>
        /// Updates the specified ExactMatchLookupJob using PATCH.
        /// </summary>
        /// <param name="exactMatchLookupJobToUpdate">The ExactMatchLookupJob 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 ExactMatchLookupJob.</returns>
        public async System.Threading.Tasks.Task <ExactMatchLookupJob> UpdateAsync(ExactMatchLookupJob exactMatchLookupJobToUpdate, CancellationToken cancellationToken)
        {
            if (exactMatchLookupJobToUpdate.AdditionalData != null)
            {
                if (exactMatchLookupJobToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    exactMatchLookupJobToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, exactMatchLookupJobToUpdate.GetType().Name)
                    });
                }
            }
            if (exactMatchLookupJobToUpdate.AdditionalData != null)
            {
                if (exactMatchLookupJobToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    exactMatchLookupJobToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, exactMatchLookupJobToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <ExactMatchLookupJob>(exactMatchLookupJobToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
示例#2
0
        /// <summary>
        /// Creates the specified ExactMatchLookupJob using POST.
        /// </summary>
        /// <param name="exactMatchLookupJobToCreate">The ExactMatchLookupJob to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created ExactMatchLookupJob.</returns>
        public async System.Threading.Tasks.Task <ExactMatchLookupJob> CreateAsync(ExactMatchLookupJob exactMatchLookupJobToCreate, CancellationToken cancellationToken)
        {
            this.ContentType = "application/json";
            this.Method      = "POST";
            var newEntity = await this.SendAsync <ExactMatchLookupJob>(exactMatchLookupJobToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
示例#3
0
        /// <summary>
        /// Initializes any collection properties after deserialization, like next requests for paging.
        /// </summary>
        /// <param name="exactMatchLookupJobToInitialize">The <see cref="ExactMatchLookupJob"/> with the collection properties to initialize.</param>
        private void InitializeCollectionProperties(ExactMatchLookupJob exactMatchLookupJobToInitialize)
        {
            if (exactMatchLookupJobToInitialize != null && exactMatchLookupJobToInitialize.AdditionalData != null)
            {
                if (exactMatchLookupJobToInitialize.MatchingRows != null && exactMatchLookupJobToInitialize.MatchingRows.CurrentPage != null)
                {
                    exactMatchLookupJobToInitialize.MatchingRows.AdditionalData = exactMatchLookupJobToInitialize.AdditionalData;

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

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        exactMatchLookupJobToInitialize.MatchingRows.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }
            }
        }
示例#4
0
 /// <summary>
 /// Creates the specified ExactMatchLookupJob using POST.
 /// </summary>
 /// <param name="exactMatchLookupJobToCreate">The ExactMatchLookupJob to create.</param>
 /// <returns>The created ExactMatchLookupJob.</returns>
 public System.Threading.Tasks.Task <ExactMatchLookupJob> CreateAsync(ExactMatchLookupJob exactMatchLookupJobToCreate)
 {
     return(this.CreateAsync(exactMatchLookupJobToCreate, CancellationToken.None));
 }