@growsober/types
v1.0.2
Published
Auto-generated TypeScript types from the GrowSober API OpenAPI specification
Maintainers
Readme
@growsober/types
Auto-generated TypeScript types from the GrowSober API OpenAPI specification.
Installation
npm install @growsober/typesUsage
import type { paths, components } from '@growsober/types';
// Access schema types
type User = components['schemas']['UserResponseDto'];
type Event = components['schemas']['EventResponseDto'];
type Hub = components['schemas']['HubResponseDto'];
// Access path types for type-safe API calls
type LoginRequest = paths['/api/v1/auth/login']['post']['requestBody']['content']['application/json'];
type LoginResponse = paths['/api/v1/auth/login']['post']['responses']['200']['content']['application/json'];Generating Types
Types are auto-generated from the running API's OpenAPI spec:
# From local development API
npm run generate
# From production API
npm run generate:prodAvailable Types
Auth Types
RegisterDto- Registration requestLoginDto- Login requestAuthResponseDto- Auth response with tokensRefreshTokenDto- Token refresh requestTokenResponseDto- Token responseFirebaseAuthDto- Firebase auth request
User Types
UserResponseDto- Full user profileUserPublicResponseDto- Public profileCreateUserDto- Create user requestUpdateUserDto- Update user request
Hub Types
HubResponseDto- Hub detailsCreateHubDto- Create hub requestUpdateHubDto- Update hub request
Event Types
EventResponseDto- Event detailsCreateEventDto- Create event requestUpdateEventDto- Update event request
Booking Types
BookingResponseDto- Booking detailsCreateBookingDto- Create booking request
Library Types
LibraryContentResponseDto- Content list itemLibraryContentDetailResponseDto- Full contentLibraryProgressResponseDto- User progress
Business Types
BusinessResponseDto- Business detailsOfferResponseDto- Offer detailsRedeemOfferDto- Redeem offer request
Subscription Types
SubscriptionResponseDto- Subscription detailsCreateCheckoutDto- Checkout request
Notification Types
NotificationResponseDto- Notification details
Type Helpers
For convenience, use with @growsober/sdk which provides type extraction utilities:
import type {
RequestBody,
ResponseBody,
QueryParams,
PathParams
} from '@growsober/sdk';
// Extract request body type
type CreateEventBody = RequestBody<'/api/v1/events', 'post'>;
// Extract response type
type EventResponse = ResponseBody<'/api/v1/events/{id}', 'get'>;Development
# Type check
npm run type-check
# Build
npm run buildLicense
UNLICENSED - Proprietary
