|
| 1 | + |
| 2 | +# Getting Started with FirstLanguage API |
| 3 | + |
| 4 | +## Introduction |
| 5 | + |
| 6 | +Collection of NLP APIs to help developers. We have grouped the APIs under Basic and Advanced. Basic APIs cover all basic text operations like POSTag, Stemmer etc and Advanced cover all the APIs like QA, translation etc. |
| 7 | + |
| 8 | +### OpenAPI Specification |
| 9 | + |
| 10 | +This API is documented in **OpenAPI v3.0 format**. |
| 11 | +In addition to standard |
| 12 | +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md). |
| 13 | + |
| 14 | +## Building |
| 15 | + |
| 16 | +### Requirements |
| 17 | + |
| 18 | +The SDK relies on **Node.js** and **npm** (to resolve dependencies). You can download and install Node.js and [npm](https://www.npmjs.com/) from [the official Node.js website](https://nodejs.org/en/download/). |
| 19 | + |
| 20 | +> **NOTE:** npm is installed by default when Node.js is installed. |
| 21 | +
|
| 22 | +### Verify Successful Installation |
| 23 | + |
| 24 | +Run the following commands in the command prompt or shell of your choice to check if Node.js and npm are successfully installed: |
| 25 | + |
| 26 | +* Node.js: `node --version` |
| 27 | + |
| 28 | +* npm: `npm --version` |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +### Install Dependencies |
| 33 | + |
| 34 | +- To resolve all dependencies, go to the **SDK root directory** and run the following command with npm: |
| 35 | + |
| 36 | +```bash |
| 37 | +npm install |
| 38 | +``` |
| 39 | + |
| 40 | +- This will install all dependencies in the **node_modules** folder. |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## Installation |
| 45 | + |
| 46 | +The following section explains how to use the generated library in a new project. |
| 47 | + |
| 48 | +### 1. Initialize the Node Project |
| 49 | + |
| 50 | +- Open an IDE/text editor for JavaScript like Visual Studio Code. The basic workflow presented here is also applicable if you prefer using a different editor or IDE. |
| 51 | + |
| 52 | +- Click on **File** and select **Open Folder**. Select an empty folder of your project, the folder will become visible in the sidebar on the left. |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +- To initialize the Node project, click on **Terminal** and select **New Terminal**. Execute the following command in the terminal: |
| 57 | + |
| 58 | +```bash |
| 59 | +npm init --y |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +### 2. Add Dependencies to the Client Library |
| 65 | + |
| 66 | +- The created project manages its dependencies using its `package.json` file. In order to add a dependency on the *FirstLanguage APILib* client library, double click on the `package.json` file in the bar on the left and add the dependency to the package in it. |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +- To install the package in the project, run the following command in the terminal: |
| 71 | + |
| 72 | +```bash |
| 73 | +npm install |
| 74 | +``` |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +## Initialize the API Client |
| 79 | + |
| 80 | +**_Note:_** Documentation for the client can be found [here.](/doc/client.md) |
| 81 | + |
| 82 | +The following parameters are configurable for the API Client: |
| 83 | + |
| 84 | +| Parameter | Type | Description | |
| 85 | +| --- | --- | --- | |
| 86 | +| `timeout` | `number` | Timeout for API calls.<br>*Default*: `0` | |
| 87 | +| `apikey` | `string` | API Key can be copied from your dashboard | |
| 88 | + |
| 89 | +The API client can be initialized as follows: |
| 90 | + |
| 91 | +```ts |
| 92 | +const client = new Client({ |
| 93 | + timeout: 0, |
| 94 | + apikey: 'apikey', |
| 95 | +}) |
| 96 | +``` |
| 97 | + |
| 98 | +## Authorization |
| 99 | + |
| 100 | +This API uses `Custom Header Signature`. |
| 101 | + |
| 102 | +## List of APIs |
| 103 | + |
| 104 | +* [Basic APIs](/doc/controllers/basic-ap-is.md) |
| 105 | +* [Advanced APIs](/doc/controllers/advanced-ap-is.md) |
| 106 | + |
| 107 | +## Classes Documentation |
| 108 | + |
| 109 | +* [ApiResponse](/doc/api-response.md) |
| 110 | +* [ApiError](/doc/api-error.md) |
| 111 | + |
0 commit comments