Summarizing text with GroupDocs.Rewriter SDK
Leave feedback
Learn more
Although you can directly call the GroupDocs.Rewriter Cloud REST API to send text and fetch the result, there is a much easier way to implement required functionality in your applications. We provide software development kits (SDKs) for all popular programming languages. They wrap up all routine operations such as establishing connections, sending API requests, and parsing responses into a few simple methods. It makes interaction with GroupDocs.Rewriter Cloud services much easier, allowing you to focus on business logic rather than technical details.
usingGroupDocs.Rewriter.Cloud.Sdk.Api;usingGroupDocs.Rewriter.Cloud.Sdk.Client;usingGroupDocs.Rewriter.Cloud.Sdk.Client.Auth;usingGroupDocs.Rewriter.Cloud.Sdk.Model;usingConfiguration=GroupDocs.Rewriter.Cloud.Sdk.Client.Configuration;usingSystem.Diagnostics;usingSystem.IO;usingSystem.Collections.Generic;usingSystem.Net.Http;usingHttpStatusCode=System.Net.HttpStatusCode;namespaceGroupDocs.Rewriter.Cloud.Sdk{publicclassTextSummarizer{publicTextSummarizer(){Configurationconfig=newConfiguration();config.OAuthFlow=OAuthFlow.APPLICATION;config.OAuthClientId="YOU_CLIENT_ID";config.OAuthClientSecret="YOU_CLIENT_SECRET";config.BasePath="https://api.groupdocs.cloud/v2.0/rewriter";SummarizeApiapi=newSummarizeApi(conf);stringsrcText="YOUR_TEXT";stringsourceLanguage="en";SummarizationTextResponsetextResponse=newSummarizationTextResponse();SummarizationTextRequestrequest=newSummarizationTextRequest(language:sourceLanguage,text:srcText,summarizationDegree:DegreeEnum.Off);StatusResponseresponseId=awaitapi.SummarizeTextPostAsync(request);try{if(responseId.Status.ToString()=="Accepted"){while(true){textResponse=awaitapi.SummarizeTextRequestIdGetAsync(responseId.Id);if(textResponse.Status.ToString()=="OK"){Console.WriteLine("Plain text summarizing: "+textResponse.SummarizationResult);break;}elseThread.Sleep(200);}}else{textResponse=newSummarizationTextResponse(){Status=responseId.Status,Message=responseId.Message};Console.WriteLine("Text error: "+textResponse.Message);}}catch(Exceptionex){Console.WriteLine("Text exception: "+ex.ToString());}}}}