Scout-api-client
This is generated api client by open-api-generator.
Once you have installed that on your target project you can use scout API:
import { GeoApi } from '@akido/scout-api-client';
export const scoutApi = new GeoApi({
basePath: SCOUT_API_URL,
});
const example = async () => {
try {
const { data } = await scoutApi.fetchMapLayers();
console.log(data, 'Result from api.');
} catch (error) {
console.log('API error: ', error);
}
};
example();
For publishing new version
Navigate to scout/apps/api
, make sure all dependencies are installed and run the server:
yarn run dev
Right after that in the same folder run:
yarn run api:generate-client
This command will generate scout-api-client
under scout/libs/scout-api-client
.
One you are ready to publish new version of package please increment package version (libs/scout-api-client/package.json
), and run npm publish
under scout/libs/scout-api-client
.
All done! Now you published new version of scout-api-client
!
Troubleshooting
- Make sure API server has been started before
yarn run api:generate-client
running
- Check the
yarn run api:generate-client
output, there might be errors related to swagger
- Make sure you have read/write GitLab token for private registry (you can find it in 1password)
- Make sure you have updated version of the package in
libs/scout-api-client/package.json
and it is above version that you currently have in GitLab registry