@karage-pos/api-client
v1.0.0
Published
TypeScript API client for Garage POS
Maintainers
Readme
@garage-pos/api-client
TypeScript API client for Garage POS, automatically generated from OpenAPI specifications.
Installation
From GitHub Packages
npm install @garage-pos/api-clientConfiguration
For GitHub Packages, add .npmrc to your project:
@garage-pos:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}Usage
import { client } from '@garage-pos/api-client';
// Configure the client
client.setConfig({
baseUrl: 'https://api.garage-pos.com',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
},
});
// Use the generated services
import { SomeService } from '@garage-pos/api-client';
const result = await SomeService.someMethod();Development
Prerequisites
- Node.js 20+
- npm or yarn
Setup
# Install dependencies
npm install
# Download OpenAPI spec (update URL as needed)
curl -L -o openapi.json https://your-backend-url/openapi.json
# Generate TypeScript client
npm run openapi-ts
# Build the package
npm run buildScripts
npm run openapi-ts- Generate TypeScript client from OpenAPI specnpm run build- Build the packagenpm run clean- Clean generated files and build output
Automatic Updates
This package is automatically updated when the OpenAPI specification changes in the backend repository. The GitHub Actions workflow:
- Monitors for OpenAPI spec updates via repository dispatch events
- Downloads the latest OpenAPI specification
- Generates the TypeScript client
- Automatically versions the package using semantic-release
- Publishes to GitHub Packages
Publishing
Publishing is handled automatically by GitHub Actions. To trigger a new release:
- Automatic: Backend repository dispatches an event when OpenAPI spec changes
- Manual: Run the workflow manually from GitHub Actions tab
License
MIT
Support
For issues and questions, please open an issue in the GitHub repository.
