myfirstpackage 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +562 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5bcf81ead498c7e305ab318b71908bd96b271a00331ca753b11eeae3d1c29557
|
4
|
+
data.tar.gz: 5009cf773f0c82d2fa7155e5914ee9dd4d3e749aab913d2cc22678f1e234b0ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 56cdcc934226d88d75dccf7205e2d9b3983fc6b882348be7ef59c81fc84082df5fad9cba1f7ad35a09e9f9d234d7f3ea6f6b4d9c4eab63a959c31c8c6abeebff
|
7
|
+
data.tar.gz: 37ad00dd51f637fa4dc5ecfc1e80c7078d20d1fa7d0d953842cdd0d7e81ca0c87c0bc901188986d0fd7be030ae73b851c1331dd8002de2ea68ce948264747275
|
data/LICENSE
ADDED
@@ -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
|
data/README.md
ADDED
@@ -0,0 +1,562 @@
|
|
1
|
+
# Getting started
|
2
|
+
|
3
|
+
## Code-Gen and Transformation as a service
|
4
|
+
[APIMatic](https://apimatic.io) is a highly customizable automatic code and documentation generator for RESTful APIs using machine-readable API descriptions. This REST API provides programmatic access to APIMatic's CodeGen and Transformation engine. The users can perform the following tasks using this REST API
|
5
|
+
- Generate client side libaries and documentation in 10 programming languages.
|
6
|
+
- Transform API descriptions to and from all popular description formats
|
7
|
+
- Validate API descriptions
|
8
|
+
|
9
|
+
### API Descriptions
|
10
|
+
APIMatic takes in machine readable descriptions as inputs. The following formats are supported:
|
11
|
+
- `APIMatic `
|
12
|
+
- `WADL `
|
13
|
+
- `OAS 1.2, 2.0, 3.0 (JSON And YAML)`
|
14
|
+
- `RAML `
|
15
|
+
- `API Blueprint `
|
16
|
+
- `IODocs `
|
17
|
+
- `Google Discovery `
|
18
|
+
- `Mashape `
|
19
|
+
- `HAR`
|
20
|
+
- `Postman`
|
21
|
+
- `WSDL`
|
22
|
+
|
23
|
+
Although most API descriptions can be used, not all API descriptions are written well-enough for automatic code generation and may fail the code generation process. For this purpose, we have provided a verbose validation API, which can be used to improve your API description.
|
24
|
+
|
25
|
+
[APIMatic](https://apimatic.io) works in two modes i.e., perform operations on **pre-configured** API descriptions, and perform operations on API descriptions sent **on the fly** with requests. The later mode of operations has its limitations with respect to the customization of the generated code through our *codegen settings*.
|
26
|
+
|
27
|
+
See [this article](https://docs.apimatic.io/api-editor/codegen-settings/) for more information about the numerous codegen settings which enable customization of the output code.
|
28
|
+
|
29
|
+
#### Pre-configured API descriptions
|
30
|
+
This mode of operation is useful where APIs are stable and therefore can be pre-configured in [APIMatic](https://apimatic.io).
|
31
|
+
You can always update an API description in [APIMatic](https://apimatic.io) using the API Editor by clicking on the *Edit* button.
|
32
|
+
When working with stored API descriptions, pre-configured *codegen settings* are used that allow customization
|
33
|
+
of the generated output. In order to uniquely identify the API to perform operations on, a *API Key* is used,
|
34
|
+
which can be retrieved using the API context menu. This *API Key* is used as a unique reference identifier to perform various options.
|
35
|
+
|
36
|
+
See [this article](https://docs.apimatic.io/getting-started/manage-apis/#view-api-integration-key) on how to get your API Key from [APIMatic](https://apimatic.io).
|
37
|
+
|
38
|
+
#### API description files
|
39
|
+
This mode of operation is useful in cases where API descriptions are automatically generated from a process
|
40
|
+
or external source and cannot be pre-configured in [APIMatic](https://apimatic.io). In this case code generation uses the default
|
41
|
+
*codegen settings*. However, if custom *codegen settings* are desired you may use the [APIMatic](https://apimatic.io) format for
|
42
|
+
generating your API descriptions, which contains nested *codegen settings*. For getting the full benefit
|
43
|
+
of our advanced features in our code generator, you must make use of these extensive *codegen settings*. For using these *codegen settings* with other formats use our format extensions. More information on the available extensions can be found here:
|
44
|
+
|
45
|
+
Format | Extensions
|
46
|
+
------------------ | -------------------
|
47
|
+
`OAS 1.2 , 2.0 & 3.0`|[Swagger Extensions](https://docs.apimatic.io/advanced/swagger-codegen-extensions/)
|
48
|
+
`API Blueprint` | [API Blueprint Extensions](https://docs.apimatic.io/advanced/blueprint-extensions/)
|
49
|
+
|
50
|
+
### Code-Gen As A Service
|
51
|
+
![Code-Gen logo](https://i.imgur.com/Iz2TJbM.png)
|
52
|
+
[APIMatic's](https://www.apimatic.io) Code-Gen as a Service is a highly customizable Code-Gen-Engine, which simplifies API consumption by generating high-quality SDKs, code samples, dynamic docs and test cases using API descriptions. This enables API providers to help their developers consume their APIs in a language of their choice. Using this REST API this highly useful Code-Gen engine can be incorporated into your CI cycle, greatly reducing time and effort. The list of supported languages are:
|
53
|
+
|
54
|
+
- `.Net`
|
55
|
+
- `.Net Standard Library`
|
56
|
+
- `Portable Class Library`
|
57
|
+
- `Android`
|
58
|
+
- `Java`
|
59
|
+
- `PHP`
|
60
|
+
- `Python`
|
61
|
+
- `Ruby`
|
62
|
+
- `Objective-C`
|
63
|
+
- `AngularJS`
|
64
|
+
- `NodeJS`
|
65
|
+
- `Go`
|
66
|
+
|
67
|
+
### API Transformer
|
68
|
+
![Convertron](https://i.imgur.com/xwscwFa.png)
|
69
|
+
[APIMatic](https://www.apimatic.io) Transformer allows its users to convert between different API description formats e.g. `Swagger`, `RAML`, etc. This enables the user to benefit from a wide range of tools available associated with any format, without any added effort. The complete list of supported formats of [Transformer](https://apimatic.io/transformer) are:
|
70
|
+
|
71
|
+
Inputs | Outputs
|
72
|
+
------------------ | -------------------
|
73
|
+
`API Blueprint` | `API Blueprint`
|
74
|
+
`Swagger v.1.2` | `Swagger 1.2`
|
75
|
+
`Swagger 2.0 (JSON and YAML)` | `Swagger 2.0 (JSON, YAML)`
|
76
|
+
`Open API v.3.0` | `Open API 3.0`
|
77
|
+
`WADL 2009 (W3C)` | `WADL 2009 (W3C)`
|
78
|
+
`WSDL (W3C)` | `WSDL (W3C)`
|
79
|
+
`Google Discovery` | `RAML 0.8 - 1.0`
|
80
|
+
`RAML 0.8 - 1.0` | `Postman Collection 1.0 - 2.0`
|
81
|
+
`I/O Docs - Mashery` | `APIMatic Format`
|
82
|
+
`HAR 1.2` |
|
83
|
+
`Postman Collection 1.0 - 2.0` |
|
84
|
+
`APIMatic Format` |
|
85
|
+
`Mashape` |
|
86
|
+
|
87
|
+
### API Validator
|
88
|
+
The verbose validation API can be used to identify and fix errors in your API descriptions. This API supports all formats listed in the `API Descriptions` section.
|
89
|
+
|
90
|
+
## How to Build
|
91
|
+
|
92
|
+
|
93
|
+
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.
|
94
|
+
These dependencies are defined in the ```requirements.txt``` file that comes with the SDK.
|
95
|
+
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/).
|
96
|
+
|
97
|
+
Python and PIP executables should be defined in your PATH. Open command prompt and type ```pip --version```.
|
98
|
+
This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.
|
99
|
+
|
100
|
+
* Using command line, navigate to the directory containing the generated files (including ```requirements.txt```) for the SDK.
|
101
|
+
* Run the command ```pip install -r requirements.txt```. This should install all the required dependencies.
|
102
|
+
|
103
|
+
![Building SDK - Step 1](https://apidocs.io/illustration/python?step=installDependencies&workspaceFolder=Apimatic-Python)
|
104
|
+
|
105
|
+
|
106
|
+
## How to Use
|
107
|
+
|
108
|
+
The following section explains how to use the Apimatic SDK package in a new project.
|
109
|
+
|
110
|
+
### 1. Open Project in an IDE
|
111
|
+
|
112
|
+
Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
|
113
|
+
|
114
|
+
![Open project in PyCharm - Step 1](https://apidocs.io/illustration/python?step=pyCharm)
|
115
|
+
|
116
|
+
Click on ```Open``` in PyCharm to browse to your generated SDK directory and then click ```OK```.
|
117
|
+
|
118
|
+
![Open project in PyCharm - Step 2](https://apidocs.io/illustration/python?step=openProject0&workspaceFolder=Apimatic-Python)
|
119
|
+
|
120
|
+
The project files will be displayed in the side bar as follows:
|
121
|
+
|
122
|
+
![Open project in PyCharm - Step 3](https://apidocs.io/illustration/python?step=openProject1&workspaceFolder=Apimatic-Python&projectName=apimatic)
|
123
|
+
|
124
|
+
### 2. Add a new Test Project
|
125
|
+
|
126
|
+
Create a new directory by right clicking on the solution name as shown below:
|
127
|
+
|
128
|
+
![Add a new project in PyCharm - Step 1](https://apidocs.io/illustration/python?step=createDirectory&workspaceFolder=Apimatic-Python&projectName=apimatic)
|
129
|
+
|
130
|
+
Name the directory as "test"
|
131
|
+
|
132
|
+
![Add a new project in PyCharm - Step 2](https://apidocs.io/illustration/python?step=nameDirectory)
|
133
|
+
|
134
|
+
Add a python file to this project with the name "testsdk"
|
135
|
+
|
136
|
+
![Add a new project in PyCharm - Step 3](https://apidocs.io/illustration/python?step=createFile&workspaceFolder=Apimatic-Python&projectName=apimatic)
|
137
|
+
|
138
|
+
Name it "testsdk"
|
139
|
+
|
140
|
+
![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?step=nameFile)
|
141
|
+
|
142
|
+
In your python file you will be required to import the generated python library using the following code lines
|
143
|
+
|
144
|
+
```Python
|
145
|
+
from apimatic.apimatic_client import ApimaticClient
|
146
|
+
```
|
147
|
+
|
148
|
+
![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?step=projectFiles&workspaceFolder=Apimatic-Python&libraryName=apimatic.apimatic_client&projectName=apimatic&className=ApimaticClient)
|
149
|
+
|
150
|
+
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.
|
151
|
+
|
152
|
+
### 3. Run the Test Project
|
153
|
+
|
154
|
+
To run the file within your test project, right click on your Python file inside your Test project and click on ```Run```
|
155
|
+
|
156
|
+
![Run Test Project - Step 1](https://apidocs.io/illustration/python?step=runProject&workspaceFolder=Apimatic-Python&libraryName=apimatic.apimatic_client&projectName=apimatic&className=ApimaticClient)
|
157
|
+
|
158
|
+
|
159
|
+
## How to Test
|
160
|
+
|
161
|
+
You can test the generated SDK and the server with automatically generated test
|
162
|
+
cases. unittest is used as the testing framework and nose is used as the test
|
163
|
+
runner. You can run the tests as follows:
|
164
|
+
|
165
|
+
1. From terminal/cmd navigate to the root directory of the SDK.
|
166
|
+
2. Invoke ```pip install -r test-requirements.txt```
|
167
|
+
3. Invoke ```nosetests```
|
168
|
+
|
169
|
+
## Initialization
|
170
|
+
|
171
|
+
### Authentication
|
172
|
+
In order to setup authentication and initialization of the API client, you need the following information.
|
173
|
+
|
174
|
+
| Parameter | Description |
|
175
|
+
|-----------|-------------|
|
176
|
+
| basic_auth_user_name | The username to use with basic authentication |
|
177
|
+
| basic_auth_password | The password to use with basic authentication |
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
API client can be initialized as following.
|
182
|
+
|
183
|
+
```python
|
184
|
+
# Configuration parameters and credentials
|
185
|
+
basic_auth_user_name = 'basic_auth_user_name' # The username to use with basic authentication
|
186
|
+
basic_auth_password = 'basic_auth_password' # The password to use with basic authentication
|
187
|
+
|
188
|
+
client = ApimaticClient(basic_auth_user_name, basic_auth_password)
|
189
|
+
```
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
# Class Reference
|
194
|
+
|
195
|
+
## <a name="list_of_controllers"></a>List of Controllers
|
196
|
+
|
197
|
+
* [ValidatorController](#validator_controller)
|
198
|
+
* [APITransformerController](#api_transformer_controller)
|
199
|
+
* [ClientGeneratorController](#client_generator_controller)
|
200
|
+
|
201
|
+
## <a name="validator_controller"></a>![Class: ](https://apidocs.io/img/class.png ".ValidatorController") ValidatorController
|
202
|
+
|
203
|
+
### Get controller instance
|
204
|
+
|
205
|
+
An instance of the ``` ValidatorController ``` class can be accessed from the API Client.
|
206
|
+
|
207
|
+
```python
|
208
|
+
validator_controller = client.validator
|
209
|
+
```
|
210
|
+
|
211
|
+
### <a name="validate_using_file"></a>![Method: ](https://apidocs.io/img/method.png ".ValidatorController.validate_using_file") validate_using_file
|
212
|
+
|
213
|
+
> This endpoint can be used to validate an API description document *on the fly* and see detailed error messages along with any warnings or useful information.
|
214
|
+
|
215
|
+
```python
|
216
|
+
def validate_using_file(self,
|
217
|
+
body)
|
218
|
+
```
|
219
|
+
|
220
|
+
#### Parameters
|
221
|
+
|
222
|
+
| Parameter | Tags | Description |
|
223
|
+
|-----------|------|-------------|
|
224
|
+
| body | ``` Required ``` | The input file to use for validation |
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
#### Example Usage
|
229
|
+
|
230
|
+
```python
|
231
|
+
body = open("pathtofile", 'rb')
|
232
|
+
|
233
|
+
result = validator_controller.validate_using_file(body)
|
234
|
+
|
235
|
+
```
|
236
|
+
|
237
|
+
|
238
|
+
### <a name="validate_using_api_key"></a>![Method: ](https://apidocs.io/img/method.png ".ValidatorController.validate_using_api_key") validate_using_api_key
|
239
|
+
|
240
|
+
> *Tags:* ``` Skips Authentication ```
|
241
|
+
|
242
|
+
> This endpoint can be used to validate a *pre-configured* API description and see detailed error messages along with any warnings or useful information.
|
243
|
+
|
244
|
+
```python
|
245
|
+
def validate_using_api_key(self,
|
246
|
+
apikey)
|
247
|
+
```
|
248
|
+
|
249
|
+
#### Parameters
|
250
|
+
|
251
|
+
| Parameter | Tags | Description |
|
252
|
+
|-----------|------|-------------|
|
253
|
+
| apikey | ``` Required ``` | The API Key of a pre-configured API description from APIMATIC |
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
#### Example Usage
|
258
|
+
|
259
|
+
```python
|
260
|
+
apikey = 'zfd8HsAb24Jcm0DFXpYwh4ucxAMmXhEygcXsdxtf7HNZhHCaSOM1e4otNoZqHEwG'
|
261
|
+
|
262
|
+
result = validator_controller.validate_using_api_key(apikey)
|
263
|
+
|
264
|
+
```
|
265
|
+
|
266
|
+
|
267
|
+
### <a name="validate_using_url"></a>![Method: ](https://apidocs.io/img/method.png ".ValidatorController.validate_using_url") validate_using_url
|
268
|
+
|
269
|
+
> This endpoint can be used to validate an API description document *on the fly* from its public Uri, and see detailed error messages along with any warnings or useful information. This endpoint is useful for API descriptions with relative links e.g., includes (RAML) and paths (swagger).
|
270
|
+
|
271
|
+
```python
|
272
|
+
def validate_using_url(self,
|
273
|
+
description_url)
|
274
|
+
```
|
275
|
+
|
276
|
+
#### Parameters
|
277
|
+
|
278
|
+
| Parameter | Tags | Description |
|
279
|
+
|-----------|------|-------------|
|
280
|
+
| descriptionUrl | ``` Required ``` | The absolute public Uri for an API description doucment |
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
#### Example Usage
|
285
|
+
|
286
|
+
```python
|
287
|
+
description_url = 'https://github.com/raml-org/raml-examples/blob/master/helloworld/helloworld.raml'
|
288
|
+
|
289
|
+
result = validator_controller.validate_using_url(description_url)
|
290
|
+
|
291
|
+
```
|
292
|
+
|
293
|
+
|
294
|
+
[Back to List of Controllers](#list_of_controllers)
|
295
|
+
|
296
|
+
## <a name="api_transformer_controller"></a>![Class: ](https://apidocs.io/img/class.png ".APITransformerController") APITransformerController
|
297
|
+
|
298
|
+
### Get controller instance
|
299
|
+
|
300
|
+
An instance of the ``` APITransformerController ``` class can be accessed from the API Client.
|
301
|
+
|
302
|
+
```python
|
303
|
+
api_transformer_controller = client.api_transformer
|
304
|
+
```
|
305
|
+
|
306
|
+
### <a name="transform_using_api_key"></a>![Method: ](https://apidocs.io/img/method.png ".APITransformerController.transform_using_api_key") transform_using_api_key
|
307
|
+
|
308
|
+
> *Tags:* ``` Skips Authentication ```
|
309
|
+
|
310
|
+
> Convert an API from the user's account using the API's [Api Integration Key](https://docs.apimatic.io/getting-started/manage-apis/#view-api-integration-key). The converted file is returned as the response.
|
311
|
+
|
312
|
+
```python
|
313
|
+
def transform_using_api_key(self,
|
314
|
+
format,
|
315
|
+
apikey)
|
316
|
+
```
|
317
|
+
|
318
|
+
#### Parameters
|
319
|
+
|
320
|
+
| Parameter | Tags | Description |
|
321
|
+
|-----------|------|-------------|
|
322
|
+
| format | ``` Required ``` | The API format to convert to |
|
323
|
+
| apikey | ``` Required ``` | Apikey of an already uploaded API Description on APIMATIC |
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
#### Example Usage
|
328
|
+
|
329
|
+
```python
|
330
|
+
format = APIDescriptionFormat.WEB SERVICES DESCRIPTION LANGUAGE
|
331
|
+
apikey = 'zfd8HsAb24Jcm0DFXpYwh4ucxAMmXhEygcXsdxtf7HNZhHCaSOM1e4otNoZqHEwG'
|
332
|
+
|
333
|
+
result = api_transformer_controller.transform_using_api_key(format, apikey)
|
334
|
+
|
335
|
+
```
|
336
|
+
|
337
|
+
#### Errors
|
338
|
+
|
339
|
+
| Error Code | Error Description |
|
340
|
+
|------------|-------------------|
|
341
|
+
| 400 | Bad Request |
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
### <a name="transform_using_url"></a>![Method: ](https://apidocs.io/img/method.png ".APITransformerController.transform_using_url") transform_using_url
|
347
|
+
|
348
|
+
> Transforms the API description from the given URL to the specified format. The API description format of the provided file will be detected automatically. The converted file is returned as the response.
|
349
|
+
|
350
|
+
```python
|
351
|
+
def transform_using_url(self,
|
352
|
+
format,
|
353
|
+
description_url)
|
354
|
+
```
|
355
|
+
|
356
|
+
#### Parameters
|
357
|
+
|
358
|
+
| Parameter | Tags | Description |
|
359
|
+
|-----------|------|-------------|
|
360
|
+
| format | ``` Required ``` | The API format to convert to |
|
361
|
+
| descriptionUrl | ``` Required ``` | The URL where the API description will be downloaded from |
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
#### Example Usage
|
366
|
+
|
367
|
+
```python
|
368
|
+
format = APIDescriptionFormat.SWAGGER
|
369
|
+
description_url = 'https://github.com/raml-org/raml-examples/blob/master/helloworld/helloworld.raml'
|
370
|
+
|
371
|
+
result = api_transformer_controller.transform_using_url(format, description_url)
|
372
|
+
|
373
|
+
```
|
374
|
+
|
375
|
+
#### Errors
|
376
|
+
|
377
|
+
| Error Code | Error Description |
|
378
|
+
|------------|-------------------|
|
379
|
+
| 400 | Bad Request |
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
### <a name="transform_using_file"></a>![Method: ](https://apidocs.io/img/method.png ".APITransformerController.transform_using_file") transform_using_file
|
385
|
+
|
386
|
+
> Upload a file and convert it to the given format. The API description format of the uploaded file will be detected automatically. The converted file is returned as the response.
|
387
|
+
|
388
|
+
```python
|
389
|
+
def transform_using_file(self,
|
390
|
+
format,
|
391
|
+
file)
|
392
|
+
```
|
393
|
+
|
394
|
+
#### Parameters
|
395
|
+
|
396
|
+
| Parameter | Tags | Description |
|
397
|
+
|-----------|------|-------------|
|
398
|
+
| format | ``` Required ``` | The API format to convert to |
|
399
|
+
| file | ``` Required ``` | The input file to convert |
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
#### Example Usage
|
404
|
+
|
405
|
+
```python
|
406
|
+
format = APIDescriptionFormat.APIMATIC
|
407
|
+
file = open("pathtofile", 'rb')
|
408
|
+
|
409
|
+
result = api_transformer_controller.transform_using_file(format, file)
|
410
|
+
|
411
|
+
```
|
412
|
+
|
413
|
+
#### Errors
|
414
|
+
|
415
|
+
| Error Code | Error Description |
|
416
|
+
|------------|-------------------|
|
417
|
+
| 400 | Bad Request |
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
[Back to List of Controllers](#list_of_controllers)
|
423
|
+
|
424
|
+
## <a name="client_generator_controller"></a>![Class: ](https://apidocs.io/img/class.png ".ClientGeneratorController") ClientGeneratorController
|
425
|
+
|
426
|
+
### Get controller instance
|
427
|
+
|
428
|
+
An instance of the ``` ClientGeneratorController ``` class can be accessed from the API Client.
|
429
|
+
|
430
|
+
```python
|
431
|
+
client_generator_controller = client.client_generator
|
432
|
+
```
|
433
|
+
|
434
|
+
### <a name="generate_using_url"></a>![Method: ](https://apidocs.io/img/method.png ".ClientGeneratorController.generate_using_url") generate_using_url
|
435
|
+
|
436
|
+
> Download API description from the given URL and convert it to the given format. The API description format of the provided file will be detected automatically. The response is generated zip file as per selected template.
|
437
|
+
|
438
|
+
```python
|
439
|
+
def generate_using_url(self,
|
440
|
+
template,
|
441
|
+
name,
|
442
|
+
description_url)
|
443
|
+
```
|
444
|
+
|
445
|
+
#### Parameters
|
446
|
+
|
447
|
+
| Parameter | Tags | Description |
|
448
|
+
|-----------|------|-------------|
|
449
|
+
| template | ``` Required ``` | The template to use for code generation |
|
450
|
+
| name | ``` Required ``` | The name of the API being used for code generation |
|
451
|
+
| descriptionUrl | ``` Required ``` | The absolute public Uri for an API description doucment |
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
#### Example Usage
|
456
|
+
|
457
|
+
```python
|
458
|
+
template = SDKTemplate.CSHARP WINDOWS PLATFORM LIBRARY
|
459
|
+
name = 'Test'
|
460
|
+
description_url = 'https://github.com/raml-org/raml-examples/blob/master/helloworld/helloworld.raml'
|
461
|
+
|
462
|
+
result = client_generator_controller.generate_using_url(template, name, description_url)
|
463
|
+
|
464
|
+
```
|
465
|
+
|
466
|
+
#### Errors
|
467
|
+
|
468
|
+
| Error Code | Error Description |
|
469
|
+
|------------|-------------------|
|
470
|
+
| 401 | Unauthorized: Access is denied due to invalid credentials. |
|
471
|
+
| 412 | Precondition Failed |
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
### <a name="generate_using_file"></a>![Method: ](https://apidocs.io/img/method.png ".ClientGeneratorController.generate_using_file") generate_using_file
|
477
|
+
|
478
|
+
> Upload a file and convert it to the given format. The API description format of uploaded file will be detected automatically. The response is generated zip file as per selected template.
|
479
|
+
|
480
|
+
```python
|
481
|
+
def generate_using_file(self,
|
482
|
+
name,
|
483
|
+
template,
|
484
|
+
body)
|
485
|
+
```
|
486
|
+
|
487
|
+
#### Parameters
|
488
|
+
|
489
|
+
| Parameter | Tags | Description |
|
490
|
+
|-----------|------|-------------|
|
491
|
+
| name | ``` Required ``` | The name of the API being used for code generation |
|
492
|
+
| template | ``` Required ``` | The template to use for code generation |
|
493
|
+
| body | ``` Required ``` | The input file to use for code generation |
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
#### Example Usage
|
498
|
+
|
499
|
+
```python
|
500
|
+
name = 'name'
|
501
|
+
template = SDKTemplate.CSHARP PORTABLE LIBRARY
|
502
|
+
body = open("pathtofile", 'rb')
|
503
|
+
|
504
|
+
result = client_generator_controller.generate_using_file(name, template, body)
|
505
|
+
|
506
|
+
```
|
507
|
+
|
508
|
+
#### Errors
|
509
|
+
|
510
|
+
| Error Code | Error Description |
|
511
|
+
|------------|-------------------|
|
512
|
+
| 401 | Unauthorized: Access is denied due to invalid credentials. |
|
513
|
+
| 412 | Precondition Failed |
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
### <a name="generate_using_api_key"></a>![Method: ](https://apidocs.io/img/method.png ".ClientGeneratorController.generate_using_api_key") generate_using_api_key
|
519
|
+
|
520
|
+
> *Tags:* ``` Skips Authentication ```
|
521
|
+
|
522
|
+
> Convert an API from the user's account using the API's [API Integration Key](https://docs.apimatic.io/getting-started/manage-apis/#view-api-integration-key). The response is generated zip file as per selected template.
|
523
|
+
|
524
|
+
```python
|
525
|
+
def generate_using_api_key(self,
|
526
|
+
apikey,
|
527
|
+
template)
|
528
|
+
```
|
529
|
+
|
530
|
+
#### Parameters
|
531
|
+
|
532
|
+
| Parameter | Tags | Description |
|
533
|
+
|-----------|------|-------------|
|
534
|
+
| apikey | ``` Required ``` | The API Key of the pre-configured API |
|
535
|
+
| template | ``` Required ``` | The template to use for code generation |
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
#### Example Usage
|
540
|
+
|
541
|
+
```python
|
542
|
+
apikey = 'zfd8HsAb24Jcm0DFXpYwh4ucxAMmXhEygcXsdxtf7HNZhHCaSOM1e4otNoZqHEwG'
|
543
|
+
template = SDKTemplate.CSHARP PORTABLE LIBRARY
|
544
|
+
|
545
|
+
result = client_generator_controller.generate_using_api_key(apikey, template)
|
546
|
+
|
547
|
+
```
|
548
|
+
|
549
|
+
#### Errors
|
550
|
+
|
551
|
+
| Error Code | Error Description |
|
552
|
+
|------------|-------------------|
|
553
|
+
| 401 | Unauthorized: Access is denied due to invalid credentials. |
|
554
|
+
| 412 | Precondition Failed |
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
[Back to List of Controllers](#list_of_controllers)
|
560
|
+
|
561
|
+
|
562
|
+
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: myfirstpackage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- APIMatic SDK Generator
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logging
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.10.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.10.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.1.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.1.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: certifi
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2016.9'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 2016.09.26
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '2016.9'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2016.09.26
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: faraday-http-cache
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.2'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.2.2
|
85
|
+
type: :runtime
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '1.2'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.2.2
|
95
|
+
description: Simple calculator API hosted on APIMATIC
|
96
|
+
email: support@apimatic.io
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- LICENSE
|
102
|
+
- README.md
|
103
|
+
homepage: https://apimatic.io
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '2.0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.7.5
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: myfirstpackage
|
127
|
+
test_files: []
|