GitHub - ragnaok/api
Api - JavaScript client for api No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) This SDK is automatically generated by the OpenAPI Generator project:
- API version: 0.0.1
- Package version: 0.0.1
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
Installation
For Node.js
npm
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
Local development
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:
Finally, switch to the directory you want to use your api from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('api') in javascript files from the directory you ran the last command above from.
git
If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --save
For browser
The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):
browserify main.js > bundle.jsThen include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: { rules: [ { parser: { amd: false } } ] }
Getting Started
Please follow the installation instruction and execute the following JS code:
var Api = require('api'); var defaultClient = Api.ApiClient.instance; // Configure API key authorization: Authorization var Authorization = defaultClient.authentications['Authorization']; Authorization.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //Authorization.apiKeyPrefix['Authorization'] = "Token" var api = new Api.BikeApi() var version = "version_example"; // {String} api version var body = new Api.CreateBikeRequest(); // {CreateBikeRequest} create bike body parameters var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }; api.createBike(version, body, callback);
Documentation for API Endpoints
All URIs are relative to http://localhost:5000
| Class | Method | HTTP request | Description |
|---|---|---|---|
| Api.BikeApi | createBike | POST /{version}/bike | |
| Api.BikeBundleApi | queryBikeBundle | GET /{version}/bike/bundles | |
| Api.CustomerApi | getCustomer | GET /{version}/customer/{customer_id} | |
| Api.FirmwareApi | getFirmwareFile | GET /{version}/firmware/{firmware_id}/files | |
| Api.FirmwareApi | queryFirmwareList | GET /{version}/firmware | |
| Api.MessageGatewayApi | getMessageGateway | GET /{version}/message_gateway/version | |
| Api.PartApi | createPart | POST /{version}/part | |
| Api.PartSpecApi | getPartSpec | GET /{version}/part_spec/{spec_id} | |
| Api.QwicBikeApi | compareQwicBike | POST /{version}/bike/compare | |
| Api.QwicBikeApi | createQwicBike | POST /{version}/bike/qwic | |
| Api.QwicBikeApi | getQwicBikeModel | GET /{version}/bike_model/qwic/{vin} |
Documentation for Models
- Api.BikeBundle
- Api.CompareBikeRequest
- Api.CompareQwicBikeResponse
- Api.CompareQwicBikeResponseResult
- Api.CreateBike
- Api.CreateBikeRequest
- Api.CreateBikeResponse
- Api.Customer
- Api.CustomerResponse
- Api.Firmware
- Api.FirmwareFile
- Api.GetFirmwareFileResponse
- Api.MessageGatewayResponse
- Api.MessageGatewayResponseResult
- Api.Part
- Api.PartMeta
- Api.PartRequest
- Api.PartResponse
- Api.PartSpec
- Api.PartSpecResponse
- Api.QueryBikeBundleResponse
- Api.QueryFirmwareResponse
- Api.QwicBikeModel
- Api.QwicBikeModelResponse
Documentation for Authorization
Authorization
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header