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

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

            this.InitializeCollectionProperties(newEntity);
            return(newEntity);
        }
        /// <summary>
        /// Issues the PATCH request.
        /// </summary>
        /// <param name="yammeractivitysummary">The YammerActivitySummary object set with the properties to update.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
        /// <returns>The task to await for async call.</returns>
        public async System.Threading.Tasks.Task <IReportRootGetYammerActivityCountsCollectionPage> PatchAsync(YammerActivitySummary yammeractivitysummary,
                                                                                                               CancellationToken cancellationToken)
        {
            this.Method = "PATCH";
            var response = await this.SendAsync <ReportRootGetYammerActivityCountsCollectionResponse>(yammeractivitysummary, cancellationToken).ConfigureAwait(false);

            if (response != null && response.Value != null && response.Value.CurrentPage != null)
            {
                if (response.AdditionalData != null)
                {
                    response.Value.AdditionalData = response.AdditionalData;

                    object nextPageLink;
                    response.AdditionalData.TryGetValue("@odata.nextLink", out nextPageLink);

                    var nextPageLinkString = nextPageLink as string;

                    if (!string.IsNullOrEmpty(nextPageLinkString))
                    {
                        response.Value.InitializeNextPageRequest(
                            this.Client,
                            nextPageLinkString);
                    }
                }

                return(response.Value);
            }

            return(null);
        }
 /// <summary>
 /// Issues the PATCH request.
 /// </summary>
 /// <param name="yammeractivitysummary">The YammerActivitySummary object set with the properties to update.</param>
 /// <returns>The task to await for async call.</returns>
 public System.Threading.Tasks.Task <IReportRootGetYammerActivityCountsCollectionPage> PatchAsync(YammerActivitySummary yammeractivitysummary)
 {
     return(this.PatchAsync(yammeractivitysummary, CancellationToken.None));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates the specified YammerActivitySummary using POST.
 /// </summary>
 /// <param name="yammerActivitySummaryToCreate">The YammerActivitySummary to create.</param>
 /// <returns>The created YammerActivitySummary.</returns>
 public System.Threading.Tasks.Task <YammerActivitySummary> CreateAsync(YammerActivitySummary yammerActivitySummaryToCreate)
 {
     return(this.CreateAsync(yammerActivitySummaryToCreate, CancellationToken.None));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes any collection properties after deserialization, like next requests for paging.
 /// </summary>
 /// <param name="yammerActivitySummaryToInitialize">The <see cref="YammerActivitySummary"/> with the collection properties to initialize.</param>
 private void InitializeCollectionProperties(YammerActivitySummary yammerActivitySummaryToInitialize)
 {
 }