/// <summary> /// Updates the specified ExactMatchDataStore using PATCH. /// </summary> /// <param name="exactMatchDataStoreToUpdate">The ExactMatchDataStore 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 ExactMatchDataStore.</returns> public async System.Threading.Tasks.Task <ExactMatchDataStore> UpdateAsync(ExactMatchDataStore exactMatchDataStoreToUpdate, CancellationToken cancellationToken) { if (exactMatchDataStoreToUpdate.AdditionalData != null) { if (exactMatchDataStoreToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || exactMatchDataStoreToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, exactMatchDataStoreToUpdate.GetType().Name) }); } } if (exactMatchDataStoreToUpdate.AdditionalData != null) { if (exactMatchDataStoreToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || exactMatchDataStoreToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, exactMatchDataStoreToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <ExactMatchDataStore>(exactMatchDataStoreToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Creates the specified ExactMatchDataStore using POST. /// </summary> /// <param name="exactMatchDataStoreToCreate">The ExactMatchDataStore to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ExactMatchDataStore.</returns> public async System.Threading.Tasks.Task <ExactMatchDataStore> CreateAsync(ExactMatchDataStore exactMatchDataStoreToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <ExactMatchDataStore>(exactMatchDataStoreToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="exactMatchDataStoreToInitialize">The <see cref="ExactMatchDataStore"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(ExactMatchDataStore exactMatchDataStoreToInitialize) { if (exactMatchDataStoreToInitialize != null && exactMatchDataStoreToInitialize.AdditionalData != null) { if (exactMatchDataStoreToInitialize.Sessions != null && exactMatchDataStoreToInitialize.Sessions.CurrentPage != null) { exactMatchDataStoreToInitialize.Sessions.AdditionalData = exactMatchDataStoreToInitialize.AdditionalData; object nextPageLink; exactMatchDataStoreToInitialize.AdditionalData.TryGetValue("*****@*****.**", out nextPageLink); var nextPageLinkString = nextPageLink as string; if (!string.IsNullOrEmpty(nextPageLinkString)) { exactMatchDataStoreToInitialize.Sessions.InitializeNextPageRequest( this.Client, nextPageLinkString); } } } }
/// <summary> /// Creates the specified ExactMatchDataStore using POST. /// </summary> /// <param name="exactMatchDataStoreToCreate">The ExactMatchDataStore to create.</param> /// <returns>The created ExactMatchDataStore.</returns> public System.Threading.Tasks.Task <ExactMatchDataStore> CreateAsync(ExactMatchDataStore exactMatchDataStoreToCreate) { return(this.CreateAsync(exactMatchDataStoreToCreate, CancellationToken.None)); }
/// <summary> /// Adds the specified ExactMatchDataStore to the collection via POST. /// </summary> /// <param name="exactMatchDataStore">The ExactMatchDataStore to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created ExactMatchDataStore.</returns> public System.Threading.Tasks.Task <ExactMatchDataStore> AddAsync(ExactMatchDataStore exactMatchDataStore, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <ExactMatchDataStore>(exactMatchDataStore, cancellationToken)); }