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