feat: add HTTP request logging, status_code property, and update enums#173
Open
fern-api[bot] wants to merge 1 commit intomasterfrom
Open
feat: add HTTP request logging, status_code property, and update enums#173fern-api[bot] wants to merge 1 commit intomasterfrom
fern-api[bot] wants to merge 1 commit intomasterfrom
Conversation
Introduces structured HTTP request/response logging with sensitive header redaction, exposes a new `status_code` property on `BaseHttpResponse`, expands `AppointmentPscLabs` from a string literal to a full StrEnum, removes the `insulin_injection` enum value from `IntervalTimeseriesExprTimeseries`, removes the `LinkBulk*RequestTeamId` types from `vital.link`, and improves SSE parsing and Pydantic v2 datetime handling internals. Key changes: - Add `LogConfig`/`Logger` support to `HttpClient` and `AsyncHttpClient` with sensitive header redaction for debug/error logging - Add `status_code` property to `BaseHttpResponse` for easier HTTP status inspection - Expand `AppointmentPscLabs` to a StrEnum with `QUEST` and `SONORA_QUEST` values (previously only `"quest"` literal) - Remove `INSULIN_INJECTION` enum value and its `visit()` callback from `IntervalTimeseriesExprTimeseries` - Remove `LinkBulkExportRequestTeamId`, `LinkBulkImportRequestTeamId`, `LinkBulkPauseRequestTeamId`, `LinkBulkTriggerHistoricalPullRequestTeamId`, and `LinkListBulkOpsRequestTeamId` public types - Add `parse_sse_obj` utility for discriminated-union SSE parsing and improve Pydantic v2 datetime adapters 🌿 Generated with Fern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version Bump: Existing callers break on three fronts:
IntervalTimeseriesExprTimeseries.visit()loses the requiredinsulin_injectionparameter, five publicLinkBulk*RequestTeamIdclasses are deleted, andAppointmentPscLabschanges from aLiteraltype alias to aStrEnumclass.Several breaking changes have been made in this release:
The
INSULIN_INJECTIONenum value has been removed fromIntervalTimeseriesExprTimeseries. Callers using.visit(insulin_injection=...)must remove that argument.The
LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId, andLinkListBulkOpsRequestTeamIdtypes have been removed fromvital.link.AppointmentPscLabshas changed from aLiteral["quest"]type alias to aStrEnumclass — code using it as a plain string type annotation may need updating.New in this release: HTTP requests now support structured logging (debug and error) with automatic redaction of sensitive headers;
BaseHttpResponseexposes a newstatus_codeproperty; andAppointmentPscLabsnow includes theSONORA_QUESTvalue.Breaking changes:
The
fileparameter ofparser_create_job(on bothLabReportClientandAsyncLabReportClient) has changed fromcore.Filetotyping.List[core.File]. Callers must now wrap a single file in a list:file=[my_file].The following types have been removed from the top-level
vitalpackage:LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId, andLinkListBulkOpsRequestTeamId.New features:
Three new resource submodules are now available:
vital.compendium,vital.lab_account, andvital.order_transaction.Over 40 new public types have been added, including
CanonicalCandidate,ClientFacingLabAccount,ClientFacingOrderTransaction,InsulinInjectionTimeseriesExpr,OrderSummary,SearchCompendiumResponse,UsState,UserAddress, and more.Client wrappers now accept an optional
loggingparameter for structured request/response logging (LogConfigorLogger).The
LabTestsClient(sync and async) has been expanded with several new parameters and types:get_psc_appointment_availabilitynow accepts a requiredlabparameter (AppointmentPscLabs) and a new optionalallow_staleflag for cached availability data.book_psc_appointmentnow supports optionalidempotency_keyandidempotency_errorparameters for idempotent PSC appointment booking (currently in closed beta).create_lab_testaccepts new optionallab_account_idandlab_slug(Labs) parameters.get_markersaccepts a new optionallab_slugparameter to filter markers by lab slug.get_ordersaccepts a new optionalorder_transaction_idparameter for filtering.request_phlebotomy_appointmentaccepts a new optionalappointment_notesparameter.create_orderaccepts a new optionalclinical_notesparameter.New types
AppointmentPscLabsandLabsare now available for use with these methods.The
get_psc_appointment_availabilitymethod now requires alabparameter (of typeAppointmentPscLabs) that was previously hardcoded to"quest". Callers must now explicitly pass the desired lab value. Additionally, many lab test and appointment methods have new optional parameters:lab_account_id,lab_slug,order_transaction_id,appointment_notes,allow_stale,clinical_notes, and idempotency support (idempotency_key,idempotency_error) for PSC appointment booking.The
team_idparameter has been removed fromlink.list_bulk_ops(),link.bulk_import(),link.bulk_trigger_historical_pull(),link.bulk_export(), andlink.bulk_pause()— callers using this keyword argument must remove it. The associated enum types (LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId,LinkListBulkOpsRequestTeamId) have also been removed.link.connect_manual_provider()now accepts three new optional parameters:vital_ios_sdk_version,vital_android_sdk_version, andgranted_permissions, enabling mobile SDK version reporting and explicit permission grants.Breaking changes:
addressparameter type in user creation/update methods (UserClient,RawUserClient) has changed fromAddresstoUserAddress. Update all imports and usages accordingly (e.g., replacefrom vital import Addresswithfrom vital import UserAddress).ParsingJob.job_idhas been removed. UseParsingJob.idto identify parsing jobs.Jpeg.contentandPng.contentnow usebytesinstead ofstr.New features:
VitalandAsyncVital:compendium,lab_account, andorder_transaction.loggingparameter is available onVitalandAsyncVitalconstructors, accepting aLogConfigdict or aLoggerinstance for configurable SDK-level logging.ClientFacingOrdernow exposeslast_event,clinical_notes,origin, andorder_transactionfields.ClientFacingInsulinInjectionSamplegains optionaldelivery_mode,delivery_form, andbolus_purposefields.OrderStatusincludes new enum values for corrected results and lab-processing-blocked states.compendium(withsearchandconvertmethods for lab test discovery and cross-lab conversion) andlab_account(withget_team_lab_accountsfor managing team lab accounts). A new structured logging module (ILogger,ConsoleLogger,LogConfig,Logger,create_logger) is also available viavital.core.order_transactionclient namespace with three methods:get_transaction(),get_transaction_result(), andget_transaction_result_pdf(). These methods provide access to order transaction details, raw lab results, and streamable PDF lab result reports respectively. Both synchronous and asynchronous variants are available.ClientFacingLabAccount,GetTeamLabAccountsResponse,LabAccountDelegatedFlow,LabAccountStatus), order transactions (ClientFacingOrderTransaction,ClientFacingOrderInTransaction,GetOrderTransactionResponse,OrderTransactionStatus,OrderOrigin,OrderStatusDetail,OrderSummary), compendium search (SearchCompendiumResponse,CompendiumSearchLabs,ConvertCompendiumResponse,SearchMode,CanonicalCandidate,PerLabCandidate,RelatedCandidate), insulin injection details (ClientFacingInsulinInjectionSampleBolusPurpose,ClientFacingInsulinInjectionSampleDeliveryForm,ClientFacingInsulinInjectionSampleDeliveryMode), and sleep analytics (AwakeningsValueMacroExpr,DerivedReadinessColumnExpr). Several existing models have gained new optional fields, and new enum values have been added toAppointmentProvider(SONORA_QUEST) and source-type enums (INSULIN_PUMP).recovery_readiness_score(onClientFacingSleep),status_detail(onClientFacingOrderEvent), andorder_transaction(onLabResultsRaw) are also available. Several enums have been expanded with new values includingSONORA_QUEST,CRL,SAMSUNG_HEALTH,INSULIN_PUMP,CORRECTED,LAB_PROCESSING_BLOCKED, andDERIVED_READINESS.OrderStatusDetail,OrderTransactionStatus, andOrderSummaryfor richer order lifecycle tracking;SearchCompendiumResponse,PerLabCandidate,RelatedCandidate, andProviderIdConversionResponsefor compendium search and provider ID conversion; andUserAddresswithUsStateenum for US address handling. New providersTANDEM_SOURCEandSAMSUNG_HEALTHhave been added to theProvidersenum,TANDEM_SOURCEtoPasswordProviders, andAPERO/PVERIFYtoPayorCodeExternalProvider. Address models (PatientAddress,PatientAddressCompatible,PatientAddressWithValidation,UsAddress) now include an optionalaccess_notesfield, and query expression union types have been expanded withAwakeningsValueMacroExpr,DerivedReadinessColumnExpr, andInsulinInjectionTimeseriesExpr.