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