Request Objects Guide
Workflow Guide
Request Objects
Many SDK methods accept request objects to provide structured parameters. These request objects:
- ** Validate input** - Ensure data correctness before sending to API
- Type safety - Provide full TypeScript support with IntelliSense
- ** Standardize patterns** - Consistent interface across all SDK methods
Request Object Examples
// Get appointments with specific criteria
const appointmentsRequest = new AppointmentsRequest({
status: "booked",
date: {
start: "2024-01-01",
end: "2024-12-31",
},
_count: 50,
});
const appointments = await sdk.healthSpace.getAppointments(appointmentsRequest);
// Cancel an appointment
const cancelRequest = new CancelAppointmentRequest({
appointmentId: "appt-123",
reason: "Patient requested cancellation",
});
const result = await sdk.healthSpace.cancelAppointment(cancelRequest);
// Search health data with filters
const conditionsRequest = new ConditionsRequest({
category: "problem-list-item",
_count: 25,
});
const conditions = await sdk.health.getConditions(conditionsRequest);
// Search for healthcare providers
const searchRequest = new SearchHealthResourcesRequest({
searchTerm: "cardiologist",
location: { city: "New York", state: "NY" },
_count: 10,
});
const providers = await sdk.search.searchHealthResources(searchRequest);Finding Request Objects
Request objects are available as named exports from the SDK and follow consistent naming patterns:
- Method-specific requests:
AppointmentsRequest,CancelAppointmentRequest - Data-specific requests:
ConditionsRequest,LabsRequest,MedicationsRequest - Search-specific requests:
SearchHealthResourcesRequest,SubmitProviderForReviewRequest - User-specific requests:
UpdateProfileRequest,CreateConsentRequest
import {
// Health Space requests
AppointmentsRequest,
BWellSDK,
CancelAppointmentRequest,
// Health Data requests
ConditionsRequest,
CreateConsentRequest,
LabsRequest,
// Search requests
SearchHealthResourcesRequest,
SubmitProviderForReviewRequest,
// User Management requests
UpdateProfileRequest,
} from "@icanbwell/bwell-sdk-ts";Request Parameter Patterns
Most SDK methods follow these patterns:
- No parameters - Methods like
getProfile(),getConditions()that return all available data - Optional request object - Methods like
getAppointments(request?)where filtering is optional - Required request object - Methods like
cancelAppointment(request)that require specific parameters
When a method requires a request object, TypeScript IntelliSense will show you the exact parameter type and available properties.
Updated 8 days ago
