@open-dpp/api-client
v2.2.2
Published
A client for my API
Readme
The open source platform for digital product passports.
Description
This repository contains a HTTP client for the REST API of our open-dpp platform.
Usage Guide
Installation
$ npm install @open-dpp/api-clientUsage
Create a new instance of a client with the baseURL parameter directing to your API.
const apiClient = new OpenDppApiClient({baseURL: API_URL});Set the ApiKey for the client to enable it to authenticate to your API.
apiClient.setApiKey(token);Use any function of the client. E.g., create an organization.
const addOrganization = async () => {
console.log('Creating organization...');
const response = await apiClient.postOrganization({
name: "Test",
});
console.log('Finished creating an organization.');
if (response.status === 201) {
console.log("Successfully created an organization.");
} else {
console.error("Error on creating an organization.");
}
};Development Guide
Installation
$ npm installDeployment
- Commit your current changed files for a clean working tree in the next step
- Merge your changes on the main branch
- Run
npm run buildto see if your code compiles - Run
npm run testto see if your code fails - Determine whether you want to create a patch, minor or major version. Run the fitting npm scripts (e.g., npm run
patch)
- This updates the version number in the package.json
- Also, a git tag is created for the version
- The git tag and current branch are pushed to GitHub
- First, the push triggers a workflow to create a new release in GitHub
- Finishing that workflow triggers another one to publish the release to npm
