@aditya2337/drive-ride-matching-types
v0.3.0
Published
TypeScript types generated from Ride Matching Service OpenAPI specification
Maintainers
Readme
Ride Matching Service API Types
This package contains TypeScript types generated from the Ride Matching Service API specification.
Installation
npm install @aditya2337/drive-ride-matching-typesUsage
import {
dto_CreateRideInput,
dto_RideOutput,
dto_DriverOutput,
dto_UpdateDriverLocationInput
} from '@aditya2337/drive-ride-matching-types';
// Using the model types
const createRideRequest: dto_CreateRideInput = {
customer_id: 123,
pickup_lat: 37.7749,
pickup_lng: -122.4194,
drop_lat: 37.3382,
drop_lng: -121.8863,
vehicle_type: 'sedan'
};
// Working with response types
function handleRideResponse(response: dto_RideOutput) {
console.log(response.id, response.status);
}
// Using request and response types for specific endpoints
import {
GetRidesIdRequest,
GetRidesIdResponse,
PostRidesRequest,
PostRidesResponse
} from '@aditya2337/drive-ride-matching-types';
// Example of creating a request for a specific endpoint
const rideRequest: PostRidesRequest = {
body: createRideRequest
};
// Handling typed responses
function processRideResponse(response: PostRidesResponse) {
// Response is properly typed
if (response.status === 201) {
console.log(response.body.id);
}
}Publishing
Automatic Publishing
This package is automatically published to npm when changes are made to the OpenAPI specification in the main repository.
Manual Publishing
To manually publish a new version:
Make sure you're logged in to npm with proper access:
npm loginRun the publish script:
./scripts/publish-types.shFollow the prompts to select version increment and confirm publishing.
