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