feat: add HTTP request logging, SSE parsing utilities, and expand enums#174
Open
fern-api[bot] wants to merge 1 commit intomasterfrom
Open
feat: add HTTP request logging, SSE parsing utilities, and expand enums#174fern-api[bot] wants to merge 1 commit intomasterfrom
fern-api[bot] wants to merge 1 commit intomasterfrom
Conversation
Introduce structured HTTP request/response logging with sensitive header redaction, a new `parse_sse_obj` utility for discriminated union SSE parsing, an expanded `AppointmentPscLabs` enum, and a `status_code` property on `BaseHttpResponse`. Also removes the `Link` bulk-ops team ID types and the `INSULIN_INJECTION` value from `IntervalTimeseriesExprTimeseries`. Key changes: - Add opt-in HTTP request/response logging via `LogConfig`/`Logger` with automatic redaction of sensitive headers (authorization, API keys, cookies, etc.) - Add `parse_sse_obj` helper in `pydantic_utilities` for smart SSE event parsing supporting both data-level and event-level discriminated unions - Add `status_code` property to `BaseHttpResponse` for direct access to HTTP status codes - Expand `AppointmentPscLabs` from a `Literal["quest"]` alias to a full `StrEnum` with `QUEST` and `SONORA_QUEST` values - Remove `LinkBulkExportRequestTeamId`, `LinkBulkImportRequestTeamId`, `LinkBulkPauseRequestTeamId`, `LinkBulkTriggerHistoricalPullRequestTeamId`, and `LinkListBulkOpsRequestTeamId` enum types - Remove `INSULIN_INJECTION` value from `IntervalTimeseriesExprTimeseries` enum and its `visit()` method 🌿 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: Removing
LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId,LinkListBulkOpsRequestTeamId, removing theINSULIN_INJECTIONenum member (breakingvisit()call sites), and changingAppointmentPscLabsfrom aLiteraltype alias to a class are all breaking changes for existing callers.Several breaking changes are included in this release:
The
LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId, andLinkListBulkOpsRequestTeamIdenum types have been removed fromvital.link. Update any code that imports or references these types.The
INSULIN_INJECTIONmember has been removed fromIntervalTimeseriesExprTimeseries. Callers using.visit(insulin_injection=...)must remove that argument.AppointmentPscLabshas changed fromLiteral["quest"]to aStrEnum; code that compares against the string"quest"directly should useAppointmentPscLabs.QUESTinstead.New in this release: HTTP request/response logging with automatic sensitive-header redaction is now available via
LogConfig/Logger, astatus_codeproperty has been added toBaseHttpResponse, andAppointmentPscLabsnow includes the newSONORA_QUESTvalue.Breaking changes:
The
fileparameter ofparser_create_job(on bothLabReportClientandAsyncLabReportClient) has changed fromcore.Filetotyping.List[core.File]. Callers must now pass a list, e.g. replacefile=my_filewithfile=[my_file].The following types have been removed from the top-level
vitalnamespace:LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId, andLinkListBulkOpsRequestTeamId.New capabilities:
The SDK now exposes three new submodules —
vital.compendium,vital.lab_account, andvital.order_transaction— along with many new types includingCanonicalCandidate,ClientFacingLabAccount,ClientFacingOrderTransaction,OrderSummary,OrderStatusDetail,SearchCompendiumResponse,UsState,UserAddress, and others. An optionalloggingparameter is now accepted by the client wrappers.lab_slugandlab_account_idparameters are available on lab test create/update andget_markersmethods;order_transaction_idcan now be used to filter order listings;appointment_notesandclinical_notesfields are available on phlebotomy appointment requests and order creation respectively. Theget_psc_appointment_availabilitymethod now accepts a requiredlabparameter (of typeAppointmentPscLabs) and an optionalallow_staleflag, andbook_psc_appointmentsupports optionalidempotency_keyandidempotency_errorparameters. Two new types,AppointmentPscLabsandLabs, are now exported from the SDK.get_psc_appointment_availabilitymethod now requires alabparameter of typeAppointmentPscLabs(previously the lab was hardcoded to"quest"). Callers must now passlab=AppointmentPscLabs(...)explicitly.Several new optional parameters have also been added across lab test and order APIs:
lab_slugandlab_account_idon lab test create/update,lab_slugonget_markers,order_transaction_idon order listing,appointment_noteson PSC appointment reschedule,clinical_noteson order creation, andidempotency_key/idempotency_erroron PSC appointment booking. Two new types (AppointmentPscLabs,Labs) are now available.team_idparameter has been removed from the followinglinkclient methods:list_bulk_ops,bulk_import,bulk_trigger_historical_pull,bulk_export, andbulk_pause. Callers passingteam_idmust remove that argument. The associated enum types (LinkBulkExportRequestTeamId,LinkBulkImportRequestTeamId,LinkBulkPauseRequestTeamId,LinkBulkTriggerHistoricalPullRequestTeamId,LinkListBulkOpsRequestTeamId) have also been removed and any imports of them will break.The
connect_manual_providermethod now accepts two new optional parameters—vital_ios_sdk_versionandvital_android_sdk_version(sent as request headers) andgranted_permissions(sent in the request body)—enabling richer manual provider connections from mobile SDKs.addressparameter type in user client methods (create_user_info/update_user_info) has changed fromAddresstoUserAddress. Callers must importUserAddressfromvitaland replace anyAddress(...)instantiation withUserAddress(...).The
Jpeg.contentandPng.contentfields have changed fromstrtobytes, andParsingJob.job_idhas been removed; update any code that reads these fields accordingly.New capabilities include
compendium,lab_account, andorder_transactionsub-clients onVital/AsyncVital, an optionalloggingparameter on both client constructors, richerClientFacingOrderfields (last_event,clinical_notes,origin,order_transaction), new insulin-injection metadata fields, additionalOrderStatusenum values, and agenderfield onResultMetadata.The SDK now includes two new resource clients:
client.compendiumprovidessearch()andconvert()methods for querying and converting lab test compendium data across labs, andclient.lab_accountprovides aget_team_lab_accounts()method for retrieving your team's lab account information. A new structured logging system (ILogger,ConsoleLogger,Logger,LogConfig,create_logger) is also available fromvital.core.The SDK now includes a new
order_transactionclient namespace with three methods:get_transaction()for retrieving order transaction details,get_transaction_result()for fetching raw lab results, andget_transaction_result_pdf()for streaming PDF lab result reports. Both synchronous and asynchronous clients are available.The SDK now exposes a large set of new types supporting lab account management (
ClientFacingLabAccount,LabAccountStatus,LabAccountDelegatedFlow,GetTeamLabAccountsResponse), order transactions (ClientFacingOrderTransaction,GetOrderTransactionResponse,OrderTransactionStatus), compendium search and conversion (SearchCompendiumResponse,ConvertCompendiumResponse,SearchMode), and insulin injection detail enums (ClientFacingInsulinInjectionSampleBolusPurpose,ClientFacingInsulinInjectionSampleDeliveryForm,ClientFacingInsulinInjectionSampleDeliveryMode). New optional fields have been added toAppointmentBookingRequest(async confirmation controls),AppointmentRescheduleRequest,Address, andClientFacingAppointment. New enum valuesSONORA_QUEST(AppointmentProvider) andINSULIN_PUMP(device/ECG source types) are also available.The SDK now supports expanded lab account management with new
ClientFacingLabAccount,LabAccountStatus, andLabAccountDelegatedFlowtypes. New order transaction models (ClientFacingOrderTransaction,GetOrderTransactionResponse,OrderOrigin) and insulin injection timeseries types (InsulinInjectionTimeseriesExpr,ClientFacingInsulinInjectionSampleDeliveryMode) are available. Additional new types includeDerivedReadinessColumnExprfor readiness data queries,CompendiumSearchLabs/ConvertCompendiumResponsefor lab compendium conversion, and lab report parsing job event models. Several existing models have new optional fields (recovery_readiness_scoreonClientFacingSleep,status_detailonClientFacingOrderEvent,order_transactiononLabResultsRaw), and multiple enums have been extended with new values includingSONORA_QUEST,CRL,SAMSUNG_HEALTH,INSULIN_PUMP,CORRECTED,LAB_PROCESSING_BLOCKED, andDERIVED_READINESS.The SDK now includes several new types and capabilities:
New models for compendium search:
SearchCompendiumResponse,PerLabCandidate,RelatedCandidate, andProviderIdConversionResponseNew order-related types:
OrderStatusDetail,OrderSummary, andOrderTransactionStatusNew address types
UserAddressandUsState, plus an optionalaccess_notesfield on all patient address models (PatientAddress,PatientAddressCompatible,PatientAddressWithValidation,UsAddress)New provider values:
TANDEM_SOURCEandSAMSUNG_HEALTHinProviders;TANDEM_SOURCEinPasswordProviders;APEROandPVERIFYinPayorCodeExternalProviderNew enums:
ParsingJobFailureReason,SearchMode, andResultMetadataGenderNew query expression types (
AwakeningsValueMacroExpr,DerivedReadinessColumnExpr,InsulinInjectionTimeseriesExpr) available inQueryGroupByItemandQuerySelectItemRECOVERY_READINESS_SCOREadded toSleepColumnExprSleep