1.0.1 • Published 6 years ago

modoki_api v1.0.1

Weekly downloads
-
License
Unlicense
Repository
-
Last release
6 years ago

modoki_api

ModokiApi - JavaScript client for modoki_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: 1.0.0
  • Package version: 1.0.0
  • 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:

npm install modoki_api --save
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

Finally, switch to the directory you want to use your modoki_api from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('modoki_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.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 ModokiApi = require('modoki_api');

var defaultClient = ModokiApi.ApiClient.instance;

// Configure API key authorization: jwt
var jwt = defaultClient.authentications['jwt'];
jwt.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//jwt.apiKeyPrefix['Authorization'] = "Token"

var api = new ModokiApi.ContainerApi()
var image = "image_example"; // {String} Name of image
var name = "name_example"; // {String} Name of container and subdomain
var opts = {
  'command': ["inner_example"], // {[String]} Command to run specified as a string or an array of strings.
  'entrypoint': ["inner_example"], // {[String]} The entry point for the container as a string or an array of strings
  'env': ["inner_example"], // {[String]} Environment variables
  'sslRedirect': true, // {Boolean} Whether HTTP is redirected to HTTPS
  'volumes': ["inner_example"], // {[String]} Path to volumes in a container
  'workingDir': "workingDir_example" // {String} Current directory (PWD) in the command will be launched
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.containerCreate(image, name, opts, callback);

Documentation for API Endpoints

All URIs are relative to http://localhost:4434/api/v2

ClassMethodHTTP requestDescription
ModokiApi.ContainerApicontainerCreateGET /container/createcreate container
ModokiApi.ContainerApicontainerDownloadGET /container/{id}/downloaddownload container
ModokiApi.ContainerApicontainerDownload1HEAD /container/downloaddownload container
ModokiApi.ContainerApicontainerExecGET /container/{id}/execexec container
ModokiApi.ContainerApicontainerGetConfigGET /container/{id}/configgetConfig container
ModokiApi.ContainerApicontainerInspectGET /container/{id}/inspectinspect container
ModokiApi.ContainerApicontainerListGET /container/listlist container
ModokiApi.ContainerApicontainerLogsGET /container/{id}/logslogs container
ModokiApi.ContainerApicontainerRemoveGET /container/{id}/removeremove container
ModokiApi.ContainerApicontainerSetConfigPOST /container/{id}/configsetConfig container
ModokiApi.ContainerApicontainerStartGET /container/{id}/startstart container
ModokiApi.ContainerApicontainerStopGET /container/{id}/stopstop container
ModokiApi.ContainerApicontainerUploadPOST /container/{id}/uploadupload container
ModokiApi.UserApiuserAddAuthorizedKeysPUT /user/config/authorizedKeysaddAuthorizedKeys user
ModokiApi.UserApiuserGetConfigGET /user/configgetConfig user
ModokiApi.UserApiuserGetDefaultShellGET /user/config/defaultShellgetDefaultShell user
ModokiApi.UserApiuserListAuthorizedKeysGET /user/config/authorizedKeyslistAuthorizedKeys user
ModokiApi.UserApiuserRemoveAuthorizedKeysDELETE /user/config/authorizedKeysremoveAuthorizedKeys user
ModokiApi.UserApiuserSetAuthorizedKeysPOST /user/config/authorizedKeyssetAuthorizedKeys user
ModokiApi.UserApiuserSetDefaultShellPOST /user/config/defaultShellsetDefaultShell user

Documentation for Models

Documentation for Authorization

jwt

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header