After cloning the repository, install the dependencies by running the following command:
yarn
Install git commit hooks with:
yarn prepare
API clients are generated using @openapitools/openapi-generator-cli
. They are generated based on the API specifications defined in the spec.json
file.
Each endpoint in the specification must have a unique operationId
, because the client method names are derived from it.
To generate the miro-api
client, run the following command:
yarn build
The command produces:
- Low-level client methods
- High-level client methods and models
- JavaScript code, compiled from the source TypeScript code.
The command generates low-level code in the api
and model
subdirectories.
This command runs openapi-generator-cli
with the miro-api
generator, based on the Mustache template files in the miro-api-template
directory.
This command executes ./generator/generate_node_highlevel_models.ts
, which generates high-level client models that use the low-level client code generated with openapi-generator-cli
.
This is based on the model definitions in the ./generator/modelDefinition.ts
file.
To customize autogenerated models:
-
Define additional classes in the
highlevel
directory. -
Update the extended model definition to point to the new file.
To view an example, seepackages/miro-api/highlevel/Team.ts
for an example.To view the generated model hierarchy, see MODELS.md.
As a final step, the command runs yarn build
to compile the source TypeScript code to JavaScript, and to generate .d.ts
files.
Documentation for the client is generated with TypeDoc.
To build the documentation, run the following command:
yarn build:docs
The resulting static HTML files and their related assets are in the docs-out
directory.
When the version in package.json
changes, the publish
GitHub action publishes the packages/miro-api
content to the npm registry as @mirohq/miro-api
.
The pages-build-deployment
GitHub action publishes the client documentation to GitHub pages.