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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Creates the specified TimeOffRequestObject using POST.
        /// </summary>
        /// <param name="timeOffRequestObjectToCreate">The TimeOffRequestObject to create.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The created TimeOffRequestObject.</returns>
        public async System.Threading.Tasks.Task <TimeOffRequestObject> CreateAsync(TimeOffRequestObject timeOffRequestObjectToCreate, CancellationToken cancellationToken = default)
        {
            this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
            this.Method      = HttpMethods.POST;
            var newEntity = await this.SendAsync <TimeOffRequestObject>(timeOffRequestObjectToCreate, cancellationToken).ConfigureAwait(false);

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
コード例 #4
0
 /// <summary>
 /// Creates the specified TimeOffRequestObject using POST.
 /// </summary>
 /// <param name="timeOffRequestObjectToCreate">The TimeOffRequestObject to create.</param>
 /// <returns>The created TimeOffRequestObject.</returns>
 public System.Threading.Tasks.Task <TimeOffRequestObject> CreateAsync(TimeOffRequestObject timeOffRequestObjectToCreate)
 {
     return(this.CreateAsync(timeOffRequestObjectToCreate, CancellationToken.None));
 }
コード例 #5
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="timeOffRequestObjectToInitialize">The <see cref="TimeOffRequestObject"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(TimeOffRequestObject timeOffRequestObjectToInitialize)
 {
 }
 /// <summary>
 /// Creates the specified TimeOffRequestObject using POST and returns a <see cref="GraphResponse{TimeOffRequestObject}"/> object.
 /// </summary>
 /// <param name="timeOffRequestObjectToCreate">The TimeOffRequestObject to create.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The <see cref="GraphResponse{TimeOffRequestObject}"/> object of the request.</returns>
 public System.Threading.Tasks.Task <GraphResponse <TimeOffRequestObject> > CreateResponseAsync(TimeOffRequestObject timeOffRequestObjectToCreate, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsyncWithGraphResponse <TimeOffRequestObject>(timeOffRequestObjectToCreate, cancellationToken));
 }
 /// <summary>
 /// Adds the specified TimeOffRequestObject to the collection via POST.
 /// </summary>
 /// <param name="timeOffRequest">The TimeOffRequestObject to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created TimeOffRequestObject.</returns>
 public System.Threading.Tasks.Task <TimeOffRequestObject> AddAsync(TimeOffRequestObject timeOffRequest, CancellationToken cancellationToken)
 {
     this.ContentType = "application/json";
     this.Method      = "POST";
     return(this.SendAsync <TimeOffRequestObject>(timeOffRequest, cancellationToken));
 }
 /// <summary>
 /// Adds the specified TimeOffRequestObject to the collection via POST.
 /// </summary>
 /// <param name="timeOffRequest">The TimeOffRequestObject to add.</param>
 /// <returns>The created TimeOffRequestObject.</returns>
 public System.Threading.Tasks.Task <TimeOffRequestObject> AddAsync(TimeOffRequestObject timeOffRequest)
 {
     return(this.AddAsync(timeOffRequest, CancellationToken.None));
 }
 /// <summary>
 /// Adds the specified TimeOffRequestObject to the collection via POST.
 /// </summary>
 /// <param name="timeOffRequest">The TimeOffRequestObject to add.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
 /// <returns>The created TimeOffRequestObject.</returns>
 public System.Threading.Tasks.Task <TimeOffRequestObject> AddAsync(TimeOffRequestObject timeOffRequest, CancellationToken cancellationToken = default)
 {
     this.ContentType = CoreConstants.MimeTypeNames.Application.Json;
     this.Method      = HttpMethods.POST;
     return(this.SendAsync <TimeOffRequestObject>(timeOffRequest, cancellationToken));
 }