Paraphrase 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{publicclassTextRewriter{publicTextRewriter(){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";ParaphraseApiapi=newParaphraseApi(conf);stringsrcText="Hello, everyone! We will try to rephrase this text into something new.";stringsourceLanguage="en";ParaphraseTextResponsetextResponse=newParaphraseTextResponse();ParaphraseTextRequestreq=newParaphraseTextRequest(language:sourceLanguage,text:srcText,suggestions:ParaphraseTextRequest.SuggestionsEnum.One,diversityDegree:DegreeEnum.Off);StatusResponseresponseId=awaitapi.ParaphraseTextPostAsync(req);try{if(responseId.Status.ToString()=="Accepted"){while(true){textResponse=awaitapi.ParaphraseTextRequestIdGetAsync(responseId.Id);if(textResponse.Status.ToString()=="OK"){Console.WriteLine("Plain text paraphrasing: "+textResponse.ParaphraseReult);break;}elseThread.Sleep(200);}}else{textResponse=newParaphraseTextResponse(){Status=responseId.Status,Message=responseId.Message};Console.WriteLine("Text error: "+textResponse.Message);}}catch(Exceptionex){Console.WriteLine("Text exception: "+ex.ToString());}}}}