huhig
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -12,3 +12,2 @@ /** | ||
class APIHelper { | ||
/** | ||
@@ -15,0 +14,0 @@ * Replaces template parameters in the given url |
@@ -12,6 +12,9 @@ /** | ||
// The base Uri for API calls | ||
BASEURI: 'http://examples.apimatic.io/apps/calculator', | ||
BASEURI: 'https://www.googleapis.com/youtube/v3', | ||
// API Key | ||
key: '', | ||
}; | ||
module.exports = Configuration; |
@@ -9,5 +9,16 @@ /** | ||
const _objectMapper = require('../ObjectMapper'); | ||
const _objectMapperInstance = new _objectMapper(); | ||
class BaseController { | ||
/** | ||
* Get ObjectMapper instance | ||
* @return {ObjectMapper} Shared instance | ||
*/ | ||
static getObjectMapper() { | ||
return _objectMapperInstance; | ||
} | ||
/** | ||
* Global error handling | ||
@@ -14,0 +25,0 @@ * @param {HttpContext} _context HttpContext containing request and response objects |
@@ -9,3 +9,3 @@ /** | ||
/** | ||
/** | ||
* Creates an instance of APIException | ||
@@ -12,0 +12,0 @@ */ |
/** | ||
* @module huhig | ||
* | ||
* Simple calculator API hosted on APIMATIC | ||
* Google API for searching youtube videos | ||
*/ | ||
@@ -10,4 +10,17 @@ | ||
const Configuration = require('./configuration'); | ||
const OperationController = require('./Controllers/OperationController'); | ||
const OperationEnum = require('./Models/OperationEnum'); | ||
const APIController = require('./Controllers/APIController'); | ||
const YoutubeJSONMasterObject = require('./Models/YoutubeJSONMasterObject'); | ||
const PageInfo = require('./Models/PageInfo'); | ||
const Item = require('./Models/Item'); | ||
const Id = require('./Models/Id'); | ||
const Snippet = require('./Models/Snippet'); | ||
const Thumbnails = require('./Models/Thumbnails'); | ||
const Default = require('./Models/Default'); | ||
const Medium = require('./Models/Medium'); | ||
const High = require('./Models/High'); | ||
const Exceptioncascadingmasterstructure = require('./Models/Exceptioncascadingmasterstructure'); | ||
const MError = require('./Models/MError'); | ||
const Error1 = require('./Models/Error1'); | ||
const PartEnum = require('./Models/PartEnum'); | ||
const ExceptionObjectException = require('./Exceptions/ExceptionObjectException'); | ||
const APIException = require('./Exceptions/APIException'); | ||
@@ -20,6 +33,19 @@ | ||
// controllers of huhig | ||
OperationController, | ||
APIController, | ||
// models of huhig | ||
OperationEnum, | ||
YoutubeJSONMasterObject, | ||
PageInfo, | ||
Item, | ||
Id, | ||
Snippet, | ||
Thumbnails, | ||
Default, | ||
Medium, | ||
High, | ||
Exceptioncascadingmasterstructure, | ||
MError, | ||
Error1, | ||
PartEnum, | ||
// exceptions of huhig | ||
ExceptionObjectException, | ||
APIException, | ||
@@ -26,0 +52,0 @@ }; |
@@ -9,4 +9,31 @@ /** | ||
const YoutubeJSONMasterObject = require('../lib/Models/YoutubeJSONMasterObject'); | ||
const PageInfo = require('../lib/Models/PageInfo'); | ||
const Item = require('../lib/Models/Item'); | ||
const Id = require('../lib/Models/Id'); | ||
const Snippet = require('../lib/Models/Snippet'); | ||
const Thumbnails = require('../lib/Models/Thumbnails'); | ||
const Default = require('../lib/Models/Default'); | ||
const Medium = require('../lib/Models/Medium'); | ||
const High = require('../lib/Models/High'); | ||
const Exceptioncascadingmasterstructure = | ||
require('../lib/Models/Exceptioncascadingmasterstructure'); | ||
const MError = require('../lib/Models/MError'); | ||
const Error1 = require('../lib/Models/Error1'); | ||
const ExceptionObjectException = require('../lib/Exceptions/ExceptionObjectException'); | ||
const classMap = { | ||
YoutubeJSONMasterObject, | ||
PageInfo, | ||
Item, | ||
Id, | ||
Snippet, | ||
Thumbnails, | ||
Default, | ||
Medium, | ||
High, | ||
Exceptioncascadingmasterstructure, | ||
MError, | ||
Error1, | ||
ExceptionObjectException, | ||
}; | ||
@@ -13,0 +40,0 @@ |
{ | ||
"name": "huhig", | ||
"version": "v1.0.0", | ||
"description": "Simple calculator API hosted on APIMATIC", | ||
"version": "1.0.1", | ||
"description": "Google API for searching youtube videos", | ||
"main": "./lib/index.js", | ||
@@ -11,4 +11,3 @@ "repository": { | ||
"scripts": { | ||
"lint": "eslint lib", | ||
"test": "mocha --recursive" | ||
"lint": "eslint lib" | ||
}, | ||
@@ -25,5 +24,3 @@ "author": "APIMATIC SDK Generator", | ||
"eslint-plugin-jsx-a11y": "^4.0.0", | ||
"eslint-plugin-react": "^6.10.3", | ||
"mocha": "^5.2.0", | ||
"chai": "^3.5.0" | ||
"eslint-plugin-react": "^6.10.3" | ||
}, | ||
@@ -30,0 +27,0 @@ "dependencies": { |
# Getting started | ||
Simple calculator API hosted on APIMATIC | ||
Google API for searching youtube videos | ||
@@ -16,3 +16,3 @@ ## How to Build | ||
![Version Check](https://apidocs.io/illustration/nodejs?step=versionCheck&workspaceFolder=APIMATIC%20Calculator-Node) | ||
![Version Check](https://apidocs.io/illustration/nodejs?step=versionCheck&workspaceFolder=Youtube%20Search%20API-Node) | ||
@@ -25,3 +25,3 @@ Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder): | ||
![Resolve Dependencies](https://apidocs.io/illustration/nodejs?step=resolveDependency1&workspaceFolder=APIMATIC%20Calculator-Node) | ||
![Resolve Dependencies](https://apidocs.io/illustration/nodejs?step=resolveDependency1&workspaceFolder=Youtube%20Search%20API-Node) | ||
@@ -47,3 +47,3 @@ ![Resolve Dependencies](https://apidocs.io/illustration/nodejs?step=resolveDependency2) | ||
![Open Project](https://apidocs.io/illustration/nodejs?step=openProject&workspaceFolder=APIMATIC%20Calculator-Node) | ||
![Open Project](https://apidocs.io/illustration/nodejs?step=openProject&workspaceFolder=Youtube%20Search%20API-Node) | ||
@@ -60,5 +60,5 @@ ### 2. Creating a Test File | ||
![Create new file](https://apidocs.io/illustration/nodejs?step=createNewFile&workspaceFolder=APIMATIC%20Calculator-Node) | ||
![Create new file](https://apidocs.io/illustration/nodejs?step=createNewFile&workspaceFolder=Youtube%20Search%20API-Node) | ||
![Save new file](https://apidocs.io/illustration/nodejs?step=saveNewFile&workspaceFolder=APIMATIC%20Calculator-Node) | ||
![Save new file](https://apidocs.io/illustration/nodejs?step=saveNewFile&workspaceFolder=Youtube%20Search%20API-Node) | ||
@@ -73,3 +73,3 @@ ### 3. Running The Test File | ||
![Run file](https://apidocs.io/illustration/nodejs?step=runProject&workspaceFolder=APIMATIC%20Calculator-Node) | ||
![Run file](https://apidocs.io/illustration/nodejs?step=runProject&workspaceFolder=Youtube%20Search%20API-Node) | ||
@@ -95,12 +95,19 @@ | ||
1. Navigate to the `../test/Controllers/` directory from command prompt. | ||
2. Type `mocha APIMATIC CalculatorController` to run all the tests in that controller file. | ||
2. Type `mocha Youtube Search APIController` to run all the tests in that controller file. | ||
> To increase mocha's default timeout, you can change the `TEST_TIMEOUT` parameter's value in `TestBootstrap.js`. | ||
![Run Tests](https://apidocs.io/illustration/nodejs?step=runTests&controllerName=APIMATIC%20CalculatorController) | ||
![Run Tests](https://apidocs.io/illustration/nodejs?step=runTests&controllerName=Youtube%20Search%20APIController) | ||
## Initialization | ||
### | ||
### Authentication | ||
In order to setup authentication in the API client, you need the following information. | ||
| Parameter | Description | | ||
|-----------|-------------| | ||
| key | API Key | | ||
API client can be initialized as following: | ||
@@ -111,2 +118,4 @@ | ||
// Configuration parameters and credentials | ||
lib.Configuration.key = "key"; // API Key | ||
@@ -121,21 +130,21 @@ ``` | ||
* [OperationController](#operation_controller) | ||
* [APIController](#api_controller) | ||
## <a name="operation_controller"></a>![Class: ](https://apidocs.io/img/class.png ".OperationController") OperationController | ||
## <a name="api_controller"></a>![Class: ](https://apidocs.io/img/class.png ".APIController") APIController | ||
### Get singleton instance | ||
The singleton instance of the ``` OperationController ``` class can be accessed from the API Client. | ||
The singleton instance of the ``` APIController ``` class can be accessed from the API Client. | ||
```javascript | ||
var controller = lib.OperationController; | ||
var controller = lib.APIController; | ||
``` | ||
### <a name="get_calculate"></a>![Method: ](https://apidocs.io/img/method.png ".OperationController.getCalculate") getCalculate | ||
### <a name="search_endpoint"></a>![Method: ](https://apidocs.io/img/method.png ".APIController.searchEndpoint") searchEndpoint | ||
> Calculates the expression using the specified operation. | ||
> Search Endpoint | ||
```javascript | ||
function getCalculate(operation, x, y, callback) | ||
function searchEndpoint(part, q, type, callback) | ||
``` | ||
@@ -146,5 +155,5 @@ #### Parameters | ||
|-----------|------|-------------| | ||
| operation | ``` Required ``` | The operator to apply on the variables | | ||
| x | ``` Required ``` | The LHS value | | ||
| y | ``` Required ``` | The RHS value | | ||
| part | ``` Required ``` | The part parameter specifies a comma-separated list of one or more search resource properties that the API response will include. Set the parameter value to snippet. | | ||
| q | ``` Required ``` | The q parameter specifies the query term to search for. | | ||
| type | ``` Optional ``` | The type parameter restricts a search query to only retrieve a particular type of resource. | | ||
@@ -157,7 +166,7 @@ | ||
var operation = new OperationEnum(MULTIPLY); | ||
var x = 4; | ||
var y = 5; | ||
var part = Object.keys(part)[0]; | ||
var q = 'q'; | ||
var type = 'type'; | ||
controller.getCalculate(operation, x, y, function(error, response, context) { | ||
controller.searchEndpoint(part, q, type, function(error, response, context) { | ||
@@ -168,4 +177,12 @@ | ||
#### Errors | ||
| Error Code | Error Description | | ||
|------------|-------------------| | ||
| 400 | Custom 400 Error message occurred | | ||
| 401 | Custom 401 Error Message Occurred | | ||
[Back to List of Controllers](#list_of_controllers) | ||
@@ -172,0 +189,0 @@ |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
62861
5
30
1564
181
0
0