/// <summary> /// Adds the specified CertificateBasedAuthConfiguration to the collection via POST. /// </summary> /// <param name="certificateBasedAuthConfiguration">The CertificateBasedAuthConfiguration to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The task to await.</returns> public System.Threading.Tasks.Task AddAsync(CertificateBasedAuthConfiguration certificateBasedAuthConfiguration, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; if (string.IsNullOrEmpty(certificateBasedAuthConfiguration.Id)) { throw new ServiceException(new Error { Code = "invalidRequest", Message = "ID is required to add a reference." }); } var requestBody = new ReferenceRequestBody { ODataId = string.Format("{0}/certificateBasedAuthConfiguration/{1}", this.Client.BaseUrl, certificateBasedAuthConfiguration.Id) }; return(this.SendAsync(requestBody, cancellationToken)); }
/// <summary> /// Creates the specified CertificateBasedAuthConfiguration using POST. /// </summary> /// <param name="certificateBasedAuthConfigurationToCreate">The CertificateBasedAuthConfiguration to create.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created CertificateBasedAuthConfiguration.</returns> public async System.Threading.Tasks.Task <CertificateBasedAuthConfiguration> CreateAsync(CertificateBasedAuthConfiguration certificateBasedAuthConfigurationToCreate, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; var newEntity = await this.SendAsync <CertificateBasedAuthConfiguration>(certificateBasedAuthConfigurationToCreate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(newEntity); return(newEntity); }
/// <summary> /// Creates the specified CertificateBasedAuthConfiguration using POST. /// </summary> /// <param name="certificateBasedAuthConfigurationToCreate">The CertificateBasedAuthConfiguration to create.</param> /// <returns>The created CertificateBasedAuthConfiguration.</returns> public System.Threading.Tasks.Task <CertificateBasedAuthConfiguration> CreateAsync(CertificateBasedAuthConfiguration certificateBasedAuthConfigurationToCreate) { return(this.CreateAsync(certificateBasedAuthConfigurationToCreate, CancellationToken.None)); }
/// <summary> /// Initializes any collection properties after deserialization, like next requests for paging. /// </summary> /// <param name="certificateBasedAuthConfigurationToInitialize">The <see cref="CertificateBasedAuthConfiguration"/> with the collection properties to initialize.</param> private void InitializeCollectionProperties(CertificateBasedAuthConfiguration certificateBasedAuthConfigurationToInitialize) { }
/// <summary> /// Updates the specified CertificateBasedAuthConfiguration using PATCH. /// </summary> /// <param name="certificateBasedAuthConfigurationToUpdate">The CertificateBasedAuthConfiguration 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 CertificateBasedAuthConfiguration.</returns> public async System.Threading.Tasks.Task <CertificateBasedAuthConfiguration> UpdateAsync(CertificateBasedAuthConfiguration certificateBasedAuthConfigurationToUpdate, CancellationToken cancellationToken) { if (certificateBasedAuthConfigurationToUpdate.AdditionalData != null) { if (certificateBasedAuthConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || certificateBasedAuthConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, certificateBasedAuthConfigurationToUpdate.GetType().Name) }); } } if (certificateBasedAuthConfigurationToUpdate.AdditionalData != null) { if (certificateBasedAuthConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) || certificateBasedAuthConfigurationToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode)) { throw new ClientException( new Error { Code = GeneratedErrorConstants.Codes.NotAllowed, Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, certificateBasedAuthConfigurationToUpdate.GetType().Name) }); } } this.ContentType = "application/json"; this.Method = "PATCH"; var updatedEntity = await this.SendAsync <CertificateBasedAuthConfiguration>(certificateBasedAuthConfigurationToUpdate, cancellationToken).ConfigureAwait(false); this.InitializeCollectionProperties(updatedEntity); return(updatedEntity); }
/// <summary> /// Adds the specified CertificateBasedAuthConfiguration to the collection via POST. /// </summary> /// <param name="certificateBasedAuthConfiguration">The CertificateBasedAuthConfiguration to add.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param> /// <returns>The created CertificateBasedAuthConfiguration.</returns> public System.Threading.Tasks.Task <CertificateBasedAuthConfiguration> AddAsync(CertificateBasedAuthConfiguration certificateBasedAuthConfiguration, CancellationToken cancellationToken) { this.ContentType = "application/json"; this.Method = "POST"; return(this.SendAsync <CertificateBasedAuthConfiguration>(certificateBasedAuthConfiguration, cancellationToken)); }
/// <summary> /// Adds the specified CertificateBasedAuthConfiguration to the collection via POST. /// </summary> /// <param name="certificateBasedAuthConfiguration">The CertificateBasedAuthConfiguration to add.</param> /// <returns>The task to await.</returns> public System.Threading.Tasks.Task AddAsync(CertificateBasedAuthConfiguration certificateBasedAuthConfiguration) { return(this.AddAsync(certificateBasedAuthConfiguration, CancellationToken.None)); }