|
1 | | -## Welcome to GitHub Pages |
2 | 1 |
|
3 | | -You can use the [editor on GitHub](https://github.com/FirstLanguage/fl-python/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. |
| 2 | +# Getting Started with FirstLanguage API |
4 | 3 |
|
5 | | -Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. |
| 4 | +## Introduction |
6 | 5 |
|
7 | | -### Markdown |
| 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. |
8 | 7 |
|
9 | | -Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for |
| 8 | +### OpenAPI Specification |
10 | 9 |
|
11 | | -```markdown |
12 | | -Syntax highlighted code block |
| 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 | 13 |
|
14 | | -# Header 1 |
15 | | -## Header 2 |
16 | | -### Header 3 |
| 14 | +## Building |
17 | 15 |
|
18 | | -- Bulleted |
19 | | -- List |
| 16 | +You must have Python `3 >=3.7, <= 3.9` installed on your system to install and run this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc. These dependencies are defined in the `requirements.txt` file that comes with the SDK. To resolve these dependencies, you can use the PIP Dependency manager. Install it by following steps at [https://pip.pypa.io/en/stable/installing/](https://pip.pypa.io/en/stable/installing/). |
20 | 17 |
|
21 | | -1. Numbered |
22 | | -2. List |
| 18 | +Python and PIP executables should be defined in your PATH. Open command prompt and type `pip --version`. This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined. |
23 | 19 |
|
24 | | -**Bold** and _Italic_ and `Code` text |
| 20 | +* Using command line, navigate to the directory containing the generated files (including `requirements.txt`) for the SDK. |
| 21 | +* Run the command `pip install -r requirements.txt`. This should install all the required dependencies. |
25 | 22 |
|
26 | | -[Link](url) and  |
| 23 | + |
| 24 | + |
| 25 | +## Installation |
| 26 | + |
| 27 | +The following section explains how to use the firstlanguageapi library in a new project. |
| 28 | + |
| 29 | +### 1. Open Project in an IDE |
| 30 | + |
| 31 | +Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +Click on `Open` in PyCharm to browse to your generated SDK directory and then click `OK`. |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +The project files will be displayed in the side bar as follows: |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +### 2. Add a new Test Project |
| 44 | + |
| 45 | +Create a new directory by right clicking on the solution name as shown below: |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +Name the directory as "test". |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +Add a python file to this project. |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +Name it "testSDK". |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +In your python file you will be required to import the generated python library using the following code lines |
| 62 | + |
| 63 | +```python |
| 64 | +from firstlanguageapi.firstlanguageapi_client import FirstlanguageapiClient |
27 | 65 | ``` |
28 | 66 |
|
29 | | -For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax). |
| 67 | + |
| 68 | + |
| 69 | +After this you can write code to instantiate an API client object, get a controller object and make API calls. Sample code is given in the subsequent sections. |
| 70 | + |
| 71 | +### 3. Run the Test Project |
| 72 | + |
| 73 | +To run the file within your test project, right click on your Python file inside your Test project and click on `Run` |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +## Test the SDK |
| 78 | + |
| 79 | +You can test the generated SDK and the server with test cases. `unittest` is used as the testing framework and `nose` is used as the test runner. You can run the tests as follows: |
| 80 | + |
| 81 | +Navigate to the root directory of the SDK and run the following commands |
| 82 | + |
| 83 | +``` |
| 84 | +pip install -r test-requirements.txt |
| 85 | +nosetests |
| 86 | +``` |
| 87 | + |
| 88 | +## Initialize the API Client |
| 89 | + |
| 90 | +**_Note:_** Documentation for the client can be found [here.](/doc/client.md) |
| 91 | + |
| 92 | +The following parameters are configurable for the API Client: |
| 93 | + |
| 94 | +| Parameter | Type | Description | |
| 95 | +| --- | --- | --- | |
| 96 | +| `apikey` | `string` | API Key can be copied from your dashboard | |
| 97 | +| `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests | |
| 98 | +| `override_http_client_configuration` | `bool` | The value which determines to override properties of the passed Http Client from the sdk user | |
| 99 | +| `timeout` | `float` | The value to use for connection timeout. <br> **Default: 60** | |
| 100 | +| `max_retries` | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** | |
| 101 | +| `backoff_factor` | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** | |
| 102 | +| `retry_statuses` | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** | |
| 103 | +| `retry_methods` | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** | |
| 104 | + |
| 105 | +The API client can be initialized as follows: |
| 106 | + |
| 107 | +```python |
| 108 | +from firstlanguageapi.firstlanguageapi_client import FirstlanguageapiClient |
| 109 | +from firstlanguageapi.configuration import Environment |
| 110 | + |
| 111 | +client = FirstlanguageapiClient( |
| 112 | + apikey='apikey', |
| 113 | + environment=Environment.PRODUCTION,) |
| 114 | +``` |
| 115 | + |
| 116 | +## Authorization |
| 117 | + |
| 118 | +This API uses `Custom Header Signature`. |
| 119 | + |
| 120 | +## List of APIs |
30 | 121 |
|
31 | | -### Jekyll Themes |
| 122 | +* [Basic AP Is](/doc/controllers/basic-ap-is.md) |
| 123 | +* [Advanced AP Is](/doc/controllers/advanced-ap-is.md) |
32 | 124 |
|
33 | | -Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/FirstLanguage/fl-python/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file. |
| 125 | +## Classes Documentation |
34 | 126 |
|
35 | | -### Support or Contact |
| 127 | +* [Utility Classes](/doc/utility-classes.md) |
| 128 | +* [HttpResponse](/doc/http-response.md) |
| 129 | +* [HttpRequest](/doc/http-request.md) |
36 | 130 |
|
37 | | -Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out. |
|
0 commit comments