Skip to content

Commit e4e2dd1

Browse files
author
dryprogrammer
committed
docs
1 parent 3a5f2ab commit e4e2dd1

30 files changed

+1798
-10
lines changed

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
License:
2+
========
3+
The MIT License (MIT)
4+
http://opensource.org/licenses/MIT
5+
6+
Copyright (c) 2014 - 2016 APIMATIC Limited
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in
16+
all copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
THE SOFTWARE.
25+
26+
Trade Mark:
27+
==========
28+
APIMATIC is a trade mark for APIMATIC Limited

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include LICENSE
2+
include README.md

README.md

Lines changed: 219 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,225 @@
1-
# Deployment Successful!
2-
You have succesfully deployed the SDK to this repository.
1+
# Getting started
2+
3+
TODO: Add Description
34

4-
This repository contains two branches.
5-
* master
6-
* CodeGen-PY
5+
## How to Build
76

8-
Changes made on the generated branch will be overwritten.
97

10-
Make sure to make your customisations on a different branch (e.g master) and then pull new versions of the generated code.
8+
You must have Python ```2 >=2.7.9``` or Python ```3 >=3.4``` installed on your system to install and run this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc.
9+
These dependencies are defined in the ```requirements.txt``` file that comes with the SDK.
10+
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/).
11+
12+
Python and PIP executables should be defined in your PATH. Open command prompt and type ```pip --version```.
13+
This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.
14+
15+
* Using command line, navigate to the directory containing the generated files (including ```requirements.txt```) for the SDK.
16+
* Run the command ```pip install -r requirements.txt```. This should install all the required dependencies.
17+
18+
![Building SDK - Step 1](https://apidocs.io/illustration/python?step=installDependencies&workspaceFolder=predix-Python)
19+
20+
21+
## How to Use
22+
23+
The following section explains how to use the Predix SDK package in a new project.
24+
25+
### 1. Open Project in an IDE
26+
27+
Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
28+
29+
![Open project in PyCharm - Step 1](https://apidocs.io/illustration/python?step=pyCharm)
30+
31+
Click on ```Open``` in PyCharm to browse to your generated SDK directory and then click ```OK```.
32+
33+
![Open project in PyCharm - Step 2](https://apidocs.io/illustration/python?step=openProject0&workspaceFolder=predix-Python)
34+
35+
The project files will be displayed in the side bar as follows:
36+
37+
![Open project in PyCharm - Step 3](https://apidocs.io/illustration/python?step=openProject1&workspaceFolder=predix-Python&projectName=predix)
38+
39+
### 2. Add a new Test Project
40+
41+
Create a new directory by right clicking on the solution name as shown below:
42+
43+
![Add a new project in PyCharm - Step 1](https://apidocs.io/illustration/python?step=createDirectory&workspaceFolder=predix-Python&projectName=predix)
44+
45+
Name the directory as "test"
46+
47+
![Add a new project in PyCharm - Step 2](https://apidocs.io/illustration/python?step=nameDirectory)
48+
49+
Add a python file to this project with the name "testsdk"
50+
51+
![Add a new project in PyCharm - Step 3](https://apidocs.io/illustration/python?step=createFile&workspaceFolder=predix-Python&projectName=predix)
52+
53+
Name it "testsdk"
54+
55+
![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?step=nameFile)
56+
57+
In your python file you will be required to import the generated python library using the following code lines
58+
59+
```Python
60+
from predix.predix_client import PredixClient
61+
```
62+
63+
![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?step=projectFiles&workspaceFolder=predix-Python&libraryName=predix.predix_client&projectName=predix&className=PredixClient)
64+
65+
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.
66+
67+
### 3. Run the Test Project
68+
69+
To run the file within your test project, right click on your Python file inside your Test project and click on ```Run```
70+
71+
![Run Test Project - Step 1](https://apidocs.io/illustration/python?step=runProject&workspaceFolder=predix-Python&libraryName=predix.predix_client&projectName=predix&className=PredixClient)
72+
73+
74+
## How to Test
75+
76+
You can test the generated SDK and the server with automatically generated test
77+
cases. unittest is used as the testing framework and nose is used as the test
78+
runner. You can run the tests as follows:
79+
80+
1. From terminal/cmd navigate to the root directory of the SDK.
81+
2. Invoke ```pip install -r test-requirements.txt```
82+
3. Invoke ```nosetests```
83+
84+
## Initialization
85+
86+
### Authentication
87+
In order to setup authentication and initialization of the API client, you need the following information.
88+
89+
| Parameter | Description |
90+
|-----------|-------------|
91+
| username | TODO: add a description |
92+
| password | TODO: add a description |
93+
94+
95+
96+
API client can be initialized as following.
97+
98+
```python
99+
# Configuration parameters and credentials
100+
username = 'username'
101+
password = 'password'
102+
103+
client = PredixClient(username, password)
104+
```
105+
106+
107+
108+
# Class Reference
109+
110+
## <a name="list_of_controllers"></a>List of Controllers
111+
112+
* [APIController](#api_controller)
113+
114+
## <a name="api_controller"></a>![Class: ](https://apidocs.io/img/class.png ".APIController") APIController
115+
116+
### Get controller instance
117+
118+
An instance of the ``` APIController ``` class can be accessed from the API Client.
119+
120+
```python
121+
client_controller = client.client
122+
```
123+
124+
### <a name="create_get_token"></a>![Method: ](https://apidocs.io/img/method.png ".APIController.create_get_token") create_get_token
125+
126+
> TODO: Add Description
127+
128+
```python
129+
def create_get_token(self,
130+
content_type,
131+
body)
132+
```
133+
134+
#### Parameters
135+
136+
| Parameter | Tags | Description |
137+
|-----------|------|-------------|
138+
| contentType | ``` Required ``` | TODO: Add a parameter description |
139+
| body | ``` Required ``` | TODO: Add a parameter description |
140+
141+
142+
143+
#### Example Usage
144+
145+
```python
146+
content_type = 'application/x-www-form-urlencoded'
147+
body = 'grant_type=client_credentials'
148+
149+
client_controller.create_get_token(content_type, body)
150+
151+
```
152+
153+
154+
### <a name="create_synchronous_execution_nlp"></a>![Method: ](https://apidocs.io/img/method.png ".APIController.create_synchronous_execution_nlp") create_synchronous_execution_nlp
155+
156+
> Execute the analytic synchronously. The analytic_uri is the analytic catalog entry id followed by your Predix Platform domain name.
157+
158+
```python
159+
def create_synchronous_execution_nlp(self,
160+
content_type,
161+
predix_zone_id,
162+
body)
163+
```
164+
165+
#### Parameters
166+
167+
| Parameter | Tags | Description |
168+
|-----------|------|-------------|
169+
| contentType | ``` Required ``` | TODO: Add a parameter description |
170+
| predixZoneId | ``` Required ``` | TODO: Add a parameter description |
171+
| body | ``` Required ``` | TODO: Add a parameter description |
172+
173+
174+
175+
#### Example Usage
176+
177+
```python
178+
content_type = 'application/json'
179+
predix_zone_id = '{{tenant_id}}'
180+
body_value = "{\"input_text\":\"UPS fails to come up Image:NONE-NONE-NONE\"}"
181+
body = json.loads(body_value)
182+
183+
client_controller.create_synchronous_execution_nlp(content_type, predix_zone_id, body)
184+
185+
```
186+
187+
188+
### <a name="create_synchronous_execution_predict_resolutions"></a>![Method: ](https://apidocs.io/img/method.png ".APIController.create_synchronous_execution_predict_resolutions") create_synchronous_execution_predict_resolutions
189+
190+
> Execute the analytic synchronously. The analytic_uri is the analytic catalog entry id followed by your Predix Platform domain name.
191+
192+
```python
193+
def create_synchronous_execution_predict_resolutions(self,
194+
content_type,
195+
predix_zone_id,
196+
body)
197+
```
198+
199+
#### Parameters
200+
201+
| Parameter | Tags | Description |
202+
|-----------|------|-------------|
203+
| contentType | ``` Required ``` | TODO: Add a parameter description |
204+
| predixZoneId | ``` Required ``` | TODO: Add a parameter description |
205+
| body | ``` Required ``` | TODO: Add a parameter description |
206+
207+
208+
209+
#### Example Usage
210+
211+
```python
212+
content_type = 'application/json'
213+
predix_zone_id = '{{tenant_id}}'
214+
body_value = "{\"symptoms\":\"this is a test\",\"errors\":\"11011,10010\"}"
215+
body = json.loads(body_value)
216+
217+
client_controller.create_synchronous_execution_predict_resolutions(content_type, predix_zone_id, body)
218+
219+
```
220+
221+
222+
[Back to List of Controllers](#list_of_controllers)
11223

12-
For any enquires contact [email protected]
13224

14-
Happy generating!
15225

16-
APIMATIC

predix/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
__all__ = [
2+
'api_helper',
3+
'configuration',
4+
'models',
5+
'controllers',
6+
'http',
7+
'exceptions',
8+
'decorators',
9+
'predix_client',
10+
]

0 commit comments

Comments
 (0)