/// <summary>
        /// Updates the specified SingletonEntity2 using PATCH.
        /// </summary>
        /// <param name="singletonEntity2ToUpdate">The SingletonEntity2 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 SingletonEntity2.</returns>
        public async System.Threading.Tasks.Task <SingletonEntity2> UpdateAsync(SingletonEntity2 singletonEntity2ToUpdate, CancellationToken cancellationToken)
        {
            if (singletonEntity2ToUpdate.AdditionalData != null)
            {
                if (singletonEntity2ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    singletonEntity2ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, singletonEntity2ToUpdate.GetType().Name)
                    });
                }
            }
            if (singletonEntity2ToUpdate.AdditionalData != null)
            {
                if (singletonEntity2ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.ResponseHeaders) ||
                    singletonEntity2ToUpdate.AdditionalData.ContainsKey(Constants.HttpPropertyNames.StatusCode))
                {
                    throw new ClientException(
                              new Error
                    {
                        Code    = GeneratedErrorConstants.Codes.NotAllowed,
                        Message = String.Format(GeneratedErrorConstants.Messages.ResponseObjectUsedForUpdate, singletonEntity2ToUpdate.GetType().Name)
                    });
                }
            }
            this.ContentType = "application/json";
            this.Method      = "PATCH";
            var updatedEntity = await this.SendAsync <SingletonEntity2>(singletonEntity2ToUpdate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(updatedEntity);
            return(updatedEntity);
        }
コード例 #2
0
 /// <summary>
 /// Creates the specified SingletonEntity2 using POST.
 /// </summary>
 /// <param name="singletonEntity2ToCreate">The SingletonEntity2 to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created SingletonEntity2.</returns>
 public async System.Threading.Tasks.Task<SingletonEntity2> CreateAsync(SingletonEntity2 singletonEntity2ToCreate, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method = "POST";
     var newEntity = await this.SendAsync<SingletonEntity2>(singletonEntity2ToCreate, cancellationToken).ConfigureAwait(false);
     this.InitializeCollectionProperties(newEntity);
     return newEntity;
 }
        /// <summary>
        /// Creates the specified SingletonEntity2 using POST.
        /// </summary>
        /// <param name="singletonEntity2ToCreate">The SingletonEntity2 to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created SingletonEntity2.</returns>
        public async System.Threading.Tasks.Task <SingletonEntity2> CreateAsync(SingletonEntity2 singletonEntity2ToCreate, CancellationToken cancellationToken = default)
        {
            this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
            this.Method      = HttpMethods.POST;
            var newEntity = await this.SendAsync <SingletonEntity2>(singletonEntity2ToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
 /// <summary>
 /// Creates the specified SingletonEntity2 using POST.
 /// </summary>
 /// <param name="singletonEntity2ToCreate">The SingletonEntity2 to create.</param>
 /// <returns>The created SingletonEntity2.</returns>
 public System.Threading.Tasks.Task <SingletonEntity2> CreateAsync(SingletonEntity2 singletonEntity2ToCreate)
 {
     return(this.CreateAsync(singletonEntity2ToCreate, CancellationToken.None));
 }
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="singletonEntity2ToInitialize">The <see cref="SingletonEntity2"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(SingletonEntity2 singletonEntity2ToInitialize)
 {
 }
コード例 #6
0
 /// <summary>
 /// Updates the specified SingletonEntity2 using PATCH.
 /// </summary>
 /// <param name="singletonEntity2ToUpdate">The SingletonEntity2 to update.</param>
 /// <returns>The updated SingletonEntity2.</returns>
 public System.Threading.Tasks.Task<SingletonEntity2> UpdateAsync(SingletonEntity2 singletonEntity2ToUpdate)
 {
     return this.UpdateAsync(singletonEntity2ToUpdate, CancellationToken.None);
 }
 /// <summary>
 /// Creates the specified SingletonEntity2 using POST and returns a <see cref="GraphResponse{SingletonEntity2}"/> object.
 /// </summary>
 /// <param name="singletonEntity2ToCreate">The SingletonEntity2 to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The <see cref="GraphResponse{SingletonEntity2}"/> object of the request.</returns>
 public System.Threading.Tasks.Task <GraphResponse <SingletonEntity2> > CreateResponseAsync(SingletonEntity2 singletonEntity2ToCreate, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsyncWithGraphResponse <SingletonEntity2>(singletonEntity2ToCreate, cancellationToken));
 }