1.1.5 • Published 3 years ago

gasper_kaze_api v1.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

gasper_kaze_api

GasperKazeApi - JavaScript client for gasper_kaze_api Handles authentication, creation/management of applications, databases, users and also provides a superuser API. Only a superuser can avail the superuser API. A superuser can grant/revoke superuser privileges to other users. A default superuser is created every time a Gasper instance is launched whose credentials are defined in the admin section of config.toml, the main configuration file. A sample configuration file is available here. Note:- Normally the applications and databases can only be managed by their owners but the superuser can bypass that check. PS:- If you want to programmatically generate a client for this API, you can find the corresponding OpenAPI specifications here. We recommend using OpenAPI-Generator for generating clients. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Package version: 1.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://chat.sdslabs.co

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install gasper_kaze_api --save

Finally, you need to build the module:

npm run build
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:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your gasper_kaze_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

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):

browserify main.js > bundle.js

Then 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 GasperKazeApi = require('gasper_kaze_api');

var defaultClient = GasperKazeApi.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN"

var api = new GasperKazeApi.AdminApi()
var authorization = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9; // {String} Bearer Token Authentication
var app = "app_example"; // {String} The name of the application
api.deleteAppByAdmin(authorization, app).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to http://localhost:3000

ClassMethodHTTP requestDescription
GasperKazeApi.AdminApideleteAppByAdminDELETE /admin/apps/{app}Delete an application
GasperKazeApi.AdminApideleteDbByAdminDELETE /admin/dbs/{db}Delete a single database
GasperKazeApi.AdminApideleteUserByAdminDELETE /admin/users/{userEmail}Delete a single user
GasperKazeApi.AdminApifetchAppByAdminGET /admin/apps/{app}Fetch a single application
GasperKazeApi.AdminApifetchAppsByAdminGET /admin/appsFetch all applications with/without a filter defined by query params
GasperKazeApi.AdminApifetchDbByAdminGET /admin/dbs/{db}Fetch a single database
GasperKazeApi.AdminApifetchDbsByAdminGET /admin/dbsFetch all databases with/without a filter defined by query params
GasperKazeApi.AdminApifetchNodeByAdminGET /admin/nodes/{type}Fetch bind addresses(IP:Port) of a single microservice on all nodes
GasperKazeApi.AdminApifetchNodesByAdminGET /admin/nodesFetch bind addresses(IP:Port) of all microservices on all nodes
GasperKazeApi.AdminApifetchUserByAdminGET /admin/users/{userEmail}Fetch a single user
GasperKazeApi.AdminApifetchUsersByAdminGET /admin/usersFetch all users with/without a filter defined by query params
GasperKazeApi.AdminApigrantSuperuserPrivilegePATCH /admin/users/{userEmail}/grantGrant superuser privileges to a single user
GasperKazeApi.AdminApirevokeSuperuserPrivilegePATCH /admin/users/{userEmail}/revokeRevoke superuser privileges from a single user
GasperKazeApi.AppsApicreateAppPOST /apps/{language}Create an application
GasperKazeApi.AppsApideleteAppByUserDELETE /apps/{app}Delete an application owned by a user
GasperKazeApi.AppsApifetchAppByUserGET /apps/{app}Fetch a single application owned by a user
GasperKazeApi.AppsApifetchAppsByUserGET /appsFetch all applications owned by a user
GasperKazeApi.AppsApifetchLogsByUserGET /apps/{app}/logsFetch logs of an application
GasperKazeApi.AppsApifetchMetricsByUserGET /apps/{app}/metricsFetch metrics of an application
GasperKazeApi.AppsApifetchTerminalByUserGET /apps/{app}/termFetch a browser terminal instance for an application owned by a user
GasperKazeApi.AppsApirebuildAppByUserPATCH /apps/{app}/rebuildRebuild an application
GasperKazeApi.AppsApitransferAppByUserPATCH /apps/{app}/transfer/{userEmail}Transfer ownership of an application to another user
GasperKazeApi.AppsApiupdateAppByUserPUT /apps/{app}Update an application owned by a user
GasperKazeApi.AuthApiloginPOST /auth/loginLogin to get a Bearer token
GasperKazeApi.AuthApirefreshGET /auth/refreshRefresh JWT token using existing token
GasperKazeApi.AuthApiregisterPOST /auth/registerRegister a user
GasperKazeApi.DbsApicreateDBPOST /dbs/{databaseType}Create a database
GasperKazeApi.DbsApideleteDbByUserDELETE /dbs/{db}Delete a single database owned by a user
GasperKazeApi.DbsApifetchDbByUserGET /dbs/{db}Fetch a single database owned by a user
GasperKazeApi.DbsApifetchDbsByUserGET /dbsFetch all databases owned by a user
GasperKazeApi.DbsApitransferDbByUserPATCH /dbs/{db}/transfer/{userEmail}Transfer ownership of a database to another user
GasperKazeApi.InstancesApifetchIntancesByUserGET /instancesFetch all instances owned by a user
GasperKazeApi.UserApideleteUserDELETE /userDelete user
GasperKazeApi.UserApifetchUserGET /userFetch logged in user's info
GasperKazeApi.UserApiupdatePasswordPUT /user/passwordUpdate the password of the logged in user

Documentation for Models

Documentation for Authorization

bearerAuth

  • Type: Bearer authentication (JWT)
2.0.0

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.2

3 years ago

1.1.1

4 years ago

1.0.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago