@ula-aca/aries-cloudagent-interface
v2.0.0
Published
An Aries Cloudagent API Wrapper for JavaScript and NodeJS
Downloads
13
Maintainers
Readme
Aries Cloudagent Interface JavaScript
Installation
In an existing project (with package.json
), install @ula-aca/aries-cloudagent-interface
# NPM
npm install --save @ula-aca/aries-cloudagent-interface
# Yarn
yarn add @ula-aca/aries-cloudagent-interface
Usage
The API is generated using the OpenAPI Schema (Swagger) from Aries Cloud Agent Python. However this schema is not representing the real API. A lot of types are not correct. Keep this in mind when using this package. Please open issues or pull requests with patches when you find them.
The interface is generated, so to know for sure what is being exported import the package and see what's exposed. It matches the OpenApi schema which is viewable in the Swagger UI.
import {
Configuration,
LedgerApi,
SchemaApi,
ConnectionsApi,
CredentialDefinitionApi,
...
} from '@ula-aca/aries-cloudagent-interface'
Generating Open API Client
Aries Cloudagent Python provides a Swagger (OpenAPI) definition of the exposed API. the OpenAPI Schema for Aries Cloud Agent Python is located in this repo. We generate the API Client with the OpenAPI Generator CLI. This can be done via the generate-api-client
script.
The generated API Client will be placed in the generated/openapi
directory and included in the TypeScript compile process.
Aries Cloudagent Python generates a Swagger v2 schema that contains errors. To get around this we convert the Swagger v2 schema to an OpenAPI v3 schema. You can do this by running the
get-openapi-spec
scripts and passing the url of theswagger.json
file to the scripts. This downloads the v2 schema, converts it to v3 and places it asresources/aca-py-openapi-schema.json
.
# Download and covert OpenAPI schema. Is tracked in git repo
yarn get-openapi-spec http://aca-py-api.com/api/docs/swagger.json
# Generate OpenAPI client. Is not tracked in git repo
yarn generate-api-client
Swagger UI
A Swagger UI instance is hosted in this repository for the currently used OpenAPI schema. See https://ula-aca.github.io/aries-cloudagent-interface-javascript/
Running tests
Unit tests are done with Mocha. As this package only generates code and exports it, there is only one test that tests whether the generated directory is exported. In the future tests can be added where appropriate.
yarn test
We aim to achieve a coverage of 100%.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License and disclaimer
apache-2.0 with a notice.
We discourage the use of this work in production environments as it is in active development and not mature enough.