ApproveapiSwaggerJs - JavaScript client for approveapi-swagger-js The simple API to request a user's approval on anything via email + sms. This SDK is automatically generated by the Swagger Codegen project:
- API version: 1
- Package version: 1
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
For Node.js
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install approveapi-swagger-js --saveTo 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:
npm installNext, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:
npm linkFinally, switch to the directory you want to use your approveapi-swagger-js from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>You should now be able to require('approveapi-swagger-js') in javascript files from the directory you ran the last
command above from.
If the library is hosted at a git repository, e.g. https://github.com/YOUR_USERNAME/approveapi-swagger-js then install it via:
npm install YOUR_USERNAME/approveapi-swagger-js --saveThe 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.
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
}
}
]
}Please follow the installation instruction and execute the following JS code:
var ApproveapiSwaggerJs = require('approveapi-swagger-js');
var defaultClient = ApproveapiSwaggerJs.ApiClient.instance;
// Configure HTTP basic authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.username = 'YOUR USERNAME'
apiKey.password = 'YOUR PASSWORD'
var api = new ApproveapiSwaggerJs.ApproveApi()
var user = "user_example"; // {String} The user to send the approval request to. Can be either an email address or a phone number.
var body = "body_example"; // {String} The body of the approval request to show the user.
var opts = {
'title': "title_example", // {String} The title of an approval request. Defaults to an empty string.
'approve_text': "approve_text_example", // {String} The approve action text. Defaults to 'Approve'.
'reject_text': "reject_text_example", // {String} The reject action text. Defaults to 'Reject'.
'long_poll': true // {Boolean} If true, the request waits (long-polls) until the user responds to the prompt or more than 10 minutes pass. Defaults to false.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.createPrompt(user, body, opts, callback);All URIs are relative to https://virtserver.swaggerhub.com/rejberg/ApproveAPI/1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| ApproveapiSwaggerJs.ApproveApi | createPrompt | POST /prompt | Sending a prompt |
| ApproveapiSwaggerJs.ApproveApi | getPrompt | GET /prompt/{id} | Retrieve a prompt |
| ApproveapiSwaggerJs.ApproveApi | getPromptStatus | GET /prompt/{id}/status | Check prompt status |
- ApproveapiSwaggerJs.Error
- ApproveapiSwaggerJs.Prompt
- ApproveapiSwaggerJs.PromptAnswer
- ApproveapiSwaggerJs.PromptStatus
- Type: HTTP basic authentication