### Installing ProWritingAid API from Git with npm Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/README.md This command installs the ProWritingAid API client library directly from its Git repository using npm, saving it as a dependency. This is useful for installing specific versions or development branches. ```Shell npm install prowriting/prowritingaid.javascript --save ``` -------------------------------- ### Installing ProWritingAid API with npm Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/README.md This command installs the ProWritingAid API client library using npm, saving it as a dependency in the project's package.json file. It's the standard way to add the package for Node.js projects. ```Shell npm install pro_writing_aid_api --save ``` -------------------------------- ### Retrieving Summary Analysis Result using JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/SummaryApi.md This snippet demonstrates how to retrieve the result of a summary analysis request using its `taskId`. It initializes the ProWritingAid API client with an API key and then calls the `get` method on the `SummaryApi` instance, logging the successful data or any errors. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.SummaryApi(); var taskId = "taskId_example"; // String | apiInstance.get(taskId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Retrieving Word Cloud Result by Task ID in JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/WordCloudApi.md This snippet demonstrates how to retrieve the result of a previously initiated word cloud request using its task ID. It initializes the `WordCloudApi` and calls the `get` method with the `taskId`, logging the successful response or any errors. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var apiInstance = new ProWritingAidApi.WordCloudApi(); var taskId = "taskId_example"; // String | apiInstance.get(taskId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Retrieving HTML Analysis Result using ProWritingAidApi in JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/HtmlApi.md This snippet demonstrates how to retrieve the result of an asynchronous HTML analysis request using its task ID with the ProWritingAidApi. It shows the necessary steps for API key configuration, instantiating the `HtmlApi` client, and making the `get` call, handling both success and error responses. The `taskId` parameter is crucial for identifying the specific analysis result. ```JavaScript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.HtmlApi(); var taskId = "taskId_example"; // String | apiInstance.get(taskId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Retrieving Contextual Thesaurus Result with Task ID (JavaScript) Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/ContextualThesaurusApi.md This snippet demonstrates how to retrieve the result of a contextual thesaurus request using a task ID. It initializes the ProWritingAid API client, configures API key authentication, and then calls the `get` method with the provided `taskId`. The expected output is the `AsyncResponseContextualThesaurusResponse` object containing the analysis result, or an error if the call fails. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.ContextualThesaurusApi(); var taskId = "taskId_example"; // String | apiInstance.get(taskId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Making a Text Analysis Request with ProWritingAid API (JavaScript) Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/TextApi.md This JavaScript snippet demonstrates how to initialize the ProWritingAid API client, configure API key authentication, and send a text analysis request. It shows the basic process of instantiating the client, setting the license code, and calling the 'post' method on the TextApi instance with a TextAnalysisRequest object, including error handling. This requires the 'pro_writing_aid_api' npm package. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.TextApi(); var requestp = new ProWritingAidApi.TextAnalysisRequest(); // TextAnalysisRequest | apiInstance.post(requestp).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Initiating Summary Analysis Request using JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/SummaryApi.md This snippet illustrates how to initiate a new summary analysis for a document. It configures the API client with an API key, creates an instance of `SummaryAnalysisRequest` (which would contain the document text), and then calls the `post` method on the `SummaryApi` instance to send the request, handling the asynchronous response. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.SummaryApi(); var requestp = new ProWritingAidApi.SummaryAnalysisRequest(); // SummaryAnalysisRequest | apiInstance.post(requestp).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Performing Text Analysis with ProWritingAid API in JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/README.md This JavaScript code demonstrates how to initialize the ProWritingAid API client, configure the base path and license code, and perform a text analysis request. It sends a sample text for grammar checking and logs the successful response or any errors. ```JavaScript var ProWritingAidApi = require('pro_writing_aid_api'); var api = new ProWritingAidApi.TextApi(); api.apiClient.basePath="https://api.prowritingaid.com"; api.apiClient.defaultHeaders={'licenseCode': 'your license code'} var request = new ProWritingAidApi.TextAnalysisRequest( "I couldnt wait any any longer, I new what I hadd to do", ['grammar'], "General", "En" ); api.post(request) .then(function(data) { console.log('API called successfully. Returned data: '); console.log(data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Making an HTML Analysis Request with ProWritingAid API in JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/HtmlApi.md This snippet demonstrates how to initialize the ProWritingAid API client in JavaScript, configure the API key for authentication, and then make an asynchronous request to the HtmlApi for HTML content analysis. It shows how to handle both successful responses and errors. ```JavaScript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.HtmlApi(); var requestp = new ProWritingAidApi.HtmlAnalysisRequest(); // HtmlAnalysisRequest | apiInstance.post(requestp).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Analyzing Text for Contextual Thesaurus Entries (JavaScript) Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/ContextualThesaurusApi.md This snippet illustrates how to analyze text to obtain contextual thesaurus entries. It sets up the ProWritingAid API client and API key authentication, then creates a `ContextualThesaurusRequest` object. The `post` method is invoked with this request object, returning an `AsyncResponseContextualThesaurusResponse` containing the analysis results upon success, or an error if the API call fails. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.ContextualThesaurusApi(); var requestp = new ProWritingAidApi.ContextualThesaurusRequest(); // ContextualThesaurusRequest | apiInstance.post(requestp).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Calling the Text Analysis Post Function (JavaScript) Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/TextApi.md This snippet shows the signature for the `post` function, which is used to send a text document for analysis to the ProwritingAid API. It takes a `requestp` parameter, which is expected to contain the text and configuration for the analysis, and returns an `AsyncResponseTextAnalysisResponse` object with the analysis results. ```JavaScript AsyncResponseTextAnalysisResponse post(requestp) ``` -------------------------------- ### Generating Word Cloud from Text in JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/WordCloudApi.md This snippet illustrates how to initiate a new word cloud generation request by sending text to the API. It initializes the `WordCloudApi` and creates a `WordCloudRequest` object, then calls the `post` method to send the request, logging the response or errors. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var apiInstance = new ProWritingAidApi.WordCloudApi(); var requestp = new ProWritingAidApi.WordCloudRequest(); // WordCloudRequest | apiInstance.post(requestp).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` -------------------------------- ### Configuring Webpack for ProWritingAid API Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/README.md This Webpack configuration rule uses `imports-loader` to resolve a dependency issue with the ProWritingAid API client. It specifically targets JavaScript files within the `pro_writing_aid_api` module and sets `define` to `false` to prevent conflicts. ```JavaScript module: { rules: [ { test: /pro_writing_aid_api\/.*\.js$/, use: 'imports-loader?define=>false' } ] } ``` -------------------------------- ### Retrieving Text Analysis Results with ProWritingAidApi in JavaScript Source: https://github.com/prowriting/prowritingaid.javascript/blob/master/docs/TextApi.md This snippet demonstrates how to retrieve the result of a previously initiated text analysis request using its taskId. It shows how to configure API key authorization and handle both successful responses and errors. The 'taskId' parameter is required to specify which analysis result to fetch. ```javascript var ProWritingAidApi = require('pro_writing_aid_api'); var defaultClient = ProWritingAidApi.ApiClient.instance; // Configure API key authorization: licenseCode var licenseCode = defaultClient.authentications['licenseCode']; licenseCode.apiKey = 'YOUR API KEY'; // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //licenseCode.apiKeyPrefix = 'Token'; var apiInstance = new ProWritingAidApi.TextApi(); var taskId = "taskId_example"; // String | apiInstance.get(taskId).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.