Sybren A. Stüvel e990603311 OAPI: Add generated JavaScript API client
This adds a JS client for the OAPI interface, and introduces the SocketIO
stuff into Flamenco Manager itself.

To build & run:
- in `web/manager-api` run `npm install`
- in `web/manager-api` run `npm link`
- in `web/app` run `npm install`
- in `web/app` run `npm link flamenco-manager`
- in `web/app` run `yarn serve`

This may not be a complete list, but at least some of those steps are
necessary.
2022-04-01 16:40:54 +02:00

183 lines
7.8 KiB
Markdown

# flamenco-manager
flamencoManager - JavaScript client for flamenco-manager
Render Farm manager API
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
- Package version: 0.0.0
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
For more information, please visit [https://flamenco.io/](https://flamenco.io/)
## Installation
### For [Node.js](https://nodejs.org/)
#### npm
To publish the library as a [npm](https://www.npmjs.com/), please follow the procedure in ["Publishing npm packages"](https://docs.npmjs.com/getting-started/publishing-npm-packages).
Then install it via:
```shell
npm install flamenco-manager --save
```
Finally, you need to build the module:
```shell
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:
```shell
npm install
```
Next, [link](https://docs.npmjs.com/cli/link) it globally in npm with the following, also from `JAVASCRIPT_CLIENT_DIR`:
```shell
npm link
```
To use the link you just defined in your project, switch to the directory you want to use your flamenco-manager from, and run:
```shell
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
```
Finally, you need to build the module:
```shell
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:
```shell
npm install GIT_USER_ID/GIT_REPO_ID --save
```
### For browser
The library also works in the browser environment via npm and [browserify](http://browserify.org/). 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):
```shell
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:
```javascript
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
```
## Getting Started
Please follow the [installation](#installation) instruction and execute the following JS code:
```javascript
var flamencoManager = require('flamenco-manager');
var api = new flamencoManager.JobsApi()
var jobId = "jobId_example"; // {String}
api.fetchJob(jobId).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*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*flamencoManager.JobsApi* | [**fetchJob**](docs/JobsApi.md#fetchJob) | **GET** /api/jobs/{job_id} | Fetch info about the job.
*flamencoManager.JobsApi* | [**getJobTypes**](docs/JobsApi.md#getJobTypes) | **GET** /api/jobs/types | Get list of job types and their parameters.
*flamencoManager.JobsApi* | [**submitJob**](docs/JobsApi.md#submitJob) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute.
*flamencoManager.MetaApi* | [**getConfiguration**](docs/MetaApi.md#getConfiguration) | **GET** /api/configuration | Get the configuration of this Manager.
*flamencoManager.MetaApi* | [**getVersion**](docs/MetaApi.md#getVersion) | **GET** /api/version | Get the Flamenco version of this Manager
*flamencoManager.ShamanApi* | [**shamanCheckout**](docs/ShamanApi.md#shamanCheckout) | **POST** /shaman/checkout/create | Create a directory, and symlink the required files into it. The files must all have been uploaded to Shaman before calling this endpoint.
*flamencoManager.ShamanApi* | [**shamanCheckoutRequirements**](docs/ShamanApi.md#shamanCheckoutRequirements) | **POST** /shaman/checkout/requirements | Checks a Shaman Requirements file, and reports which files are unknown.
*flamencoManager.ShamanApi* | [**shamanFileStore**](docs/ShamanApi.md#shamanFileStore) | **POST** /shaman/files/{checksum}/{filesize} | Store a new file on the Shaman server. Note that the Shaman server can forcibly close the HTTP connection when another client finishes uploading the exact same file, to prevent double uploads. The file&#39;s contents should be sent in the request body.
*flamencoManager.ShamanApi* | [**shamanFileStoreCheck**](docs/ShamanApi.md#shamanFileStoreCheck) | **GET** /shaman/files/{checksum}/{filesize} | Check the status of a file on the Shaman server.
*flamencoManager.WorkerApi* | [**registerWorker**](docs/WorkerApi.md#registerWorker) | **POST** /api/worker/register-worker | Register a new worker
*flamencoManager.WorkerApi* | [**scheduleTask**](docs/WorkerApi.md#scheduleTask) | **POST** /api/worker/task | Obtain a new task to execute
*flamencoManager.WorkerApi* | [**signOff**](docs/WorkerApi.md#signOff) | **POST** /api/worker/sign-off | Mark the worker as offline
*flamencoManager.WorkerApi* | [**signOn**](docs/WorkerApi.md#signOn) | **POST** /api/worker/sign-on | Authenticate &amp; sign in the worker.
*flamencoManager.WorkerApi* | [**taskUpdate**](docs/WorkerApi.md#taskUpdate) | **POST** /api/worker/task/{task_id} | Update the task, typically to indicate progress, completion, or failure.
*flamencoManager.WorkerApi* | [**workerState**](docs/WorkerApi.md#workerState) | **GET** /api/worker/state |
*flamencoManager.WorkerApi* | [**workerStateChanged**](docs/WorkerApi.md#workerStateChanged) | **POST** /api/worker/state-changed | Worker changed state. This could be as acknowledgement of a Manager-requested state change, or in response to worker-local signals.
## Documentation for Models
- [flamencoManager.AssignedTask](docs/AssignedTask.md)
- [flamencoManager.AvailableJobSetting](docs/AvailableJobSetting.md)
- [flamencoManager.AvailableJobSettingSubtype](docs/AvailableJobSettingSubtype.md)
- [flamencoManager.AvailableJobSettingType](docs/AvailableJobSettingType.md)
- [flamencoManager.AvailableJobType](docs/AvailableJobType.md)
- [flamencoManager.AvailableJobTypes](docs/AvailableJobTypes.md)
- [flamencoManager.Command](docs/Command.md)
- [flamencoManager.Error](docs/Error.md)
- [flamencoManager.FlamencoVersion](docs/FlamencoVersion.md)
- [flamencoManager.Job](docs/Job.md)
- [flamencoManager.JobAllOf](docs/JobAllOf.md)
- [flamencoManager.JobStatus](docs/JobStatus.md)
- [flamencoManager.ManagerConfiguration](docs/ManagerConfiguration.md)
- [flamencoManager.RegisteredWorker](docs/RegisteredWorker.md)
- [flamencoManager.SecurityError](docs/SecurityError.md)
- [flamencoManager.ShamanCheckout](docs/ShamanCheckout.md)
- [flamencoManager.ShamanCheckoutResult](docs/ShamanCheckoutResult.md)
- [flamencoManager.ShamanFileSpec](docs/ShamanFileSpec.md)
- [flamencoManager.ShamanFileSpecWithStatus](docs/ShamanFileSpecWithStatus.md)
- [flamencoManager.ShamanFileStatus](docs/ShamanFileStatus.md)
- [flamencoManager.ShamanRequirementsRequest](docs/ShamanRequirementsRequest.md)
- [flamencoManager.ShamanRequirementsResponse](docs/ShamanRequirementsResponse.md)
- [flamencoManager.ShamanSingleFileStatus](docs/ShamanSingleFileStatus.md)
- [flamencoManager.SubmittedJob](docs/SubmittedJob.md)
- [flamencoManager.TaskStatus](docs/TaskStatus.md)
- [flamencoManager.TaskUpdate](docs/TaskUpdate.md)
- [flamencoManager.WorkerRegistration](docs/WorkerRegistration.md)
- [flamencoManager.WorkerSignOn](docs/WorkerSignOn.md)
- [flamencoManager.WorkerStateChange](docs/WorkerStateChange.md)
- [flamencoManager.WorkerStateChanged](docs/WorkerStateChanged.md)
- [flamencoManager.WorkerStatus](docs/WorkerStatus.md)
## Documentation for Authorization
### worker_auth
- **Type**: HTTP basic authentication