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