From 1c7bf0b5a490e6196c686f799a8207d996a52474 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 11:48:46 +0000 Subject: [PATCH] feat: add derived readiness data type and update lab parsing schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update introduces support for derived readiness data queries and enhances the lab report parsing system with improved metadata handling and failure reporting. Key changes: - Add DerivedReadinessColumnExpr type with comprehensive readiness metrics - Update QueryBatch fields from optional to required for timeframe and queries - Add ParsingJobFailureReason enum for better error classification - Enhance ResultMetadata with optional gender field and nullable patient fields - Remove JobId field from ParsingJob in favor of simplified structure - Support multiple file uploads in BodyCreateLabReportParserJob 🌿 Generated with Fern --- .fern/metadata.json | 7 +- .fernignore | 1 + .github/workflows/ci.yml | 14 +- activity.go | 2 +- activity/client.go | 8 +- activity/raw_client.go | 8 +- aggregate.go | 206 +- aggregate/client.go | 8 +- aggregate/raw_client.go | 8 +- body.go | 2 +- body/client.go | 8 +- body/raw_client.go | 8 +- changelog.md | 10 + client/client.go | 61 +- client/client_test.go | 2 +- compendium.go | 1367 ++++++++++++ compendium/client.go | 65 + compendium/raw_client.go | 131 ++ core/request_option.go | 4 +- devices.go | 2 +- devices/client.go | 8 +- devices/raw_client.go | 8 +- electrocardiogram.go | 2 +- electrocardiogram/client.go | 8 +- electrocardiogram/raw_client.go | 8 +- error_codes.go | 4 +- errors.go | 2 +- go.mod | 2 +- insurance.go | 23 +- insurance/client.go | 8 +- insurance/raw_client.go | 8 +- internal/caller.go | 75 +- internal/caller_test.go | 239 +- internal/error_decoder.go | 2 +- internal/error_decoder_test.go | 2 +- internal/multipart.go | 3 + internal/multipart_test.go | 76 + internal/retrier_test.go | 2 +- introspect.go | 2 +- introspect/client.go | 8 +- introspect/raw_client.go | 8 +- lab_account.go | 587 +++++ lab_report.go | 163 +- lab_tests.go | 3251 +++++++--------------------- labaccount/client.go | 49 + labaccount/raw_client.go | 79 + labreport/client.go | 10 +- labreport/raw_client.go | 14 +- labtests/client.go | 13 +- labtests/raw_client.go | 17 +- link.go | 343 ++- link/client.go | 8 +- link/raw_client.go | 14 +- meal.go | 2 +- meal/client.go | 8 +- meal/raw_client.go | 8 +- menstrual_cycle.go | 2 +- menstrualcycle/client.go | 8 +- menstrualcycle/raw_client.go | 8 +- option/request_option.go | 2 +- order.go | 2 +- order/client.go | 8 +- order/raw_client.go | 8 +- order_transaction.go | 328 +++ ordertransaction/client.go | 82 + ordertransaction/raw_client.go | 165 ++ payor.go | 25 +- payor/client.go | 8 +- payor/raw_client.go | 8 +- pointer.go | 5 + profile.go | 2 +- profile/client.go | 8 +- profile/raw_client.go | 8 +- providers.go | 2 +- providers/client.go | 8 +- providers/raw_client.go | 8 +- reference.md | 558 ++++- sleep.go | 2 +- sleep/client.go | 8 +- sleep/raw_client.go | 8 +- sleep_cycle.go | 2 +- sleepcycle/client.go | 8 +- sleepcycle/raw_client.go | 8 +- team.go | 2 +- team/client.go | 8 +- team/raw_client.go | 8 +- testkit.go | 50 +- testkit/client.go | 8 +- testkit/raw_client.go | 8 +- types.go | 3590 +++++++++++++++++++++++++++---- user.go | 293 ++- user/client.go | 8 +- user/raw_client.go | 8 +- vitals.go | 2 +- vitals/client.go | 8 +- vitals/raw_client.go | 8 +- workouts.go | 2 +- workouts/client.go | 8 +- workouts/raw_client.go | 8 +- 99 files changed, 9120 insertions(+), 3174 deletions(-) create mode 100644 changelog.md create mode 100644 compendium.go create mode 100644 compendium/client.go create mode 100644 compendium/raw_client.go create mode 100644 lab_account.go create mode 100644 labaccount/client.go create mode 100644 labaccount/raw_client.go create mode 100644 order_transaction.go create mode 100644 ordertransaction/client.go create mode 100644 ordertransaction/raw_client.go diff --git a/.fern/metadata.json b/.fern/metadata.json index c85f405..a8642d2 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,9 +1,10 @@ { - "cliVersion": "3.35.1", + "cliVersion": "4.37.10", "generatorName": "fernapi/fern-go-sdk", - "generatorVersion": "1.21.8", + "generatorVersion": "1.24.0", "generatorConfig": { "enableWireTests": false }, - "sdkVersion": "v1.1.575" + "originGitCommit": "490713277bc34d3e43cde8608486b46ac79daef9", + "sdkVersion": "v2.0.0" } \ No newline at end of file diff --git a/.fernignore b/.fernignore index 43ca0d2..07281cd 100644 --- a/.fernignore +++ b/.fernignore @@ -1,3 +1,4 @@ # Specify files that shouldn't be modified by Fern README.md +changelog.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56310d6..13a56af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,11 +25,21 @@ jobs: - name: Setup wiremock server run: | - if [ -f wiremock/docker-compose.test.yml ]; then docker compose -f wiremock/docker-compose.test.yml down && docker compose -f wiremock/docker-compose.test.yml up -d; fi + PROJECT_NAME="wiremock-$(basename $(dirname $(pwd)) | tr -d '.')" + echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV + if [ -f wiremock/docker-compose.test.yml ]; then + docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml down + docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml up -d + WIREMOCK_PORT=$(docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml port wiremock 8080 | cut -d: -f2) + echo "WIREMOCK_PORT=$WIREMOCK_PORT" >> $GITHUB_ENV + fi - name: Test run: go test ./... - name: Teardown wiremock server + if: always() run: | - if [ -f wiremock/docker-compose.test.yml ]; then docker compose -f wiremock/docker-compose.test.yml down; fi + if [ -f wiremock/docker-compose.test.yml ]; then + docker compose -p "$PROJECT_NAME" -f wiremock/docker-compose.test.yml down + fi diff --git a/activity.go b/activity.go index 70a2797..33b0769 100644 --- a/activity.go +++ b/activity.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/activity/client.go b/activity/client.go index 4244b06..e814d0d 100644 --- a/activity/client.go +++ b/activity/client.go @@ -4,10 +4,10 @@ package activity import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/activity/raw_client.go b/activity/raw_client.go index b8ce8fa..86f4954 100644 --- a/activity/raw_client.go +++ b/activity/raw_client.go @@ -4,10 +4,10 @@ package activity import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/aggregate.go b/aggregate.go index 8b151af..afced5f 100644 --- a/aggregate.go +++ b/aggregate.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) @@ -51,8 +51,8 @@ var ( ) type QueryBatch struct { - Timeframe *QueryBatchTimeframe `json:"timeframe,omitempty" url:"-"` - Queries []*Query `json:"queries,omitempty" url:"-"` + Timeframe *QueryBatchTimeframe `json:"timeframe" url:"-"` + Queries []*Query `json:"queries" url:"-"` Config *QueryConfig `json:"config,omitempty" url:"-"` accept string @@ -381,6 +381,7 @@ func (a *AggregateExpr) String() string { type AggregateExprArg struct { SleepColumnExpr *SleepColumnExpr + DerivedReadinessColumnExpr *DerivedReadinessColumnExpr ActivityColumnExpr *ActivityColumnExpr WorkoutColumnExpr *WorkoutColumnExpr BodyColumnExpr *BodyColumnExpr @@ -409,6 +410,13 @@ func (a *AggregateExprArg) GetSleepColumnExpr() *SleepColumnExpr { return a.SleepColumnExpr } +func (a *AggregateExprArg) GetDerivedReadinessColumnExpr() *DerivedReadinessColumnExpr { + if a == nil { + return nil + } + return a.DerivedReadinessColumnExpr +} + func (a *AggregateExprArg) GetActivityColumnExpr() *ActivityColumnExpr { if a == nil { return nil @@ -535,6 +543,12 @@ func (a *AggregateExprArg) UnmarshalJSON(data []byte) error { a.SleepColumnExpr = valueSleepColumnExpr return nil } + valueDerivedReadinessColumnExpr := new(DerivedReadinessColumnExpr) + if err := json.Unmarshal(data, &valueDerivedReadinessColumnExpr); err == nil { + a.typ = "DerivedReadinessColumnExpr" + a.DerivedReadinessColumnExpr = valueDerivedReadinessColumnExpr + return nil + } valueActivityColumnExpr := new(ActivityColumnExpr) if err := json.Unmarshal(data, &valueActivityColumnExpr); err == nil { a.typ = "ActivityColumnExpr" @@ -644,6 +658,9 @@ func (a AggregateExprArg) MarshalJSON() ([]byte, error) { if a.typ == "SleepColumnExpr" || a.SleepColumnExpr != nil { return json.Marshal(a.SleepColumnExpr) } + if a.typ == "DerivedReadinessColumnExpr" || a.DerivedReadinessColumnExpr != nil { + return json.Marshal(a.DerivedReadinessColumnExpr) + } if a.typ == "ActivityColumnExpr" || a.ActivityColumnExpr != nil { return json.Marshal(a.ActivityColumnExpr) } @@ -700,6 +717,7 @@ func (a AggregateExprArg) MarshalJSON() ([]byte, error) { type AggregateExprArgVisitor interface { VisitSleepColumnExpr(*SleepColumnExpr) error + VisitDerivedReadinessColumnExpr(*DerivedReadinessColumnExpr) error VisitActivityColumnExpr(*ActivityColumnExpr) error VisitWorkoutColumnExpr(*WorkoutColumnExpr) error VisitBodyColumnExpr(*BodyColumnExpr) error @@ -723,6 +741,9 @@ func (a *AggregateExprArg) Accept(visitor AggregateExprArgVisitor) error { if a.typ == "SleepColumnExpr" || a.SleepColumnExpr != nil { return visitor.VisitSleepColumnExpr(a.SleepColumnExpr) } + if a.typ == "DerivedReadinessColumnExpr" || a.DerivedReadinessColumnExpr != nil { + return visitor.VisitDerivedReadinessColumnExpr(a.DerivedReadinessColumnExpr) + } if a.typ == "ActivityColumnExpr" || a.ActivityColumnExpr != nil { return visitor.VisitActivityColumnExpr(a.ActivityColumnExpr) } @@ -2189,6 +2210,126 @@ func (d *DateTruncExprArg) Accept(visitor DateTruncExprArgVisitor) error { return fmt.Errorf("type %T does not include a non-empty union type", d) } +var ( + derivedReadinessColumnExprFieldDerivedReadiness = big.NewInt(1 << 0) +) + +type DerivedReadinessColumnExpr struct { + // ℹ️ This enum is non-exhaustive. + DerivedReadiness DerivedReadinessColumnExprDerivedReadiness `json:"derived_readiness" url:"derived_readiness"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (d *DerivedReadinessColumnExpr) GetDerivedReadiness() DerivedReadinessColumnExprDerivedReadiness { + if d == nil { + return "" + } + return d.DerivedReadiness +} + +func (d *DerivedReadinessColumnExpr) GetExtraProperties() map[string]interface{} { + return d.extraProperties +} + +func (d *DerivedReadinessColumnExpr) require(field *big.Int) { + if d.explicitFields == nil { + d.explicitFields = big.NewInt(0) + } + d.explicitFields.Or(d.explicitFields, field) +} + +// SetDerivedReadiness sets the DerivedReadiness field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (d *DerivedReadinessColumnExpr) SetDerivedReadiness(derivedReadiness DerivedReadinessColumnExprDerivedReadiness) { + d.DerivedReadiness = derivedReadiness + d.require(derivedReadinessColumnExprFieldDerivedReadiness) +} + +func (d *DerivedReadinessColumnExpr) UnmarshalJSON(data []byte) error { + type unmarshaler DerivedReadinessColumnExpr + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DerivedReadinessColumnExpr(value) + extraProperties, err := internal.ExtractExtraProperties(data, *d) + if err != nil { + return err + } + d.extraProperties = extraProperties + d.rawJSON = json.RawMessage(data) + return nil +} + +func (d *DerivedReadinessColumnExpr) MarshalJSON() ([]byte, error) { + type embed DerivedReadinessColumnExpr + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (d *DerivedReadinessColumnExpr) String() string { + if len(d.rawJSON) > 0 { + if value, err := internal.StringifyJSON(d.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(d); err == nil { + return value + } + return fmt.Sprintf("%#v", d) +} + +// ℹ️ This enum is non-exhaustive. +type DerivedReadinessColumnExprDerivedReadiness string + +const ( + DerivedReadinessColumnExprDerivedReadinessDate DerivedReadinessColumnExprDerivedReadiness = "date" + DerivedReadinessColumnExprDerivedReadinessChronotype DerivedReadinessColumnExprDerivedReadiness = "chronotype" + DerivedReadinessColumnExprDerivedReadinessSleepScore DerivedReadinessColumnExprDerivedReadiness = "sleep_score" + DerivedReadinessColumnExprDerivedReadinessRecoveryScore DerivedReadinessColumnExprDerivedReadiness = "recovery_score" + DerivedReadinessColumnExprDerivedReadinessRecoveryZone DerivedReadinessColumnExprDerivedReadiness = "recovery_zone" + DerivedReadinessColumnExprDerivedReadinessStressScore DerivedReadinessColumnExprDerivedReadiness = "stress_score" + DerivedReadinessColumnExprDerivedReadinessStrainScore DerivedReadinessColumnExprDerivedReadiness = "strain_score" + DerivedReadinessColumnExprDerivedReadinessStrainZone DerivedReadinessColumnExprDerivedReadiness = "strain_zone" +) + +func NewDerivedReadinessColumnExprDerivedReadinessFromString(s string) (DerivedReadinessColumnExprDerivedReadiness, error) { + switch s { + case "date": + return DerivedReadinessColumnExprDerivedReadinessDate, nil + case "chronotype": + return DerivedReadinessColumnExprDerivedReadinessChronotype, nil + case "sleep_score": + return DerivedReadinessColumnExprDerivedReadinessSleepScore, nil + case "recovery_score": + return DerivedReadinessColumnExprDerivedReadinessRecoveryScore, nil + case "recovery_zone": + return DerivedReadinessColumnExprDerivedReadinessRecoveryZone, nil + case "stress_score": + return DerivedReadinessColumnExprDerivedReadinessStressScore, nil + case "strain_score": + return DerivedReadinessColumnExprDerivedReadinessStrainScore, nil + case "strain_zone": + return DerivedReadinessColumnExprDerivedReadinessStrainZone, nil + } + var t DerivedReadinessColumnExprDerivedReadiness + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (d DerivedReadinessColumnExprDerivedReadiness) Ptr() *DerivedReadinessColumnExprDerivedReadiness { + return &d +} + var ( discreteTimeseriesExprFieldTimeseries = big.NewInt(1 << 0) discreteTimeseriesExprFieldField = big.NewInt(1 << 1) @@ -2602,19 +2743,22 @@ func (i *IndexColumnExpr) String() string { type IndexColumnExprIndex string const ( - IndexColumnExprIndexSleep IndexColumnExprIndex = "sleep" - IndexColumnExprIndexActivity IndexColumnExprIndex = "activity" - IndexColumnExprIndexWorkout IndexColumnExprIndex = "workout" - IndexColumnExprIndexBody IndexColumnExprIndex = "body" - IndexColumnExprIndexMeal IndexColumnExprIndex = "meal" - IndexColumnExprIndexProfile IndexColumnExprIndex = "profile" - IndexColumnExprIndexTimeseries IndexColumnExprIndex = "timeseries" + IndexColumnExprIndexSleep IndexColumnExprIndex = "sleep" + IndexColumnExprIndexDerivedReadiness IndexColumnExprIndex = "derived_readiness" + IndexColumnExprIndexActivity IndexColumnExprIndex = "activity" + IndexColumnExprIndexWorkout IndexColumnExprIndex = "workout" + IndexColumnExprIndexBody IndexColumnExprIndex = "body" + IndexColumnExprIndexMeal IndexColumnExprIndex = "meal" + IndexColumnExprIndexProfile IndexColumnExprIndex = "profile" + IndexColumnExprIndexTimeseries IndexColumnExprIndex = "timeseries" ) func NewIndexColumnExprIndexFromString(s string) (IndexColumnExprIndex, error) { switch s { case "sleep": return IndexColumnExprIndexSleep, nil + case "derived_readiness": + return IndexColumnExprIndexDerivedReadiness, nil case "activity": return IndexColumnExprIndexActivity, nil case "workout": @@ -3867,6 +4011,7 @@ type QueryGroupByItem struct { DateTruncExpr *DateTruncExpr DatePartExpr *DatePartExpr SleepColumnExpr *SleepColumnExpr + DerivedReadinessColumnExpr *DerivedReadinessColumnExpr ActivityColumnExpr *ActivityColumnExpr WorkoutColumnExpr *WorkoutColumnExpr BodyColumnExpr *BodyColumnExpr @@ -3909,6 +4054,13 @@ func (q *QueryGroupByItem) GetSleepColumnExpr() *SleepColumnExpr { return q.SleepColumnExpr } +func (q *QueryGroupByItem) GetDerivedReadinessColumnExpr() *DerivedReadinessColumnExpr { + if q == nil { + return nil + } + return q.DerivedReadinessColumnExpr +} + func (q *QueryGroupByItem) GetActivityColumnExpr() *ActivityColumnExpr { if q == nil { return nil @@ -4047,6 +4199,12 @@ func (q *QueryGroupByItem) UnmarshalJSON(data []byte) error { q.SleepColumnExpr = valueSleepColumnExpr return nil } + valueDerivedReadinessColumnExpr := new(DerivedReadinessColumnExpr) + if err := json.Unmarshal(data, &valueDerivedReadinessColumnExpr); err == nil { + q.typ = "DerivedReadinessColumnExpr" + q.DerivedReadinessColumnExpr = valueDerivedReadinessColumnExpr + return nil + } valueActivityColumnExpr := new(ActivityColumnExpr) if err := json.Unmarshal(data, &valueActivityColumnExpr); err == nil { q.typ = "ActivityColumnExpr" @@ -4162,6 +4320,9 @@ func (q QueryGroupByItem) MarshalJSON() ([]byte, error) { if q.typ == "SleepColumnExpr" || q.SleepColumnExpr != nil { return json.Marshal(q.SleepColumnExpr) } + if q.typ == "DerivedReadinessColumnExpr" || q.DerivedReadinessColumnExpr != nil { + return json.Marshal(q.DerivedReadinessColumnExpr) + } if q.typ == "ActivityColumnExpr" || q.ActivityColumnExpr != nil { return json.Marshal(q.ActivityColumnExpr) } @@ -4220,6 +4381,7 @@ type QueryGroupByItemVisitor interface { VisitDateTruncExpr(*DateTruncExpr) error VisitDatePartExpr(*DatePartExpr) error VisitSleepColumnExpr(*SleepColumnExpr) error + VisitDerivedReadinessColumnExpr(*DerivedReadinessColumnExpr) error VisitActivityColumnExpr(*ActivityColumnExpr) error VisitWorkoutColumnExpr(*WorkoutColumnExpr) error VisitBodyColumnExpr(*BodyColumnExpr) error @@ -4249,6 +4411,9 @@ func (q *QueryGroupByItem) Accept(visitor QueryGroupByItemVisitor) error { if q.typ == "SleepColumnExpr" || q.SleepColumnExpr != nil { return visitor.VisitSleepColumnExpr(q.SleepColumnExpr) } + if q.typ == "DerivedReadinessColumnExpr" || q.DerivedReadinessColumnExpr != nil { + return visitor.VisitDerivedReadinessColumnExpr(q.DerivedReadinessColumnExpr) + } if q.typ == "ActivityColumnExpr" || q.ActivityColumnExpr != nil { return visitor.VisitActivityColumnExpr(q.ActivityColumnExpr) } @@ -4307,6 +4472,7 @@ type QuerySelectItem struct { AggregateExpr *AggregateExpr GroupKeyColumnExpr *GroupKeyColumnExpr SleepColumnExpr *SleepColumnExpr + DerivedReadinessColumnExpr *DerivedReadinessColumnExpr ActivityColumnExpr *ActivityColumnExpr WorkoutColumnExpr *WorkoutColumnExpr BodyColumnExpr *BodyColumnExpr @@ -4350,6 +4516,13 @@ func (q *QuerySelectItem) GetSleepColumnExpr() *SleepColumnExpr { return q.SleepColumnExpr } +func (q *QuerySelectItem) GetDerivedReadinessColumnExpr() *DerivedReadinessColumnExpr { + if q == nil { + return nil + } + return q.DerivedReadinessColumnExpr +} + func (q *QuerySelectItem) GetActivityColumnExpr() *ActivityColumnExpr { if q == nil { return nil @@ -4495,6 +4668,12 @@ func (q *QuerySelectItem) UnmarshalJSON(data []byte) error { q.SleepColumnExpr = valueSleepColumnExpr return nil } + valueDerivedReadinessColumnExpr := new(DerivedReadinessColumnExpr) + if err := json.Unmarshal(data, &valueDerivedReadinessColumnExpr); err == nil { + q.typ = "DerivedReadinessColumnExpr" + q.DerivedReadinessColumnExpr = valueDerivedReadinessColumnExpr + return nil + } valueActivityColumnExpr := new(ActivityColumnExpr) if err := json.Unmarshal(data, &valueActivityColumnExpr); err == nil { q.typ = "ActivityColumnExpr" @@ -4616,6 +4795,9 @@ func (q QuerySelectItem) MarshalJSON() ([]byte, error) { if q.typ == "SleepColumnExpr" || q.SleepColumnExpr != nil { return json.Marshal(q.SleepColumnExpr) } + if q.typ == "DerivedReadinessColumnExpr" || q.DerivedReadinessColumnExpr != nil { + return json.Marshal(q.DerivedReadinessColumnExpr) + } if q.typ == "ActivityColumnExpr" || q.ActivityColumnExpr != nil { return json.Marshal(q.ActivityColumnExpr) } @@ -4677,6 +4859,7 @@ type QuerySelectItemVisitor interface { VisitAggregateExpr(*AggregateExpr) error VisitGroupKeyColumnExpr(*GroupKeyColumnExpr) error VisitSleepColumnExpr(*SleepColumnExpr) error + VisitDerivedReadinessColumnExpr(*DerivedReadinessColumnExpr) error VisitActivityColumnExpr(*ActivityColumnExpr) error VisitWorkoutColumnExpr(*WorkoutColumnExpr) error VisitBodyColumnExpr(*BodyColumnExpr) error @@ -4707,6 +4890,9 @@ func (q *QuerySelectItem) Accept(visitor QuerySelectItemVisitor) error { if q.typ == "SleepColumnExpr" || q.SleepColumnExpr != nil { return visitor.VisitSleepColumnExpr(q.SleepColumnExpr) } + if q.typ == "DerivedReadinessColumnExpr" || q.DerivedReadinessColumnExpr != nil { + return visitor.VisitDerivedReadinessColumnExpr(q.DerivedReadinessColumnExpr) + } if q.typ == "ActivityColumnExpr" || q.ActivityColumnExpr != nil { return visitor.VisitActivityColumnExpr(q.ActivityColumnExpr) } diff --git a/aggregate/client.go b/aggregate/client.go index 61f01d4..394325f 100644 --- a/aggregate/client.go +++ b/aggregate/client.go @@ -4,10 +4,10 @@ package aggregate import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/aggregate/raw_client.go b/aggregate/raw_client.go index 30f8853..65b866e 100644 --- a/aggregate/raw_client.go +++ b/aggregate/raw_client.go @@ -4,10 +4,10 @@ package aggregate import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/body.go b/body.go index 1c5296c..3407157 100644 --- a/body.go +++ b/body.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/body/client.go b/body/client.go index ced0615..2fc36a8 100644 --- a/body/client.go +++ b/body/client.go @@ -4,10 +4,10 @@ package body import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/body/raw_client.go b/body/raw_client.go index a9f8a11..6788f73 100644 --- a/body/raw_client.go +++ b/body/raw_client.go @@ -4,10 +4,10 @@ package body import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..e181b02 --- /dev/null +++ b/changelog.md @@ -0,0 +1,10 @@ +## v2.0.0 - 2026-03-20 +* The SDK now supports derived readiness data queries through the new DerivedReadinessColumnExpr type, enabling analysis of sleep scores, recovery metrics, strain data, and chronotype information. Lab report parsing has been enhanced with better error handling via ParsingJobFailureReason enum and improved metadata collection including optional gender fields. +* The SDK now supports asynchronous appointment booking with configurable timeout settings through the `async_confirmation` field. Appointment notes can be added when booking or rescheduling appointments. Sonora Quest is now available as a lab provider for PSC appointments. Additional configuration options have been added for lab test creation including lab account ID and lab slug parameters. +* The SDK now supports Samsung Health manual connections and Tandem Source password-based connections. Enhanced serialization control for better validation of required fields in request bodies. +* The SDK now supports lab report parsing workflows with new BiomarkerResult and LabResultsRaw types for handling detailed lab data. Added ClientFacingLabReportParsingJobCreatedEvent and ClientFacingLabReportParsingJobUpdatedEvent for tracking parsing job status. Enhanced order management with new ClientFacingOrderTransaction type and additional order status values. Added AccessNotes field to address types and ClinicalNotes field to orders for improved data capture. +* New client modules added: Compendium for lab test information, LabAccount for lab account management, and OrderTransaction for order transaction operations. The SDK now supports form-encoded HTTP requests in addition to JSON. Lab report parsing now accepts multiple file uploads. +* The SDK now supports compendium API functionality with new types for lab test search and conversion. Available search modes include canonical test lookup and crosswalk between different lab providers (LabCorp, Quest, BioReference, Sonora Quest). +* New compendium client available for searching and converting compendium data. New lab account client available for managing team lab accounts with support for delegation flows and billing configurations. +* New order transaction client available with methods to retrieve transaction details (`GetTransaction`), lab results (`GetTransactionResult`), and PDF reports (`GetTransactionResultPdf`). The SDK also includes a new `Bytes()` utility function for creating pointers to byte slices. + diff --git a/client/client.go b/client/client.go index d3a41bb..3bd4e6a 100644 --- a/client/client.go +++ b/client/client.go @@ -3,32 +3,35 @@ package client import ( - activity "github.com/tryVital/vital-go/activity" - aggregate "github.com/tryVital/vital-go/aggregate" - body "github.com/tryVital/vital-go/body" - core "github.com/tryVital/vital-go/core" - devices "github.com/tryVital/vital-go/devices" - electrocardiogram "github.com/tryVital/vital-go/electrocardiogram" - insurance "github.com/tryVital/vital-go/insurance" - internal "github.com/tryVital/vital-go/internal" - introspect "github.com/tryVital/vital-go/introspect" - labreport "github.com/tryVital/vital-go/labreport" - labtests "github.com/tryVital/vital-go/labtests" - link "github.com/tryVital/vital-go/link" - meal "github.com/tryVital/vital-go/meal" - menstrualcycle "github.com/tryVital/vital-go/menstrualcycle" - option "github.com/tryVital/vital-go/option" - order "github.com/tryVital/vital-go/order" - payor "github.com/tryVital/vital-go/payor" - profile "github.com/tryVital/vital-go/profile" - providers "github.com/tryVital/vital-go/providers" - sleep "github.com/tryVital/vital-go/sleep" - sleepcycle "github.com/tryVital/vital-go/sleepcycle" - team "github.com/tryVital/vital-go/team" - testkit "github.com/tryVital/vital-go/testkit" - user "github.com/tryVital/vital-go/user" - vitals "github.com/tryVital/vital-go/vitals" - workouts "github.com/tryVital/vital-go/workouts" + activity "github.com/tryVital/vital-go/v2/activity" + aggregate "github.com/tryVital/vital-go/v2/aggregate" + body "github.com/tryVital/vital-go/v2/body" + compendium "github.com/tryVital/vital-go/v2/compendium" + core "github.com/tryVital/vital-go/v2/core" + devices "github.com/tryVital/vital-go/v2/devices" + electrocardiogram "github.com/tryVital/vital-go/v2/electrocardiogram" + insurance "github.com/tryVital/vital-go/v2/insurance" + internal "github.com/tryVital/vital-go/v2/internal" + introspect "github.com/tryVital/vital-go/v2/introspect" + labaccount "github.com/tryVital/vital-go/v2/labaccount" + labreport "github.com/tryVital/vital-go/v2/labreport" + labtests "github.com/tryVital/vital-go/v2/labtests" + link "github.com/tryVital/vital-go/v2/link" + meal "github.com/tryVital/vital-go/v2/meal" + menstrualcycle "github.com/tryVital/vital-go/v2/menstrualcycle" + option "github.com/tryVital/vital-go/v2/option" + order "github.com/tryVital/vital-go/v2/order" + ordertransaction "github.com/tryVital/vital-go/v2/ordertransaction" + payor "github.com/tryVital/vital-go/v2/payor" + profile "github.com/tryVital/vital-go/v2/profile" + providers "github.com/tryVital/vital-go/v2/providers" + sleep "github.com/tryVital/vital-go/v2/sleep" + sleepcycle "github.com/tryVital/vital-go/v2/sleepcycle" + team "github.com/tryVital/vital-go/v2/team" + testkit "github.com/tryVital/vital-go/v2/testkit" + user "github.com/tryVital/vital-go/v2/user" + vitals "github.com/tryVital/vital-go/v2/vitals" + workouts "github.com/tryVital/vital-go/v2/workouts" ) type Client struct { @@ -49,6 +52,9 @@ type Client struct { Providers *providers.Client Introspect *introspect.Client LabTests *labtests.Client + Compendium *compendium.Client + LabAccount *labaccount.Client + OrderTransaction *ordertransaction.Client Testkit *testkit.Client Order *order.Client Insurance *insurance.Client @@ -81,6 +87,9 @@ func NewClient(opts ...option.RequestOption) *Client { Providers: providers.NewClient(options), Introspect: introspect.NewClient(options), LabTests: labtests.NewClient(options), + Compendium: compendium.NewClient(options), + LabAccount: labaccount.NewClient(options), + OrderTransaction: ordertransaction.NewClient(options), Testkit: testkit.NewClient(options), Order: order.NewClient(options), Insurance: insurance.NewClient(options), diff --git a/client/client_test.go b/client/client_test.go index 0dba352..237c7bb 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -4,7 +4,7 @@ package client import ( assert "github.com/stretchr/testify/assert" - option "github.com/tryVital/vital-go/option" + option "github.com/tryVital/vital-go/v2/option" http "net/http" testing "testing" time "time" diff --git a/compendium.go b/compendium.go new file mode 100644 index 0000000..600bdd2 --- /dev/null +++ b/compendium.go @@ -0,0 +1,1367 @@ +// Code generated by Fern. DO NOT EDIT. + +package api + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/tryVital/vital-go/v2/internal" + big "math/big" +) + +var ( + convertCompendiumBodyFieldTeamId = big.NewInt(1 << 0) + convertCompendiumBodyFieldLabTestId = big.NewInt(1 << 1) + convertCompendiumBodyFieldProviderIds = big.NewInt(1 << 2) + convertCompendiumBodyFieldTargetLab = big.NewInt(1 << 3) + convertCompendiumBodyFieldLimit = big.NewInt(1 << 4) +) + +type ConvertCompendiumBody struct { + TeamId *CompendiumConvertRequestTeamId `json:"-" url:"team_id,omitempty"` + LabTestId *string `json:"lab_test_id,omitempty" url:"-"` + ProviderIds []string `json:"provider_ids,omitempty" url:"-"` + TargetLab CompendiumSearchLabs `json:"target_lab" url:"-"` + Limit *int `json:"limit,omitempty" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (c *ConvertCompendiumBody) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetTeamId sets the TeamId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumBody) SetTeamId(teamId *CompendiumConvertRequestTeamId) { + c.TeamId = teamId + c.require(convertCompendiumBodyFieldTeamId) +} + +// SetLabTestId sets the LabTestId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumBody) SetLabTestId(labTestId *string) { + c.LabTestId = labTestId + c.require(convertCompendiumBodyFieldLabTestId) +} + +// SetProviderIds sets the ProviderIds field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumBody) SetProviderIds(providerIds []string) { + c.ProviderIds = providerIds + c.require(convertCompendiumBodyFieldProviderIds) +} + +// SetTargetLab sets the TargetLab field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumBody) SetTargetLab(targetLab CompendiumSearchLabs) { + c.TargetLab = targetLab + c.require(convertCompendiumBodyFieldTargetLab) +} + +// SetLimit sets the Limit field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumBody) SetLimit(limit *int) { + c.Limit = limit + c.require(convertCompendiumBodyFieldLimit) +} + +func (c *ConvertCompendiumBody) UnmarshalJSON(data []byte) error { + type unmarshaler ConvertCompendiumBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = ConvertCompendiumBody(body) + return nil +} + +func (c *ConvertCompendiumBody) MarshalJSON() ([]byte, error) { + type embed ConvertCompendiumBody + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +var ( + searchCompendiumBodyFieldTeamId = big.NewInt(1 << 0) + searchCompendiumBodyFieldMode = big.NewInt(1 << 1) + searchCompendiumBodyFieldQuery = big.NewInt(1 << 2) + searchCompendiumBodyFieldCptCodes = big.NewInt(1 << 3) + searchCompendiumBodyFieldLoincSetHash = big.NewInt(1 << 4) + searchCompendiumBodyFieldLabs = big.NewInt(1 << 5) + searchCompendiumBodyFieldIncludeRelated = big.NewInt(1 << 6) + searchCompendiumBodyFieldLimit = big.NewInt(1 << 7) +) + +type SearchCompendiumBody struct { + TeamId *CompendiumSearchRequestTeamId `json:"-" url:"team_id,omitempty"` + Mode SearchMode `json:"mode" url:"-"` + Query *string `json:"query,omitempty" url:"-"` + CptCodes []string `json:"cpt_codes,omitempty" url:"-"` + LoincSetHash *string `json:"loinc_set_hash,omitempty" url:"-"` + Labs []CompendiumSearchLabs `json:"labs,omitempty" url:"-"` + IncludeRelated *bool `json:"include_related,omitempty" url:"-"` + Limit *int `json:"limit,omitempty" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (s *SearchCompendiumBody) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetTeamId sets the TeamId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetTeamId(teamId *CompendiumSearchRequestTeamId) { + s.TeamId = teamId + s.require(searchCompendiumBodyFieldTeamId) +} + +// SetMode sets the Mode field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetMode(mode SearchMode) { + s.Mode = mode + s.require(searchCompendiumBodyFieldMode) +} + +// SetQuery sets the Query field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetQuery(query *string) { + s.Query = query + s.require(searchCompendiumBodyFieldQuery) +} + +// SetCptCodes sets the CptCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetCptCodes(cptCodes []string) { + s.CptCodes = cptCodes + s.require(searchCompendiumBodyFieldCptCodes) +} + +// SetLoincSetHash sets the LoincSetHash field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetLoincSetHash(loincSetHash *string) { + s.LoincSetHash = loincSetHash + s.require(searchCompendiumBodyFieldLoincSetHash) +} + +// SetLabs sets the Labs field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetLabs(labs []CompendiumSearchLabs) { + s.Labs = labs + s.require(searchCompendiumBodyFieldLabs) +} + +// SetIncludeRelated sets the IncludeRelated field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetIncludeRelated(includeRelated *bool) { + s.IncludeRelated = includeRelated + s.require(searchCompendiumBodyFieldIncludeRelated) +} + +// SetLimit sets the Limit field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumBody) SetLimit(limit *int) { + s.Limit = limit + s.require(searchCompendiumBodyFieldLimit) +} + +func (s *SearchCompendiumBody) UnmarshalJSON(data []byte) error { + type unmarshaler SearchCompendiumBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *s = SearchCompendiumBody(body) + return nil +} + +func (s *SearchCompendiumBody) MarshalJSON() ([]byte, error) { + type embed SearchCompendiumBody + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +var ( + canonicalCandidateFieldLoincSetHash = big.NewInt(1 << 0) + canonicalCandidateFieldDisplayName = big.NewInt(1 << 1) + canonicalCandidateFieldAliases = big.NewInt(1 << 2) + canonicalCandidateFieldLoincCodes = big.NewInt(1 << 3) + canonicalCandidateFieldProviderIds = big.NewInt(1 << 4) + canonicalCandidateFieldLoincComponents = big.NewInt(1 << 5) + canonicalCandidateFieldLoincGroups = big.NewInt(1 << 6) + canonicalCandidateFieldCptCodes = big.NewInt(1 << 7) + canonicalCandidateFieldPopularityScore = big.NewInt(1 << 8) + canonicalCandidateFieldConfidence = big.NewInt(1 << 9) +) + +type CanonicalCandidate struct { + LoincSetHash string `json:"loinc_set_hash" url:"loinc_set_hash"` + DisplayName string `json:"display_name" url:"display_name"` + Aliases []string `json:"aliases,omitempty" url:"aliases,omitempty"` + LoincCodes []string `json:"loinc_codes,omitempty" url:"loinc_codes,omitempty"` + ProviderIds []string `json:"provider_ids,omitempty" url:"provider_ids,omitempty"` + LoincComponents []string `json:"loinc_components,omitempty" url:"loinc_components,omitempty"` + LoincGroups []string `json:"loinc_groups,omitempty" url:"loinc_groups,omitempty"` + CptCodes []string `json:"cpt_codes,omitempty" url:"cpt_codes,omitempty"` + PopularityScore float64 `json:"popularity_score" url:"popularity_score"` + Confidence float64 `json:"confidence" url:"confidence"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CanonicalCandidate) GetLoincSetHash() string { + if c == nil { + return "" + } + return c.LoincSetHash +} + +func (c *CanonicalCandidate) GetDisplayName() string { + if c == nil { + return "" + } + return c.DisplayName +} + +func (c *CanonicalCandidate) GetAliases() []string { + if c == nil { + return nil + } + return c.Aliases +} + +func (c *CanonicalCandidate) GetLoincCodes() []string { + if c == nil { + return nil + } + return c.LoincCodes +} + +func (c *CanonicalCandidate) GetProviderIds() []string { + if c == nil { + return nil + } + return c.ProviderIds +} + +func (c *CanonicalCandidate) GetLoincComponents() []string { + if c == nil { + return nil + } + return c.LoincComponents +} + +func (c *CanonicalCandidate) GetLoincGroups() []string { + if c == nil { + return nil + } + return c.LoincGroups +} + +func (c *CanonicalCandidate) GetCptCodes() []string { + if c == nil { + return nil + } + return c.CptCodes +} + +func (c *CanonicalCandidate) GetPopularityScore() float64 { + if c == nil { + return 0 + } + return c.PopularityScore +} + +func (c *CanonicalCandidate) GetConfidence() float64 { + if c == nil { + return 0 + } + return c.Confidence +} + +func (c *CanonicalCandidate) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CanonicalCandidate) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetLoincSetHash sets the LoincSetHash field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetLoincSetHash(loincSetHash string) { + c.LoincSetHash = loincSetHash + c.require(canonicalCandidateFieldLoincSetHash) +} + +// SetDisplayName sets the DisplayName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetDisplayName(displayName string) { + c.DisplayName = displayName + c.require(canonicalCandidateFieldDisplayName) +} + +// SetAliases sets the Aliases field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetAliases(aliases []string) { + c.Aliases = aliases + c.require(canonicalCandidateFieldAliases) +} + +// SetLoincCodes sets the LoincCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetLoincCodes(loincCodes []string) { + c.LoincCodes = loincCodes + c.require(canonicalCandidateFieldLoincCodes) +} + +// SetProviderIds sets the ProviderIds field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetProviderIds(providerIds []string) { + c.ProviderIds = providerIds + c.require(canonicalCandidateFieldProviderIds) +} + +// SetLoincComponents sets the LoincComponents field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetLoincComponents(loincComponents []string) { + c.LoincComponents = loincComponents + c.require(canonicalCandidateFieldLoincComponents) +} + +// SetLoincGroups sets the LoincGroups field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetLoincGroups(loincGroups []string) { + c.LoincGroups = loincGroups + c.require(canonicalCandidateFieldLoincGroups) +} + +// SetCptCodes sets the CptCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetCptCodes(cptCodes []string) { + c.CptCodes = cptCodes + c.require(canonicalCandidateFieldCptCodes) +} + +// SetPopularityScore sets the PopularityScore field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetPopularityScore(popularityScore float64) { + c.PopularityScore = popularityScore + c.require(canonicalCandidateFieldPopularityScore) +} + +// SetConfidence sets the Confidence field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CanonicalCandidate) SetConfidence(confidence float64) { + c.Confidence = confidence + c.require(canonicalCandidateFieldConfidence) +} + +func (c *CanonicalCandidate) UnmarshalJSON(data []byte) error { + type unmarshaler CanonicalCandidate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CanonicalCandidate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CanonicalCandidate) MarshalJSON() ([]byte, error) { + type embed CanonicalCandidate + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *CanonicalCandidate) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// ℹ️ This enum is non-exhaustive. +type CompendiumSearchLabs string + +const ( + CompendiumSearchLabsLabcorp CompendiumSearchLabs = "labcorp" + CompendiumSearchLabsQuest CompendiumSearchLabs = "quest" + CompendiumSearchLabsBioreference CompendiumSearchLabs = "bioreference" + CompendiumSearchLabsSonoraQuest CompendiumSearchLabs = "sonora_quest" +) + +func NewCompendiumSearchLabsFromString(s string) (CompendiumSearchLabs, error) { + switch s { + case "labcorp": + return CompendiumSearchLabsLabcorp, nil + case "quest": + return CompendiumSearchLabsQuest, nil + case "bioreference": + return CompendiumSearchLabsBioreference, nil + case "sonora_quest": + return CompendiumSearchLabsSonoraQuest, nil + } + var t CompendiumSearchLabs + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CompendiumSearchLabs) Ptr() *CompendiumSearchLabs { + return &c +} + +var ( + convertCompendiumResponseFieldSourceLabTestId = big.NewInt(1 << 0) + convertCompendiumResponseFieldSourceLabId = big.NewInt(1 << 1) + convertCompendiumResponseFieldTargetLabId = big.NewInt(1 << 2) + convertCompendiumResponseFieldTargetLabSlug = big.NewInt(1 << 3) + convertCompendiumResponseFieldSourceProviderIds = big.NewInt(1 << 4) + convertCompendiumResponseFieldConvertedProviderIds = big.NewInt(1 << 5) + convertCompendiumResponseFieldUnresolvedProviderIds = big.NewInt(1 << 6) + convertCompendiumResponseFieldBySourceProviderId = big.NewInt(1 << 7) +) + +type ConvertCompendiumResponse struct { + SourceLabTestId *string `json:"source_lab_test_id,omitempty" url:"source_lab_test_id,omitempty"` + SourceLabId *int `json:"source_lab_id,omitempty" url:"source_lab_id,omitempty"` + TargetLabId int `json:"target_lab_id" url:"target_lab_id"` + TargetLabSlug string `json:"target_lab_slug" url:"target_lab_slug"` + SourceProviderIds []string `json:"source_provider_ids,omitempty" url:"source_provider_ids,omitempty"` + ConvertedProviderIds []string `json:"converted_provider_ids,omitempty" url:"converted_provider_ids,omitempty"` + UnresolvedProviderIds []string `json:"unresolved_provider_ids,omitempty" url:"unresolved_provider_ids,omitempty"` + BySourceProviderId map[string]*ProviderIdConversionResponse `json:"by_source_provider_id,omitempty" url:"by_source_provider_id,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ConvertCompendiumResponse) GetSourceLabTestId() *string { + if c == nil { + return nil + } + return c.SourceLabTestId +} + +func (c *ConvertCompendiumResponse) GetSourceLabId() *int { + if c == nil { + return nil + } + return c.SourceLabId +} + +func (c *ConvertCompendiumResponse) GetTargetLabId() int { + if c == nil { + return 0 + } + return c.TargetLabId +} + +func (c *ConvertCompendiumResponse) GetTargetLabSlug() string { + if c == nil { + return "" + } + return c.TargetLabSlug +} + +func (c *ConvertCompendiumResponse) GetSourceProviderIds() []string { + if c == nil { + return nil + } + return c.SourceProviderIds +} + +func (c *ConvertCompendiumResponse) GetConvertedProviderIds() []string { + if c == nil { + return nil + } + return c.ConvertedProviderIds +} + +func (c *ConvertCompendiumResponse) GetUnresolvedProviderIds() []string { + if c == nil { + return nil + } + return c.UnresolvedProviderIds +} + +func (c *ConvertCompendiumResponse) GetBySourceProviderId() map[string]*ProviderIdConversionResponse { + if c == nil { + return nil + } + return c.BySourceProviderId +} + +func (c *ConvertCompendiumResponse) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ConvertCompendiumResponse) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetSourceLabTestId sets the SourceLabTestId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetSourceLabTestId(sourceLabTestId *string) { + c.SourceLabTestId = sourceLabTestId + c.require(convertCompendiumResponseFieldSourceLabTestId) +} + +// SetSourceLabId sets the SourceLabId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetSourceLabId(sourceLabId *int) { + c.SourceLabId = sourceLabId + c.require(convertCompendiumResponseFieldSourceLabId) +} + +// SetTargetLabId sets the TargetLabId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetTargetLabId(targetLabId int) { + c.TargetLabId = targetLabId + c.require(convertCompendiumResponseFieldTargetLabId) +} + +// SetTargetLabSlug sets the TargetLabSlug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetTargetLabSlug(targetLabSlug string) { + c.TargetLabSlug = targetLabSlug + c.require(convertCompendiumResponseFieldTargetLabSlug) +} + +// SetSourceProviderIds sets the SourceProviderIds field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetSourceProviderIds(sourceProviderIds []string) { + c.SourceProviderIds = sourceProviderIds + c.require(convertCompendiumResponseFieldSourceProviderIds) +} + +// SetConvertedProviderIds sets the ConvertedProviderIds field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetConvertedProviderIds(convertedProviderIds []string) { + c.ConvertedProviderIds = convertedProviderIds + c.require(convertCompendiumResponseFieldConvertedProviderIds) +} + +// SetUnresolvedProviderIds sets the UnresolvedProviderIds field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetUnresolvedProviderIds(unresolvedProviderIds []string) { + c.UnresolvedProviderIds = unresolvedProviderIds + c.require(convertCompendiumResponseFieldUnresolvedProviderIds) +} + +// SetBySourceProviderId sets the BySourceProviderId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ConvertCompendiumResponse) SetBySourceProviderId(bySourceProviderId map[string]*ProviderIdConversionResponse) { + c.BySourceProviderId = bySourceProviderId + c.require(convertCompendiumResponseFieldBySourceProviderId) +} + +func (c *ConvertCompendiumResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ConvertCompendiumResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = ConvertCompendiumResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ConvertCompendiumResponse) MarshalJSON() ([]byte, error) { + type embed ConvertCompendiumResponse + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ConvertCompendiumResponse) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + perLabCandidateFieldMarkerId = big.NewInt(1 << 0) + perLabCandidateFieldLabId = big.NewInt(1 << 1) + perLabCandidateFieldLabSlug = big.NewInt(1 << 2) + perLabCandidateFieldName = big.NewInt(1 << 3) + perLabCandidateFieldResultNames = big.NewInt(1 << 4) + perLabCandidateFieldProviderId = big.NewInt(1 << 5) + perLabCandidateFieldLoincSetHash = big.NewInt(1 << 6) + perLabCandidateFieldLoincCodes = big.NewInt(1 << 7) + perLabCandidateFieldLoincComponents = big.NewInt(1 << 8) + perLabCandidateFieldLoincGroups = big.NewInt(1 << 9) + perLabCandidateFieldCptCodes = big.NewInt(1 << 10) + perLabCandidateFieldRelation = big.NewInt(1 << 11) + perLabCandidateFieldConfidence = big.NewInt(1 << 12) + perLabCandidateFieldReasonCodes = big.NewInt(1 << 13) + perLabCandidateFieldMarkerPopularityScore = big.NewInt(1 << 14) +) + +type PerLabCandidate struct { + MarkerId int `json:"marker_id" url:"marker_id"` + LabId int `json:"lab_id" url:"lab_id"` + LabSlug *string `json:"lab_slug,omitempty" url:"lab_slug,omitempty"` + Name string `json:"name" url:"name"` + ResultNames []string `json:"result_names,omitempty" url:"result_names,omitempty"` + ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` + LoincSetHash string `json:"loinc_set_hash" url:"loinc_set_hash"` + LoincCodes []string `json:"loinc_codes,omitempty" url:"loinc_codes,omitempty"` + LoincComponents []string `json:"loinc_components,omitempty" url:"loinc_components,omitempty"` + LoincGroups []string `json:"loinc_groups,omitempty" url:"loinc_groups,omitempty"` + CptCodes []string `json:"cpt_codes,omitempty" url:"cpt_codes,omitempty"` + Relation string `json:"relation" url:"relation"` + Confidence float64 `json:"confidence" url:"confidence"` + ReasonCodes []string `json:"reason_codes,omitempty" url:"reason_codes,omitempty"` + MarkerPopularityScore float64 `json:"marker_popularity_score" url:"marker_popularity_score"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *PerLabCandidate) GetMarkerId() int { + if p == nil { + return 0 + } + return p.MarkerId +} + +func (p *PerLabCandidate) GetLabId() int { + if p == nil { + return 0 + } + return p.LabId +} + +func (p *PerLabCandidate) GetLabSlug() *string { + if p == nil { + return nil + } + return p.LabSlug +} + +func (p *PerLabCandidate) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *PerLabCandidate) GetResultNames() []string { + if p == nil { + return nil + } + return p.ResultNames +} + +func (p *PerLabCandidate) GetProviderId() *string { + if p == nil { + return nil + } + return p.ProviderId +} + +func (p *PerLabCandidate) GetLoincSetHash() string { + if p == nil { + return "" + } + return p.LoincSetHash +} + +func (p *PerLabCandidate) GetLoincCodes() []string { + if p == nil { + return nil + } + return p.LoincCodes +} + +func (p *PerLabCandidate) GetLoincComponents() []string { + if p == nil { + return nil + } + return p.LoincComponents +} + +func (p *PerLabCandidate) GetLoincGroups() []string { + if p == nil { + return nil + } + return p.LoincGroups +} + +func (p *PerLabCandidate) GetCptCodes() []string { + if p == nil { + return nil + } + return p.CptCodes +} + +func (p *PerLabCandidate) GetRelation() string { + if p == nil { + return "" + } + return p.Relation +} + +func (p *PerLabCandidate) GetConfidence() float64 { + if p == nil { + return 0 + } + return p.Confidence +} + +func (p *PerLabCandidate) GetReasonCodes() []string { + if p == nil { + return nil + } + return p.ReasonCodes +} + +func (p *PerLabCandidate) GetMarkerPopularityScore() float64 { + if p == nil { + return 0 + } + return p.MarkerPopularityScore +} + +func (p *PerLabCandidate) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PerLabCandidate) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetMarkerId sets the MarkerId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetMarkerId(markerId int) { + p.MarkerId = markerId + p.require(perLabCandidateFieldMarkerId) +} + +// SetLabId sets the LabId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetLabId(labId int) { + p.LabId = labId + p.require(perLabCandidateFieldLabId) +} + +// SetLabSlug sets the LabSlug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetLabSlug(labSlug *string) { + p.LabSlug = labSlug + p.require(perLabCandidateFieldLabSlug) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetName(name string) { + p.Name = name + p.require(perLabCandidateFieldName) +} + +// SetResultNames sets the ResultNames field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetResultNames(resultNames []string) { + p.ResultNames = resultNames + p.require(perLabCandidateFieldResultNames) +} + +// SetProviderId sets the ProviderId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetProviderId(providerId *string) { + p.ProviderId = providerId + p.require(perLabCandidateFieldProviderId) +} + +// SetLoincSetHash sets the LoincSetHash field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetLoincSetHash(loincSetHash string) { + p.LoincSetHash = loincSetHash + p.require(perLabCandidateFieldLoincSetHash) +} + +// SetLoincCodes sets the LoincCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetLoincCodes(loincCodes []string) { + p.LoincCodes = loincCodes + p.require(perLabCandidateFieldLoincCodes) +} + +// SetLoincComponents sets the LoincComponents field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetLoincComponents(loincComponents []string) { + p.LoincComponents = loincComponents + p.require(perLabCandidateFieldLoincComponents) +} + +// SetLoincGroups sets the LoincGroups field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetLoincGroups(loincGroups []string) { + p.LoincGroups = loincGroups + p.require(perLabCandidateFieldLoincGroups) +} + +// SetCptCodes sets the CptCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetCptCodes(cptCodes []string) { + p.CptCodes = cptCodes + p.require(perLabCandidateFieldCptCodes) +} + +// SetRelation sets the Relation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetRelation(relation string) { + p.Relation = relation + p.require(perLabCandidateFieldRelation) +} + +// SetConfidence sets the Confidence field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetConfidence(confidence float64) { + p.Confidence = confidence + p.require(perLabCandidateFieldConfidence) +} + +// SetReasonCodes sets the ReasonCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetReasonCodes(reasonCodes []string) { + p.ReasonCodes = reasonCodes + p.require(perLabCandidateFieldReasonCodes) +} + +// SetMarkerPopularityScore sets the MarkerPopularityScore field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerLabCandidate) SetMarkerPopularityScore(markerPopularityScore float64) { + p.MarkerPopularityScore = markerPopularityScore + p.require(perLabCandidateFieldMarkerPopularityScore) +} + +func (p *PerLabCandidate) UnmarshalJSON(data []byte) error { + type unmarshaler PerLabCandidate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PerLabCandidate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *PerLabCandidate) MarshalJSON() ([]byte, error) { + type embed PerLabCandidate + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *PerLabCandidate) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + providerIdConversionResponseFieldSourceProviderId = big.NewInt(1 << 0) + providerIdConversionResponseFieldCandidates = big.NewInt(1 << 1) +) + +type ProviderIdConversionResponse struct { + SourceProviderId string `json:"source_provider_id" url:"source_provider_id"` + Candidates []*PerLabCandidate `json:"candidates,omitempty" url:"candidates,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProviderIdConversionResponse) GetSourceProviderId() string { + if p == nil { + return "" + } + return p.SourceProviderId +} + +func (p *ProviderIdConversionResponse) GetCandidates() []*PerLabCandidate { + if p == nil { + return nil + } + return p.Candidates +} + +func (p *ProviderIdConversionResponse) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *ProviderIdConversionResponse) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetSourceProviderId sets the SourceProviderId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProviderIdConversionResponse) SetSourceProviderId(sourceProviderId string) { + p.SourceProviderId = sourceProviderId + p.require(providerIdConversionResponseFieldSourceProviderId) +} + +// SetCandidates sets the Candidates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ProviderIdConversionResponse) SetCandidates(candidates []*PerLabCandidate) { + p.Candidates = candidates + p.require(providerIdConversionResponseFieldCandidates) +} + +func (p *ProviderIdConversionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ProviderIdConversionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ProviderIdConversionResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProviderIdConversionResponse) MarshalJSON() ([]byte, error) { + type embed ProviderIdConversionResponse + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ProviderIdConversionResponse) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + +var ( + relatedCandidateFieldCanonical = big.NewInt(1 << 0) + relatedCandidateFieldRelation = big.NewInt(1 << 1) + relatedCandidateFieldConfidence = big.NewInt(1 << 2) + relatedCandidateFieldReasonCodes = big.NewInt(1 << 3) +) + +type RelatedCandidate struct { + Canonical *CanonicalCandidate `json:"canonical" url:"canonical"` + Relation string `json:"relation" url:"relation"` + Confidence float64 `json:"confidence" url:"confidence"` + ReasonCodes []string `json:"reason_codes,omitempty" url:"reason_codes,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (r *RelatedCandidate) GetCanonical() *CanonicalCandidate { + if r == nil { + return nil + } + return r.Canonical +} + +func (r *RelatedCandidate) GetRelation() string { + if r == nil { + return "" + } + return r.Relation +} + +func (r *RelatedCandidate) GetConfidence() float64 { + if r == nil { + return 0 + } + return r.Confidence +} + +func (r *RelatedCandidate) GetReasonCodes() []string { + if r == nil { + return nil + } + return r.ReasonCodes +} + +func (r *RelatedCandidate) GetExtraProperties() map[string]interface{} { + return r.extraProperties +} + +func (r *RelatedCandidate) require(field *big.Int) { + if r.explicitFields == nil { + r.explicitFields = big.NewInt(0) + } + r.explicitFields.Or(r.explicitFields, field) +} + +// SetCanonical sets the Canonical field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RelatedCandidate) SetCanonical(canonical *CanonicalCandidate) { + r.Canonical = canonical + r.require(relatedCandidateFieldCanonical) +} + +// SetRelation sets the Relation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RelatedCandidate) SetRelation(relation string) { + r.Relation = relation + r.require(relatedCandidateFieldRelation) +} + +// SetConfidence sets the Confidence field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RelatedCandidate) SetConfidence(confidence float64) { + r.Confidence = confidence + r.require(relatedCandidateFieldConfidence) +} + +// SetReasonCodes sets the ReasonCodes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RelatedCandidate) SetReasonCodes(reasonCodes []string) { + r.ReasonCodes = reasonCodes + r.require(relatedCandidateFieldReasonCodes) +} + +func (r *RelatedCandidate) UnmarshalJSON(data []byte) error { + type unmarshaler RelatedCandidate + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RelatedCandidate(value) + extraProperties, err := internal.ExtractExtraProperties(data, *r) + if err != nil { + return err + } + r.extraProperties = extraProperties + r.rawJSON = json.RawMessage(data) + return nil +} + +func (r *RelatedCandidate) MarshalJSON() ([]byte, error) { + type embed RelatedCandidate + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (r *RelatedCandidate) String() string { + if len(r.rawJSON) > 0 { + if value, err := internal.StringifyJSON(r.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(r); err == nil { + return value + } + return fmt.Sprintf("%#v", r) +} + +var ( + searchCompendiumResponseFieldMode = big.NewInt(1 << 0) + searchCompendiumResponseFieldSelectedCanonical = big.NewInt(1 << 1) + searchCompendiumResponseFieldCanonicalCandidates = big.NewInt(1 << 2) + searchCompendiumResponseFieldPerLab = big.NewInt(1 << 3) + searchCompendiumResponseFieldRelated = big.NewInt(1 << 4) +) + +type SearchCompendiumResponse struct { + Mode SearchMode `json:"mode" url:"mode"` + SelectedCanonical *CanonicalCandidate `json:"selected_canonical,omitempty" url:"selected_canonical,omitempty"` + CanonicalCandidates []*CanonicalCandidate `json:"canonical_candidates,omitempty" url:"canonical_candidates,omitempty"` + PerLab map[string][]*PerLabCandidate `json:"per_lab,omitempty" url:"per_lab,omitempty"` + Related []*RelatedCandidate `json:"related,omitempty" url:"related,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SearchCompendiumResponse) GetMode() SearchMode { + if s == nil { + return "" + } + return s.Mode +} + +func (s *SearchCompendiumResponse) GetSelectedCanonical() *CanonicalCandidate { + if s == nil { + return nil + } + return s.SelectedCanonical +} + +func (s *SearchCompendiumResponse) GetCanonicalCandidates() []*CanonicalCandidate { + if s == nil { + return nil + } + return s.CanonicalCandidates +} + +func (s *SearchCompendiumResponse) GetPerLab() map[string][]*PerLabCandidate { + if s == nil { + return nil + } + return s.PerLab +} + +func (s *SearchCompendiumResponse) GetRelated() []*RelatedCandidate { + if s == nil { + return nil + } + return s.Related +} + +func (s *SearchCompendiumResponse) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SearchCompendiumResponse) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetMode sets the Mode field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumResponse) SetMode(mode SearchMode) { + s.Mode = mode + s.require(searchCompendiumResponseFieldMode) +} + +// SetSelectedCanonical sets the SelectedCanonical field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumResponse) SetSelectedCanonical(selectedCanonical *CanonicalCandidate) { + s.SelectedCanonical = selectedCanonical + s.require(searchCompendiumResponseFieldSelectedCanonical) +} + +// SetCanonicalCandidates sets the CanonicalCandidates field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumResponse) SetCanonicalCandidates(canonicalCandidates []*CanonicalCandidate) { + s.CanonicalCandidates = canonicalCandidates + s.require(searchCompendiumResponseFieldCanonicalCandidates) +} + +// SetPerLab sets the PerLab field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumResponse) SetPerLab(perLab map[string][]*PerLabCandidate) { + s.PerLab = perLab + s.require(searchCompendiumResponseFieldPerLab) +} + +// SetRelated sets the Related field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SearchCompendiumResponse) SetRelated(related []*RelatedCandidate) { + s.Related = related + s.require(searchCompendiumResponseFieldRelated) +} + +func (s *SearchCompendiumResponse) UnmarshalJSON(data []byte) error { + type unmarshaler SearchCompendiumResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SearchCompendiumResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SearchCompendiumResponse) MarshalJSON() ([]byte, error) { + type embed SearchCompendiumResponse + var marshaler = struct { + embed + }{ + embed: embed(*s), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (s *SearchCompendiumResponse) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + +// ℹ️ This enum is non-exhaustive. +type SearchMode string + +const ( + SearchModeCanonical SearchMode = "canonical" + SearchModeCrosswalk SearchMode = "crosswalk" +) + +func NewSearchModeFromString(s string) (SearchMode, error) { + switch s { + case "canonical": + return SearchModeCanonical, nil + case "crosswalk": + return SearchModeCrosswalk, nil + } + var t SearchMode + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (s SearchMode) Ptr() *SearchMode { + return &s +} + +type CompendiumConvertRequestTeamId string + +const ( + CompendiumConvertRequestTeamIdInferFromContext CompendiumConvertRequestTeamId = "infer_from_context" +) + +func NewCompendiumConvertRequestTeamIdFromString(s string) (CompendiumConvertRequestTeamId, error) { + switch s { + case "infer_from_context": + return CompendiumConvertRequestTeamIdInferFromContext, nil + } + var t CompendiumConvertRequestTeamId + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CompendiumConvertRequestTeamId) Ptr() *CompendiumConvertRequestTeamId { + return &c +} + +type CompendiumSearchRequestTeamId string + +const ( + CompendiumSearchRequestTeamIdInferFromContext CompendiumSearchRequestTeamId = "infer_from_context" +) + +func NewCompendiumSearchRequestTeamIdFromString(s string) (CompendiumSearchRequestTeamId, error) { + switch s { + case "infer_from_context": + return CompendiumSearchRequestTeamIdInferFromContext, nil + } + var t CompendiumSearchRequestTeamId + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (c CompendiumSearchRequestTeamId) Ptr() *CompendiumSearchRequestTeamId { + return &c +} diff --git a/compendium/client.go b/compendium/client.go new file mode 100644 index 0000000..7f667fa --- /dev/null +++ b/compendium/client.go @@ -0,0 +1,65 @@ +// Code generated by Fern. DO NOT EDIT. + +package compendium + +import ( + context "context" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + }, + ), + } +} + +func (c *Client) Search( + ctx context.Context, + request *vitalgo.SearchCompendiumBody, + opts ...option.RequestOption, +) (*vitalgo.SearchCompendiumResponse, error) { + response, err := c.WithRawResponse.Search( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +func (c *Client) Convert( + ctx context.Context, + request *vitalgo.ConvertCompendiumBody, + opts ...option.RequestOption, +) (*vitalgo.ConvertCompendiumResponse, error) { + response, err := c.WithRawResponse.Convert( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/compendium/raw_client.go b/compendium/raw_client.go new file mode 100644 index 0000000..2975805 --- /dev/null +++ b/compendium/raw_client.go @@ -0,0 +1,131 @@ +// Code generated by Fern. DO NOT EDIT. + +package compendium + +import ( + context "context" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" + http "net/http" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + }, + ), + } +} + +func (r *RawClient) Search( + ctx context.Context, + request *vitalgo.SearchCompendiumBody, + opts ...option.RequestOption, +) (*core.Response[*vitalgo.SearchCompendiumResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.tryvital.io", + ) + endpointURL := baseURL + "/v3/compendium/search" + queryParams, err := internal.QueryValues(request) + if err != nil { + return nil, err + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + headers.Add("Content-Type", "application/json") + var response *vitalgo.SearchCompendiumResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(vitalgo.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*vitalgo.SearchCompendiumResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) Convert( + ctx context.Context, + request *vitalgo.ConvertCompendiumBody, + opts ...option.RequestOption, +) (*core.Response[*vitalgo.ConvertCompendiumResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.tryvital.io", + ) + endpointURL := baseURL + "/v3/compendium/convert" + queryParams, err := internal.QueryValues(request) + if err != nil { + return nil, err + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + headers.Add("Content-Type", "application/json") + var response *vitalgo.ConvertCompendiumResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodPost, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Request: request, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(vitalgo.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*vitalgo.ConvertCompendiumResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/core/request_option.go b/core/request_option.go index c1a22f7..c5e69a4 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -57,8 +57,8 @@ func (r *RequestOptions) cloneHeader() http.Header { headers := r.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") headers.Set("X-Fern-SDK-Name", "github.com/tryVital/vital-go") - headers.Set("X-Fern-SDK-Version", "v1.1.575") - headers.Set("User-Agent", "github.com/tryVital/vital-go/1.1.575") + headers.Set("X-Fern-SDK-Version", "v2.0.0") + headers.Set("User-Agent", "github.com/tryVital/vital-go/v2.0.0") return headers } diff --git a/devices.go b/devices.go index 0e75e1d..e6b97fd 100644 --- a/devices.go +++ b/devices.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" ) diff --git a/devices/client.go b/devices/client.go index e015b36..37df203 100644 --- a/devices/client.go +++ b/devices/client.go @@ -4,10 +4,10 @@ package devices import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/devices/raw_client.go b/devices/raw_client.go index be8425c..4d137e0 100644 --- a/devices/raw_client.go +++ b/devices/raw_client.go @@ -4,10 +4,10 @@ package devices import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/electrocardiogram.go b/electrocardiogram.go index a803424..3427cfc 100644 --- a/electrocardiogram.go +++ b/electrocardiogram.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/electrocardiogram/client.go b/electrocardiogram/client.go index 0e5dda9..3f0efd7 100644 --- a/electrocardiogram/client.go +++ b/electrocardiogram/client.go @@ -4,10 +4,10 @@ package electrocardiogram import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/electrocardiogram/raw_client.go b/electrocardiogram/raw_client.go index 4b4bd8f..b6e5761 100644 --- a/electrocardiogram/raw_client.go +++ b/electrocardiogram/raw_client.go @@ -4,10 +4,10 @@ package electrocardiogram import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/error_codes.go b/error_codes.go index 02ea0ce..f88bc43 100644 --- a/error_codes.go +++ b/error_codes.go @@ -3,8 +3,8 @@ package api import ( - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" ) var ErrorCodes internal.ErrorCodes = internal.ErrorCodes{ diff --git a/errors.go b/errors.go index fb7d918..7ab6362 100644 --- a/errors.go +++ b/errors.go @@ -4,7 +4,7 @@ package api import ( json "encoding/json" - core "github.com/tryVital/vital-go/core" + core "github.com/tryVital/vital-go/v2/core" ) // Bad Request diff --git a/go.mod b/go.mod index 2f4a446..491a943 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/tryVital/vital-go +module github.com/tryVital/vital-go/v2 go 1.21 diff --git a/insurance.go b/insurance.go index d03c6ff..09dee6d 100644 --- a/insurance.go +++ b/insurance.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" ) @@ -120,6 +120,27 @@ func (p *PayorSearchRequest) SetProviderId(providerId *string) { p.require(payorSearchRequestFieldProviderId) } +func (p *PayorSearchRequest) UnmarshalJSON(data []byte) error { + type unmarshaler PayorSearchRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *p = PayorSearchRequest(body) + return nil +} + +func (p *PayorSearchRequest) MarshalJSON() ([]byte, error) { + type embed PayorSearchRequest + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( clientFacingDiagnosisInformationFieldDiagnosisCode = big.NewInt(1 << 0) clientFacingDiagnosisInformationFieldDescription = big.NewInt(1 << 1) diff --git a/insurance/client.go b/insurance/client.go index 1f554b5..d5cd704 100644 --- a/insurance/client.go +++ b/insurance/client.go @@ -4,10 +4,10 @@ package insurance import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/insurance/raw_client.go b/insurance/raw_client.go index 46fa7bc..36baded 100644 --- a/insurance/raw_client.go +++ b/insurance/raw_client.go @@ -4,10 +4,10 @@ package insurance import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/internal/caller.go b/internal/caller.go index 8a40fa0..46e06a6 100644 --- a/internal/caller.go +++ b/internal/caller.go @@ -12,13 +12,14 @@ import ( "reflect" "strings" - "github.com/tryVital/vital-go/core" + "github.com/tryVital/vital-go/v2/core" ) const ( // contentType specifies the JSON Content-Type header value. - contentType = "application/json" - contentTypeHeader = "Content-Type" + contentType = "application/json" + contentTypeHeader = "Content-Type" + contentTypeFormURLEncoded = "application/x-www-form-urlencoded" ) // Caller calls APIs and deserializes their response, if any. @@ -180,7 +181,14 @@ func newRequest( request interface{}, bodyProperties map[string]interface{}, ) (*http.Request, error) { - requestBody, err := newRequestBody(request, bodyProperties) + // Determine the content type from headers, defaulting to JSON. + reqContentType := contentType + if endpointHeaders != nil { + if ct := endpointHeaders.Get(contentTypeHeader); ct != "" { + reqContentType = ct + } + } + requestBody, err := newRequestBody(request, bodyProperties, reqContentType) if err != nil { return nil, err } @@ -189,7 +197,7 @@ func newRequest( return nil, err } req = req.WithContext(ctx) - req.Header.Set(contentTypeHeader, contentType) + req.Header.Set(contentTypeHeader, reqContentType) for name, values := range endpointHeaders { req.Header[name] = values } @@ -197,11 +205,14 @@ func newRequest( } // newRequestBody returns a new io.Reader that represents the HTTP request body. -func newRequestBody(request interface{}, bodyProperties map[string]interface{}) (io.Reader, error) { +func newRequestBody(request interface{}, bodyProperties map[string]interface{}, reqContentType string) (io.Reader, error) { if isNil(request) { if len(bodyProperties) == 0 { return nil, nil } + if reqContentType == contentTypeFormURLEncoded { + return newFormURLEncodedBody(bodyProperties), nil + } requestBytes, err := json.Marshal(bodyProperties) if err != nil { return nil, err @@ -211,6 +222,10 @@ func newRequestBody(request interface{}, bodyProperties map[string]interface{}) if body, ok := request.(io.Reader); ok { return body, nil } + // Handle form URL encoded content type. + if reqContentType == contentTypeFormURLEncoded { + return newFormURLEncodedRequestBody(request, bodyProperties) + } requestBytes, err := MarshalJSONWithExtraProperties(request, bodyProperties) if err != nil { return nil, err @@ -218,6 +233,54 @@ func newRequestBody(request interface{}, bodyProperties map[string]interface{}) return bytes.NewReader(requestBytes), nil } +// newFormURLEncodedBody returns a new io.Reader that represents a form URL encoded body +// from the given body properties map. +func newFormURLEncodedBody(bodyProperties map[string]interface{}) io.Reader { + values := url.Values{} + for key, val := range bodyProperties { + values.Set(key, fmt.Sprintf("%v", val)) + } + return strings.NewReader(values.Encode()) +} + +// newFormURLEncodedRequestBody returns a new io.Reader that represents a form URL encoded body +// from the given request struct and body properties. +func newFormURLEncodedRequestBody(request interface{}, bodyProperties map[string]interface{}) (io.Reader, error) { + values := url.Values{} + // Marshal the request to JSON first to respect any custom MarshalJSON methods, + // then unmarshal into a map to extract the field values. + jsonBytes, err := json.Marshal(request) + if err != nil { + return nil, err + } + var jsonMap map[string]interface{} + if err := json.Unmarshal(jsonBytes, &jsonMap); err != nil { + return nil, err + } + // Convert the JSON map to form URL encoded values. + for key, val := range jsonMap { + if val == nil { + continue + } + values.Set(key, fmt.Sprintf("%v", val)) + } + // Add any extra body properties. + for key, val := range bodyProperties { + values.Set(key, fmt.Sprintf("%v", val)) + } + return strings.NewReader(values.Encode()), nil +} + +// isZeroValue checks if the given reflect.Value is the zero value for its type. +func isZeroValue(v reflect.Value) bool { + switch v.Kind() { + case reflect.Ptr, reflect.Interface, reflect.Slice, reflect.Map, reflect.Chan, reflect.Func: + return v.IsNil() + default: + return v.IsZero() + } +} + // decodeError decodes the error from the given HTTP response. Note that // it's the caller's responsibility to close the response body. func decodeError(response *http.Response, errorDecoder ErrorDecoder) error { diff --git a/internal/caller_test.go b/internal/caller_test.go index 18fc297..7a1153d 100644 --- a/internal/caller_test.go +++ b/internal/caller_test.go @@ -11,11 +11,12 @@ import ( "net/http/httptest" "net/url" "strconv" + "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tryVital/vital-go/core" + "github.com/tryVital/vital-go/v2/core" ) // InternalTestCase represents a single test case. @@ -467,3 +468,239 @@ func newTestErrorDecoder(t *testing.T) func(int, http.Header, io.Reader) error { return apiError } } + +// FormURLEncodedTestRequest is a test struct for form URL encoding tests. +type FormURLEncodedTestRequest struct { + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + GrantType string `json:"grant_type,omitempty"` + Scope *string `json:"scope,omitempty"` + NilPointer *string `json:"nil_pointer,omitempty"` +} + +func TestNewFormURLEncodedBody(t *testing.T) { + t.Run("simple key-value pairs", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "client_id": "test_client_id", + "client_secret": "test_client_secret", + "grant_type": "client_credentials", + } + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + + // Verify it's not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON, got: %s", bodyStr) + }) + + t.Run("special characters requiring URL encoding", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "value_with_space": "hello world", + "value_with_ampersand": "a&b", + "value_with_equals": "a=b", + "value_with_plus": "a+b", + } + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values are correctly decoded + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "hello world", values.Get("value_with_space")) + assert.Equal(t, "a&b", values.Get("value_with_ampersand")) + assert.Equal(t, "a=b", values.Get("value_with_equals")) + assert.Equal(t, "a+b", values.Get("value_with_plus")) + }) + + t.Run("empty map", func(t *testing.T) { + bodyProperties := map[string]interface{}{} + reader := newFormURLEncodedBody(bodyProperties) + body, err := io.ReadAll(reader) + require.NoError(t, err) + assert.Empty(t, string(body)) + }) +} + +func TestNewFormURLEncodedRequestBody(t *testing.T) { + t.Run("struct with json tags", func(t *testing.T) { + scope := "read write" + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "client_credentials", + Scope: &scope, + NilPointer: nil, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Parse the body and verify values + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + assert.Equal(t, "read write", values.Get("scope")) + // nil_pointer should not be present (nil pointer with omitempty) + assert.Empty(t, values.Get("nil_pointer")) + + // Verify it's not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON, got: %s", bodyStr) + }) + + t.Run("struct with omitempty and zero values", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "", // empty string with omitempty should be omitted + Scope: nil, + NilPointer: nil, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + // grant_type should not be present (empty string with omitempty) + assert.Empty(t, values.Get("grant_type")) + assert.Empty(t, values.Get("scope")) + }) + + t.Run("struct with extra body properties", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + } + bodyProperties := map[string]interface{}{ + "extra_param": "extra_value", + } + reader, err := newFormURLEncodedRequestBody(request, bodyProperties) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "extra_value", values.Get("extra_param")) + }) + + t.Run("special characters in struct fields", func(t *testing.T) { + scope := "read&write=all+permissions" + request := &FormURLEncodedTestRequest{ + ClientID: "client with spaces", + ClientSecret: "secret&with=special+chars", + Scope: &scope, + } + reader, err := newFormURLEncodedRequestBody(request, nil) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "client with spaces", values.Get("client_id")) + assert.Equal(t, "secret&with=special+chars", values.Get("client_secret")) + assert.Equal(t, "read&write=all+permissions", values.Get("scope")) + }) +} + +func TestNewRequestBodyFormURLEncoded(t *testing.T) { + t.Run("selects form encoding when content-type is form-urlencoded", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + GrantType: "client_credentials", + } + reader, err := newRequestBody(request, nil, contentTypeFormURLEncoded) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Verify it's form-urlencoded, not JSON + bodyStr := string(body) + assert.False(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should not be JSON when Content-Type is form-urlencoded, got: %s", bodyStr) + + // Parse and verify values + values, err := url.ParseQuery(bodyStr) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + assert.Equal(t, "client_credentials", values.Get("grant_type")) + }) + + t.Run("selects JSON encoding when content-type is application/json", func(t *testing.T) { + request := &FormURLEncodedTestRequest{ + ClientID: "test_client_id", + ClientSecret: "test_client_secret", + } + reader, err := newRequestBody(request, nil, contentType) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + // Verify it's JSON + bodyStr := string(body) + assert.True(t, strings.HasPrefix(strings.TrimSpace(bodyStr), "{"), + "Body should be JSON when Content-Type is application/json, got: %s", bodyStr) + + // Parse and verify it's valid JSON + var parsed map[string]interface{} + err = json.Unmarshal(body, &parsed) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", parsed["client_id"]) + assert.Equal(t, "test_client_secret", parsed["client_secret"]) + }) + + t.Run("form encoding with body properties only (nil request)", func(t *testing.T) { + bodyProperties := map[string]interface{}{ + "client_id": "test_client_id", + "client_secret": "test_client_secret", + } + reader, err := newRequestBody(nil, bodyProperties, contentTypeFormURLEncoded) + require.NoError(t, err) + + body, err := io.ReadAll(reader) + require.NoError(t, err) + + values, err := url.ParseQuery(string(body)) + require.NoError(t, err) + + assert.Equal(t, "test_client_id", values.Get("client_id")) + assert.Equal(t, "test_client_secret", values.Get("client_secret")) + }) +} diff --git a/internal/error_decoder.go b/internal/error_decoder.go index b8229ed..be685e2 100644 --- a/internal/error_decoder.go +++ b/internal/error_decoder.go @@ -8,7 +8,7 @@ import ( "io" "net/http" - "github.com/tryVital/vital-go/core" + "github.com/tryVital/vital-go/v2/core" ) // ErrorCodes maps HTTP status codes to error constructors. diff --git a/internal/error_decoder_test.go b/internal/error_decoder_test.go index e763a63..bfd3e16 100644 --- a/internal/error_decoder_test.go +++ b/internal/error_decoder_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/tryVital/vital-go/core" + "github.com/tryVital/vital-go/v2/core" ) func TestErrorDecoder(t *testing.T) { diff --git a/internal/multipart.go b/internal/multipart.go index 67a2229..d8d9955 100644 --- a/internal/multipart.go +++ b/internal/multipart.go @@ -119,6 +119,9 @@ func (w *MultipartWriter) writeFile( filename = getFilename(file) contentType = getContentType(file) ) + if filename == "" { + filename = field + } if contentType == "" { contentType = defaultContentType } diff --git a/internal/multipart_test.go b/internal/multipart_test.go index 07008dd..13201f7 100644 --- a/internal/multipart_test.go +++ b/internal/multipart_test.go @@ -1,6 +1,7 @@ package internal import ( + "bytes" "encoding/json" "io" "mime/multipart" @@ -174,6 +175,81 @@ func TestMultipartWriter(t *testing.T) { } }) + t.Run("write file without name", func(t *testing.T) { + tests := []struct { + desc string + giveField string + giveReader func(content string) io.Reader + giveContent string + wantFilename string + }{ + { + desc: "strings.Reader without name uses field name as filename", + giveField: "file", + giveReader: func(content string) io.Reader { + return strings.NewReader(content) + }, + giveContent: "test content", + wantFilename: "file", + }, + { + desc: "bytes.Reader without name uses field name as filename", + giveField: "document", + giveReader: func(content string) io.Reader { + return bytes.NewReader([]byte(content)) + }, + giveContent: "some data", + wantFilename: "document", + }, + { + desc: "bytes.Buffer without name uses field name as filename", + giveField: "upload", + giveReader: func(content string) io.Reader { + return bytes.NewBufferString(content) + }, + giveContent: "buffer content", + wantFilename: "upload", + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + w := NewMultipartWriter() + + reader := tt.giveReader(tt.giveContent) + require.NoError(t, w.WriteFile(tt.giveField, reader)) + require.NoError(t, w.Close()) + + multipartReader := multipart.NewReader(w.Buffer(), w.writer.Boundary()) + form, err := multipartReader.ReadForm(maxFormMemory) + require.NoError(t, err) + defer func() { + require.NoError(t, form.RemoveAll()) + }() + + files := form.File[tt.giveField] + require.Len(t, files, 1) + + file := files[0] + assert.Equal(t, tt.wantFilename, file.Filename) + + // Verify the Content-Disposition header includes the filename attribute + contentDisposition := file.Header.Get("Content-Disposition") + assert.Contains(t, contentDisposition, `filename="`+tt.wantFilename+`"`) + + f, err := file.Open() + require.NoError(t, err) + defer func() { + require.NoError(t, f.Close()) + }() + + content, err := io.ReadAll(f) + require.NoError(t, err) + assert.Equal(t, tt.giveContent, string(content)) + }) + } + }) + t.Run("write JSON", func(t *testing.T) { type testStruct struct { Name string `json:"name"` diff --git a/internal/retrier_test.go b/internal/retrier_test.go index a78c333..0151984 100644 --- a/internal/retrier_test.go +++ b/internal/retrier_test.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tryVital/vital-go/core" + "github.com/tryVital/vital-go/v2/core" ) type RetryTestCase struct { diff --git a/introspect.go b/introspect.go index cf009ca..e106743 100644 --- a/introspect.go +++ b/introspect.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/introspect/client.go b/introspect/client.go index af5e38a..77927db 100644 --- a/introspect/client.go +++ b/introspect/client.go @@ -4,10 +4,10 @@ package introspect import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/introspect/raw_client.go b/introspect/raw_client.go index e025044..b2cf3bc 100644 --- a/introspect/raw_client.go +++ b/introspect/raw_client.go @@ -4,10 +4,10 @@ package introspect import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/lab_account.go b/lab_account.go new file mode 100644 index 0000000..849c5db --- /dev/null +++ b/lab_account.go @@ -0,0 +1,587 @@ +// Code generated by Fern. DO NOT EDIT. + +package api + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/tryVital/vital-go/v2/internal" + big "math/big" +) + +var ( + labAccountGetTeamLabAccountsRequestFieldLabAccountId = big.NewInt(1 << 0) + labAccountGetTeamLabAccountsRequestFieldStatus = big.NewInt(1 << 1) +) + +type LabAccountGetTeamLabAccountsRequest struct { + LabAccountId *string `json:"-" url:"lab_account_id,omitempty"` + Status *LabAccountStatus `json:"-" url:"status,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (l *LabAccountGetTeamLabAccountsRequest) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetLabAccountId sets the LabAccountId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabAccountGetTeamLabAccountsRequest) SetLabAccountId(labAccountId *string) { + l.LabAccountId = labAccountId + l.require(labAccountGetTeamLabAccountsRequestFieldLabAccountId) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabAccountGetTeamLabAccountsRequest) SetStatus(status *LabAccountStatus) { + l.Status = status + l.require(labAccountGetTeamLabAccountsRequestFieldStatus) +} + +var ( + clientFacingLabAccountFieldId = big.NewInt(1 << 0) + clientFacingLabAccountFieldLab = big.NewInt(1 << 1) + clientFacingLabAccountFieldOrgId = big.NewInt(1 << 2) + clientFacingLabAccountFieldStatus = big.NewInt(1 << 3) + clientFacingLabAccountFieldDelegatedFlow = big.NewInt(1 << 4) + clientFacingLabAccountFieldProviderAccountId = big.NewInt(1 << 5) + clientFacingLabAccountFieldAccountName = big.NewInt(1 << 6) + clientFacingLabAccountFieldDefaultClinicalNotes = big.NewInt(1 << 7) + clientFacingLabAccountFieldBusinessUnits = big.NewInt(1 << 8) + clientFacingLabAccountFieldAllowedBilling = big.NewInt(1 << 9) + clientFacingLabAccountFieldTeamIdAllowlist = big.NewInt(1 << 10) +) + +type ClientFacingLabAccount struct { + Id string `json:"id" url:"id"` + Lab Labs `json:"lab" url:"lab"` + OrgId *string `json:"org_id,omitempty" url:"org_id,omitempty"` + Status LabAccountStatus `json:"status" url:"status"` + DelegatedFlow LabAccountDelegatedFlow `json:"delegated_flow" url:"delegated_flow"` + ProviderAccountId string `json:"provider_account_id" url:"provider_account_id"` + AccountName *string `json:"account_name,omitempty" url:"account_name,omitempty"` + DefaultClinicalNotes *string `json:"default_clinical_notes,omitempty" url:"default_clinical_notes,omitempty"` + BusinessUnits []string `json:"business_units,omitempty" url:"business_units,omitempty"` + AllowedBilling map[string][]UsState `json:"allowed_billing" url:"allowed_billing"` + TeamIdAllowlist []string `json:"team_id_allowlist" url:"team_id_allowlist"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClientFacingLabAccount) GetId() string { + if c == nil { + return "" + } + return c.Id +} + +func (c *ClientFacingLabAccount) GetLab() Labs { + if c == nil { + return "" + } + return c.Lab +} + +func (c *ClientFacingLabAccount) GetOrgId() *string { + if c == nil { + return nil + } + return c.OrgId +} + +func (c *ClientFacingLabAccount) GetStatus() LabAccountStatus { + if c == nil { + return "" + } + return c.Status +} + +func (c *ClientFacingLabAccount) GetDelegatedFlow() LabAccountDelegatedFlow { + if c == nil { + return "" + } + return c.DelegatedFlow +} + +func (c *ClientFacingLabAccount) GetProviderAccountId() string { + if c == nil { + return "" + } + return c.ProviderAccountId +} + +func (c *ClientFacingLabAccount) GetAccountName() *string { + if c == nil { + return nil + } + return c.AccountName +} + +func (c *ClientFacingLabAccount) GetDefaultClinicalNotes() *string { + if c == nil { + return nil + } + return c.DefaultClinicalNotes +} + +func (c *ClientFacingLabAccount) GetBusinessUnits() []string { + if c == nil { + return nil + } + return c.BusinessUnits +} + +func (c *ClientFacingLabAccount) GetAllowedBilling() map[string][]UsState { + if c == nil { + return nil + } + return c.AllowedBilling +} + +func (c *ClientFacingLabAccount) GetTeamIdAllowlist() []string { + if c == nil { + return nil + } + return c.TeamIdAllowlist +} + +func (c *ClientFacingLabAccount) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientFacingLabAccount) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetId sets the Id field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetId(id string) { + c.Id = id + c.require(clientFacingLabAccountFieldId) +} + +// SetLab sets the Lab field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetLab(lab Labs) { + c.Lab = lab + c.require(clientFacingLabAccountFieldLab) +} + +// SetOrgId sets the OrgId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetOrgId(orgId *string) { + c.OrgId = orgId + c.require(clientFacingLabAccountFieldOrgId) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetStatus(status LabAccountStatus) { + c.Status = status + c.require(clientFacingLabAccountFieldStatus) +} + +// SetDelegatedFlow sets the DelegatedFlow field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetDelegatedFlow(delegatedFlow LabAccountDelegatedFlow) { + c.DelegatedFlow = delegatedFlow + c.require(clientFacingLabAccountFieldDelegatedFlow) +} + +// SetProviderAccountId sets the ProviderAccountId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetProviderAccountId(providerAccountId string) { + c.ProviderAccountId = providerAccountId + c.require(clientFacingLabAccountFieldProviderAccountId) +} + +// SetAccountName sets the AccountName field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetAccountName(accountName *string) { + c.AccountName = accountName + c.require(clientFacingLabAccountFieldAccountName) +} + +// SetDefaultClinicalNotes sets the DefaultClinicalNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetDefaultClinicalNotes(defaultClinicalNotes *string) { + c.DefaultClinicalNotes = defaultClinicalNotes + c.require(clientFacingLabAccountFieldDefaultClinicalNotes) +} + +// SetBusinessUnits sets the BusinessUnits field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetBusinessUnits(businessUnits []string) { + c.BusinessUnits = businessUnits + c.require(clientFacingLabAccountFieldBusinessUnits) +} + +// SetAllowedBilling sets the AllowedBilling field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetAllowedBilling(allowedBilling map[string][]UsState) { + c.AllowedBilling = allowedBilling + c.require(clientFacingLabAccountFieldAllowedBilling) +} + +// SetTeamIdAllowlist sets the TeamIdAllowlist field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabAccount) SetTeamIdAllowlist(teamIdAllowlist []string) { + c.TeamIdAllowlist = teamIdAllowlist + c.require(clientFacingLabAccountFieldTeamIdAllowlist) +} + +func (c *ClientFacingLabAccount) UnmarshalJSON(data []byte) error { + type unmarshaler ClientFacingLabAccount + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = ClientFacingLabAccount(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientFacingLabAccount) MarshalJSON() ([]byte, error) { + type embed ClientFacingLabAccount + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ClientFacingLabAccount) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + getTeamLabAccountsResponseFieldData = big.NewInt(1 << 0) +) + +type GetTeamLabAccountsResponse struct { + Data []*ClientFacingLabAccount `json:"data,omitempty" url:"data,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetTeamLabAccountsResponse) GetData() []*ClientFacingLabAccount { + if g == nil { + return nil + } + return g.Data +} + +func (g *GetTeamLabAccountsResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetTeamLabAccountsResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetData sets the Data field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetTeamLabAccountsResponse) SetData(data []*ClientFacingLabAccount) { + g.Data = data + g.require(getTeamLabAccountsResponseFieldData) +} + +func (g *GetTeamLabAccountsResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetTeamLabAccountsResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetTeamLabAccountsResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetTeamLabAccountsResponse) MarshalJSON() ([]byte, error) { + type embed GetTeamLabAccountsResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetTeamLabAccountsResponse) String() string { + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Describes which parts of the lab testing flow are delegated to the customer. +// +// - ORDER_DELEGATED: Ordering using client's physicians, critical result follow up via Junction +// - RESULT_DELEGATED: Ordering using Junction's Physician Network, critical results handled by client +// - FULLY_DELEGATED: Order and critical results handled by client +// - NOT_DELEGATED: Junction handles both ordering and results ℹ️ This enum is non-exhaustive. +type LabAccountDelegatedFlow string + +const ( + LabAccountDelegatedFlowOrderDelegated LabAccountDelegatedFlow = "order_delegated" + LabAccountDelegatedFlowResultDelegated LabAccountDelegatedFlow = "result_delegated" + LabAccountDelegatedFlowFullyDelegated LabAccountDelegatedFlow = "fully_delegated" + LabAccountDelegatedFlowNotDelegated LabAccountDelegatedFlow = "not_delegated" +) + +func NewLabAccountDelegatedFlowFromString(s string) (LabAccountDelegatedFlow, error) { + switch s { + case "order_delegated": + return LabAccountDelegatedFlowOrderDelegated, nil + case "result_delegated": + return LabAccountDelegatedFlowResultDelegated, nil + case "fully_delegated": + return LabAccountDelegatedFlowFullyDelegated, nil + case "not_delegated": + return LabAccountDelegatedFlowNotDelegated, nil + } + var t LabAccountDelegatedFlow + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LabAccountDelegatedFlow) Ptr() *LabAccountDelegatedFlow { + return &l +} + +// ℹ️ This enum is non-exhaustive. +type LabAccountStatus string + +const ( + LabAccountStatusActive LabAccountStatus = "active" + LabAccountStatusPending LabAccountStatus = "pending" + LabAccountStatusSuspended LabAccountStatus = "suspended" +) + +func NewLabAccountStatusFromString(s string) (LabAccountStatus, error) { + switch s { + case "active": + return LabAccountStatusActive, nil + case "pending": + return LabAccountStatusPending, nil + case "suspended": + return LabAccountStatusSuspended, nil + } + var t LabAccountStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LabAccountStatus) Ptr() *LabAccountStatus { + return &l +} + +// ℹ️ This enum is non-exhaustive. +type UsState string + +const ( + UsStateAl UsState = "AL" + UsStateAk UsState = "AK" + UsStateAz UsState = "AZ" + UsStateAr UsState = "AR" + UsStateCa UsState = "CA" + UsStateCo UsState = "CO" + UsStateCt UsState = "CT" + UsStateDe UsState = "DE" + UsStateFl UsState = "FL" + UsStateGa UsState = "GA" + UsStateHi UsState = "HI" + UsStateId UsState = "ID" + UsStateIl UsState = "IL" + UsStateIn UsState = "IN" + UsStateIa UsState = "IA" + UsStateKs UsState = "KS" + UsStateKy UsState = "KY" + UsStateLa UsState = "LA" + UsStateMe UsState = "ME" + UsStateMd UsState = "MD" + UsStateMa UsState = "MA" + UsStateMi UsState = "MI" + UsStateMn UsState = "MN" + UsStateMs UsState = "MS" + UsStateMo UsState = "MO" + UsStateMt UsState = "MT" + UsStateNe UsState = "NE" + UsStateNv UsState = "NV" + UsStateNh UsState = "NH" + UsStateNj UsState = "NJ" + UsStateNm UsState = "NM" + UsStateNy UsState = "NY" + UsStateNc UsState = "NC" + UsStateNd UsState = "ND" + UsStateOh UsState = "OH" + UsStateOk UsState = "OK" + UsStateOr UsState = "OR" + UsStatePa UsState = "PA" + UsStateRi UsState = "RI" + UsStateSc UsState = "SC" + UsStateSd UsState = "SD" + UsStateTn UsState = "TN" + UsStateTx UsState = "TX" + UsStateUt UsState = "UT" + UsStateVt UsState = "VT" + UsStateVa UsState = "VA" + UsStateWa UsState = "WA" + UsStateWv UsState = "WV" + UsStateWi UsState = "WI" + UsStateWy UsState = "WY" +) + +func NewUsStateFromString(s string) (UsState, error) { + switch s { + case "AL": + return UsStateAl, nil + case "AK": + return UsStateAk, nil + case "AZ": + return UsStateAz, nil + case "AR": + return UsStateAr, nil + case "CA": + return UsStateCa, nil + case "CO": + return UsStateCo, nil + case "CT": + return UsStateCt, nil + case "DE": + return UsStateDe, nil + case "FL": + return UsStateFl, nil + case "GA": + return UsStateGa, nil + case "HI": + return UsStateHi, nil + case "ID": + return UsStateId, nil + case "IL": + return UsStateIl, nil + case "IN": + return UsStateIn, nil + case "IA": + return UsStateIa, nil + case "KS": + return UsStateKs, nil + case "KY": + return UsStateKy, nil + case "LA": + return UsStateLa, nil + case "ME": + return UsStateMe, nil + case "MD": + return UsStateMd, nil + case "MA": + return UsStateMa, nil + case "MI": + return UsStateMi, nil + case "MN": + return UsStateMn, nil + case "MS": + return UsStateMs, nil + case "MO": + return UsStateMo, nil + case "MT": + return UsStateMt, nil + case "NE": + return UsStateNe, nil + case "NV": + return UsStateNv, nil + case "NH": + return UsStateNh, nil + case "NJ": + return UsStateNj, nil + case "NM": + return UsStateNm, nil + case "NY": + return UsStateNy, nil + case "NC": + return UsStateNc, nil + case "ND": + return UsStateNd, nil + case "OH": + return UsStateOh, nil + case "OK": + return UsStateOk, nil + case "OR": + return UsStateOr, nil + case "PA": + return UsStatePa, nil + case "RI": + return UsStateRi, nil + case "SC": + return UsStateSc, nil + case "SD": + return UsStateSd, nil + case "TN": + return UsStateTn, nil + case "TX": + return UsStateTx, nil + case "UT": + return UsStateUt, nil + case "VT": + return UsStateVt, nil + case "VA": + return UsStateVa, nil + case "WA": + return UsStateWa, nil + case "WV": + return UsStateWv, nil + case "WI": + return UsStateWi, nil + case "WY": + return UsStateWy, nil + } + var t UsState + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (u UsState) Ptr() *UsState { + return &u +} diff --git a/lab_report.go b/lab_report.go index f0858c2..bada585 100644 --- a/lab_report.go +++ b/lab_report.go @@ -5,15 +5,15 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" io "io" big "math/big" ) type BodyCreateLabReportParserJob struct { - File io.Reader `json:"-" url:"-"` - UserId string `json:"user_id" url:"-"` - NeedsHumanReview *bool `json:"needs_human_review,omitempty" url:"-"` + File []io.Reader `json:"-" url:"-"` + UserId string `json:"user_id" url:"-"` + NeedsHumanReview *bool `json:"needs_human_review,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -540,20 +540,20 @@ func (p *ParsedLabReportData) String() string { var ( parsingJobFieldId = big.NewInt(1 << 0) - parsingJobFieldJobId = big.NewInt(1 << 1) - parsingJobFieldStatus = big.NewInt(1 << 2) + parsingJobFieldStatus = big.NewInt(1 << 1) + parsingJobFieldFailureReason = big.NewInt(1 << 2) parsingJobFieldData = big.NewInt(1 << 3) parsingJobFieldNeedsHumanReview = big.NewInt(1 << 4) parsingJobFieldIsReviewed = big.NewInt(1 << 5) ) type ParsingJob struct { - Id string `json:"id" url:"id"` - JobId string `json:"job_id" url:"job_id"` - Status ParsingJobStatus `json:"status" url:"status"` - Data *ParsedLabReportData `json:"data,omitempty" url:"data,omitempty"` - NeedsHumanReview bool `json:"needs_human_review" url:"needs_human_review"` - IsReviewed bool `json:"is_reviewed" url:"is_reviewed"` + Id string `json:"id" url:"id"` + Status ParsingJobStatus `json:"status" url:"status"` + FailureReason *ParsingJobFailureReason `json:"failure_reason,omitempty" url:"failure_reason,omitempty"` + Data *ParsedLabReportData `json:"data,omitempty" url:"data,omitempty"` + NeedsHumanReview bool `json:"needs_human_review" url:"needs_human_review"` + IsReviewed bool `json:"is_reviewed" url:"is_reviewed"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -569,18 +569,18 @@ func (p *ParsingJob) GetId() string { return p.Id } -func (p *ParsingJob) GetJobId() string { +func (p *ParsingJob) GetStatus() ParsingJobStatus { if p == nil { return "" } - return p.JobId + return p.Status } -func (p *ParsingJob) GetStatus() ParsingJobStatus { +func (p *ParsingJob) GetFailureReason() *ParsingJobFailureReason { if p == nil { - return "" + return nil } - return p.Status + return p.FailureReason } func (p *ParsingJob) GetData() *ParsedLabReportData { @@ -622,13 +622,6 @@ func (p *ParsingJob) SetId(id string) { p.require(parsingJobFieldId) } -// SetJobId sets the JobId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *ParsingJob) SetJobId(jobId string) { - p.JobId = jobId - p.require(parsingJobFieldJobId) -} - // SetStatus sets the Status field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (p *ParsingJob) SetStatus(status ParsingJobStatus) { @@ -636,6 +629,13 @@ func (p *ParsingJob) SetStatus(status ParsingJobStatus) { p.require(parsingJobFieldStatus) } +// SetFailureReason sets the FailureReason field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ParsingJob) SetFailureReason(failureReason *ParsingJobFailureReason) { + p.FailureReason = failureReason + p.require(parsingJobFieldFailureReason) +} + // SetData sets the Data field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (p *ParsingJob) SetData(data *ParsedLabReportData) { @@ -696,6 +696,32 @@ func (p *ParsingJob) String() string { return fmt.Sprintf("%#v", p) } +// Machine-readable failure reasons for parsing jobs. ℹ️ This enum is non-exhaustive. +type ParsingJobFailureReason string + +const ( + ParsingJobFailureReasonInvalidInput ParsingJobFailureReason = "invalid_input" + ParsingJobFailureReasonLowQuality ParsingJobFailureReason = "low_quality" + ParsingJobFailureReasonNotEnglish ParsingJobFailureReason = "not_english" +) + +func NewParsingJobFailureReasonFromString(s string) (ParsingJobFailureReason, error) { + switch s { + case "invalid_input": + return ParsingJobFailureReasonInvalidInput, nil + case "low_quality": + return ParsingJobFailureReasonLowQuality, nil + case "not_english": + return ParsingJobFailureReasonNotEnglish, nil + } + var t ParsingJobFailureReason + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (p ParsingJobFailureReason) Ptr() *ParsingJobFailureReason { + return &p +} + // ℹ️ This enum is non-exhaustive. type ParsingJobStatus string @@ -729,20 +755,23 @@ var ( resultMetadataFieldPatientFirstName = big.NewInt(1 << 0) resultMetadataFieldPatientLastName = big.NewInt(1 << 1) resultMetadataFieldDob = big.NewInt(1 << 2) - resultMetadataFieldLabName = big.NewInt(1 << 3) - resultMetadataFieldDateReported = big.NewInt(1 << 4) - resultMetadataFieldDateCollected = big.NewInt(1 << 5) - resultMetadataFieldSpecimenNumber = big.NewInt(1 << 6) + resultMetadataFieldGender = big.NewInt(1 << 3) + resultMetadataFieldLabName = big.NewInt(1 << 4) + resultMetadataFieldDateReported = big.NewInt(1 << 5) + resultMetadataFieldDateCollected = big.NewInt(1 << 6) + resultMetadataFieldSpecimenNumber = big.NewInt(1 << 7) ) type ResultMetadata struct { - PatientFirstName string `json:"patient_first_name" url:"patient_first_name"` - PatientLastName string `json:"patient_last_name" url:"patient_last_name"` - Dob string `json:"dob" url:"dob"` - LabName string `json:"lab_name" url:"lab_name"` - DateReported *string `json:"date_reported,omitempty" url:"date_reported,omitempty"` - DateCollected *string `json:"date_collected,omitempty" url:"date_collected,omitempty"` - SpecimenNumber *string `json:"specimen_number,omitempty" url:"specimen_number,omitempty"` + PatientFirstName *string `json:"patient_first_name,omitempty" url:"patient_first_name,omitempty"` + PatientLastName *string `json:"patient_last_name,omitempty" url:"patient_last_name,omitempty"` + Dob *string `json:"dob,omitempty" url:"dob,omitempty"` + // ℹ️ This enum is non-exhaustive. + Gender *ResultMetadataGender `json:"gender,omitempty" url:"gender,omitempty"` + LabName *string `json:"lab_name,omitempty" url:"lab_name,omitempty"` + DateReported *string `json:"date_reported,omitempty" url:"date_reported,omitempty"` + DateCollected *string `json:"date_collected,omitempty" url:"date_collected,omitempty"` + SpecimenNumber *string `json:"specimen_number,omitempty" url:"specimen_number,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -751,30 +780,37 @@ type ResultMetadata struct { rawJSON json.RawMessage } -func (r *ResultMetadata) GetPatientFirstName() string { +func (r *ResultMetadata) GetPatientFirstName() *string { if r == nil { - return "" + return nil } return r.PatientFirstName } -func (r *ResultMetadata) GetPatientLastName() string { +func (r *ResultMetadata) GetPatientLastName() *string { if r == nil { - return "" + return nil } return r.PatientLastName } -func (r *ResultMetadata) GetDob() string { +func (r *ResultMetadata) GetDob() *string { if r == nil { - return "" + return nil } return r.Dob } -func (r *ResultMetadata) GetLabName() string { +func (r *ResultMetadata) GetGender() *ResultMetadataGender { if r == nil { - return "" + return nil + } + return r.Gender +} + +func (r *ResultMetadata) GetLabName() *string { + if r == nil { + return nil } return r.LabName } @@ -813,28 +849,35 @@ func (r *ResultMetadata) require(field *big.Int) { // SetPatientFirstName sets the PatientFirstName field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (r *ResultMetadata) SetPatientFirstName(patientFirstName string) { +func (r *ResultMetadata) SetPatientFirstName(patientFirstName *string) { r.PatientFirstName = patientFirstName r.require(resultMetadataFieldPatientFirstName) } // SetPatientLastName sets the PatientLastName field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (r *ResultMetadata) SetPatientLastName(patientLastName string) { +func (r *ResultMetadata) SetPatientLastName(patientLastName *string) { r.PatientLastName = patientLastName r.require(resultMetadataFieldPatientLastName) } // SetDob sets the Dob field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (r *ResultMetadata) SetDob(dob string) { +func (r *ResultMetadata) SetDob(dob *string) { r.Dob = dob r.require(resultMetadataFieldDob) } +// SetGender sets the Gender field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *ResultMetadata) SetGender(gender *ResultMetadataGender) { + r.Gender = gender + r.require(resultMetadataFieldGender) +} + // SetLabName sets the LabName field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (r *ResultMetadata) SetLabName(labName string) { +func (r *ResultMetadata) SetLabName(labName *string) { r.LabName = labName r.require(resultMetadataFieldLabName) } @@ -898,3 +941,29 @@ func (r *ResultMetadata) String() string { } return fmt.Sprintf("%#v", r) } + +// ℹ️ This enum is non-exhaustive. +type ResultMetadataGender string + +const ( + ResultMetadataGenderMale ResultMetadataGender = "male" + ResultMetadataGenderFemale ResultMetadataGender = "female" + ResultMetadataGenderOther ResultMetadataGender = "other" +) + +func NewResultMetadataGenderFromString(s string) (ResultMetadataGender, error) { + switch s { + case "male": + return ResultMetadataGenderMale, nil + case "female": + return ResultMetadataGenderFemale, nil + case "other": + return ResultMetadataGenderOther, nil + } + var t ResultMetadataGender + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r ResultMetadataGender) Ptr() *ResultMetadataGender { + return &r +} diff --git a/lab_tests.go b/lab_tests.go index 6b29f22..a5103c8 100644 --- a/lab_tests.go +++ b/lab_tests.go @@ -5,11 +5,61 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) +var ( + labTestsBookPscAppointmentRequestFieldIdempotencyKey = big.NewInt(1 << 0) + labTestsBookPscAppointmentRequestFieldIdempotencyError = big.NewInt(1 << 1) +) + +type LabTestsBookPscAppointmentRequest struct { + // [!] This feature (Idempotency Key) is under closed beta. Idempotency Key support for booking PSC appointment. + IdempotencyKey *string `json:"-" url:"-"` + // If `no-cache`, applies idempotency only to successful outcomes. + IdempotencyError *string `json:"-" url:"-"` + Body *AppointmentBookingRequest `json:"-" url:"-"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` +} + +func (l *LabTestsBookPscAppointmentRequest) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetIdempotencyKey sets the IdempotencyKey field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestsBookPscAppointmentRequest) SetIdempotencyKey(idempotencyKey *string) { + l.IdempotencyKey = idempotencyKey + l.require(labTestsBookPscAppointmentRequestFieldIdempotencyKey) +} + +// SetIdempotencyError sets the IdempotencyError field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestsBookPscAppointmentRequest) SetIdempotencyError(idempotencyError *string) { + l.IdempotencyError = idempotencyError + l.require(labTestsBookPscAppointmentRequestFieldIdempotencyError) +} + +func (l *LabTestsBookPscAppointmentRequest) UnmarshalJSON(data []byte) error { + body := new(AppointmentBookingRequest) + if err := json.Unmarshal(data, &body); err != nil { + return err + } + l.Body = body + return nil +} + +func (l *LabTestsBookPscAppointmentRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(l.Body) +} + var ( apiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequestFieldCancellationReasonId = big.NewInt(1 << 0) apiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequestFieldNotes = big.NewInt(1 << 1) @@ -44,6 +94,27 @@ func (a *ApiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelReques a.require(apiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequestFieldNotes) } +func (a *ApiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequest) UnmarshalJSON(data []byte) error { + type unmarshaler ApiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *a = ApiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequest(body) + return nil +} + +func (a *ApiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequest) MarshalJSON() ([]byte, error) { + type embed ApiApiV1EndpointsVitalApiLabTestingOrdersHelpersAppointmentCancelRequest + var marshaler = struct { + embed + }{ + embed: embed(*a), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, a.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( vitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequestFieldCancellationReasonId = big.NewInt(1 << 0) vitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequestFieldNote = big.NewInt(1 << 1) @@ -78,22 +149,47 @@ func (v *VitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequest) SetNote(n v.require(vitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequestFieldNote) } +func (v *VitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequest) UnmarshalJSON(data []byte) error { + type unmarshaler VitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *v = VitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequest(body) + return nil +} + +func (v *VitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequest) MarshalJSON() ([]byte, error) { + type embed VitalCoreClientsLabTestGetlabsSchemaAppointmentCancelRequest + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( - createLabTestRequestFieldMarkerIds = big.NewInt(1 << 0) - createLabTestRequestFieldProviderIds = big.NewInt(1 << 1) - createLabTestRequestFieldName = big.NewInt(1 << 2) - createLabTestRequestFieldMethod = big.NewInt(1 << 3) - createLabTestRequestFieldDescription = big.NewInt(1 << 4) - createLabTestRequestFieldFasting = big.NewInt(1 << 5) + createLabTestRequestFieldMarkerIds = big.NewInt(1 << 0) + createLabTestRequestFieldProviderIds = big.NewInt(1 << 1) + createLabTestRequestFieldName = big.NewInt(1 << 2) + createLabTestRequestFieldMethod = big.NewInt(1 << 3) + createLabTestRequestFieldDescription = big.NewInt(1 << 4) + createLabTestRequestFieldFasting = big.NewInt(1 << 5) + createLabTestRequestFieldLabAccountId = big.NewInt(1 << 6) + createLabTestRequestFieldLabSlug = big.NewInt(1 << 7) ) type CreateLabTestRequest struct { - MarkerIds []int `json:"marker_ids,omitempty" url:"-"` - ProviderIds []string `json:"provider_ids,omitempty" url:"-"` - Name string `json:"name" url:"-"` - Method LabTestCollectionMethod `json:"method" url:"-"` - Description string `json:"description" url:"-"` - Fasting *bool `json:"fasting,omitempty" url:"-"` + MarkerIds []int `json:"marker_ids,omitempty" url:"-"` + ProviderIds []string `json:"provider_ids,omitempty" url:"-"` + Name string `json:"name" url:"-"` + Method LabTestCollectionMethod `json:"method" url:"-"` + Description string `json:"description" url:"-"` + Fasting *bool `json:"fasting,omitempty" url:"-"` + LabAccountId *string `json:"lab_account_id,omitempty" url:"-"` + LabSlug *Labs `json:"lab_slug,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -148,6 +244,41 @@ func (c *CreateLabTestRequest) SetFasting(fasting *bool) { c.require(createLabTestRequestFieldFasting) } +// SetLabAccountId sets the LabAccountId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateLabTestRequest) SetLabAccountId(labAccountId *string) { + c.LabAccountId = labAccountId + c.require(createLabTestRequestFieldLabAccountId) +} + +// SetLabSlug sets the LabSlug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateLabTestRequest) SetLabSlug(labSlug *Labs) { + c.LabSlug = labSlug + c.require(createLabTestRequestFieldLabSlug) +} + +func (c *CreateLabTestRequest) UnmarshalJSON(data []byte) error { + type unmarshaler CreateLabTestRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CreateLabTestRequest(body) + return nil +} + +func (c *CreateLabTestRequest) MarshalJSON() ([]byte, error) { + type embed CreateLabTestRequest + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( createOrderRequestCompatibleFieldIdempotencyKey = big.NewInt(1 << 0) createOrderRequestCompatibleFieldIdempotencyError = big.NewInt(1 << 1) @@ -164,10 +295,11 @@ var ( createOrderRequestCompatibleFieldActivateBy = big.NewInt(1 << 12) createOrderRequestCompatibleFieldAoeAnswers = big.NewInt(1 << 13) createOrderRequestCompatibleFieldPassthrough = big.NewInt(1 << 14) - createOrderRequestCompatibleFieldLabAccountId = big.NewInt(1 << 15) - createOrderRequestCompatibleFieldCreatorMemberId = big.NewInt(1 << 16) - createOrderRequestCompatibleFieldPatientDetails = big.NewInt(1 << 17) - createOrderRequestCompatibleFieldPatientAddress = big.NewInt(1 << 18) + createOrderRequestCompatibleFieldClinicalNotes = big.NewInt(1 << 15) + createOrderRequestCompatibleFieldLabAccountId = big.NewInt(1 << 16) + createOrderRequestCompatibleFieldCreatorMemberId = big.NewInt(1 << 17) + createOrderRequestCompatibleFieldPatientDetails = big.NewInt(1 << 18) + createOrderRequestCompatibleFieldPatientAddress = big.NewInt(1 << 19) ) type CreateOrderRequestCompatible struct { @@ -188,10 +320,11 @@ type CreateOrderRequestCompatible struct { ActivateBy *string `json:"activate_by,omitempty" url:"-"` AoeAnswers []*AoEAnswer `json:"aoe_answers,omitempty" url:"-"` Passthrough *string `json:"passthrough,omitempty" url:"-"` + ClinicalNotes *string `json:"clinical_notes,omitempty" url:"-"` LabAccountId *string `json:"lab_account_id,omitempty" url:"-"` CreatorMemberId *string `json:"creator_member_id,omitempty" url:"-"` - PatientDetails *PatientDetailsWithValidation `json:"patient_details,omitempty" url:"-"` - PatientAddress *PatientAddressWithValidation `json:"patient_address,omitempty" url:"-"` + PatientDetails *PatientDetailsWithValidation `json:"patient_details" url:"-"` + PatientAddress *PatientAddressWithValidation `json:"patient_address" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -309,6 +442,13 @@ func (c *CreateOrderRequestCompatible) SetPassthrough(passthrough *string) { c.require(createOrderRequestCompatibleFieldPassthrough) } +// SetClinicalNotes sets the ClinicalNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *CreateOrderRequestCompatible) SetClinicalNotes(clinicalNotes *string) { + c.ClinicalNotes = clinicalNotes + c.require(createOrderRequestCompatibleFieldClinicalNotes) +} + // SetLabAccountId sets the LabAccountId field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *CreateOrderRequestCompatible) SetLabAccountId(labAccountId *string) { @@ -337,6 +477,27 @@ func (c *CreateOrderRequestCompatible) SetPatientAddress(patientAddress *Patient c.require(createOrderRequestCompatibleFieldPatientAddress) } +func (c *CreateOrderRequestCompatible) UnmarshalJSON(data []byte) error { + type unmarshaler CreateOrderRequestCompatible + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CreateOrderRequestCompatible(body) + return nil +} + +func (c *CreateOrderRequestCompatible) MarshalJSON() ([]byte, error) { + type embed CreateOrderRequestCompatible + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( labTestsGetRequestFieldGenerationMethod = big.NewInt(1 << 0) labTestsGetRequestFieldLabSlug = big.NewInt(1 << 1) @@ -571,16 +732,19 @@ func (l *LabTestsGetLabelsPdfRequest) SetCollectionDate(collectionDate time.Time var ( labTestsGetMarkersRequestFieldLabId = big.NewInt(1 << 0) - labTestsGetMarkersRequestFieldName = big.NewInt(1 << 1) - labTestsGetMarkersRequestFieldALaCarteEnabled = big.NewInt(1 << 2) - labTestsGetMarkersRequestFieldLabAccountId = big.NewInt(1 << 3) - labTestsGetMarkersRequestFieldPage = big.NewInt(1 << 4) - labTestsGetMarkersRequestFieldSize = big.NewInt(1 << 5) + labTestsGetMarkersRequestFieldLabSlug = big.NewInt(1 << 1) + labTestsGetMarkersRequestFieldName = big.NewInt(1 << 2) + labTestsGetMarkersRequestFieldALaCarteEnabled = big.NewInt(1 << 3) + labTestsGetMarkersRequestFieldLabAccountId = big.NewInt(1 << 4) + labTestsGetMarkersRequestFieldPage = big.NewInt(1 << 5) + labTestsGetMarkersRequestFieldSize = big.NewInt(1 << 6) ) type LabTestsGetMarkersRequest struct { // The identifier Vital assigned to a lab partner. LabId []*int `json:"-" url:"lab_id,omitempty"` + // The slug of the lab for these markers. If both lab_id and lab_slug are provided, lab_slug will be used. + LabSlug *string `json:"-" url:"lab_slug,omitempty"` // The name or test code of an individual biomarker or a panel. Name *string `json:"-" url:"name,omitempty"` ALaCarteEnabled *bool `json:"-" url:"a_la_carte_enabled,omitempty"` @@ -607,6 +771,13 @@ func (l *LabTestsGetMarkersRequest) SetLabId(labId []*int) { l.require(labTestsGetMarkersRequestFieldLabId) } +// SetLabSlug sets the LabSlug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestsGetMarkersRequest) SetLabSlug(labSlug *string) { + l.LabSlug = labSlug + l.require(labTestsGetMarkersRequestFieldLabSlug) +} + // SetName sets the Name field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (l *LabTestsGetMarkersRequest) SetName(name *string) { @@ -813,8 +984,9 @@ var ( labTestsGetOrdersRequestFieldPatientName = big.NewInt(1 << 13) labTestsGetOrdersRequestFieldShippingRecipientName = big.NewInt(1 << 14) labTestsGetOrdersRequestFieldOrderIds = big.NewInt(1 << 15) - labTestsGetOrdersRequestFieldPage = big.NewInt(1 << 16) - labTestsGetOrdersRequestFieldSize = big.NewInt(1 << 17) + labTestsGetOrdersRequestFieldOrderTransactionId = big.NewInt(1 << 16) + labTestsGetOrdersRequestFieldPage = big.NewInt(1 << 17) + labTestsGetOrdersRequestFieldSize = big.NewInt(1 << 18) ) type LabTestsGetOrdersRequest struct { @@ -850,8 +1022,10 @@ type LabTestsGetOrdersRequest struct { ShippingRecipientName *string `json:"-" url:"shipping_recipient_name,omitempty"` // Filter by order ids. OrderIds []*string `json:"-" url:"order_ids,omitempty"` - Page *int `json:"-" url:"page,omitempty"` - Size *int `json:"-" url:"size,omitempty"` + // Filter by order transaction ID + OrderTransactionId *string `json:"-" url:"order_transaction_id,omitempty"` + Page *int `json:"-" url:"page,omitempty"` + Size *int `json:"-" url:"size,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -976,6 +1150,13 @@ func (l *LabTestsGetOrdersRequest) SetOrderIds(orderIds []*string) { l.require(labTestsGetOrdersRequestFieldOrderIds) } +// SetOrderTransactionId sets the OrderTransactionId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestsGetOrdersRequest) SetOrderTransactionId(orderTransactionId *string) { + l.OrderTransactionId = orderTransactionId + l.require(labTestsGetOrdersRequestFieldOrderTransactionId) +} + // SetPage sets the Page field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (l *LabTestsGetOrdersRequest) SetPage(page *int) { @@ -1153,11 +1334,12 @@ func (l *LabTestsGetPhlebotomyAppointmentAvailabilityRequest) MarshalJSON() ([]b } var ( - labTestsGetPscAppointmentAvailabilityRequestFieldLab = big.NewInt(1 << 0) - labTestsGetPscAppointmentAvailabilityRequestFieldStartDate = big.NewInt(1 << 1) - labTestsGetPscAppointmentAvailabilityRequestFieldSiteCodes = big.NewInt(1 << 2) - labTestsGetPscAppointmentAvailabilityRequestFieldZipCode = big.NewInt(1 << 3) - labTestsGetPscAppointmentAvailabilityRequestFieldRadius = big.NewInt(1 << 4) + labTestsGetPscAppointmentAvailabilityRequestFieldLab = big.NewInt(1 << 0) + labTestsGetPscAppointmentAvailabilityRequestFieldStartDate = big.NewInt(1 << 1) + labTestsGetPscAppointmentAvailabilityRequestFieldSiteCodes = big.NewInt(1 << 2) + labTestsGetPscAppointmentAvailabilityRequestFieldZipCode = big.NewInt(1 << 3) + labTestsGetPscAppointmentAvailabilityRequestFieldRadius = big.NewInt(1 << 4) + labTestsGetPscAppointmentAvailabilityRequestFieldAllowStale = big.NewInt(1 << 5) ) type LabTestsGetPscAppointmentAvailabilityRequest struct { @@ -1171,6 +1353,8 @@ type LabTestsGetPscAppointmentAvailabilityRequest struct { ZipCode *string `json:"-" url:"zip_code,omitempty"` // Radius in which to search. (meters) Radius *AllowedRadius `json:"-" url:"radius,omitempty"` + // If true, allows cached availability data to be returned. + AllowStale *bool `json:"-" url:"allow_stale,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -1218,6 +1402,13 @@ func (l *LabTestsGetPscAppointmentAvailabilityRequest) SetRadius(radius *Allowed l.require(labTestsGetPscAppointmentAvailabilityRequestFieldRadius) } +// SetAllowStale sets the AllowStale field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestsGetPscAppointmentAvailabilityRequest) SetAllowStale(allowStale *bool) { + l.AllowStale = allowStale + l.require(labTestsGetPscAppointmentAvailabilityRequestFieldAllowStale) +} + var ( labTestsGetPscInfoRequestFieldZipCode = big.NewInt(1 << 0) labTestsGetPscInfoRequestFieldLabId = big.NewInt(1 << 1) @@ -1299,11 +1490,11 @@ var ( type ImportOrderBody struct { UserId string `json:"user_id" url:"-"` BillingType Billing `json:"billing_type" url:"-"` - OrderSet *OrderSetRequest `json:"order_set,omitempty" url:"-"` + OrderSet *OrderSetRequest `json:"order_set" url:"-"` CollectionMethod LabTestCollectionMethod `json:"collection_method" url:"-"` Physician *PhysicianCreateRequest `json:"physician,omitempty" url:"-"` - PatientDetails *PatientDetailsWithValidation `json:"patient_details,omitempty" url:"-"` - PatientAddress *PatientAddress `json:"patient_address,omitempty" url:"-"` + PatientDetails *PatientDetailsWithValidation `json:"patient_details" url:"-"` + PatientAddress *PatientAddress `json:"patient_address" url:"-"` SampleId string `json:"sample_id" url:"-"` LabAccountId *string `json:"lab_account_id,omitempty" url:"-"` @@ -1381,15 +1572,38 @@ func (i *ImportOrderBody) SetLabAccountId(labAccountId *string) { i.require(importOrderBodyFieldLabAccountId) } +func (i *ImportOrderBody) UnmarshalJSON(data []byte) error { + type unmarshaler ImportOrderBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *i = ImportOrderBody(body) + return nil +} + +func (i *ImportOrderBody) MarshalJSON() ([]byte, error) { + type embed ImportOrderBody + var marshaler = struct { + embed + }{ + embed: embed(*i), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, i.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( - requestAppointmentRequestFieldAddress = big.NewInt(1 << 0) - requestAppointmentRequestFieldProvider = big.NewInt(1 << 1) + requestAppointmentRequestFieldAddress = big.NewInt(1 << 0) + requestAppointmentRequestFieldProvider = big.NewInt(1 << 1) + requestAppointmentRequestFieldAppointmentNotes = big.NewInt(1 << 2) ) type RequestAppointmentRequest struct { // At-home phlebotomy appointment address. - Address *UsAddress `json:"address,omitempty" url:"-"` - Provider AppointmentProvider `json:"provider" url:"-"` + Address *UsAddress `json:"address" url:"-"` + Provider AppointmentProvider `json:"provider" url:"-"` + AppointmentNotes *string `json:"appointment_notes,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -1416,6 +1630,34 @@ func (r *RequestAppointmentRequest) SetProvider(provider AppointmentProvider) { r.require(requestAppointmentRequestFieldProvider) } +// SetAppointmentNotes sets the AppointmentNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (r *RequestAppointmentRequest) SetAppointmentNotes(appointmentNotes *string) { + r.AppointmentNotes = appointmentNotes + r.require(requestAppointmentRequestFieldAppointmentNotes) +} + +func (r *RequestAppointmentRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RequestAppointmentRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *r = RequestAppointmentRequest(body) + return nil +} + +func (r *RequestAppointmentRequest) MarshalJSON() ([]byte, error) { + type embed RequestAppointmentRequest + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( labTestsSimulateOrderProcessRequestFieldFinalStatus = big.NewInt(1 << 0) labTestsSimulateOrderProcessRequestFieldDelay = big.NewInt(1 << 1) @@ -1795,11 +2037,22 @@ func (a *AppointmentAvailabilitySlots) String() string { } var ( - appointmentBookingRequestFieldBookingKey = big.NewInt(1 << 0) + appointmentBookingRequestFieldBookingKey = big.NewInt(1 << 0) + appointmentBookingRequestFieldAppointmentNotes = big.NewInt(1 << 1) + appointmentBookingRequestFieldAsyncConfirmation = big.NewInt(1 << 2) + appointmentBookingRequestFieldSyncConfirmationTimeoutMillisecond = big.NewInt(1 << 3) + appointmentBookingRequestFieldAsyncConfirmationTimeoutMillisecond = big.NewInt(1 << 4) ) type AppointmentBookingRequest struct { - BookingKey string `json:"booking_key" url:"booking_key"` + BookingKey string `json:"booking_key" url:"booking_key"` + AppointmentNotes *string `json:"appointment_notes,omitempty" url:"appointment_notes,omitempty"` + // If true, the endpoint attempts to confirm the booking within the `sync_confirmation_timeout_millisecond` window. If confirmation is not received in time, a pending appointment is returned and booking continues asynchronously. If false (default), the endpoint waits for confirmation or returns a 500 error on failure. + AsyncConfirmation *bool `json:"async_confirmation,omitempty" url:"async_confirmation,omitempty"` + // Maximum time (in milliseconds) to wait for booking confirmation before returning a pending appointment. Only applies when `async_confirmation` is true. Defaults to 2500ms. Range: 1000-10000ms. + SyncConfirmationTimeoutMillisecond *int `json:"sync_confirmation_timeout_millisecond,omitempty" url:"sync_confirmation_timeout_millisecond,omitempty"` + // Maximum time (in milliseconds) to attempt asynchronous booking before cancelling the pending appointment. Only applies when `async_confirmation` is true. Defaults to 15 minutes. Range: 60000-172800000ms. + AsyncConfirmationTimeoutMillisecond *int `json:"async_confirmation_timeout_millisecond,omitempty" url:"async_confirmation_timeout_millisecond,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -1815,6 +2068,34 @@ func (a *AppointmentBookingRequest) GetBookingKey() string { return a.BookingKey } +func (a *AppointmentBookingRequest) GetAppointmentNotes() *string { + if a == nil { + return nil + } + return a.AppointmentNotes +} + +func (a *AppointmentBookingRequest) GetAsyncConfirmation() *bool { + if a == nil { + return nil + } + return a.AsyncConfirmation +} + +func (a *AppointmentBookingRequest) GetSyncConfirmationTimeoutMillisecond() *int { + if a == nil { + return nil + } + return a.SyncConfirmationTimeoutMillisecond +} + +func (a *AppointmentBookingRequest) GetAsyncConfirmationTimeoutMillisecond() *int { + if a == nil { + return nil + } + return a.AsyncConfirmationTimeoutMillisecond +} + func (a *AppointmentBookingRequest) GetExtraProperties() map[string]interface{} { return a.extraProperties } @@ -1833,6 +2114,34 @@ func (a *AppointmentBookingRequest) SetBookingKey(bookingKey string) { a.require(appointmentBookingRequestFieldBookingKey) } +// SetAppointmentNotes sets the AppointmentNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (a *AppointmentBookingRequest) SetAppointmentNotes(appointmentNotes *string) { + a.AppointmentNotes = appointmentNotes + a.require(appointmentBookingRequestFieldAppointmentNotes) +} + +// SetAsyncConfirmation sets the AsyncConfirmation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (a *AppointmentBookingRequest) SetAsyncConfirmation(asyncConfirmation *bool) { + a.AsyncConfirmation = asyncConfirmation + a.require(appointmentBookingRequestFieldAsyncConfirmation) +} + +// SetSyncConfirmationTimeoutMillisecond sets the SyncConfirmationTimeoutMillisecond field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (a *AppointmentBookingRequest) SetSyncConfirmationTimeoutMillisecond(syncConfirmationTimeoutMillisecond *int) { + a.SyncConfirmationTimeoutMillisecond = syncConfirmationTimeoutMillisecond + a.require(appointmentBookingRequestFieldSyncConfirmationTimeoutMillisecond) +} + +// SetAsyncConfirmationTimeoutMillisecond sets the AsyncConfirmationTimeoutMillisecond field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (a *AppointmentBookingRequest) SetAsyncConfirmationTimeoutMillisecond(asyncConfirmationTimeoutMillisecond *int) { + a.AsyncConfirmationTimeoutMillisecond = asyncConfirmationTimeoutMillisecond + a.require(appointmentBookingRequestFieldAsyncConfirmationTimeoutMillisecond) +} + func (a *AppointmentBookingRequest) UnmarshalJSON(data []byte) error { type unmarshaler AppointmentBookingRequest var value unmarshaler @@ -2072,6 +2381,7 @@ const ( AppointmentProviderGetlabs AppointmentProvider = "getlabs" AppointmentProviderPhlebfinders AppointmentProvider = "phlebfinders" AppointmentProviderQuest AppointmentProvider = "quest" + AppointmentProviderSonoraQuest AppointmentProvider = "sonora_quest" ) func NewAppointmentProviderFromString(s string) (AppointmentProvider, error) { @@ -2082,6 +2392,8 @@ func NewAppointmentProviderFromString(s string) (AppointmentProvider, error) { return AppointmentProviderPhlebfinders, nil case "quest": return AppointmentProviderQuest, nil + case "sonora_quest": + return AppointmentProviderSonoraQuest, nil } var t AppointmentProvider return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -2092,14 +2404,36 @@ func (a AppointmentProvider) Ptr() *AppointmentProvider { } // ℹ️ This enum is non-exhaustive. -type AppointmentPscLabs = string +type AppointmentPscLabs string + +const ( + AppointmentPscLabsQuest AppointmentPscLabs = "quest" + AppointmentPscLabsSonoraQuest AppointmentPscLabs = "sonora_quest" +) + +func NewAppointmentPscLabsFromString(s string) (AppointmentPscLabs, error) { + switch s { + case "quest": + return AppointmentPscLabsQuest, nil + case "sonora_quest": + return AppointmentPscLabsSonoraQuest, nil + } + var t AppointmentPscLabs + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (a AppointmentPscLabs) Ptr() *AppointmentPscLabs { + return &a +} var ( - appointmentRescheduleRequestFieldBookingKey = big.NewInt(1 << 0) + appointmentRescheduleRequestFieldBookingKey = big.NewInt(1 << 0) + appointmentRescheduleRequestFieldAppointmentNotes = big.NewInt(1 << 1) ) type AppointmentRescheduleRequest struct { - BookingKey string `json:"booking_key" url:"booking_key"` + BookingKey string `json:"booking_key" url:"booking_key"` + AppointmentNotes *string `json:"appointment_notes,omitempty" url:"appointment_notes,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -2115,6 +2449,13 @@ func (a *AppointmentRescheduleRequest) GetBookingKey() string { return a.BookingKey } +func (a *AppointmentRescheduleRequest) GetAppointmentNotes() *string { + if a == nil { + return nil + } + return a.AppointmentNotes +} + func (a *AppointmentRescheduleRequest) GetExtraProperties() map[string]interface{} { return a.extraProperties } @@ -2133,6 +2474,13 @@ func (a *AppointmentRescheduleRequest) SetBookingKey(bookingKey string) { a.require(appointmentRescheduleRequestFieldBookingKey) } +// SetAppointmentNotes sets the AppointmentNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (a *AppointmentRescheduleRequest) SetAppointmentNotes(appointmentNotes *string) { + a.AppointmentNotes = appointmentNotes + a.require(appointmentRescheduleRequestFieldAppointmentNotes) +} + func (a *AppointmentRescheduleRequest) UnmarshalJSON(data []byte) error { type unmarshaler AppointmentRescheduleRequest var value unmarshaler @@ -2363,49 +2711,50 @@ func (a *AreaInfo) String() string { return fmt.Sprintf("%#v", a) } -// Represent the schema for an individual biomarker result. var ( - biomarkerResultFieldName = big.NewInt(1 << 0) - biomarkerResultFieldSlug = big.NewInt(1 << 1) - biomarkerResultFieldResult = big.NewInt(1 << 2) - biomarkerResultFieldType = big.NewInt(1 << 3) - biomarkerResultFieldUnit = big.NewInt(1 << 4) - biomarkerResultFieldTimestamp = big.NewInt(1 << 5) - biomarkerResultFieldNotes = big.NewInt(1 << 6) - biomarkerResultFieldReferenceRange = big.NewInt(1 << 7) - biomarkerResultFieldMinRangeValue = big.NewInt(1 << 8) - biomarkerResultFieldMaxRangeValue = big.NewInt(1 << 9) - biomarkerResultFieldIsAboveMaxRange = big.NewInt(1 << 10) - biomarkerResultFieldIsBelowMinRange = big.NewInt(1 << 11) - biomarkerResultFieldInterpretation = big.NewInt(1 << 12) - biomarkerResultFieldLoinc = big.NewInt(1 << 13) - biomarkerResultFieldLoincSlug = big.NewInt(1 << 14) - biomarkerResultFieldProviderId = big.NewInt(1 << 15) - biomarkerResultFieldSourceMarkers = big.NewInt(1 << 16) - biomarkerResultFieldPerformingLaboratory = big.NewInt(1 << 17) - biomarkerResultFieldSourceSampleId = big.NewInt(1 << 18) + clientFacingAppointmentFieldId = big.NewInt(1 << 0) + clientFacingAppointmentFieldUserId = big.NewInt(1 << 1) + clientFacingAppointmentFieldOrderId = big.NewInt(1 << 2) + clientFacingAppointmentFieldOrderTransactionId = big.NewInt(1 << 3) + clientFacingAppointmentFieldAddress = big.NewInt(1 << 4) + clientFacingAppointmentFieldLocation = big.NewInt(1 << 5) + clientFacingAppointmentFieldStartAt = big.NewInt(1 << 6) + clientFacingAppointmentFieldEndAt = big.NewInt(1 << 7) + clientFacingAppointmentFieldIanaTimezone = big.NewInt(1 << 8) + clientFacingAppointmentFieldType = big.NewInt(1 << 9) + clientFacingAppointmentFieldProvider = big.NewInt(1 << 10) + clientFacingAppointmentFieldStatus = big.NewInt(1 << 11) + clientFacingAppointmentFieldProviderId = big.NewInt(1 << 12) + clientFacingAppointmentFieldExternalId = big.NewInt(1 << 13) + clientFacingAppointmentFieldCanReschedule = big.NewInt(1 << 14) + clientFacingAppointmentFieldAppointmentNotes = big.NewInt(1 << 15) + clientFacingAppointmentFieldEventStatus = big.NewInt(1 << 16) + clientFacingAppointmentFieldEventData = big.NewInt(1 << 17) + clientFacingAppointmentFieldEvents = big.NewInt(1 << 18) ) -type BiomarkerResult struct { - Name string `json:"name" url:"name"` - Slug *string `json:"slug,omitempty" url:"slug,omitempty"` - Result string `json:"result" url:"result"` - Type ResultType `json:"type" url:"type"` - Unit *string `json:"unit,omitempty" url:"unit,omitempty"` - Timestamp *time.Time `json:"timestamp,omitempty" url:"timestamp,omitempty"` - Notes *string `json:"notes,omitempty" url:"notes,omitempty"` - ReferenceRange *string `json:"reference_range,omitempty" url:"reference_range,omitempty"` - MinRangeValue *float64 `json:"min_range_value,omitempty" url:"min_range_value,omitempty"` - MaxRangeValue *float64 `json:"max_range_value,omitempty" url:"max_range_value,omitempty"` - IsAboveMaxRange *bool `json:"is_above_max_range,omitempty" url:"is_above_max_range,omitempty"` - IsBelowMinRange *bool `json:"is_below_min_range,omitempty" url:"is_below_min_range,omitempty"` - Interpretation *string `json:"interpretation,omitempty" url:"interpretation,omitempty"` - Loinc *string `json:"loinc,omitempty" url:"loinc,omitempty"` - LoincSlug *string `json:"loinc_slug,omitempty" url:"loinc_slug,omitempty"` - ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` - SourceMarkers []*ParentBiomarkerData `json:"source_markers,omitempty" url:"source_markers,omitempty"` - PerformingLaboratory *string `json:"performing_laboratory,omitempty" url:"performing_laboratory,omitempty"` - SourceSampleId *string `json:"source_sample_id,omitempty" url:"source_sample_id,omitempty"` +type ClientFacingAppointment struct { + Id string `json:"id" url:"id"` + UserId string `json:"user_id" url:"user_id"` + OrderId string `json:"order_id" url:"order_id"` + OrderTransactionId *string `json:"order_transaction_id,omitempty" url:"order_transaction_id,omitempty"` + Address *UsAddress `json:"address" url:"address"` + Location *LngLat `json:"location" url:"location"` + // Time is in UTC + StartAt *time.Time `json:"start_at,omitempty" url:"start_at,omitempty"` + // Time is in UTC + EndAt *time.Time `json:"end_at,omitempty" url:"end_at,omitempty"` + IanaTimezone *string `json:"iana_timezone,omitempty" url:"iana_timezone,omitempty"` + Type AppointmentType `json:"type" url:"type"` + Provider AppointmentProvider `json:"provider" url:"provider"` + Status AppointmentStatus `json:"status" url:"status"` + ProviderId string `json:"provider_id" url:"provider_id"` + ExternalId *string `json:"external_id,omitempty" url:"external_id,omitempty"` + CanReschedule bool `json:"can_reschedule" url:"can_reschedule"` + AppointmentNotes *string `json:"appointment_notes,omitempty" url:"appointment_notes,omitempty"` + EventStatus AppointmentEventStatus `json:"event_status" url:"event_status"` + EventData map[string]interface{} `json:"event_data,omitempty" url:"event_data,omitempty"` + Events []*ClientFacingAppointmentEvent `json:"events" url:"events"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -2414,474 +2763,116 @@ type BiomarkerResult struct { rawJSON json.RawMessage } -func (b *BiomarkerResult) GetName() string { - if b == nil { +func (c *ClientFacingAppointment) GetId() string { + if c == nil { return "" } - return b.Name -} - -func (b *BiomarkerResult) GetSlug() *string { - if b == nil { - return nil - } - return b.Slug + return c.Id } -func (b *BiomarkerResult) GetResult() string { - if b == nil { +func (c *ClientFacingAppointment) GetUserId() string { + if c == nil { return "" } - return b.Result + return c.UserId } -func (b *BiomarkerResult) GetType() ResultType { - if b == nil { +func (c *ClientFacingAppointment) GetOrderId() string { + if c == nil { return "" } - return b.Type + return c.OrderId } -func (b *BiomarkerResult) GetUnit() *string { - if b == nil { +func (c *ClientFacingAppointment) GetOrderTransactionId() *string { + if c == nil { return nil } - return b.Unit + return c.OrderTransactionId } -func (b *BiomarkerResult) GetTimestamp() *time.Time { - if b == nil { +func (c *ClientFacingAppointment) GetAddress() *UsAddress { + if c == nil { return nil } - return b.Timestamp + return c.Address } -func (b *BiomarkerResult) GetNotes() *string { - if b == nil { +func (c *ClientFacingAppointment) GetLocation() *LngLat { + if c == nil { return nil } - return b.Notes + return c.Location } -func (b *BiomarkerResult) GetReferenceRange() *string { - if b == nil { +func (c *ClientFacingAppointment) GetStartAt() *time.Time { + if c == nil { return nil } - return b.ReferenceRange + return c.StartAt } -func (b *BiomarkerResult) GetMinRangeValue() *float64 { - if b == nil { +func (c *ClientFacingAppointment) GetEndAt() *time.Time { + if c == nil { return nil } - return b.MinRangeValue + return c.EndAt } -func (b *BiomarkerResult) GetMaxRangeValue() *float64 { - if b == nil { +func (c *ClientFacingAppointment) GetIanaTimezone() *string { + if c == nil { return nil } - return b.MaxRangeValue + return c.IanaTimezone } -func (b *BiomarkerResult) GetIsAboveMaxRange() *bool { - if b == nil { - return nil +func (c *ClientFacingAppointment) GetType() AppointmentType { + if c == nil { + return "" } - return b.IsAboveMaxRange + return c.Type } -func (b *BiomarkerResult) GetIsBelowMinRange() *bool { - if b == nil { - return nil +func (c *ClientFacingAppointment) GetProvider() AppointmentProvider { + if c == nil { + return "" } - return b.IsBelowMinRange + return c.Provider } -func (b *BiomarkerResult) GetInterpretation() *string { - if b == nil { - return nil +func (c *ClientFacingAppointment) GetStatus() AppointmentStatus { + if c == nil { + return "" } - return b.Interpretation + return c.Status } -func (b *BiomarkerResult) GetLoinc() *string { - if b == nil { - return nil +func (c *ClientFacingAppointment) GetProviderId() string { + if c == nil { + return "" } - return b.Loinc + return c.ProviderId } -func (b *BiomarkerResult) GetLoincSlug() *string { - if b == nil { +func (c *ClientFacingAppointment) GetExternalId() *string { + if c == nil { return nil } - return b.LoincSlug + return c.ExternalId } -func (b *BiomarkerResult) GetProviderId() *string { - if b == nil { - return nil - } - return b.ProviderId -} - -func (b *BiomarkerResult) GetSourceMarkers() []*ParentBiomarkerData { - if b == nil { - return nil - } - return b.SourceMarkers -} - -func (b *BiomarkerResult) GetPerformingLaboratory() *string { - if b == nil { - return nil - } - return b.PerformingLaboratory -} - -func (b *BiomarkerResult) GetSourceSampleId() *string { - if b == nil { - return nil - } - return b.SourceSampleId -} - -func (b *BiomarkerResult) GetExtraProperties() map[string]interface{} { - return b.extraProperties -} - -func (b *BiomarkerResult) require(field *big.Int) { - if b.explicitFields == nil { - b.explicitFields = big.NewInt(0) - } - b.explicitFields.Or(b.explicitFields, field) -} - -// SetName sets the Name field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetName(name string) { - b.Name = name - b.require(biomarkerResultFieldName) -} - -// SetSlug sets the Slug field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetSlug(slug *string) { - b.Slug = slug - b.require(biomarkerResultFieldSlug) -} - -// SetResult sets the Result field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetResult(result string) { - b.Result = result - b.require(biomarkerResultFieldResult) -} - -// SetType sets the Type field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetType(type_ ResultType) { - b.Type = type_ - b.require(biomarkerResultFieldType) -} - -// SetUnit sets the Unit field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetUnit(unit *string) { - b.Unit = unit - b.require(biomarkerResultFieldUnit) -} - -// SetTimestamp sets the Timestamp field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetTimestamp(timestamp *time.Time) { - b.Timestamp = timestamp - b.require(biomarkerResultFieldTimestamp) -} - -// SetNotes sets the Notes field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetNotes(notes *string) { - b.Notes = notes - b.require(biomarkerResultFieldNotes) -} - -// SetReferenceRange sets the ReferenceRange field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetReferenceRange(referenceRange *string) { - b.ReferenceRange = referenceRange - b.require(biomarkerResultFieldReferenceRange) -} - -// SetMinRangeValue sets the MinRangeValue field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetMinRangeValue(minRangeValue *float64) { - b.MinRangeValue = minRangeValue - b.require(biomarkerResultFieldMinRangeValue) -} - -// SetMaxRangeValue sets the MaxRangeValue field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetMaxRangeValue(maxRangeValue *float64) { - b.MaxRangeValue = maxRangeValue - b.require(biomarkerResultFieldMaxRangeValue) -} - -// SetIsAboveMaxRange sets the IsAboveMaxRange field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetIsAboveMaxRange(isAboveMaxRange *bool) { - b.IsAboveMaxRange = isAboveMaxRange - b.require(biomarkerResultFieldIsAboveMaxRange) -} - -// SetIsBelowMinRange sets the IsBelowMinRange field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetIsBelowMinRange(isBelowMinRange *bool) { - b.IsBelowMinRange = isBelowMinRange - b.require(biomarkerResultFieldIsBelowMinRange) -} - -// SetInterpretation sets the Interpretation field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetInterpretation(interpretation *string) { - b.Interpretation = interpretation - b.require(biomarkerResultFieldInterpretation) -} - -// SetLoinc sets the Loinc field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetLoinc(loinc *string) { - b.Loinc = loinc - b.require(biomarkerResultFieldLoinc) -} - -// SetLoincSlug sets the LoincSlug field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetLoincSlug(loincSlug *string) { - b.LoincSlug = loincSlug - b.require(biomarkerResultFieldLoincSlug) -} - -// SetProviderId sets the ProviderId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetProviderId(providerId *string) { - b.ProviderId = providerId - b.require(biomarkerResultFieldProviderId) -} - -// SetSourceMarkers sets the SourceMarkers field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetSourceMarkers(sourceMarkers []*ParentBiomarkerData) { - b.SourceMarkers = sourceMarkers - b.require(biomarkerResultFieldSourceMarkers) -} - -// SetPerformingLaboratory sets the PerformingLaboratory field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetPerformingLaboratory(performingLaboratory *string) { - b.PerformingLaboratory = performingLaboratory - b.require(biomarkerResultFieldPerformingLaboratory) -} - -// SetSourceSampleId sets the SourceSampleId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (b *BiomarkerResult) SetSourceSampleId(sourceSampleId *string) { - b.SourceSampleId = sourceSampleId - b.require(biomarkerResultFieldSourceSampleId) -} - -func (b *BiomarkerResult) UnmarshalJSON(data []byte) error { - type embed BiomarkerResult - var unmarshaler = struct { - embed - Timestamp *internal.DateTime `json:"timestamp,omitempty"` - }{ - embed: embed(*b), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *b = BiomarkerResult(unmarshaler.embed) - b.Timestamp = unmarshaler.Timestamp.TimePtr() - extraProperties, err := internal.ExtractExtraProperties(data, *b) - if err != nil { - return err - } - b.extraProperties = extraProperties - b.rawJSON = json.RawMessage(data) - return nil -} - -func (b *BiomarkerResult) MarshalJSON() ([]byte, error) { - type embed BiomarkerResult - var marshaler = struct { - embed - Timestamp *internal.DateTime `json:"timestamp,omitempty"` - }{ - embed: embed(*b), - Timestamp: internal.NewOptionalDateTime(b.Timestamp), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (b *BiomarkerResult) String() string { - if len(b.rawJSON) > 0 { - if value, err := internal.StringifyJSON(b.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(b); err == nil { - return value - } - return fmt.Sprintf("%#v", b) -} - -var ( - clientFacingAppointmentFieldId = big.NewInt(1 << 0) - clientFacingAppointmentFieldUserId = big.NewInt(1 << 1) - clientFacingAppointmentFieldOrderId = big.NewInt(1 << 2) - clientFacingAppointmentFieldAddress = big.NewInt(1 << 3) - clientFacingAppointmentFieldLocation = big.NewInt(1 << 4) - clientFacingAppointmentFieldStartAt = big.NewInt(1 << 5) - clientFacingAppointmentFieldEndAt = big.NewInt(1 << 6) - clientFacingAppointmentFieldIanaTimezone = big.NewInt(1 << 7) - clientFacingAppointmentFieldType = big.NewInt(1 << 8) - clientFacingAppointmentFieldProvider = big.NewInt(1 << 9) - clientFacingAppointmentFieldStatus = big.NewInt(1 << 10) - clientFacingAppointmentFieldProviderId = big.NewInt(1 << 11) - clientFacingAppointmentFieldExternalId = big.NewInt(1 << 12) - clientFacingAppointmentFieldCanReschedule = big.NewInt(1 << 13) - clientFacingAppointmentFieldEventStatus = big.NewInt(1 << 14) - clientFacingAppointmentFieldEventData = big.NewInt(1 << 15) - clientFacingAppointmentFieldEvents = big.NewInt(1 << 16) -) - -type ClientFacingAppointment struct { - Id string `json:"id" url:"id"` - UserId string `json:"user_id" url:"user_id"` - OrderId string `json:"order_id" url:"order_id"` - Address *UsAddress `json:"address" url:"address"` - Location *LngLat `json:"location" url:"location"` - // Time is in UTC - StartAt *time.Time `json:"start_at,omitempty" url:"start_at,omitempty"` - // Time is in UTC - EndAt *time.Time `json:"end_at,omitempty" url:"end_at,omitempty"` - IanaTimezone *string `json:"iana_timezone,omitempty" url:"iana_timezone,omitempty"` - Type AppointmentType `json:"type" url:"type"` - Provider AppointmentProvider `json:"provider" url:"provider"` - Status AppointmentStatus `json:"status" url:"status"` - ProviderId string `json:"provider_id" url:"provider_id"` - ExternalId *string `json:"external_id,omitempty" url:"external_id,omitempty"` - CanReschedule bool `json:"can_reschedule" url:"can_reschedule"` - EventStatus AppointmentEventStatus `json:"event_status" url:"event_status"` - EventData map[string]interface{} `json:"event_data,omitempty" url:"event_data,omitempty"` - Events []*ClientFacingAppointmentEvent `json:"events" url:"events"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (c *ClientFacingAppointment) GetId() string { - if c == nil { - return "" - } - return c.Id -} - -func (c *ClientFacingAppointment) GetUserId() string { - if c == nil { - return "" - } - return c.UserId -} - -func (c *ClientFacingAppointment) GetOrderId() string { - if c == nil { - return "" - } - return c.OrderId -} - -func (c *ClientFacingAppointment) GetAddress() *UsAddress { - if c == nil { - return nil - } - return c.Address -} - -func (c *ClientFacingAppointment) GetLocation() *LngLat { - if c == nil { - return nil - } - return c.Location -} - -func (c *ClientFacingAppointment) GetStartAt() *time.Time { - if c == nil { - return nil - } - return c.StartAt -} - -func (c *ClientFacingAppointment) GetEndAt() *time.Time { - if c == nil { - return nil - } - return c.EndAt -} - -func (c *ClientFacingAppointment) GetIanaTimezone() *string { - if c == nil { - return nil - } - return c.IanaTimezone -} - -func (c *ClientFacingAppointment) GetType() AppointmentType { - if c == nil { - return "" - } - return c.Type -} - -func (c *ClientFacingAppointment) GetProvider() AppointmentProvider { - if c == nil { - return "" - } - return c.Provider -} - -func (c *ClientFacingAppointment) GetStatus() AppointmentStatus { - if c == nil { - return "" - } - return c.Status -} - -func (c *ClientFacingAppointment) GetProviderId() string { +func (c *ClientFacingAppointment) GetCanReschedule() bool { if c == nil { - return "" + return false } - return c.ProviderId + return c.CanReschedule } -func (c *ClientFacingAppointment) GetExternalId() *string { +func (c *ClientFacingAppointment) GetAppointmentNotes() *string { if c == nil { return nil } - return c.ExternalId -} - -func (c *ClientFacingAppointment) GetCanReschedule() bool { - if c == nil { - return false - } - return c.CanReschedule + return c.AppointmentNotes } func (c *ClientFacingAppointment) GetEventStatus() AppointmentEventStatus { @@ -2937,6 +2928,13 @@ func (c *ClientFacingAppointment) SetOrderId(orderId string) { c.require(clientFacingAppointmentFieldOrderId) } +// SetOrderTransactionId sets the OrderTransactionId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingAppointment) SetOrderTransactionId(orderTransactionId *string) { + c.OrderTransactionId = orderTransactionId + c.require(clientFacingAppointmentFieldOrderTransactionId) +} + // SetAddress sets the Address field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *ClientFacingAppointment) SetAddress(address *UsAddress) { @@ -3014,6 +3012,13 @@ func (c *ClientFacingAppointment) SetCanReschedule(canReschedule bool) { c.require(clientFacingAppointmentFieldCanReschedule) } +// SetAppointmentNotes sets the AppointmentNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingAppointment) SetAppointmentNotes(appointmentNotes *string) { + c.AppointmentNotes = appointmentNotes + c.require(clientFacingAppointmentFieldAppointmentNotes) +} + // SetEventStatus sets the EventStatus field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *ClientFacingAppointment) SetEventStatus(eventStatus AppointmentEventStatus) { @@ -3479,6 +3484,7 @@ const ( ClientFacingLabsQuest ClientFacingLabs = "quest" ClientFacingLabsLabcorp ClientFacingLabs = "labcorp" ClientFacingLabsBioreference ClientFacingLabs = "bioreference" + ClientFacingLabsSonoraQuest ClientFacingLabs = "sonora_quest" ) func NewClientFacingLabsFromString(s string) (ClientFacingLabs, error) { @@ -3489,6 +3495,8 @@ func NewClientFacingLabsFromString(s string) (ClientFacingLabs, error) { return ClientFacingLabsLabcorp, nil case "bioreference": return ClientFacingLabsBioreference, nil + case "sonora_quest": + return ClientFacingLabsSonoraQuest, nil } var t ClientFacingLabs return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -4117,17 +4125,15 @@ func (c *ClientFacingResult) String() string { } var ( - clinicalInformationFieldFasting = big.NewInt(1 << 0) - clinicalInformationFieldNotes = big.NewInt(1 << 1) - clinicalInformationFieldInformation = big.NewInt(1 << 2) - clinicalInformationFieldTotalVolume = big.NewInt(1 << 3) + daySlotsFieldLocation = big.NewInt(1 << 0) + daySlotsFieldDate = big.NewInt(1 << 1) + daySlotsFieldSlots = big.NewInt(1 << 2) ) -type ClinicalInformation struct { - Fasting *bool `json:"fasting,omitempty" url:"fasting,omitempty"` - Notes *string `json:"notes,omitempty" url:"notes,omitempty"` - Information *string `json:"information,omitempty" url:"information,omitempty"` - TotalVolume *string `json:"total_volume,omitempty" url:"total_volume,omitempty"` +type DaySlots struct { + Location *AppointmentLocation `json:"location,omitempty" url:"location,omitempty"` + Date string `json:"date" url:"date"` + Slots []*TimeSlot `json:"slots" url:"slots"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -4136,153 +4142,29 @@ type ClinicalInformation struct { rawJSON json.RawMessage } -func (c *ClinicalInformation) GetFasting() *bool { - if c == nil { - return nil - } - return c.Fasting -} - -func (c *ClinicalInformation) GetNotes() *string { - if c == nil { +func (d *DaySlots) GetLocation() *AppointmentLocation { + if d == nil { return nil } - return c.Notes + return d.Location } -func (c *ClinicalInformation) GetInformation() *string { - if c == nil { - return nil +func (d *DaySlots) GetDate() string { + if d == nil { + return "" } - return c.Information + return d.Date } -func (c *ClinicalInformation) GetTotalVolume() *string { - if c == nil { +func (d *DaySlots) GetSlots() []*TimeSlot { + if d == nil { return nil } - return c.TotalVolume + return d.Slots } -func (c *ClinicalInformation) GetExtraProperties() map[string]interface{} { - return c.extraProperties -} - -func (c *ClinicalInformation) require(field *big.Int) { - if c.explicitFields == nil { - c.explicitFields = big.NewInt(0) - } - c.explicitFields.Or(c.explicitFields, field) -} - -// SetFasting sets the Fasting field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClinicalInformation) SetFasting(fasting *bool) { - c.Fasting = fasting - c.require(clinicalInformationFieldFasting) -} - -// SetNotes sets the Notes field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClinicalInformation) SetNotes(notes *string) { - c.Notes = notes - c.require(clinicalInformationFieldNotes) -} - -// SetInformation sets the Information field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClinicalInformation) SetInformation(information *string) { - c.Information = information - c.require(clinicalInformationFieldInformation) -} - -// SetTotalVolume sets the TotalVolume field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClinicalInformation) SetTotalVolume(totalVolume *string) { - c.TotalVolume = totalVolume - c.require(clinicalInformationFieldTotalVolume) -} - -func (c *ClinicalInformation) UnmarshalJSON(data []byte) error { - type unmarshaler ClinicalInformation - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *c = ClinicalInformation(value) - extraProperties, err := internal.ExtractExtraProperties(data, *c) - if err != nil { - return err - } - c.extraProperties = extraProperties - c.rawJSON = json.RawMessage(data) - return nil -} - -func (c *ClinicalInformation) MarshalJSON() ([]byte, error) { - type embed ClinicalInformation - var marshaler = struct { - embed - }{ - embed: embed(*c), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (c *ClinicalInformation) String() string { - if len(c.rawJSON) > 0 { - if value, err := internal.StringifyJSON(c.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(c); err == nil { - return value - } - return fmt.Sprintf("%#v", c) -} - -var ( - daySlotsFieldLocation = big.NewInt(1 << 0) - daySlotsFieldDate = big.NewInt(1 << 1) - daySlotsFieldSlots = big.NewInt(1 << 2) -) - -type DaySlots struct { - Location *AppointmentLocation `json:"location,omitempty" url:"location,omitempty"` - Date string `json:"date" url:"date"` - Slots []*TimeSlot `json:"slots" url:"slots"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (d *DaySlots) GetLocation() *AppointmentLocation { - if d == nil { - return nil - } - return d.Location -} - -func (d *DaySlots) GetDate() string { - if d == nil { - return "" - } - return d.Date -} - -func (d *DaySlots) GetSlots() []*TimeSlot { - if d == nil { - return nil - } - return d.Slots -} - -func (d *DaySlots) GetExtraProperties() map[string]interface{} { - return d.extraProperties +func (d *DaySlots) GetExtraProperties() map[string]interface{} { + return d.extraProperties } func (d *DaySlots) require(field *big.Int) { @@ -4352,56 +4234,6 @@ func (d *DaySlots) String() string { return fmt.Sprintf("%#v", d) } -// ℹ️ This enum is non-exhaustive. -type FailureType string - -const ( - FailureTypeQuantityNotSufficientFailure FailureType = "quantity_not_sufficient_failure" - FailureTypeCollectionProcessFailure FailureType = "collection_process_failure" - FailureTypeDropOffFailure FailureType = "drop_off_failure" - FailureTypeInternalLabFailure FailureType = "internal_lab_failure" - FailureTypeOrderEntryFailure FailureType = "order_entry_failure" - FailureTypeNonFailure FailureType = "non_failure" - FailureTypeUnknownFailure FailureType = "unknown_failure" - FailureTypePatientConditionFailure FailureType = "patient_condition_failure" - FailureTypeMissingResultCalcFailure FailureType = "missing_result_calc_failure" - FailureTypeMissingDemoAoeCalcFailure FailureType = "missing_demo_aoe_calc_failure" - FailureTypeInsufficientVolume FailureType = "insufficient_volume" -) - -func NewFailureTypeFromString(s string) (FailureType, error) { - switch s { - case "quantity_not_sufficient_failure": - return FailureTypeQuantityNotSufficientFailure, nil - case "collection_process_failure": - return FailureTypeCollectionProcessFailure, nil - case "drop_off_failure": - return FailureTypeDropOffFailure, nil - case "internal_lab_failure": - return FailureTypeInternalLabFailure, nil - case "order_entry_failure": - return FailureTypeOrderEntryFailure, nil - case "non_failure": - return FailureTypeNonFailure, nil - case "unknown_failure": - return FailureTypeUnknownFailure, nil - case "patient_condition_failure": - return FailureTypePatientConditionFailure, nil - case "missing_result_calc_failure": - return FailureTypeMissingResultCalcFailure, nil - case "missing_demo_aoe_calc_failure": - return FailureTypeMissingDemoAoeCalcFailure, nil - case "insufficient_volume": - return FailureTypeInsufficientVolume, nil - } - var t FailureType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (f FailureType) Ptr() *FailureType { - return &f -} - var ( getMarkersResponseFieldMarkers = big.NewInt(1 << 0) getMarkersResponseFieldTotal = big.NewInt(1 << 1) @@ -5122,38 +4954,41 @@ func (l *LabLocationMetadata) String() string { return fmt.Sprintf("%#v", l) } +// ℹ️ This enum is non-exhaustive. +type LabTestGenerationMethodFilter string + +const ( + LabTestGenerationMethodFilterAuto LabTestGenerationMethodFilter = "auto" + LabTestGenerationMethodFilterManual LabTestGenerationMethodFilter = "manual" + LabTestGenerationMethodFilterAll LabTestGenerationMethodFilter = "all" +) + +func NewLabTestGenerationMethodFilterFromString(s string) (LabTestGenerationMethodFilter, error) { + switch s { + case "auto": + return LabTestGenerationMethodFilterAuto, nil + case "manual": + return LabTestGenerationMethodFilterManual, nil + case "all": + return LabTestGenerationMethodFilterAll, nil + } + var t LabTestGenerationMethodFilter + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LabTestGenerationMethodFilter) Ptr() *LabTestGenerationMethodFilter { + return &l +} + var ( - labResultsMetadataFieldAge = big.NewInt(1 << 0) - labResultsMetadataFieldDob = big.NewInt(1 << 1) - labResultsMetadataFieldClia = big.NewInt(1 << 2) - labResultsMetadataFieldPatient = big.NewInt(1 << 3) - labResultsMetadataFieldProvider = big.NewInt(1 << 4) - labResultsMetadataFieldLaboratory = big.NewInt(1 << 5) - labResultsMetadataFieldDateReported = big.NewInt(1 << 6) - labResultsMetadataFieldDateCollected = big.NewInt(1 << 7) - labResultsMetadataFieldSpecimenNumber = big.NewInt(1 << 8) - labResultsMetadataFieldDateReceived = big.NewInt(1 << 9) - labResultsMetadataFieldStatus = big.NewInt(1 << 10) - labResultsMetadataFieldInterpretation = big.NewInt(1 << 11) - labResultsMetadataFieldPatientId = big.NewInt(1 << 12) - labResultsMetadataFieldAccountId = big.NewInt(1 << 13) + labTestResourcesResponseFieldData = big.NewInt(1 << 0) + labTestResourcesResponseFieldNextCursor = big.NewInt(1 << 1) ) -type LabResultsMetadata struct { - Age string `json:"age" url:"age"` - Dob string `json:"dob" url:"dob"` - Clia *string `json:"clia_#,omitempty" url:"clia_#,omitempty"` - Patient string `json:"patient" url:"patient"` - Provider *string `json:"provider,omitempty" url:"provider,omitempty"` - Laboratory *string `json:"laboratory,omitempty" url:"laboratory,omitempty"` - DateReported string `json:"date_reported" url:"date_reported"` - DateCollected *string `json:"date_collected,omitempty" url:"date_collected,omitempty"` - SpecimenNumber string `json:"specimen_number" url:"specimen_number"` - DateReceived *string `json:"date_received,omitempty" url:"date_received,omitempty"` - Status *string `json:"status,omitempty" url:"status,omitempty"` - Interpretation *string `json:"interpretation,omitempty" url:"interpretation,omitempty"` - PatientId *string `json:"patient_id,omitempty" url:"patient_id,omitempty"` - AccountId *string `json:"account_id,omitempty" url:"account_id,omitempty"` +type LabTestResourcesResponse struct { + Data []*ClientFacingLabTest `json:"data" url:"data"` + // The cursor for fetching the next page, or `null` to fetch the first page. + NextCursor *string `json:"next_cursor,omitempty" url:"next_cursor,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -5162,843 +4997,176 @@ type LabResultsMetadata struct { rawJSON json.RawMessage } -func (l *LabResultsMetadata) GetAge() string { - if l == nil { - return "" - } - return l.Age -} - -func (l *LabResultsMetadata) GetDob() string { +func (l *LabTestResourcesResponse) GetData() []*ClientFacingLabTest { if l == nil { - return "" + return nil } - return l.Dob + return l.Data } -func (l *LabResultsMetadata) GetClia() *string { +func (l *LabTestResourcesResponse) GetNextCursor() *string { if l == nil { return nil } - return l.Clia + return l.NextCursor } -func (l *LabResultsMetadata) GetPatient() string { - if l == nil { - return "" - } - return l.Patient +func (l *LabTestResourcesResponse) GetExtraProperties() map[string]interface{} { + return l.extraProperties } -func (l *LabResultsMetadata) GetProvider() *string { - if l == nil { - return nil +func (l *LabTestResourcesResponse) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) } - return l.Provider + l.explicitFields.Or(l.explicitFields, field) } -func (l *LabResultsMetadata) GetLaboratory() *string { - if l == nil { - return nil - } - return l.Laboratory +// SetData sets the Data field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestResourcesResponse) SetData(data []*ClientFacingLabTest) { + l.Data = data + l.require(labTestResourcesResponseFieldData) } -func (l *LabResultsMetadata) GetDateReported() string { - if l == nil { - return "" - } - return l.DateReported +// SetNextCursor sets the NextCursor field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabTestResourcesResponse) SetNextCursor(nextCursor *string) { + l.NextCursor = nextCursor + l.require(labTestResourcesResponseFieldNextCursor) } -func (l *LabResultsMetadata) GetDateCollected() *string { - if l == nil { - return nil +func (l *LabTestResourcesResponse) UnmarshalJSON(data []byte) error { + type unmarshaler LabTestResourcesResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - return l.DateCollected -} - -func (l *LabResultsMetadata) GetSpecimenNumber() string { - if l == nil { - return "" + *l = LabTestResourcesResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err } - return l.SpecimenNumber + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil } -func (l *LabResultsMetadata) GetDateReceived() *string { - if l == nil { - return nil +func (l *LabTestResourcesResponse) MarshalJSON() ([]byte, error) { + type embed LabTestResourcesResponse + var marshaler = struct { + embed + }{ + embed: embed(*l), } - return l.DateReceived + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) } -func (l *LabResultsMetadata) GetStatus() *string { - if l == nil { - return nil +func (l *LabTestResourcesResponse) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } } - return l.Status + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } -func (l *LabResultsMetadata) GetInterpretation() *string { - if l == nil { - return nil - } - return l.Interpretation +var ( + lngLatFieldLng = big.NewInt(1 << 0) + lngLatFieldLat = big.NewInt(1 << 1) +) + +type LngLat struct { + Lng float64 `json:"lng" url:"lng"` + Lat float64 `json:"lat" url:"lat"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (l *LabResultsMetadata) GetPatientId() *string { +func (l *LngLat) GetLng() float64 { if l == nil { - return nil + return 0 } - return l.PatientId + return l.Lng } -func (l *LabResultsMetadata) GetAccountId() *string { +func (l *LngLat) GetLat() float64 { if l == nil { - return nil + return 0 } - return l.AccountId + return l.Lat } -func (l *LabResultsMetadata) GetExtraProperties() map[string]interface{} { +func (l *LngLat) GetExtraProperties() map[string]interface{} { return l.extraProperties } -func (l *LabResultsMetadata) require(field *big.Int) { +func (l *LngLat) require(field *big.Int) { if l.explicitFields == nil { l.explicitFields = big.NewInt(0) } l.explicitFields.Or(l.explicitFields, field) } -// SetAge sets the Age field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetAge(age string) { - l.Age = age - l.require(labResultsMetadataFieldAge) -} - -// SetDob sets the Dob field and marks it as non-optional; +// SetLng sets the Lng field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetDob(dob string) { - l.Dob = dob - l.require(labResultsMetadataFieldDob) +func (l *LngLat) SetLng(lng float64) { + l.Lng = lng + l.require(lngLatFieldLng) } -// SetClia sets the Clia field and marks it as non-optional; +// SetLat sets the Lat field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetClia(clia *string) { - l.Clia = clia - l.require(labResultsMetadataFieldClia) +func (l *LngLat) SetLat(lat float64) { + l.Lat = lat + l.require(lngLatFieldLat) } -// SetPatient sets the Patient field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetPatient(patient string) { - l.Patient = patient - l.require(labResultsMetadataFieldPatient) -} - -// SetProvider sets the Provider field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetProvider(provider *string) { - l.Provider = provider - l.require(labResultsMetadataFieldProvider) -} - -// SetLaboratory sets the Laboratory field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetLaboratory(laboratory *string) { - l.Laboratory = laboratory - l.require(labResultsMetadataFieldLaboratory) -} - -// SetDateReported sets the DateReported field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetDateReported(dateReported string) { - l.DateReported = dateReported - l.require(labResultsMetadataFieldDateReported) -} - -// SetDateCollected sets the DateCollected field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetDateCollected(dateCollected *string) { - l.DateCollected = dateCollected - l.require(labResultsMetadataFieldDateCollected) -} - -// SetSpecimenNumber sets the SpecimenNumber field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetSpecimenNumber(specimenNumber string) { - l.SpecimenNumber = specimenNumber - l.require(labResultsMetadataFieldSpecimenNumber) -} - -// SetDateReceived sets the DateReceived field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetDateReceived(dateReceived *string) { - l.DateReceived = dateReceived - l.require(labResultsMetadataFieldDateReceived) -} - -// SetStatus sets the Status field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetStatus(status *string) { - l.Status = status - l.require(labResultsMetadataFieldStatus) -} - -// SetInterpretation sets the Interpretation field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetInterpretation(interpretation *string) { - l.Interpretation = interpretation - l.require(labResultsMetadataFieldInterpretation) -} - -// SetPatientId sets the PatientId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetPatientId(patientId *string) { - l.PatientId = patientId - l.require(labResultsMetadataFieldPatientId) -} - -// SetAccountId sets the AccountId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsMetadata) SetAccountId(accountId *string) { - l.AccountId = accountId - l.require(labResultsMetadataFieldAccountId) -} - -func (l *LabResultsMetadata) UnmarshalJSON(data []byte) error { - type unmarshaler LabResultsMetadata - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = LabResultsMetadata(value) - extraProperties, err := internal.ExtractExtraProperties(data, *l) - if err != nil { - return err - } - l.extraProperties = extraProperties - l.rawJSON = json.RawMessage(data) - return nil -} - -func (l *LabResultsMetadata) MarshalJSON() ([]byte, error) { - type embed LabResultsMetadata - var marshaler = struct { - embed - }{ - embed: embed(*l), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (l *LabResultsMetadata) String() string { - if len(l.rawJSON) > 0 { - if value, err := internal.StringifyJSON(l.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) -} - -var ( - labResultsRawFieldMetadata = big.NewInt(1 << 0) - labResultsRawFieldResults = big.NewInt(1 << 1) - labResultsRawFieldMissingResults = big.NewInt(1 << 2) - labResultsRawFieldSampleInformation = big.NewInt(1 << 3) -) - -type LabResultsRaw struct { - Metadata *LabResultsMetadata `json:"metadata" url:"metadata"` - Results *LabResultsRawResults `json:"results" url:"results"` - MissingResults []*MissingBiomarkerResult `json:"missing_results,omitempty" url:"missing_results,omitempty"` - SampleInformation map[string]*SampleData `json:"sample_information,omitempty" url:"sample_information,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (l *LabResultsRaw) GetMetadata() *LabResultsMetadata { - if l == nil { - return nil - } - return l.Metadata -} - -func (l *LabResultsRaw) GetResults() *LabResultsRawResults { - if l == nil { - return nil - } - return l.Results -} - -func (l *LabResultsRaw) GetMissingResults() []*MissingBiomarkerResult { - if l == nil { - return nil - } - return l.MissingResults -} - -func (l *LabResultsRaw) GetSampleInformation() map[string]*SampleData { - if l == nil { - return nil - } - return l.SampleInformation -} - -func (l *LabResultsRaw) GetExtraProperties() map[string]interface{} { - return l.extraProperties -} - -func (l *LabResultsRaw) require(field *big.Int) { - if l.explicitFields == nil { - l.explicitFields = big.NewInt(0) - } - l.explicitFields.Or(l.explicitFields, field) -} - -// SetMetadata sets the Metadata field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsRaw) SetMetadata(metadata *LabResultsMetadata) { - l.Metadata = metadata - l.require(labResultsRawFieldMetadata) -} - -// SetResults sets the Results field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsRaw) SetResults(results *LabResultsRawResults) { - l.Results = results - l.require(labResultsRawFieldResults) -} - -// SetMissingResults sets the MissingResults field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsRaw) SetMissingResults(missingResults []*MissingBiomarkerResult) { - l.MissingResults = missingResults - l.require(labResultsRawFieldMissingResults) -} - -// SetSampleInformation sets the SampleInformation field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabResultsRaw) SetSampleInformation(sampleInformation map[string]*SampleData) { - l.SampleInformation = sampleInformation - l.require(labResultsRawFieldSampleInformation) -} - -func (l *LabResultsRaw) UnmarshalJSON(data []byte) error { - type unmarshaler LabResultsRaw - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = LabResultsRaw(value) - extraProperties, err := internal.ExtractExtraProperties(data, *l) - if err != nil { - return err - } - l.extraProperties = extraProperties - l.rawJSON = json.RawMessage(data) - return nil -} - -func (l *LabResultsRaw) MarshalJSON() ([]byte, error) { - type embed LabResultsRaw - var marshaler = struct { - embed - }{ - embed: embed(*l), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (l *LabResultsRaw) String() string { - if len(l.rawJSON) > 0 { - if value, err := internal.StringifyJSON(l.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) -} - -type LabResultsRawResults struct { - BiomarkerResultList []*BiomarkerResult - StringUnknownMap map[string]interface{} - - typ string -} - -func (l *LabResultsRawResults) GetBiomarkerResultList() []*BiomarkerResult { - if l == nil { - return nil - } - return l.BiomarkerResultList -} - -func (l *LabResultsRawResults) GetStringUnknownMap() map[string]interface{} { - if l == nil { - return nil - } - return l.StringUnknownMap -} - -func (l *LabResultsRawResults) UnmarshalJSON(data []byte) error { - var valueBiomarkerResultList []*BiomarkerResult - if err := json.Unmarshal(data, &valueBiomarkerResultList); err == nil { - l.typ = "BiomarkerResultList" - l.BiomarkerResultList = valueBiomarkerResultList - return nil - } - var valueStringUnknownMap map[string]interface{} - if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { - l.typ = "StringUnknownMap" - l.StringUnknownMap = valueStringUnknownMap - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, l) -} - -func (l LabResultsRawResults) MarshalJSON() ([]byte, error) { - if l.typ == "BiomarkerResultList" || l.BiomarkerResultList != nil { - return json.Marshal(l.BiomarkerResultList) - } - if l.typ == "StringUnknownMap" || l.StringUnknownMap != nil { - return json.Marshal(l.StringUnknownMap) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", l) -} - -type LabResultsRawResultsVisitor interface { - VisitBiomarkerResultList([]*BiomarkerResult) error - VisitStringUnknownMap(map[string]interface{}) error -} - -func (l *LabResultsRawResults) Accept(visitor LabResultsRawResultsVisitor) error { - if l.typ == "BiomarkerResultList" || l.BiomarkerResultList != nil { - return visitor.VisitBiomarkerResultList(l.BiomarkerResultList) - } - if l.typ == "StringUnknownMap" || l.StringUnknownMap != nil { - return visitor.VisitStringUnknownMap(l.StringUnknownMap) - } - return fmt.Errorf("type %T does not include a non-empty union type", l) -} - -// ℹ️ This enum is non-exhaustive. -type LabTestGenerationMethodFilter string - -const ( - LabTestGenerationMethodFilterAuto LabTestGenerationMethodFilter = "auto" - LabTestGenerationMethodFilterManual LabTestGenerationMethodFilter = "manual" - LabTestGenerationMethodFilterAll LabTestGenerationMethodFilter = "all" -) - -func NewLabTestGenerationMethodFilterFromString(s string) (LabTestGenerationMethodFilter, error) { - switch s { - case "auto": - return LabTestGenerationMethodFilterAuto, nil - case "manual": - return LabTestGenerationMethodFilterManual, nil - case "all": - return LabTestGenerationMethodFilterAll, nil - } - var t LabTestGenerationMethodFilter - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (l LabTestGenerationMethodFilter) Ptr() *LabTestGenerationMethodFilter { - return &l -} - -var ( - labTestResourcesResponseFieldData = big.NewInt(1 << 0) - labTestResourcesResponseFieldNextCursor = big.NewInt(1 << 1) -) - -type LabTestResourcesResponse struct { - Data []*ClientFacingLabTest `json:"data" url:"data"` - // The cursor for fetching the next page, or `null` to fetch the first page. - NextCursor *string `json:"next_cursor,omitempty" url:"next_cursor,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (l *LabTestResourcesResponse) GetData() []*ClientFacingLabTest { - if l == nil { - return nil - } - return l.Data -} - -func (l *LabTestResourcesResponse) GetNextCursor() *string { - if l == nil { - return nil - } - return l.NextCursor -} - -func (l *LabTestResourcesResponse) GetExtraProperties() map[string]interface{} { - return l.extraProperties -} - -func (l *LabTestResourcesResponse) require(field *big.Int) { - if l.explicitFields == nil { - l.explicitFields = big.NewInt(0) - } - l.explicitFields.Or(l.explicitFields, field) -} - -// SetData sets the Data field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabTestResourcesResponse) SetData(data []*ClientFacingLabTest) { - l.Data = data - l.require(labTestResourcesResponseFieldData) -} - -// SetNextCursor sets the NextCursor field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LabTestResourcesResponse) SetNextCursor(nextCursor *string) { - l.NextCursor = nextCursor - l.require(labTestResourcesResponseFieldNextCursor) -} - -func (l *LabTestResourcesResponse) UnmarshalJSON(data []byte) error { - type unmarshaler LabTestResourcesResponse - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = LabTestResourcesResponse(value) - extraProperties, err := internal.ExtractExtraProperties(data, *l) - if err != nil { - return err - } - l.extraProperties = extraProperties - l.rawJSON = json.RawMessage(data) - return nil -} - -func (l *LabTestResourcesResponse) MarshalJSON() ([]byte, error) { - type embed LabTestResourcesResponse - var marshaler = struct { - embed - }{ - embed: embed(*l), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (l *LabTestResourcesResponse) String() string { - if len(l.rawJSON) > 0 { - if value, err := internal.StringifyJSON(l.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) -} - -var ( - lngLatFieldLng = big.NewInt(1 << 0) - lngLatFieldLat = big.NewInt(1 << 1) -) - -type LngLat struct { - Lng float64 `json:"lng" url:"lng"` - Lat float64 `json:"lat" url:"lat"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (l *LngLat) GetLng() float64 { - if l == nil { - return 0 - } - return l.Lng -} - -func (l *LngLat) GetLat() float64 { - if l == nil { - return 0 - } - return l.Lat -} - -func (l *LngLat) GetExtraProperties() map[string]interface{} { - return l.extraProperties -} - -func (l *LngLat) require(field *big.Int) { - if l.explicitFields == nil { - l.explicitFields = big.NewInt(0) - } - l.explicitFields.Or(l.explicitFields, field) -} - -// SetLng sets the Lng field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LngLat) SetLng(lng float64) { - l.Lng = lng - l.require(lngLatFieldLng) -} - -// SetLat sets the Lat field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (l *LngLat) SetLat(lat float64) { - l.Lat = lat - l.require(lngLatFieldLat) -} - -func (l *LngLat) UnmarshalJSON(data []byte) error { - type unmarshaler LngLat - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *l = LngLat(value) - extraProperties, err := internal.ExtractExtraProperties(data, *l) - if err != nil { - return err - } - l.extraProperties = extraProperties - l.rawJSON = json.RawMessage(data) - return nil -} - -func (l *LngLat) MarshalJSON() ([]byte, error) { - type embed LngLat - var marshaler = struct { - embed - }{ - embed: embed(*l), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (l *LngLat) String() string { - if len(l.rawJSON) > 0 { - if value, err := internal.StringifyJSON(l.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(l); err == nil { - return value - } - return fmt.Sprintf("%#v", l) -} - -var ( - missingBiomarkerResultFieldName = big.NewInt(1 << 0) - missingBiomarkerResultFieldSlug = big.NewInt(1 << 1) - missingBiomarkerResultFieldInferredFailureType = big.NewInt(1 << 2) - missingBiomarkerResultFieldNote = big.NewInt(1 << 3) - missingBiomarkerResultFieldLoinc = big.NewInt(1 << 4) - missingBiomarkerResultFieldLoincSlug = big.NewInt(1 << 5) - missingBiomarkerResultFieldProviderId = big.NewInt(1 << 6) - missingBiomarkerResultFieldSourceMarkers = big.NewInt(1 << 7) -) - -type MissingBiomarkerResult struct { - Name string `json:"name" url:"name"` - Slug string `json:"slug" url:"slug"` - InferredFailureType FailureType `json:"inferred_failure_type" url:"inferred_failure_type"` - Note *string `json:"note,omitempty" url:"note,omitempty"` - Loinc *string `json:"loinc,omitempty" url:"loinc,omitempty"` - LoincSlug *string `json:"loinc_slug,omitempty" url:"loinc_slug,omitempty"` - ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` - SourceMarkers []*ParentBiomarkerData `json:"source_markers,omitempty" url:"source_markers,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (m *MissingBiomarkerResult) GetName() string { - if m == nil { - return "" - } - return m.Name -} - -func (m *MissingBiomarkerResult) GetSlug() string { - if m == nil { - return "" - } - return m.Slug -} - -func (m *MissingBiomarkerResult) GetInferredFailureType() FailureType { - if m == nil { - return "" - } - return m.InferredFailureType -} - -func (m *MissingBiomarkerResult) GetNote() *string { - if m == nil { - return nil - } - return m.Note -} - -func (m *MissingBiomarkerResult) GetLoinc() *string { - if m == nil { - return nil - } - return m.Loinc -} - -func (m *MissingBiomarkerResult) GetLoincSlug() *string { - if m == nil { - return nil - } - return m.LoincSlug -} - -func (m *MissingBiomarkerResult) GetProviderId() *string { - if m == nil { - return nil - } - return m.ProviderId -} - -func (m *MissingBiomarkerResult) GetSourceMarkers() []*ParentBiomarkerData { - if m == nil { - return nil - } - return m.SourceMarkers -} - -func (m *MissingBiomarkerResult) GetExtraProperties() map[string]interface{} { - return m.extraProperties -} - -func (m *MissingBiomarkerResult) require(field *big.Int) { - if m.explicitFields == nil { - m.explicitFields = big.NewInt(0) - } - m.explicitFields.Or(m.explicitFields, field) -} - -// SetName sets the Name field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetName(name string) { - m.Name = name - m.require(missingBiomarkerResultFieldName) -} - -// SetSlug sets the Slug field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetSlug(slug string) { - m.Slug = slug - m.require(missingBiomarkerResultFieldSlug) -} - -// SetInferredFailureType sets the InferredFailureType field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetInferredFailureType(inferredFailureType FailureType) { - m.InferredFailureType = inferredFailureType - m.require(missingBiomarkerResultFieldInferredFailureType) -} - -// SetNote sets the Note field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetNote(note *string) { - m.Note = note - m.require(missingBiomarkerResultFieldNote) -} - -// SetLoinc sets the Loinc field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetLoinc(loinc *string) { - m.Loinc = loinc - m.require(missingBiomarkerResultFieldLoinc) -} - -// SetLoincSlug sets the LoincSlug field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetLoincSlug(loincSlug *string) { - m.LoincSlug = loincSlug - m.require(missingBiomarkerResultFieldLoincSlug) -} - -// SetProviderId sets the ProviderId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetProviderId(providerId *string) { - m.ProviderId = providerId - m.require(missingBiomarkerResultFieldProviderId) -} - -// SetSourceMarkers sets the SourceMarkers field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (m *MissingBiomarkerResult) SetSourceMarkers(sourceMarkers []*ParentBiomarkerData) { - m.SourceMarkers = sourceMarkers - m.require(missingBiomarkerResultFieldSourceMarkers) -} - -func (m *MissingBiomarkerResult) UnmarshalJSON(data []byte) error { - type unmarshaler MissingBiomarkerResult +func (l *LngLat) UnmarshalJSON(data []byte) error { + type unmarshaler LngLat var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *m = MissingBiomarkerResult(value) - extraProperties, err := internal.ExtractExtraProperties(data, *m) + *l = LngLat(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) if err != nil { return err } - m.extraProperties = extraProperties - m.rawJSON = json.RawMessage(data) + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) return nil } -func (m *MissingBiomarkerResult) MarshalJSON() ([]byte, error) { - type embed MissingBiomarkerResult +func (l *LngLat) MarshalJSON() ([]byte, error) { + type embed LngLat var marshaler = struct { embed }{ - embed: embed(*m), + embed: embed(*l), } - explicitMarshaler := internal.HandleExplicitFields(marshaler, m.explicitFields) + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) return json.Marshal(explicitMarshaler) } -func (m *MissingBiomarkerResult) String() string { - if len(m.rawJSON) > 0 { - if value, err := internal.StringifyJSON(m.rawJSON); err == nil { +func (l *LngLat) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { return value } } - if value, err := internal.StringifyJSON(m); err == nil { + if value, err := internal.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", m) + return fmt.Sprintf("%#v", l) } // ℹ️ This enum is non-exhaustive. @@ -6024,98 +5192,6 @@ func (o OrderActivationType) Ptr() *OrderActivationType { return &o } -// ℹ️ This enum is non-exhaustive. -type OrderLowLevelStatus string - -const ( - OrderLowLevelStatusOrdered OrderLowLevelStatus = "ordered" - OrderLowLevelStatusRequisitionCreated OrderLowLevelStatus = "requisition_created" - OrderLowLevelStatusRequisitionBypassed OrderLowLevelStatus = "requisition_bypassed" - OrderLowLevelStatusTransitCustomer OrderLowLevelStatus = "transit_customer" - OrderLowLevelStatusOutForDelivery OrderLowLevelStatus = "out_for_delivery" - OrderLowLevelStatusWithCustomer OrderLowLevelStatus = "with_customer" - OrderLowLevelStatusTransitLab OrderLowLevelStatus = "transit_lab" - OrderLowLevelStatusDeliveredToLab OrderLowLevelStatus = "delivered_to_lab" - OrderLowLevelStatusCompleted OrderLowLevelStatus = "completed" - OrderLowLevelStatusFailureToDeliverToLab OrderLowLevelStatus = "failure_to_deliver_to_lab" - OrderLowLevelStatusFailureToDeliverToCustomer OrderLowLevelStatus = "failure_to_deliver_to_customer" - OrderLowLevelStatusProblemInTransitLab OrderLowLevelStatus = "problem_in_transit_lab" - OrderLowLevelStatusProblemInTransitCustomer OrderLowLevelStatus = "problem_in_transit_customer" - OrderLowLevelStatusSampleError OrderLowLevelStatus = "sample_error" - OrderLowLevelStatusAppointmentScheduled OrderLowLevelStatus = "appointment_scheduled" - OrderLowLevelStatusAppointmentCancelled OrderLowLevelStatus = "appointment_cancelled" - OrderLowLevelStatusAppointmentPending OrderLowLevelStatus = "appointment_pending" - OrderLowLevelStatusDrawCompleted OrderLowLevelStatus = "draw_completed" - OrderLowLevelStatusCancelled OrderLowLevelStatus = "cancelled" - OrderLowLevelStatusLost OrderLowLevelStatus = "lost" - OrderLowLevelStatusDoNotProcess OrderLowLevelStatus = "do_not_process" - OrderLowLevelStatusPartialResults OrderLowLevelStatus = "partial_results" - OrderLowLevelStatusAwaitingRegistration OrderLowLevelStatus = "awaiting_registration" - OrderLowLevelStatusRegistered OrderLowLevelStatus = "registered" - OrderLowLevelStatusRedrawAvailable OrderLowLevelStatus = "redraw_available" -) - -func NewOrderLowLevelStatusFromString(s string) (OrderLowLevelStatus, error) { - switch s { - case "ordered": - return OrderLowLevelStatusOrdered, nil - case "requisition_created": - return OrderLowLevelStatusRequisitionCreated, nil - case "requisition_bypassed": - return OrderLowLevelStatusRequisitionBypassed, nil - case "transit_customer": - return OrderLowLevelStatusTransitCustomer, nil - case "out_for_delivery": - return OrderLowLevelStatusOutForDelivery, nil - case "with_customer": - return OrderLowLevelStatusWithCustomer, nil - case "transit_lab": - return OrderLowLevelStatusTransitLab, nil - case "delivered_to_lab": - return OrderLowLevelStatusDeliveredToLab, nil - case "completed": - return OrderLowLevelStatusCompleted, nil - case "failure_to_deliver_to_lab": - return OrderLowLevelStatusFailureToDeliverToLab, nil - case "failure_to_deliver_to_customer": - return OrderLowLevelStatusFailureToDeliverToCustomer, nil - case "problem_in_transit_lab": - return OrderLowLevelStatusProblemInTransitLab, nil - case "problem_in_transit_customer": - return OrderLowLevelStatusProblemInTransitCustomer, nil - case "sample_error": - return OrderLowLevelStatusSampleError, nil - case "appointment_scheduled": - return OrderLowLevelStatusAppointmentScheduled, nil - case "appointment_cancelled": - return OrderLowLevelStatusAppointmentCancelled, nil - case "appointment_pending": - return OrderLowLevelStatusAppointmentPending, nil - case "draw_completed": - return OrderLowLevelStatusDrawCompleted, nil - case "cancelled": - return OrderLowLevelStatusCancelled, nil - case "lost": - return OrderLowLevelStatusLost, nil - case "do_not_process": - return OrderLowLevelStatusDoNotProcess, nil - case "partial_results": - return OrderLowLevelStatusPartialResults, nil - case "awaiting_registration": - return OrderLowLevelStatusAwaitingRegistration, nil - case "registered": - return OrderLowLevelStatusRegistered, nil - case "redraw_available": - return OrderLowLevelStatusRedrawAvailable, nil - } - var t OrderLowLevelStatus - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (o OrderLowLevelStatus) Ptr() *OrderLowLevelStatus { - return &o -} - var ( orderSetRequestFieldLabTestIds = big.NewInt(1 << 0) orderSetRequestFieldAddOn = big.NewInt(1 << 1) @@ -6226,132 +5302,6 @@ func (o *OrderSetRequest) String() string { return fmt.Sprintf("%#v", o) } -var ( - parentBiomarkerDataFieldMarkerId = big.NewInt(1 << 0) - parentBiomarkerDataFieldName = big.NewInt(1 << 1) - parentBiomarkerDataFieldSlug = big.NewInt(1 << 2) - parentBiomarkerDataFieldProviderId = big.NewInt(1 << 3) -) - -type ParentBiomarkerData struct { - MarkerId int `json:"marker_id" url:"marker_id"` - Name string `json:"name" url:"name"` - Slug string `json:"slug" url:"slug"` - ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (p *ParentBiomarkerData) GetMarkerId() int { - if p == nil { - return 0 - } - return p.MarkerId -} - -func (p *ParentBiomarkerData) GetName() string { - if p == nil { - return "" - } - return p.Name -} - -func (p *ParentBiomarkerData) GetSlug() string { - if p == nil { - return "" - } - return p.Slug -} - -func (p *ParentBiomarkerData) GetProviderId() *string { - if p == nil { - return nil - } - return p.ProviderId -} - -func (p *ParentBiomarkerData) GetExtraProperties() map[string]interface{} { - return p.extraProperties -} - -func (p *ParentBiomarkerData) require(field *big.Int) { - if p.explicitFields == nil { - p.explicitFields = big.NewInt(0) - } - p.explicitFields.Or(p.explicitFields, field) -} - -// SetMarkerId sets the MarkerId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *ParentBiomarkerData) SetMarkerId(markerId int) { - p.MarkerId = markerId - p.require(parentBiomarkerDataFieldMarkerId) -} - -// SetName sets the Name field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *ParentBiomarkerData) SetName(name string) { - p.Name = name - p.require(parentBiomarkerDataFieldName) -} - -// SetSlug sets the Slug field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *ParentBiomarkerData) SetSlug(slug string) { - p.Slug = slug - p.require(parentBiomarkerDataFieldSlug) -} - -// SetProviderId sets the ProviderId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *ParentBiomarkerData) SetProviderId(providerId *string) { - p.ProviderId = providerId - p.require(parentBiomarkerDataFieldProviderId) -} - -func (p *ParentBiomarkerData) UnmarshalJSON(data []byte) error { - type unmarshaler ParentBiomarkerData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = ParentBiomarkerData(value) - extraProperties, err := internal.ExtractExtraProperties(data, *p) - if err != nil { - return err - } - p.extraProperties = extraProperties - p.rawJSON = json.RawMessage(data) - return nil -} - -func (p *ParentBiomarkerData) MarshalJSON() ([]byte, error) { - type embed ParentBiomarkerData - var marshaler = struct { - embed - }{ - embed: embed(*p), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (p *ParentBiomarkerData) String() string { - if len(p.rawJSON) > 0 { - if value, err := internal.StringifyJSON(p.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - var ( patientAddressFieldReceiverName = big.NewInt(1 << 0) patientAddressFieldFirstLine = big.NewInt(1 << 1) @@ -6360,6 +5310,7 @@ var ( patientAddressFieldState = big.NewInt(1 << 4) patientAddressFieldZip = big.NewInt(1 << 5) patientAddressFieldCountry = big.NewInt(1 << 6) + patientAddressFieldAccessNotes = big.NewInt(1 << 7) ) type PatientAddress struct { @@ -6370,6 +5321,7 @@ type PatientAddress struct { State string `json:"state" url:"state"` Zip string `json:"zip" url:"zip"` Country string `json:"country" url:"country"` + AccessNotes *string `json:"access_notes,omitempty" url:"access_notes,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -6427,6 +5379,13 @@ func (p *PatientAddress) GetCountry() string { return p.Country } +func (p *PatientAddress) GetAccessNotes() *string { + if p == nil { + return nil + } + return p.AccessNotes +} + func (p *PatientAddress) GetExtraProperties() map[string]interface{} { return p.extraProperties } @@ -6468,158 +5427,39 @@ func (p *PatientAddress) SetCity(city string) { // SetState sets the State field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (p *PatientAddress) SetState(state string) { - p.State = state - p.require(patientAddressFieldState) -} - -// SetZip sets the Zip field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *PatientAddress) SetZip(zip string) { - p.Zip = zip - p.require(patientAddressFieldZip) -} - -// SetCountry sets the Country field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *PatientAddress) SetCountry(country string) { - p.Country = country - p.require(patientAddressFieldCountry) -} - -func (p *PatientAddress) UnmarshalJSON(data []byte) error { - type unmarshaler PatientAddress - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PatientAddress(value) - extraProperties, err := internal.ExtractExtraProperties(data, *p) - if err != nil { - return err - } - p.extraProperties = extraProperties - p.rawJSON = json.RawMessage(data) - return nil -} - -func (p *PatientAddress) MarshalJSON() ([]byte, error) { - type embed PatientAddress - var marshaler = struct { - embed - }{ - embed: embed(*p), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (p *PatientAddress) String() string { - if len(p.rawJSON) > 0 { - if value, err := internal.StringifyJSON(p.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -var ( - performingLaboratoryFieldName = big.NewInt(1 << 0) - performingLaboratoryFieldPhoneNumber = big.NewInt(1 << 1) - performingLaboratoryFieldMedicalDirector = big.NewInt(1 << 2) - performingLaboratoryFieldAddress = big.NewInt(1 << 3) -) - -type PerformingLaboratory struct { - Name string `json:"name" url:"name"` - PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` - MedicalDirector *string `json:"medical_director,omitempty" url:"medical_director,omitempty"` - Address *Address `json:"address,omitempty" url:"address,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (p *PerformingLaboratory) GetName() string { - if p == nil { - return "" - } - return p.Name -} - -func (p *PerformingLaboratory) GetPhoneNumber() *string { - if p == nil { - return nil - } - return p.PhoneNumber -} - -func (p *PerformingLaboratory) GetMedicalDirector() *string { - if p == nil { - return nil - } - return p.MedicalDirector -} - -func (p *PerformingLaboratory) GetAddress() *Address { - if p == nil { - return nil - } - return p.Address -} - -func (p *PerformingLaboratory) GetExtraProperties() map[string]interface{} { - return p.extraProperties -} - -func (p *PerformingLaboratory) require(field *big.Int) { - if p.explicitFields == nil { - p.explicitFields = big.NewInt(0) - } - p.explicitFields.Or(p.explicitFields, field) -} - -// SetName sets the Name field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *PerformingLaboratory) SetName(name string) { - p.Name = name - p.require(performingLaboratoryFieldName) +func (p *PatientAddress) SetState(state string) { + p.State = state + p.require(patientAddressFieldState) } -// SetPhoneNumber sets the PhoneNumber field and marks it as non-optional; +// SetZip sets the Zip field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (p *PerformingLaboratory) SetPhoneNumber(phoneNumber *string) { - p.PhoneNumber = phoneNumber - p.require(performingLaboratoryFieldPhoneNumber) +func (p *PatientAddress) SetZip(zip string) { + p.Zip = zip + p.require(patientAddressFieldZip) } -// SetMedicalDirector sets the MedicalDirector field and marks it as non-optional; +// SetCountry sets the Country field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (p *PerformingLaboratory) SetMedicalDirector(medicalDirector *string) { - p.MedicalDirector = medicalDirector - p.require(performingLaboratoryFieldMedicalDirector) +func (p *PatientAddress) SetCountry(country string) { + p.Country = country + p.require(patientAddressFieldCountry) } -// SetAddress sets the Address field and marks it as non-optional; +// SetAccessNotes sets the AccessNotes field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (p *PerformingLaboratory) SetAddress(address *Address) { - p.Address = address - p.require(performingLaboratoryFieldAddress) +func (p *PatientAddress) SetAccessNotes(accessNotes *string) { + p.AccessNotes = accessNotes + p.require(patientAddressFieldAccessNotes) } -func (p *PerformingLaboratory) UnmarshalJSON(data []byte) error { - type unmarshaler PerformingLaboratory +func (p *PatientAddress) UnmarshalJSON(data []byte) error { + type unmarshaler PatientAddress var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PerformingLaboratory(value) + *p = PatientAddress(value) extraProperties, err := internal.ExtractExtraProperties(data, *p) if err != nil { return err @@ -6629,8 +5469,8 @@ func (p *PerformingLaboratory) UnmarshalJSON(data []byte) error { return nil } -func (p *PerformingLaboratory) MarshalJSON() ([]byte, error) { - type embed PerformingLaboratory +func (p *PatientAddress) MarshalJSON() ([]byte, error) { + type embed PatientAddress var marshaler = struct { embed }{ @@ -6640,7 +5480,7 @@ func (p *PerformingLaboratory) MarshalJSON() ([]byte, error) { return json.Marshal(explicitMarshaler) } -func (p *PerformingLaboratory) String() string { +func (p *PatientAddress) String() string { if len(p.rawJSON) > 0 { if value, err := internal.StringifyJSON(p.rawJSON); err == nil { return value @@ -7265,536 +6105,147 @@ func (p *PscAreaInfoDetails) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &value); err != nil { return err } - *p = PscAreaInfoDetails(value) - extraProperties, err := internal.ExtractExtraProperties(data, *p) - if err != nil { - return err - } - p.extraProperties = extraProperties - p.rawJSON = json.RawMessage(data) - return nil -} - -func (p *PscAreaInfoDetails) MarshalJSON() ([]byte, error) { - type embed PscAreaInfoDetails - var marshaler = struct { - embed - }{ - embed: embed(*p), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (p *PscAreaInfoDetails) String() string { - if len(p.rawJSON) > 0 { - if value, err := internal.StringifyJSON(p.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -var ( - pscInfoFieldLabId = big.NewInt(1 << 0) - pscInfoFieldSlug = big.NewInt(1 << 1) - pscInfoFieldPatientServiceCenters = big.NewInt(1 << 2) -) - -type PscInfo struct { - LabId int `json:"lab_id" url:"lab_id"` - Slug Labs `json:"slug" url:"slug"` - PatientServiceCenters []*ClientFacingLabLocation `json:"patient_service_centers" url:"patient_service_centers"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (p *PscInfo) GetLabId() int { - if p == nil { - return 0 - } - return p.LabId -} - -func (p *PscInfo) GetSlug() Labs { - if p == nil { - return "" - } - return p.Slug -} - -func (p *PscInfo) GetPatientServiceCenters() []*ClientFacingLabLocation { - if p == nil { - return nil - } - return p.PatientServiceCenters -} - -func (p *PscInfo) GetExtraProperties() map[string]interface{} { - return p.extraProperties -} - -func (p *PscInfo) require(field *big.Int) { - if p.explicitFields == nil { - p.explicitFields = big.NewInt(0) - } - p.explicitFields.Or(p.explicitFields, field) -} - -// SetLabId sets the LabId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *PscInfo) SetLabId(labId int) { - p.LabId = labId - p.require(pscInfoFieldLabId) -} - -// SetSlug sets the Slug field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *PscInfo) SetSlug(slug Labs) { - p.Slug = slug - p.require(pscInfoFieldSlug) -} - -// SetPatientServiceCenters sets the PatientServiceCenters field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (p *PscInfo) SetPatientServiceCenters(patientServiceCenters []*ClientFacingLabLocation) { - p.PatientServiceCenters = patientServiceCenters - p.require(pscInfoFieldPatientServiceCenters) -} - -func (p *PscInfo) UnmarshalJSON(data []byte) error { - type unmarshaler PscInfo - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *p = PscInfo(value) - extraProperties, err := internal.ExtractExtraProperties(data, *p) - if err != nil { - return err - } - p.extraProperties = extraProperties - p.rawJSON = json.RawMessage(data) - return nil -} - -func (p *PscInfo) MarshalJSON() ([]byte, error) { - type embed PscInfo - var marshaler = struct { - embed - }{ - embed: embed(*p), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (p *PscInfo) String() string { - if len(p.rawJSON) > 0 { - if value, err := internal.StringifyJSON(p.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(p); err == nil { - return value - } - return fmt.Sprintf("%#v", p) -} - -// ℹ️ This enum is non-exhaustive. -type ResultType string - -const ( - ResultTypeNumeric ResultType = "numeric" - ResultTypeRange ResultType = "range" - ResultTypeComment ResultType = "comment" - ResultTypeCodedValue ResultType = "coded_value" -) - -func NewResultTypeFromString(s string) (ResultType, error) { - switch s { - case "numeric": - return ResultTypeNumeric, nil - case "range": - return ResultTypeRange, nil - case "comment": - return ResultTypeComment, nil - case "coded_value": - return ResultTypeCodedValue, nil - } - var t ResultType - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (r ResultType) Ptr() *ResultType { - return &r -} - -var ( - sampleDataFieldSampleId = big.NewInt(1 << 0) - sampleDataFieldControlNumber = big.NewInt(1 << 1) - sampleDataFieldDateCollected = big.NewInt(1 << 2) - sampleDataFieldDateReceived = big.NewInt(1 << 3) - sampleDataFieldDateReported = big.NewInt(1 << 4) - sampleDataFieldPerformingLaboratories = big.NewInt(1 << 5) - sampleDataFieldClinicalInformation = big.NewInt(1 << 6) -) - -type SampleData struct { - SampleId *string `json:"sample_id,omitempty" url:"sample_id,omitempty"` - ControlNumber *string `json:"control_number,omitempty" url:"control_number,omitempty"` - DateCollected *SampleDataDateCollected `json:"date_collected,omitempty" url:"date_collected,omitempty"` - DateReceived *SampleDataDateReceived `json:"date_received,omitempty" url:"date_received,omitempty"` - DateReported *SampleDataDateReported `json:"date_reported,omitempty" url:"date_reported,omitempty"` - PerformingLaboratories map[string]*PerformingLaboratory `json:"performing_laboratories,omitempty" url:"performing_laboratories,omitempty"` - ClinicalInformation *ClinicalInformation `json:"clinical_information,omitempty" url:"clinical_information,omitempty"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (s *SampleData) GetSampleId() *string { - if s == nil { - return nil - } - return s.SampleId -} - -func (s *SampleData) GetControlNumber() *string { - if s == nil { - return nil - } - return s.ControlNumber -} - -func (s *SampleData) GetDateCollected() *SampleDataDateCollected { - if s == nil { - return nil - } - return s.DateCollected -} - -func (s *SampleData) GetDateReceived() *SampleDataDateReceived { - if s == nil { - return nil - } - return s.DateReceived -} - -func (s *SampleData) GetDateReported() *SampleDataDateReported { - if s == nil { - return nil - } - return s.DateReported -} - -func (s *SampleData) GetPerformingLaboratories() map[string]*PerformingLaboratory { - if s == nil { - return nil - } - return s.PerformingLaboratories -} - -func (s *SampleData) GetClinicalInformation() *ClinicalInformation { - if s == nil { - return nil - } - return s.ClinicalInformation -} - -func (s *SampleData) GetExtraProperties() map[string]interface{} { - return s.extraProperties -} - -func (s *SampleData) require(field *big.Int) { - if s.explicitFields == nil { - s.explicitFields = big.NewInt(0) - } - s.explicitFields.Or(s.explicitFields, field) -} - -// SetSampleId sets the SampleId field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetSampleId(sampleId *string) { - s.SampleId = sampleId - s.require(sampleDataFieldSampleId) -} - -// SetControlNumber sets the ControlNumber field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetControlNumber(controlNumber *string) { - s.ControlNumber = controlNumber - s.require(sampleDataFieldControlNumber) -} - -// SetDateCollected sets the DateCollected field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetDateCollected(dateCollected *SampleDataDateCollected) { - s.DateCollected = dateCollected - s.require(sampleDataFieldDateCollected) -} - -// SetDateReceived sets the DateReceived field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetDateReceived(dateReceived *SampleDataDateReceived) { - s.DateReceived = dateReceived - s.require(sampleDataFieldDateReceived) -} - -// SetDateReported sets the DateReported field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetDateReported(dateReported *SampleDataDateReported) { - s.DateReported = dateReported - s.require(sampleDataFieldDateReported) -} - -// SetPerformingLaboratories sets the PerformingLaboratories field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetPerformingLaboratories(performingLaboratories map[string]*PerformingLaboratory) { - s.PerformingLaboratories = performingLaboratories - s.require(sampleDataFieldPerformingLaboratories) -} - -// SetClinicalInformation sets the ClinicalInformation field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (s *SampleData) SetClinicalInformation(clinicalInformation *ClinicalInformation) { - s.ClinicalInformation = clinicalInformation - s.require(sampleDataFieldClinicalInformation) -} - -func (s *SampleData) UnmarshalJSON(data []byte) error { - type unmarshaler SampleData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *s = SampleData(value) - extraProperties, err := internal.ExtractExtraProperties(data, *s) + *p = PscAreaInfoDetails(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) if err != nil { return err } - s.extraProperties = extraProperties - s.rawJSON = json.RawMessage(data) + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) return nil } -func (s *SampleData) MarshalJSON() ([]byte, error) { - type embed SampleData +func (p *PscAreaInfoDetails) MarshalJSON() ([]byte, error) { + type embed PscAreaInfoDetails var marshaler = struct { embed }{ - embed: embed(*s), + embed: embed(*p), } - explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) return json.Marshal(explicitMarshaler) } -func (s *SampleData) String() string { - if len(s.rawJSON) > 0 { - if value, err := internal.StringifyJSON(s.rawJSON); err == nil { +func (p *PscAreaInfoDetails) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { return value } } - if value, err := internal.StringifyJSON(s); err == nil { + if value, err := internal.StringifyJSON(p); err == nil { return value } - return fmt.Sprintf("%#v", s) -} - -type SampleDataDateCollected struct { - UtcTimestampWithTimezoneOffset *UtcTimestampWithTimezoneOffset - String string - - typ string -} - -func (s *SampleDataDateCollected) GetUtcTimestampWithTimezoneOffset() *UtcTimestampWithTimezoneOffset { - if s == nil { - return nil - } - return s.UtcTimestampWithTimezoneOffset -} - -func (s *SampleDataDateCollected) GetString() string { - if s == nil { - return "" - } - return s.String -} - -func (s *SampleDataDateCollected) UnmarshalJSON(data []byte) error { - valueUtcTimestampWithTimezoneOffset := new(UtcTimestampWithTimezoneOffset) - if err := json.Unmarshal(data, &valueUtcTimestampWithTimezoneOffset); err == nil { - s.typ = "UtcTimestampWithTimezoneOffset" - s.UtcTimestampWithTimezoneOffset = valueUtcTimestampWithTimezoneOffset - return nil - } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.typ = "String" - s.String = valueString - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s SampleDataDateCollected) MarshalJSON() ([]byte, error) { - if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { - return json.Marshal(s.UtcTimestampWithTimezoneOffset) - } - if s.typ == "String" || s.String != "" { - return json.Marshal(s.String) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) + return fmt.Sprintf("%#v", p) } -type SampleDataDateCollectedVisitor interface { - VisitUtcTimestampWithTimezoneOffset(*UtcTimestampWithTimezoneOffset) error - VisitString(string) error -} +var ( + pscInfoFieldLabId = big.NewInt(1 << 0) + pscInfoFieldSlug = big.NewInt(1 << 1) + pscInfoFieldPatientServiceCenters = big.NewInt(1 << 2) +) -func (s *SampleDataDateCollected) Accept(visitor SampleDataDateCollectedVisitor) error { - if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { - return visitor.VisitUtcTimestampWithTimezoneOffset(s.UtcTimestampWithTimezoneOffset) - } - if s.typ == "String" || s.String != "" { - return visitor.VisitString(s.String) - } - return fmt.Errorf("type %T does not include a non-empty union type", s) -} +type PscInfo struct { + LabId int `json:"lab_id" url:"lab_id"` + Slug Labs `json:"slug" url:"slug"` + PatientServiceCenters []*ClientFacingLabLocation `json:"patient_service_centers" url:"patient_service_centers"` -type SampleDataDateReceived struct { - UtcTimestampWithTimezoneOffset *UtcTimestampWithTimezoneOffset - String string + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` - typ string + extraProperties map[string]interface{} + rawJSON json.RawMessage } -func (s *SampleDataDateReceived) GetUtcTimestampWithTimezoneOffset() *UtcTimestampWithTimezoneOffset { - if s == nil { - return nil +func (p *PscInfo) GetLabId() int { + if p == nil { + return 0 } - return s.UtcTimestampWithTimezoneOffset + return p.LabId } -func (s *SampleDataDateReceived) GetString() string { - if s == nil { +func (p *PscInfo) GetSlug() Labs { + if p == nil { return "" } - return s.String + return p.Slug } -func (s *SampleDataDateReceived) UnmarshalJSON(data []byte) error { - valueUtcTimestampWithTimezoneOffset := new(UtcTimestampWithTimezoneOffset) - if err := json.Unmarshal(data, &valueUtcTimestampWithTimezoneOffset); err == nil { - s.typ = "UtcTimestampWithTimezoneOffset" - s.UtcTimestampWithTimezoneOffset = valueUtcTimestampWithTimezoneOffset - return nil - } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.typ = "String" - s.String = valueString +func (p *PscInfo) GetPatientServiceCenters() []*ClientFacingLabLocation { + if p == nil { return nil } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s SampleDataDateReceived) MarshalJSON() ([]byte, error) { - if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { - return json.Marshal(s.UtcTimestampWithTimezoneOffset) - } - if s.typ == "String" || s.String != "" { - return json.Marshal(s.String) - } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) + return p.PatientServiceCenters } -type SampleDataDateReceivedVisitor interface { - VisitUtcTimestampWithTimezoneOffset(*UtcTimestampWithTimezoneOffset) error - VisitString(string) error +func (p *PscInfo) GetExtraProperties() map[string]interface{} { + return p.extraProperties } -func (s *SampleDataDateReceived) Accept(visitor SampleDataDateReceivedVisitor) error { - if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { - return visitor.VisitUtcTimestampWithTimezoneOffset(s.UtcTimestampWithTimezoneOffset) - } - if s.typ == "String" || s.String != "" { - return visitor.VisitString(s.String) +func (p *PscInfo) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) } - return fmt.Errorf("type %T does not include a non-empty union type", s) + p.explicitFields.Or(p.explicitFields, field) } -type SampleDataDateReported struct { - UtcTimestampWithTimezoneOffset *UtcTimestampWithTimezoneOffset - String string - - typ string +// SetLabId sets the LabId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PscInfo) SetLabId(labId int) { + p.LabId = labId + p.require(pscInfoFieldLabId) } -func (s *SampleDataDateReported) GetUtcTimestampWithTimezoneOffset() *UtcTimestampWithTimezoneOffset { - if s == nil { - return nil - } - return s.UtcTimestampWithTimezoneOffset +// SetSlug sets the Slug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PscInfo) SetSlug(slug Labs) { + p.Slug = slug + p.require(pscInfoFieldSlug) } -func (s *SampleDataDateReported) GetString() string { - if s == nil { - return "" - } - return s.String +// SetPatientServiceCenters sets the PatientServiceCenters field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PscInfo) SetPatientServiceCenters(patientServiceCenters []*ClientFacingLabLocation) { + p.PatientServiceCenters = patientServiceCenters + p.require(pscInfoFieldPatientServiceCenters) } -func (s *SampleDataDateReported) UnmarshalJSON(data []byte) error { - valueUtcTimestampWithTimezoneOffset := new(UtcTimestampWithTimezoneOffset) - if err := json.Unmarshal(data, &valueUtcTimestampWithTimezoneOffset); err == nil { - s.typ = "UtcTimestampWithTimezoneOffset" - s.UtcTimestampWithTimezoneOffset = valueUtcTimestampWithTimezoneOffset - return nil +func (p *PscInfo) UnmarshalJSON(data []byte) error { + type unmarshaler PscInfo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.typ = "String" - s.String = valueString - return nil + *p = PscInfo(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil } -func (s SampleDataDateReported) MarshalJSON() ([]byte, error) { - if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { - return json.Marshal(s.UtcTimestampWithTimezoneOffset) - } - if s.typ == "String" || s.String != "" { - return json.Marshal(s.String) +func (p *PscInfo) MarshalJSON() ([]byte, error) { + type embed PscInfo + var marshaler = struct { + embed + }{ + embed: embed(*p), } - return nil, fmt.Errorf("type %T does not include a non-empty union type", s) -} - -type SampleDataDateReportedVisitor interface { - VisitUtcTimestampWithTimezoneOffset(*UtcTimestampWithTimezoneOffset) error - VisitString(string) error + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) } -func (s *SampleDataDateReported) Accept(visitor SampleDataDateReportedVisitor) error { - if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { - return visitor.VisitUtcTimestampWithTimezoneOffset(s.UtcTimestampWithTimezoneOffset) +func (p *PscInfo) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } } - if s.typ == "String" || s.String != "" { - return visitor.VisitString(s.String) + if value, err := internal.StringifyJSON(p); err == nil { + return value } - return fmt.Errorf("type %T does not include a non-empty union type", s) + return fmt.Sprintf("%#v", p) } var ( @@ -8100,12 +6551,13 @@ func (t *TimeSlot) String() string { } var ( - usAddressFieldFirstLine = big.NewInt(1 << 0) - usAddressFieldSecondLine = big.NewInt(1 << 1) - usAddressFieldCity = big.NewInt(1 << 2) - usAddressFieldState = big.NewInt(1 << 3) - usAddressFieldZipCode = big.NewInt(1 << 4) - usAddressFieldUnit = big.NewInt(1 << 5) + usAddressFieldFirstLine = big.NewInt(1 << 0) + usAddressFieldSecondLine = big.NewInt(1 << 1) + usAddressFieldCity = big.NewInt(1 << 2) + usAddressFieldState = big.NewInt(1 << 3) + usAddressFieldZipCode = big.NewInt(1 << 4) + usAddressFieldUnit = big.NewInt(1 << 5) + usAddressFieldAccessNotes = big.NewInt(1 << 6) ) type UsAddress struct { @@ -8115,7 +6567,8 @@ type UsAddress struct { State string `json:"state" url:"state"` ZipCode string `json:"zip_code" url:"zip_code"` // Deprecated. Use `second_line` instead to provide the unit number. Subject to removal after 20 Nov 2023. - Unit *string `json:"unit,omitempty" url:"unit,omitempty"` + Unit *string `json:"unit,omitempty" url:"unit,omitempty"` + AccessNotes *string `json:"access_notes,omitempty" url:"access_notes,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -8166,6 +6619,13 @@ func (u *UsAddress) GetUnit() *string { return u.Unit } +func (u *UsAddress) GetAccessNotes() *string { + if u == nil { + return nil + } + return u.AccessNotes +} + func (u *UsAddress) GetExtraProperties() map[string]interface{} { return u.extraProperties } @@ -8219,6 +6679,13 @@ func (u *UsAddress) SetUnit(unit *string) { u.require(usAddressFieldUnit) } +// SetAccessNotes sets the AccessNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UsAddress) SetAccessNotes(accessNotes *string) { + u.AccessNotes = accessNotes + u.require(usAddressFieldAccessNotes) +} + func (u *UsAddress) UnmarshalJSON(data []byte) error { type unmarshaler UsAddress var value unmarshaler @@ -8258,108 +6725,6 @@ func (u *UsAddress) String() string { return fmt.Sprintf("%#v", u) } -var ( - utcTimestampWithTimezoneOffsetFieldTimestamp = big.NewInt(1 << 0) - utcTimestampWithTimezoneOffsetFieldTimezoneOffset = big.NewInt(1 << 1) -) - -type UtcTimestampWithTimezoneOffset struct { - Timestamp time.Time `json:"timestamp" url:"timestamp"` - TimezoneOffset int `json:"timezone_offset" url:"timezone_offset"` - - // Private bitmask of fields set to an explicit value and therefore not to be omitted - explicitFields *big.Int `json:"-" url:"-"` - - extraProperties map[string]interface{} - rawJSON json.RawMessage -} - -func (u *UtcTimestampWithTimezoneOffset) GetTimestamp() time.Time { - if u == nil { - return time.Time{} - } - return u.Timestamp -} - -func (u *UtcTimestampWithTimezoneOffset) GetTimezoneOffset() int { - if u == nil { - return 0 - } - return u.TimezoneOffset -} - -func (u *UtcTimestampWithTimezoneOffset) GetExtraProperties() map[string]interface{} { - return u.extraProperties -} - -func (u *UtcTimestampWithTimezoneOffset) require(field *big.Int) { - if u.explicitFields == nil { - u.explicitFields = big.NewInt(0) - } - u.explicitFields.Or(u.explicitFields, field) -} - -// SetTimestamp sets the Timestamp field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UtcTimestampWithTimezoneOffset) SetTimestamp(timestamp time.Time) { - u.Timestamp = timestamp - u.require(utcTimestampWithTimezoneOffsetFieldTimestamp) -} - -// SetTimezoneOffset sets the TimezoneOffset field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (u *UtcTimestampWithTimezoneOffset) SetTimezoneOffset(timezoneOffset int) { - u.TimezoneOffset = timezoneOffset - u.require(utcTimestampWithTimezoneOffsetFieldTimezoneOffset) -} - -func (u *UtcTimestampWithTimezoneOffset) UnmarshalJSON(data []byte) error { - type embed UtcTimestampWithTimezoneOffset - var unmarshaler = struct { - embed - Timestamp *internal.DateTime `json:"timestamp"` - }{ - embed: embed(*u), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { - return err - } - *u = UtcTimestampWithTimezoneOffset(unmarshaler.embed) - u.Timestamp = unmarshaler.Timestamp.Time() - extraProperties, err := internal.ExtractExtraProperties(data, *u) - if err != nil { - return err - } - u.extraProperties = extraProperties - u.rawJSON = json.RawMessage(data) - return nil -} - -func (u *UtcTimestampWithTimezoneOffset) MarshalJSON() ([]byte, error) { - type embed UtcTimestampWithTimezoneOffset - var marshaler = struct { - embed - Timestamp *internal.DateTime `json:"timestamp"` - }{ - embed: embed(*u), - Timestamp: internal.NewDateTime(u.Timestamp), - } - explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) - return json.Marshal(explicitMarshaler) -} - -func (u *UtcTimestampWithTimezoneOffset) String() string { - if len(u.rawJSON) > 0 { - if value, err := internal.StringifyJSON(u.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(u); err == nil { - return value - } - return fmt.Sprintf("%#v", u) -} - var ( validateIcdCodesResponseFieldValid = big.NewInt(1 << 0) validateIcdCodesResponseFieldErrors = big.NewInt(1 << 1) @@ -8661,12 +7026,33 @@ func (u *UpdateLabTestRequest) SetActive(active *bool) { u.require(updateLabTestRequestFieldActive) } +func (u *UpdateLabTestRequest) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateLabTestRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *u = UpdateLabTestRequest(body) + return nil +} + +func (u *UpdateLabTestRequest) MarshalJSON() ([]byte, error) { + type embed UpdateLabTestRequest + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( validateIcdCodesBodyFieldCodes = big.NewInt(1 << 0) ) type ValidateIcdCodesBody struct { - Codes []string `json:"codes,omitempty" url:"-"` + Codes []string `json:"codes" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -8685,3 +7071,24 @@ func (v *ValidateIcdCodesBody) SetCodes(codes []string) { v.Codes = codes v.require(validateIcdCodesBodyFieldCodes) } + +func (v *ValidateIcdCodesBody) UnmarshalJSON(data []byte) error { + type unmarshaler ValidateIcdCodesBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *v = ValidateIcdCodesBody(body) + return nil +} + +func (v *ValidateIcdCodesBody) MarshalJSON() ([]byte, error) { + type embed ValidateIcdCodesBody + var marshaler = struct { + embed + }{ + embed: embed(*v), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, v.explicitFields) + return json.Marshal(explicitMarshaler) +} diff --git a/labaccount/client.go b/labaccount/client.go new file mode 100644 index 0000000..e3da065 --- /dev/null +++ b/labaccount/client.go @@ -0,0 +1,49 @@ +// Code generated by Fern. DO NOT EDIT. + +package labaccount + +import ( + context "context" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + }, + ), + } +} + +func (c *Client) GetTeamLabAccounts( + ctx context.Context, + request *vitalgo.LabAccountGetTeamLabAccountsRequest, + opts ...option.RequestOption, +) (*vitalgo.GetTeamLabAccountsResponse, error) { + response, err := c.WithRawResponse.GetTeamLabAccounts( + ctx, + request, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/labaccount/raw_client.go b/labaccount/raw_client.go new file mode 100644 index 0000000..92bccc6 --- /dev/null +++ b/labaccount/raw_client.go @@ -0,0 +1,79 @@ +// Code generated by Fern. DO NOT EDIT. + +package labaccount + +import ( + context "context" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" + http "net/http" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + }, + ), + } +} + +func (r *RawClient) GetTeamLabAccounts( + ctx context.Context, + request *vitalgo.LabAccountGetTeamLabAccountsRequest, + opts ...option.RequestOption, +) (*core.Response[*vitalgo.GetTeamLabAccountsResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.tryvital.io", + ) + endpointURL := baseURL + "/v3/lab_test/lab_account" + queryParams, err := internal.QueryValues(request) + if err != nil { + return nil, err + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *vitalgo.GetTeamLabAccountsResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(vitalgo.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*vitalgo.GetTeamLabAccountsResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/labreport/client.go b/labreport/client.go index 71c84e4..9b4233b 100644 --- a/labreport/client.go +++ b/labreport/client.go @@ -4,10 +4,10 @@ package labreport import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { @@ -32,7 +32,7 @@ func NewClient(options *core.RequestOptions) *Client { } } -// Creates a parse job, uploads the file to provider, persists the job row, +// Creates a parse job, uploads the file(s) to provider, persists the job row, // and starts the ParseLabReport. Returns a generated job_id. func (c *Client) ParserCreateJob( ctx context.Context, diff --git a/labreport/raw_client.go b/labreport/raw_client.go index 177bee3..013d24a 100644 --- a/labreport/raw_client.go +++ b/labreport/raw_client.go @@ -5,10 +5,10 @@ package labreport import ( context "context" fmt "fmt" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) @@ -48,8 +48,10 @@ func (r *RawClient) ParserCreateJob( options.ToHeader(), ) writer := internal.NewMultipartWriter() - if err := writer.WriteFile("file", request.File); err != nil { - return nil, err + for _, f := range request.File { + if err := writer.WriteFile("file", f); err != nil { + return nil, err + } } if err := writer.WriteField("user_id", request.UserId); err != nil { return nil, err diff --git a/labtests/client.go b/labtests/client.go index f850df1..0a97bce 100644 --- a/labtests/client.go +++ b/labtests/client.go @@ -4,10 +4,10 @@ package labtests import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" io "io" ) @@ -103,7 +103,7 @@ func (c *Client) UpdateLabTest( return response.Body, nil } -// GET all the markers for the given lab. +// List active and orderable markers for a given Lab. Note that reflex markers are not included. func (c *Client) GetMarkers( ctx context.Context, request *vitalgo.LabTestsGetMarkersRequest, @@ -136,6 +136,7 @@ func (c *Client) GetMarkersForOrderSet( return response.Body, nil } +// List all markers for a given Lab Test, as well as any associated reflex markers. func (c *Client) GetMarkersForLabTest( ctx context.Context, labTestId string, @@ -518,7 +519,7 @@ func (c *Client) BookPscAppointment( ctx context.Context, // Your Order ID. orderId string, - request *vitalgo.AppointmentBookingRequest, + request *vitalgo.LabTestsBookPscAppointmentRequest, opts ...option.RequestOption, ) (*vitalgo.ClientFacingAppointment, error) { response, err := c.WithRawResponse.BookPscAppointment( diff --git a/labtests/raw_client.go b/labtests/raw_client.go index 46e32b0..f94e0f9 100644 --- a/labtests/raw_client.go +++ b/labtests/raw_client.go @@ -5,10 +5,10 @@ package labtests import ( bytes "bytes" context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" io "io" http "net/http" ) @@ -1314,7 +1314,7 @@ func (r *RawClient) BookPscAppointment( ctx context.Context, // Your Order ID. orderId string, - request *vitalgo.AppointmentBookingRequest, + request *vitalgo.LabTestsBookPscAppointmentRequest, opts ...option.RequestOption, ) (*core.Response[*vitalgo.ClientFacingAppointment], error) { options := core.NewRequestOptions(opts...) @@ -1331,6 +1331,13 @@ func (r *RawClient) BookPscAppointment( r.options.ToHeader(), options.ToHeader(), ) + if request.IdempotencyKey != nil { + headers.Add("x-idempotency-key", *request.IdempotencyKey) + } + if request.IdempotencyError != nil { + headers.Add("x-idempotency-error", *request.IdempotencyError) + } + headers.Add("Content-Type", "application/json") var response *vitalgo.ClientFacingAppointment raw, err := r.caller.Call( ctx, diff --git a/link.go b/link.go index ef0713f..5f32304 100644 --- a/link.go +++ b/link.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) @@ -62,6 +62,27 @@ func (b *BulkExportConnectionsBody) SetNextToken(nextToken *string) { b.require(bulkExportConnectionsBodyFieldNextToken) } +func (b *BulkExportConnectionsBody) UnmarshalJSON(data []byte) error { + type unmarshaler BulkExportConnectionsBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *b = BulkExportConnectionsBody(body) + return nil +} + +func (b *BulkExportConnectionsBody) MarshalJSON() ([]byte, error) { + type embed BulkExportConnectionsBody + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( bulkImportConnectionsBodyFieldTeamId = big.NewInt(1 << 0) bulkImportConnectionsBodyFieldProvider = big.NewInt(1 << 1) @@ -72,7 +93,7 @@ var ( type BulkImportConnectionsBody struct { TeamId *LinkBulkImportRequestTeamId `json:"-" url:"team_id,omitempty"` Provider OAuthProviders `json:"provider" url:"-"` - Connections []*ConnectionRecipe `json:"connections,omitempty" url:"-"` + Connections []*ConnectionRecipe `json:"connections" url:"-"` // Whether or not the endpoint should wait for the Bulk Op to complete before responding. // // When `wait_for_completion` is enabled, the endpoint may respond 200 OK if the Bulk Op takes less than 20 seconds to complete. @@ -120,6 +141,27 @@ func (b *BulkImportConnectionsBody) SetWaitForCompletion(waitForCompletion *bool b.require(bulkImportConnectionsBodyFieldWaitForCompletion) } +func (b *BulkImportConnectionsBody) UnmarshalJSON(data []byte) error { + type unmarshaler BulkImportConnectionsBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *b = BulkImportConnectionsBody(body) + return nil +} + +func (b *BulkImportConnectionsBody) MarshalJSON() ([]byte, error) { + type embed BulkImportConnectionsBody + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( bulkPauseConnectionsBodyFieldTeamId = big.NewInt(1 << 0) bulkPauseConnectionsBodyFieldUserIds = big.NewInt(1 << 1) @@ -128,7 +170,7 @@ var ( type BulkPauseConnectionsBody struct { TeamId *LinkBulkPauseRequestTeamId `json:"-" url:"team_id,omitempty"` - UserIds []string `json:"user_ids,omitempty" url:"-"` + UserIds []string `json:"user_ids" url:"-"` Provider OAuthProviders `json:"provider" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted @@ -163,6 +205,27 @@ func (b *BulkPauseConnectionsBody) SetProvider(provider OAuthProviders) { b.require(bulkPauseConnectionsBodyFieldProvider) } +func (b *BulkPauseConnectionsBody) UnmarshalJSON(data []byte) error { + type unmarshaler BulkPauseConnectionsBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *b = BulkPauseConnectionsBody(body) + return nil +} + +func (b *BulkPauseConnectionsBody) MarshalJSON() ([]byte, error) { + type embed BulkPauseConnectionsBody + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( bulkTriggerHistoricalPullBodyFieldTeamId = big.NewInt(1 << 0) bulkTriggerHistoricalPullBodyFieldUserIds = big.NewInt(1 << 1) @@ -172,7 +235,7 @@ var ( type BulkTriggerHistoricalPullBody struct { TeamId *LinkBulkTriggerHistoricalPullRequestTeamId `json:"-" url:"team_id,omitempty"` - UserIds []string `json:"user_ids,omitempty" url:"-"` + UserIds []string `json:"user_ids" url:"-"` Provider OAuthProviders `json:"provider" url:"-"` // Whether or not the endpoint should wait for the Bulk Op to complete before responding. // @@ -221,6 +284,27 @@ func (b *BulkTriggerHistoricalPullBody) SetWaitForCompletion(waitForCompletion * b.require(bulkTriggerHistoricalPullBodyFieldWaitForCompletion) } +func (b *BulkTriggerHistoricalPullBody) UnmarshalJSON(data []byte) error { + type unmarshaler BulkTriggerHistoricalPullBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *b = BulkTriggerHistoricalPullBody(body) + return nil +} + +func (b *BulkTriggerHistoricalPullBody) MarshalJSON() ([]byte, error) { + type embed BulkTriggerHistoricalPullBody + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( linkCodeCreateRequestFieldUserId = big.NewInt(1 << 0) linkCodeCreateRequestFieldExpiresAt = big.NewInt(1 << 1) @@ -290,6 +374,27 @@ func (c *CompletePasswordProviderMfaBody) SetMfaCode(mfaCode string) { c.require(completePasswordProviderMfaBodyFieldMfaCode) } +func (c *CompletePasswordProviderMfaBody) UnmarshalJSON(data []byte) error { + type unmarshaler CompletePasswordProviderMfaBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CompletePasswordProviderMfaBody(body) + return nil +} + +func (c *CompletePasswordProviderMfaBody) MarshalJSON() ([]byte, error) { + type embed CompletePasswordProviderMfaBody + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( demoConnectionCreationPayloadFieldUserId = big.NewInt(1 << 0) demoConnectionCreationPayloadFieldProvider = big.NewInt(1 << 1) @@ -326,6 +431,27 @@ func (d *DemoConnectionCreationPayload) SetProvider(provider DemoProviders) { d.require(demoConnectionCreationPayloadFieldProvider) } +func (d *DemoConnectionCreationPayload) UnmarshalJSON(data []byte) error { + type unmarshaler DemoConnectionCreationPayload + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *d = DemoConnectionCreationPayload(body) + return nil +} + +func (d *DemoConnectionCreationPayload) MarshalJSON() ([]byte, error) { + type embed DemoConnectionCreationPayload + var marshaler = struct { + embed + }{ + embed: embed(*d), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( emailProviderAuthLinkFieldVitalLinkToken = big.NewInt(1 << 0) emailProviderAuthLinkFieldEmail = big.NewInt(1 << 1) @@ -378,14 +504,41 @@ func (e *EmailProviderAuthLink) SetRegion(region *Region) { e.require(emailProviderAuthLinkFieldRegion) } +func (e *EmailProviderAuthLink) UnmarshalJSON(data []byte) error { + type unmarshaler EmailProviderAuthLink + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *e = EmailProviderAuthLink(body) + return nil +} + +func (e *EmailProviderAuthLink) MarshalJSON() ([]byte, error) { + type embed EmailProviderAuthLink + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( - manualConnectionDataFieldUserId = big.NewInt(1 << 0) - manualConnectionDataFieldProviderId = big.NewInt(1 << 1) + manualConnectionDataFieldVitalIosSdkVersion = big.NewInt(1 << 0) + manualConnectionDataFieldVitalAndroidSdkVersion = big.NewInt(1 << 1) + manualConnectionDataFieldUserId = big.NewInt(1 << 2) + manualConnectionDataFieldProviderId = big.NewInt(1 << 3) + manualConnectionDataFieldGrantedPermissions = big.NewInt(1 << 4) ) type ManualConnectionData struct { - UserId string `json:"user_id" url:"-"` - ProviderId *string `json:"provider_id,omitempty" url:"-"` + VitalIosSdkVersion *string `json:"-" url:"-"` + VitalAndroidSdkVersion *string `json:"-" url:"-"` + UserId string `json:"user_id" url:"-"` + ProviderId *string `json:"provider_id,omitempty" url:"-"` + GrantedPermissions []string `json:"granted_permissions,omitempty" url:"-"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -398,6 +551,20 @@ func (m *ManualConnectionData) require(field *big.Int) { m.explicitFields.Or(m.explicitFields, field) } +// SetVitalIosSdkVersion sets the VitalIosSdkVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *ManualConnectionData) SetVitalIosSdkVersion(vitalIosSdkVersion *string) { + m.VitalIosSdkVersion = vitalIosSdkVersion + m.require(manualConnectionDataFieldVitalIosSdkVersion) +} + +// SetVitalAndroidSdkVersion sets the VitalAndroidSdkVersion field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *ManualConnectionData) SetVitalAndroidSdkVersion(vitalAndroidSdkVersion *string) { + m.VitalAndroidSdkVersion = vitalAndroidSdkVersion + m.require(manualConnectionDataFieldVitalAndroidSdkVersion) +} + // SetUserId sets the UserId field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (m *ManualConnectionData) SetUserId(userId string) { @@ -412,6 +579,34 @@ func (m *ManualConnectionData) SetProviderId(providerId *string) { m.require(manualConnectionDataFieldProviderId) } +// SetGrantedPermissions sets the GrantedPermissions field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *ManualConnectionData) SetGrantedPermissions(grantedPermissions []string) { + m.GrantedPermissions = grantedPermissions + m.require(manualConnectionDataFieldGrantedPermissions) +} + +func (m *ManualConnectionData) UnmarshalJSON(data []byte) error { + type unmarshaler ManualConnectionData + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *m = ManualConnectionData(body) + return nil +} + +func (m *ManualConnectionData) MarshalJSON() ([]byte, error) { + type embed ManualConnectionData + var marshaler = struct { + embed + }{ + embed: embed(*m), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, m.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( individualProviderDataFieldVitalLinkToken = big.NewInt(1 << 0) individualProviderDataFieldUsername = big.NewInt(1 << 1) @@ -467,6 +662,27 @@ func (i *IndividualProviderData) SetRegion(region *Region) { i.require(individualProviderDataFieldRegion) } +func (i *IndividualProviderData) UnmarshalJSON(data []byte) error { + type unmarshaler IndividualProviderData + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *i = IndividualProviderData(body) + return nil +} + +func (i *IndividualProviderData) MarshalJSON() ([]byte, error) { + type embed IndividualProviderData + var marshaler = struct { + embed + }{ + embed: embed(*i), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, i.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( emailAuthLinkFieldVitalLinkToken = big.NewInt(1 << 0) emailAuthLinkFieldEmail = big.NewInt(1 << 1) @@ -528,6 +744,27 @@ func (e *EmailAuthLink) SetRegion(region *Region) { e.require(emailAuthLinkFieldRegion) } +func (e *EmailAuthLink) UnmarshalJSON(data []byte) error { + type unmarshaler EmailAuthLink + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *e = EmailAuthLink(body) + return nil +} + +func (e *EmailAuthLink) MarshalJSON() ([]byte, error) { + type embed EmailAuthLink + var marshaler = struct { + embed + }{ + embed: embed(*e), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, e.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( linkGenerateOauthLinkRequestFieldVitalLinkToken = big.NewInt(1 << 0) ) @@ -603,6 +840,27 @@ func (l *LinkTokenValidationRequest) SetToken(token string) { l.require(linkTokenValidationRequestFieldToken) } +func (l *LinkTokenValidationRequest) UnmarshalJSON(data []byte) error { + type unmarshaler LinkTokenValidationRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *l = LinkTokenValidationRequest(body) + return nil +} + +func (l *LinkTokenValidationRequest) MarshalJSON() ([]byte, error) { + type embed LinkTokenValidationRequest + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( linkListBulkOpsRequestFieldNextCursor = big.NewInt(1 << 0) linkListBulkOpsRequestFieldPageSize = big.NewInt(1 << 1) @@ -707,6 +965,27 @@ func (p *PasswordAuthLink) SetAuthType(authType AuthType) { p.require(passwordAuthLinkFieldAuthType) } +func (p *PasswordAuthLink) UnmarshalJSON(data []byte) error { + type unmarshaler PasswordAuthLink + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *p = PasswordAuthLink(body) + return nil +} + +func (p *PasswordAuthLink) MarshalJSON() ([]byte, error) { + type embed PasswordAuthLink + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( beginLinkTokenRequestFieldLinkToken = big.NewInt(1 << 0) beginLinkTokenRequestFieldProvider = big.NewInt(1 << 1) @@ -741,6 +1020,27 @@ func (b *BeginLinkTokenRequest) SetProvider(provider Providers) { b.require(beginLinkTokenRequestFieldProvider) } +func (b *BeginLinkTokenRequest) UnmarshalJSON(data []byte) error { + type unmarshaler BeginLinkTokenRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *b = BeginLinkTokenRequest(body) + return nil +} + +func (b *BeginLinkTokenRequest) MarshalJSON() ([]byte, error) { + type embed BeginLinkTokenRequest + var marshaler = struct { + embed + }{ + embed: embed(*b), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( linkTokenExchangeFieldUserId = big.NewInt(1 << 0) linkTokenExchangeFieldProvider = big.NewInt(1 << 1) @@ -829,6 +1129,27 @@ func (l *LinkTokenExchange) SetOnClose(onClose *string) { l.require(linkTokenExchangeFieldOnClose) } +func (l *LinkTokenExchange) UnmarshalJSON(data []byte) error { + type unmarshaler LinkTokenExchange + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *l = LinkTokenExchange(body) + return nil +} + +func (l *LinkTokenExchange) MarshalJSON() ([]byte, error) { + type embed LinkTokenExchange + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( linkTokenStateRequestFieldVitalLinkToken = big.NewInt(1 << 0) ) @@ -1813,6 +2134,7 @@ const ( ManualProvidersAppleHealthKit ManualProviders = "apple_health_kit" ManualProvidersManual ManualProviders = "manual" ManualProvidersHealthConnect ManualProviders = "health_connect" + ManualProvidersSamsungHealth ManualProviders = "samsung_health" ) func NewManualProvidersFromString(s string) (ManualProviders, error) { @@ -1835,6 +2157,8 @@ func NewManualProvidersFromString(s string) (ManualProviders, error) { return ManualProvidersManual, nil case "health_connect": return ManualProvidersHealthConnect, nil + case "samsung_health": + return ManualProvidersSamsungHealth, nil } var t ManualProviders return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -1924,6 +2248,7 @@ const ( PasswordProvidersMyFitnessPal PasswordProviders = "my_fitness_pal" PasswordProvidersKardia PasswordProviders = "kardia" PasswordProvidersAbbottLibreview PasswordProviders = "abbott_libreview" + PasswordProvidersTandemSource PasswordProviders = "tandem_source" ) func NewPasswordProvidersFromString(s string) (PasswordProviders, error) { @@ -1950,6 +2275,8 @@ func NewPasswordProvidersFromString(s string) (PasswordProviders, error) { return PasswordProvidersKardia, nil case "abbott_libreview": return PasswordProvidersAbbottLibreview, nil + case "tandem_source": + return PasswordProvidersTandemSource, nil } var t PasswordProviders return "", fmt.Errorf("%s is not a valid %T", s, t) diff --git a/link/client.go b/link/client.go index 10f3b64..d9d2419 100644 --- a/link/client.go +++ b/link/client.go @@ -4,10 +4,10 @@ package link import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/link/raw_client.go b/link/raw_client.go index b3084e5..8136e9f 100644 --- a/link/raw_client.go +++ b/link/raw_client.go @@ -4,10 +4,10 @@ package link import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) @@ -856,6 +856,12 @@ func (r *RawClient) ConnectManualProvider( r.options.ToHeader(), options.ToHeader(), ) + if request.VitalIosSdkVersion != nil { + headers.Add("x-vital-ios-sdk-version", *request.VitalIosSdkVersion) + } + if request.VitalAndroidSdkVersion != nil { + headers.Add("x-vital-android-sdk-version", *request.VitalAndroidSdkVersion) + } headers.Add("Content-Type", "application/json") var response map[string]bool raw, err := r.caller.Call( diff --git a/meal.go b/meal.go index 22333d0..59c6e15 100644 --- a/meal.go +++ b/meal.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/meal/client.go b/meal/client.go index 93417b1..ca45ee9 100644 --- a/meal/client.go +++ b/meal/client.go @@ -4,10 +4,10 @@ package meal import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/meal/raw_client.go b/meal/raw_client.go index 41fc4df..b68499e 100644 --- a/meal/raw_client.go +++ b/meal/raw_client.go @@ -4,10 +4,10 @@ package meal import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/menstrual_cycle.go b/menstrual_cycle.go index be0329a..0d2927c 100644 --- a/menstrual_cycle.go +++ b/menstrual_cycle.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/menstrualcycle/client.go b/menstrualcycle/client.go index b45e6c4..247eb58 100644 --- a/menstrualcycle/client.go +++ b/menstrualcycle/client.go @@ -4,10 +4,10 @@ package menstrualcycle import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/menstrualcycle/raw_client.go b/menstrualcycle/raw_client.go index dc2fbb2..6a2f9b8 100644 --- a/menstrualcycle/raw_client.go +++ b/menstrualcycle/raw_client.go @@ -4,10 +4,10 @@ package menstrualcycle import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/option/request_option.go b/option/request_option.go index dc7ff50..93c0df2 100644 --- a/option/request_option.go +++ b/option/request_option.go @@ -3,7 +3,7 @@ package option import ( - core "github.com/tryVital/vital-go/core" + core "github.com/tryVital/vital-go/v2/core" http "net/http" url "net/url" ) diff --git a/order.go b/order.go index dc81d93..0ca0270 100644 --- a/order.go +++ b/order.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/order/client.go b/order/client.go index 252ad29..af23907 100644 --- a/order/client.go +++ b/order/client.go @@ -4,10 +4,10 @@ package order import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/order/raw_client.go b/order/raw_client.go index 26357b7..e396f71 100644 --- a/order/raw_client.go +++ b/order/raw_client.go @@ -4,10 +4,10 @@ package order import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/order_transaction.go b/order_transaction.go new file mode 100644 index 0000000..009c9af --- /dev/null +++ b/order_transaction.go @@ -0,0 +1,328 @@ +// Code generated by Fern. DO NOT EDIT. + +package api + +import ( + json "encoding/json" + fmt "fmt" + internal "github.com/tryVital/vital-go/v2/internal" + big "math/big" + time "time" +) + +var ( + getOrderTransactionResponseFieldId = big.NewInt(1 << 0) + getOrderTransactionResponseFieldTeamId = big.NewInt(1 << 1) + getOrderTransactionResponseFieldStatus = big.NewInt(1 << 2) + getOrderTransactionResponseFieldOrders = big.NewInt(1 << 3) +) + +type GetOrderTransactionResponse struct { + Id string `json:"id" url:"id"` + TeamId string `json:"team_id" url:"team_id"` + Status OrderTransactionStatus `json:"status" url:"status"` + Orders []*OrderSummary `json:"orders,omitempty" url:"orders,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *GetOrderTransactionResponse) GetId() string { + if g == nil { + return "" + } + return g.Id +} + +func (g *GetOrderTransactionResponse) GetTeamId() string { + if g == nil { + return "" + } + return g.TeamId +} + +func (g *GetOrderTransactionResponse) GetStatus() OrderTransactionStatus { + if g == nil { + return "" + } + return g.Status +} + +func (g *GetOrderTransactionResponse) GetOrders() []*OrderSummary { + if g == nil { + return nil + } + return g.Orders +} + +func (g *GetOrderTransactionResponse) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *GetOrderTransactionResponse) require(field *big.Int) { + if g.explicitFields == nil { + g.explicitFields = big.NewInt(0) + } + g.explicitFields.Or(g.explicitFields, field) +} + +// SetId sets the Id field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetOrderTransactionResponse) SetId(id string) { + g.Id = id + g.require(getOrderTransactionResponseFieldId) +} + +// SetTeamId sets the TeamId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetOrderTransactionResponse) SetTeamId(teamId string) { + g.TeamId = teamId + g.require(getOrderTransactionResponseFieldTeamId) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetOrderTransactionResponse) SetStatus(status OrderTransactionStatus) { + g.Status = status + g.require(getOrderTransactionResponseFieldStatus) +} + +// SetOrders sets the Orders field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (g *GetOrderTransactionResponse) SetOrders(orders []*OrderSummary) { + g.Orders = orders + g.require(getOrderTransactionResponseFieldOrders) +} + +func (g *GetOrderTransactionResponse) UnmarshalJSON(data []byte) error { + type unmarshaler GetOrderTransactionResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GetOrderTransactionResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *g) + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *GetOrderTransactionResponse) MarshalJSON() ([]byte, error) { + type embed GetOrderTransactionResponse + var marshaler = struct { + embed + }{ + embed: embed(*g), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, g.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (g *GetOrderTransactionResponse) String() string { + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + +// Lightweight order summary. +var ( + orderSummaryFieldId = big.NewInt(1 << 0) + orderSummaryFieldOrigin = big.NewInt(1 << 1) + orderSummaryFieldParentId = big.NewInt(1 << 2) + orderSummaryFieldLastStatus = big.NewInt(1 << 3) + orderSummaryFieldLastStatusCreatedAt = big.NewInt(1 << 4) + orderSummaryFieldUpdatedAt = big.NewInt(1 << 5) + orderSummaryFieldCreatedAt = big.NewInt(1 << 6) +) + +type OrderSummary struct { + Id string `json:"id" url:"id"` + Origin *OrderOrigin `json:"origin,omitempty" url:"origin,omitempty"` + ParentId *string `json:"parent_id,omitempty" url:"parent_id,omitempty"` + LastStatus OrderLowLevelStatus `json:"last_status" url:"last_status"` + LastStatusCreatedAt time.Time `json:"last_status_created_at" url:"last_status_created_at"` + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + CreatedAt time.Time `json:"created_at" url:"created_at"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (o *OrderSummary) GetId() string { + if o == nil { + return "" + } + return o.Id +} + +func (o *OrderSummary) GetOrigin() *OrderOrigin { + if o == nil { + return nil + } + return o.Origin +} + +func (o *OrderSummary) GetParentId() *string { + if o == nil { + return nil + } + return o.ParentId +} + +func (o *OrderSummary) GetLastStatus() OrderLowLevelStatus { + if o == nil { + return "" + } + return o.LastStatus +} + +func (o *OrderSummary) GetLastStatusCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.LastStatusCreatedAt +} + +func (o *OrderSummary) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +func (o *OrderSummary) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *OrderSummary) GetExtraProperties() map[string]interface{} { + return o.extraProperties +} + +func (o *OrderSummary) require(field *big.Int) { + if o.explicitFields == nil { + o.explicitFields = big.NewInt(0) + } + o.explicitFields.Or(o.explicitFields, field) +} + +// SetId sets the Id field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetId(id string) { + o.Id = id + o.require(orderSummaryFieldId) +} + +// SetOrigin sets the Origin field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetOrigin(origin *OrderOrigin) { + o.Origin = origin + o.require(orderSummaryFieldOrigin) +} + +// SetParentId sets the ParentId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetParentId(parentId *string) { + o.ParentId = parentId + o.require(orderSummaryFieldParentId) +} + +// SetLastStatus sets the LastStatus field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetLastStatus(lastStatus OrderLowLevelStatus) { + o.LastStatus = lastStatus + o.require(orderSummaryFieldLastStatus) +} + +// SetLastStatusCreatedAt sets the LastStatusCreatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetLastStatusCreatedAt(lastStatusCreatedAt time.Time) { + o.LastStatusCreatedAt = lastStatusCreatedAt + o.require(orderSummaryFieldLastStatusCreatedAt) +} + +// SetUpdatedAt sets the UpdatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetUpdatedAt(updatedAt time.Time) { + o.UpdatedAt = updatedAt + o.require(orderSummaryFieldUpdatedAt) +} + +// SetCreatedAt sets the CreatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (o *OrderSummary) SetCreatedAt(createdAt time.Time) { + o.CreatedAt = createdAt + o.require(orderSummaryFieldCreatedAt) +} + +func (o *OrderSummary) UnmarshalJSON(data []byte) error { + type embed OrderSummary + var unmarshaler = struct { + embed + LastStatusCreatedAt *internal.DateTime `json:"last_status_created_at"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*o), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *o = OrderSummary(unmarshaler.embed) + o.LastStatusCreatedAt = unmarshaler.LastStatusCreatedAt.Time() + o.UpdatedAt = unmarshaler.UpdatedAt.Time() + o.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *o) + if err != nil { + return err + } + o.extraProperties = extraProperties + o.rawJSON = json.RawMessage(data) + return nil +} + +func (o *OrderSummary) MarshalJSON() ([]byte, error) { + type embed OrderSummary + var marshaler = struct { + embed + LastStatusCreatedAt *internal.DateTime `json:"last_status_created_at"` + UpdatedAt *internal.DateTime `json:"updated_at"` + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*o), + LastStatusCreatedAt: internal.NewDateTime(o.LastStatusCreatedAt), + UpdatedAt: internal.NewDateTime(o.UpdatedAt), + CreatedAt: internal.NewDateTime(o.CreatedAt), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, o.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (o *OrderSummary) String() string { + if len(o.rawJSON) > 0 { + if value, err := internal.StringifyJSON(o.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(o); err == nil { + return value + } + return fmt.Sprintf("%#v", o) +} diff --git a/ordertransaction/client.go b/ordertransaction/client.go new file mode 100644 index 0000000..cda9896 --- /dev/null +++ b/ordertransaction/client.go @@ -0,0 +1,82 @@ +// Code generated by Fern. DO NOT EDIT. + +package ordertransaction + +import ( + context "context" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" + io "io" +) + +type Client struct { + WithRawResponse *RawClient + + options *core.RequestOptions + baseURL string + caller *internal.Caller +} + +func NewClient(options *core.RequestOptions) *Client { + return &Client{ + WithRawResponse: NewRawClient(options), + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + }, + ), + } +} + +func (c *Client) GetTransaction( + ctx context.Context, + transactionId string, + opts ...option.RequestOption, +) (*vitalgo.GetOrderTransactionResponse, error) { + response, err := c.WithRawResponse.GetTransaction( + ctx, + transactionId, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +func (c *Client) GetTransactionResult( + ctx context.Context, + transactionId string, + opts ...option.RequestOption, +) (*vitalgo.LabResultsRaw, error) { + response, err := c.WithRawResponse.GetTransactionResult( + ctx, + transactionId, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} + +func (c *Client) GetTransactionResultPdf( + ctx context.Context, + transactionId string, + opts ...option.RequestOption, +) (io.Reader, error) { + response, err := c.WithRawResponse.GetTransactionResultPdf( + ctx, + transactionId, + opts..., + ) + if err != nil { + return nil, err + } + return response.Body, nil +} diff --git a/ordertransaction/raw_client.go b/ordertransaction/raw_client.go new file mode 100644 index 0000000..9256e05 --- /dev/null +++ b/ordertransaction/raw_client.go @@ -0,0 +1,165 @@ +// Code generated by Fern. DO NOT EDIT. + +package ordertransaction + +import ( + bytes "bytes" + context "context" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" + io "io" + http "net/http" +) + +type RawClient struct { + baseURL string + caller *internal.Caller + options *core.RequestOptions +} + +func NewRawClient(options *core.RequestOptions) *RawClient { + return &RawClient{ + options: options, + baseURL: options.BaseURL, + caller: internal.NewCaller( + &internal.CallerParams{ + Client: options.HTTPClient, + MaxAttempts: options.MaxAttempts, + }, + ), + } +} + +func (r *RawClient) GetTransaction( + ctx context.Context, + transactionId string, + opts ...option.RequestOption, +) (*core.Response[*vitalgo.GetOrderTransactionResponse], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.tryvital.io", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v3/order_transaction/%v", + transactionId, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *vitalgo.GetOrderTransactionResponse + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(vitalgo.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*vitalgo.GetOrderTransactionResponse]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetTransactionResult( + ctx context.Context, + transactionId string, + opts ...option.RequestOption, +) (*core.Response[*vitalgo.LabResultsRaw], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.tryvital.io", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v3/order_transaction/%v/result", + transactionId, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + var response *vitalgo.LabResultsRaw + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: &response, + ErrorDecoder: internal.NewErrorDecoder(vitalgo.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[*vitalgo.LabResultsRaw]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} + +func (r *RawClient) GetTransactionResultPdf( + ctx context.Context, + transactionId string, + opts ...option.RequestOption, +) (*core.Response[io.Reader], error) { + options := core.NewRequestOptions(opts...) + baseURL := internal.ResolveBaseURL( + options.BaseURL, + r.baseURL, + "https://api.tryvital.io", + ) + endpointURL := internal.EncodeURL( + baseURL+"/v3/order_transaction/%v/result/pdf", + transactionId, + ) + headers := internal.MergeHeaders( + r.options.ToHeader(), + options.ToHeader(), + ) + response := bytes.NewBuffer(nil) + raw, err := r.caller.Call( + ctx, + &internal.CallParams{ + URL: endpointURL, + Method: http.MethodGet, + Headers: headers, + MaxAttempts: options.MaxAttempts, + BodyProperties: options.BodyProperties, + QueryParameters: options.QueryParameters, + Client: options.HTTPClient, + Response: response, + ErrorDecoder: internal.NewErrorDecoder(vitalgo.ErrorCodes), + }, + ) + if err != nil { + return nil, err + } + return &core.Response[io.Reader]{ + StatusCode: raw.StatusCode, + Header: raw.Header, + Body: response, + }, nil +} diff --git a/payor.go b/payor.go index a3d3197..fb4d73c 100644 --- a/payor.go +++ b/payor.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" ) @@ -18,7 +18,7 @@ var ( type CreatePayorBody struct { Name string `json:"name" url:"-"` - Address *Address `json:"address,omitempty" url:"-"` + Address *Address `json:"address" url:"-"` Provider *PayorCodeExternalProvider `json:"provider,omitempty" url:"-"` ProviderPayorId *string `json:"provider_payor_id,omitempty" url:"-"` @@ -61,6 +61,27 @@ func (c *CreatePayorBody) SetProviderPayorId(providerPayorId *string) { c.require(createPayorBodyFieldProviderPayorId) } +func (c *CreatePayorBody) UnmarshalJSON(data []byte) error { + type unmarshaler CreatePayorBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CreatePayorBody(body) + return nil +} + +func (c *CreatePayorBody) MarshalJSON() ([]byte, error) { + type embed CreatePayorBody + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( clientFacingPayorFieldPayorCode = big.NewInt(1 << 0) clientFacingPayorFieldName = big.NewInt(1 << 1) diff --git a/payor/client.go b/payor/client.go index 48ad8e4..a4be1e6 100644 --- a/payor/client.go +++ b/payor/client.go @@ -4,10 +4,10 @@ package payor import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/payor/raw_client.go b/payor/raw_client.go index 943d328..07b0914 100644 --- a/payor/raw_client.go +++ b/payor/raw_client.go @@ -4,10 +4,10 @@ package payor import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/pointer.go b/pointer.go index faaf462..f9a8177 100644 --- a/pointer.go +++ b/pointer.go @@ -16,6 +16,11 @@ func Byte(b byte) *byte { return &b } +// Bytes returns a pointer to the given []byte value. +func Bytes(b []byte) *[]byte { + return &b +} + // Complex64 returns a pointer to the given complex64 value. func Complex64(c complex64) *complex64 { return &c diff --git a/profile.go b/profile.go index f59af33..0efd663 100644 --- a/profile.go +++ b/profile.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/profile/client.go b/profile/client.go index 836291f..410e6b5 100644 --- a/profile/client.go +++ b/profile/client.go @@ -4,10 +4,10 @@ package profile import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/profile/raw_client.go b/profile/raw_client.go index d17825c..1369a8d 100644 --- a/profile/raw_client.go +++ b/profile/raw_client.go @@ -4,10 +4,10 @@ package profile import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/providers.go b/providers.go index 8df605c..d539447 100644 --- a/providers.go +++ b/providers.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" ) diff --git a/providers/client.go b/providers/client.go index 8a3d6cd..a0da8b9 100644 --- a/providers/client.go +++ b/providers/client.go @@ -4,10 +4,10 @@ package providers import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/providers/raw_client.go b/providers/raw_client.go index c731771..ecc9410 100644 --- a/providers/raw_client.go +++ b/providers/raw_client.go @@ -4,10 +4,10 @@ package providers import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/reference.md b/reference.md index e2b07c2..f27b0e1 100644 --- a/reference.md +++ b/reference.md @@ -726,11 +726,7 @@ Check link token state - can be hit continuously used as heartbeat
```go -request := &vitalgo.LinkTokenStateRequest{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), - } +request := &vitalgo.LinkTokenStateRequest{} client.Link.TokenState( context.TODO(), request, @@ -790,9 +786,6 @@ Deprecated. Use `POST /v2/link/provider/email/{provider}` instead. ```go request := &vitalgo.EmailAuthLink{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), Email: "email", Provider: vitalgo.ProvidersOura, AuthType: vitalgo.AuthTypePassword, @@ -888,9 +881,6 @@ Deprecated. Use `POST /v2/link/provider/password/{provider}` instead. ```go request := &vitalgo.PasswordAuthLink{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), Username: "username", Password: "password", Provider: vitalgo.ProvidersOura, @@ -986,11 +976,7 @@ This endpoint generates an OAuth link for oauth provider
```go -request := &vitalgo.LinkGenerateOauthLinkRequest{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), - } +request := &vitalgo.LinkGenerateOauthLinkRequest{} client.Link.GenerateOauthLink( context.TODO(), vitalgo.OAuthProvidersOura.Ptr(), @@ -1059,9 +1045,6 @@ This connects auth providers that are password based. ```go request := &vitalgo.IndividualProviderData{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), Username: "username", Password: "password", } @@ -1157,9 +1140,6 @@ This connects auth providers that are password based. ```go request := &vitalgo.CompletePasswordProviderMfaBody{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), MfaCode: "mfa_code", } client.Link.CompletePasswordProviderMfa( @@ -1238,9 +1218,6 @@ This connects auth providers that are email based. ```go request := &vitalgo.EmailProviderAuthLink{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), Email: "email", } client.Link.ConnectEmailAuthProvider( @@ -1336,11 +1313,7 @@ GET List of all available providers given the generated link token.
```go -request := &vitalgo.LinkGetAllProvidersRequest{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), - } +request := &vitalgo.LinkGetAllProvidersRequest{} client.Link.GetAllProviders( context.TODO(), request, @@ -1416,6 +1389,22 @@ client.Link.ConnectManualProvider(
+**vitalIosSdkVersion:** `*string` + +
+
+ +
+
+ +**vitalAndroidSdkVersion:** `*string` + +
+
+ +
+
+ **userId:** `string`
@@ -1426,6 +1415,14 @@ client.Link.ConnectManualProvider( **providerId:** `*string` +
+ + +
+
+ +**grantedPermissions:** `[]string` +
@@ -10647,7 +10644,7 @@ request := &vitalgo.UserInfoCreateRequest{ PhoneNumber: "phone_number", Gender: "gender", Dob: "dob", - Address: &vitalgo.Address{ + Address: &vitalgo.UserAddress{ FirstLine: "first_line", Country: "country", Zip: "zip", @@ -10731,7 +10728,7 @@ client.User.UpsertUserInfo(
-**address:** `*vitalgo.Address` +**address:** `*vitalgo.UserAddress`
@@ -11446,11 +11443,7 @@ Post teams.
```go -request := &vitalgo.TeamGetLinkConfigRequest{ - VitalLinkToken: vitalgo.String( - "x-vital-link-token", - ), - } +request := &vitalgo.TeamGetLinkConfigRequest{} client.Team.GetLinkConfig( context.TODO(), request, @@ -12240,6 +12233,22 @@ client.LabTests.Create( **fasting:** `*bool` +
+ + +
+
+ +**labAccountId:** `*string` + +
+
+ +
+
+ +**labSlug:** `*vitalgo.Labs` +
@@ -12396,7 +12405,7 @@ client.LabTests.UpdateLabTest(
-GET all the markers for the given lab. +List active and orderable markers for a given Lab. Note that reflex markers are not included.
@@ -12412,6 +12421,9 @@ GET all the markers for the given lab. ```go request := &vitalgo.LabTestsGetMarkersRequest{ + LabSlug: vitalgo.String( + "lab_slug", + ), Name: vitalgo.String( "name", ), @@ -12455,6 +12467,14 @@ client.LabTests.GetMarkers(
+**labSlug:** `*string` — The slug of the lab for these markers. If both lab_id and lab_slug are provided, lab_slug will be used. + +
+
+ +
+
+ **name:** `*string` — The name or test code of an individual biomarker or a panel.
@@ -12572,6 +12592,20 @@ client.LabTests.GetMarkersForOrderSet(
+#### 📝 Description + +
+
+ +
+
+ +List all markers for a given Lab Test, as well as any associated reflex markers. +
+
+
+
+ #### 🔌 Usage
@@ -13038,6 +13072,9 @@ request := &vitalgo.LabTestsGetOrdersRequest{ ShippingRecipientName: vitalgo.String( "shipping_recipient_name", ), + OrderTransactionId: vitalgo.String( + "order_transaction_id", + ), Page: vitalgo.Int( 1, ), @@ -13192,6 +13229,14 @@ client.LabTests.GetOrders(
+**orderTransactionId:** `*string` — Filter by order transaction ID + +
+
+ +
+
+ **page:** `*int`
@@ -13434,6 +13479,14 @@ client.LabTests.RequestPhlebotomyAppointment( **provider:** `*vitalgo.AppointmentProvider` +
+
+ +
+
+ +**appointmentNotes:** `*string` +
@@ -14211,9 +14264,7 @@ client.LabTests.GetLabelsPdf( ```go request := &vitalgo.LabTestsGetPscAppointmentAvailabilityRequest{ - Lab: vitalgo.AppointmentPscLabs( - "quest", - ), + Lab: vitalgo.AppointmentPscLabsQuest, StartDate: vitalgo.String( "start_date", ), @@ -14221,6 +14272,9 @@ request := &vitalgo.LabTestsGetPscAppointmentAvailabilityRequest{ "zip_code", ), Radius: vitalgo.AllowedRadiusTen.Ptr(), + AllowStale: vitalgo.Bool( + true, + ), } client.LabTests.GetPscAppointmentAvailability( context.TODO(), @@ -14241,7 +14295,7 @@ client.LabTests.GetPscAppointmentAvailability(
-**lab:** `vitalgo.AppointmentPscLabs` — Lab to check for availability +**lab:** `*vitalgo.AppointmentPscLabs` — Lab to check for availability
@@ -14275,6 +14329,14 @@ client.LabTests.GetPscAppointmentAvailability( **radius:** `*vitalgo.AllowedRadius` — Radius in which to search. (meters) + +
+ +
+
+ +**allowStale:** `*bool` — If true, allows cached availability data to be returned. +
@@ -14298,8 +14360,10 @@ client.LabTests.GetPscAppointmentAvailability(
```go -request := &vitalgo.AppointmentBookingRequest{ - BookingKey: "booking_key", +request := &vitalgo.LabTestsBookPscAppointmentRequest{ + Body: &vitalgo.AppointmentBookingRequest{ + BookingKey: "booking_key", + }, } client.LabTests.BookPscAppointment( context.TODO(), @@ -14329,6 +14393,22 @@ client.LabTests.BookPscAppointment(
+**idempotencyKey:** `*string` — [!] This feature (Idempotency Key) is under closed beta. Idempotency Key support for booking PSC appointment. + +
+
+ +
+
+ +**idempotencyError:** `*string` — If `no-cache`, applies idempotency only to successful outcomes. + +
+
+ +
+
+ **request:** `*vitalgo.AppointmentBookingRequest`
@@ -14793,9 +14873,6 @@ client.LabTests.GetOrder( ```go request := &vitalgo.CreateOrderRequestCompatible{ - IdempotencyKey: vitalgo.String( - "X-Idempotency-Key", - ), UserId: "user_id", PatientDetails: &vitalgo.PatientDetailsWithValidation{ FirstName: "first_name", @@ -14952,6 +15029,14 @@ client.LabTests.CreateOrder(
+**clinicalNotes:** `*string` + +
+
+ +
+
+ **labAccountId:** `*string`
@@ -15370,6 +15455,383 @@ client.LabTests.ValidateIcdCodes(
+
+ + + +## Compendium +
client.Compendium.Search(request) -> *vitalgo.SearchCompendiumResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &vitalgo.SearchCompendiumBody{ + TeamId: vitalgo.CompendiumSearchRequestTeamIdInferFromContext.Ptr(), + Mode: vitalgo.SearchModeCanonical, + } +client.Compendium.Search( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**teamId:** `*vitalgo.CompendiumSearchRequestTeamId` + +
+
+ +
+
+ +**mode:** `*vitalgo.SearchMode` + +
+
+ +
+
+ +**query:** `*string` + +
+
+ +
+
+ +**cptCodes:** `[]string` + +
+
+ +
+
+ +**loincSetHash:** `*string` + +
+
+ +
+
+ +**labs:** `[]*vitalgo.CompendiumSearchLabs` + +
+
+ +
+
+ +**includeRelated:** `*bool` + +
+
+ +
+
+ +**limit:** `*int` + +
+
+
+
+ + +
+
+
+ +
client.Compendium.Convert(request) -> *vitalgo.ConvertCompendiumResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &vitalgo.ConvertCompendiumBody{ + TeamId: vitalgo.CompendiumConvertRequestTeamIdInferFromContext.Ptr(), + TargetLab: vitalgo.CompendiumSearchLabsLabcorp, + } +client.Compendium.Convert( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**teamId:** `*vitalgo.CompendiumConvertRequestTeamId` + +
+
+ +
+
+ +**labTestId:** `*string` + +
+
+ +
+
+ +**providerIds:** `[]string` + +
+
+ +
+
+ +**targetLab:** `*vitalgo.CompendiumSearchLabs` + +
+
+ +
+
+ +**limit:** `*int` + +
+
+
+
+ + +
+
+
+ +## LabAccount +
client.LabAccount.GetTeamLabAccounts() -> *vitalgo.GetTeamLabAccountsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +request := &vitalgo.LabAccountGetTeamLabAccountsRequest{ + LabAccountId: vitalgo.String( + "lab_account_id", + ), + Status: vitalgo.LabAccountStatusActive.Ptr(), + } +client.LabAccount.GetTeamLabAccounts( + context.TODO(), + request, + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**labAccountId:** `*string` + +
+
+ +
+
+ +**status:** `*vitalgo.LabAccountStatus` + +
+
+
+
+ + +
+
+
+ +## OrderTransaction +
client.OrderTransaction.GetTransaction(TransactionId) -> *vitalgo.GetOrderTransactionResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.OrderTransaction.GetTransaction( + context.TODO(), + "transaction_id", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**transactionId:** `string` + +
+
+
+
+ + +
+
+
+ +
client.OrderTransaction.GetTransactionResult(TransactionId) -> *vitalgo.LabResultsRaw +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.OrderTransaction.GetTransactionResult( + context.TODO(), + "transaction_id", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**transactionId:** `string` + +
+
+
+
+ + +
+
+
+ +
client.OrderTransaction.GetTransactionResultPdf(TransactionId) -> string +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```go +client.OrderTransaction.GetTransactionResultPdf( + context.TODO(), + "transaction_id", + ) +} +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**transactionId:** `string` + +
+
+
+
+ +
@@ -15934,7 +16396,7 @@ client.Payor.CreatePayor(
-Creates a parse job, uploads the file to provider, persists the job row, +Creates a parse job, uploads the file(s) to provider, persists the job row, and starts the ParseLabReport. Returns a generated job_id.
diff --git a/sleep.go b/sleep.go index de987bd..2270504 100644 --- a/sleep.go +++ b/sleep.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/sleep/client.go b/sleep/client.go index 60fbd29..64cc3e5 100644 --- a/sleep/client.go +++ b/sleep/client.go @@ -4,10 +4,10 @@ package sleep import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/sleep/raw_client.go b/sleep/raw_client.go index ff3b3bf..f4e2743 100644 --- a/sleep/raw_client.go +++ b/sleep/raw_client.go @@ -4,10 +4,10 @@ package sleep import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/sleep_cycle.go b/sleep_cycle.go index 717b346..ff0a8c0 100644 --- a/sleep_cycle.go +++ b/sleep_cycle.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/sleepcycle/client.go b/sleepcycle/client.go index 8899d76..5f73109 100644 --- a/sleepcycle/client.go +++ b/sleepcycle/client.go @@ -4,10 +4,10 @@ package sleepcycle import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/sleepcycle/raw_client.go b/sleepcycle/raw_client.go index d583a67..fb2f3ec 100644 --- a/sleepcycle/raw_client.go +++ b/sleepcycle/raw_client.go @@ -4,10 +4,10 @@ package sleepcycle import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/team.go b/team.go index 8f70f0f..d0e4993 100644 --- a/team.go +++ b/team.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/team/client.go b/team/client.go index 558e9e8..456869c 100644 --- a/team/client.go +++ b/team/client.go @@ -4,10 +4,10 @@ package team import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/team/raw_client.go b/team/raw_client.go index babe524..5df6612 100644 --- a/team/raw_client.go +++ b/team/raw_client.go @@ -4,10 +4,10 @@ package team import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/testkit.go b/testkit.go index cb1066f..17e5504 100644 --- a/testkit.go +++ b/testkit.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" ) @@ -20,7 +20,7 @@ var ( type CreateRegistrableTestkitOrderRequest struct { UserId string `json:"user_id" url:"-"` LabTestId string `json:"lab_test_id" url:"-"` - ShippingDetails *ShippingAddressWithValidation `json:"shipping_details,omitempty" url:"-"` + ShippingDetails *ShippingAddressWithValidation `json:"shipping_details" url:"-"` Passthrough *string `json:"passthrough,omitempty" url:"-"` LabAccountId *string `json:"lab_account_id,omitempty" url:"-"` @@ -70,6 +70,27 @@ func (c *CreateRegistrableTestkitOrderRequest) SetLabAccountId(labAccountId *str c.require(createRegistrableTestkitOrderRequestFieldLabAccountId) } +func (c *CreateRegistrableTestkitOrderRequest) UnmarshalJSON(data []byte) error { + type unmarshaler CreateRegistrableTestkitOrderRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CreateRegistrableTestkitOrderRequest(body) + return nil +} + +func (c *CreateRegistrableTestkitOrderRequest) MarshalJSON() ([]byte, error) { + type embed CreateRegistrableTestkitOrderRequest + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( registerTestkitRequestFieldUserId = big.NewInt(1 << 0) registerTestkitRequestFieldSampleId = big.NewInt(1 << 1) @@ -84,8 +105,8 @@ type RegisterTestkitRequest struct { // The user ID of the patient. UserId *string `json:"user_id,omitempty" url:"-"` SampleId string `json:"sample_id" url:"-"` - PatientDetails *PatientDetailsWithValidation `json:"patient_details,omitempty" url:"-"` - PatientAddress *PatientAddressWithValidation `json:"patient_address,omitempty" url:"-"` + PatientDetails *PatientDetailsWithValidation `json:"patient_details" url:"-"` + PatientAddress *PatientAddressWithValidation `json:"patient_address" url:"-"` Physician *PhysicianCreateRequestBase `json:"physician,omitempty" url:"-"` HealthInsurance *HealthInsuranceCreateRequest `json:"health_insurance,omitempty" url:"-"` Consents []*Consent `json:"consents,omitempty" url:"-"` @@ -150,6 +171,27 @@ func (r *RegisterTestkitRequest) SetConsents(consents []*Consent) { r.require(registerTestkitRequestFieldConsents) } +func (r *RegisterTestkitRequest) UnmarshalJSON(data []byte) error { + type unmarshaler RegisterTestkitRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *r = RegisterTestkitRequest(body) + return nil +} + +func (r *RegisterTestkitRequest) MarshalJSON() ([]byte, error) { + type embed RegisterTestkitRequest + var marshaler = struct { + embed + }{ + embed: embed(*r), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( physicianCreateRequestBaseFieldFirstName = big.NewInt(1 << 0) physicianCreateRequestBaseFieldLastName = big.NewInt(1 << 1) diff --git a/testkit/client.go b/testkit/client.go index 153971e..66d45c2 100644 --- a/testkit/client.go +++ b/testkit/client.go @@ -4,10 +4,10 @@ package testkit import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/testkit/raw_client.go b/testkit/raw_client.go index be0cfc0..b2a32f7 100644 --- a/testkit/raw_client.go +++ b/testkit/raw_client.go @@ -4,10 +4,10 @@ package testkit import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/types.go b/types.go index e6f9c36..48810f1 100644 --- a/types.go +++ b/types.go @@ -5,27 +5,29 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) var ( - addressFieldFirstLine = big.NewInt(1 << 0) - addressFieldSecondLine = big.NewInt(1 << 1) - addressFieldCountry = big.NewInt(1 << 2) - addressFieldZip = big.NewInt(1 << 3) - addressFieldCity = big.NewInt(1 << 4) - addressFieldState = big.NewInt(1 << 5) + addressFieldFirstLine = big.NewInt(1 << 0) + addressFieldSecondLine = big.NewInt(1 << 1) + addressFieldCountry = big.NewInt(1 << 2) + addressFieldZip = big.NewInt(1 << 3) + addressFieldCity = big.NewInt(1 << 4) + addressFieldState = big.NewInt(1 << 5) + addressFieldAccessNotes = big.NewInt(1 << 6) ) type Address struct { - FirstLine string `json:"first_line" url:"first_line"` - SecondLine *string `json:"second_line,omitempty" url:"second_line,omitempty"` - Country string `json:"country" url:"country"` - Zip string `json:"zip" url:"zip"` - City string `json:"city" url:"city"` - State string `json:"state" url:"state"` + FirstLine string `json:"first_line" url:"first_line"` + SecondLine *string `json:"second_line,omitempty" url:"second_line,omitempty"` + Country string `json:"country" url:"country"` + Zip string `json:"zip" url:"zip"` + City string `json:"city" url:"city"` + State string `json:"state" url:"state"` + AccessNotes *string `json:"access_notes,omitempty" url:"access_notes,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -76,6 +78,13 @@ func (a *Address) GetState() string { return a.State } +func (a *Address) GetAccessNotes() *string { + if a == nil { + return nil + } + return a.AccessNotes +} + func (a *Address) GetExtraProperties() map[string]interface{} { return a.extraProperties } @@ -129,6 +138,13 @@ func (a *Address) SetState(state string) { a.require(addressFieldState) } +// SetAccessNotes sets the AccessNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (a *Address) SetAccessNotes(accessNotes *string) { + a.AccessNotes = accessNotes + a.require(addressFieldAccessNotes) +} + func (a *Address) UnmarshalJSON(data []byte) error { type unmarshaler Address var value unmarshaler @@ -385,6 +401,381 @@ func (b Billing) Ptr() *Billing { return &b } +// Represent the schema for an individual biomarker result. +var ( + biomarkerResultFieldName = big.NewInt(1 << 0) + biomarkerResultFieldSlug = big.NewInt(1 << 1) + biomarkerResultFieldResult = big.NewInt(1 << 2) + biomarkerResultFieldType = big.NewInt(1 << 3) + biomarkerResultFieldUnit = big.NewInt(1 << 4) + biomarkerResultFieldTimestamp = big.NewInt(1 << 5) + biomarkerResultFieldNotes = big.NewInt(1 << 6) + biomarkerResultFieldReferenceRange = big.NewInt(1 << 7) + biomarkerResultFieldMinRangeValue = big.NewInt(1 << 8) + biomarkerResultFieldMaxRangeValue = big.NewInt(1 << 9) + biomarkerResultFieldIsAboveMaxRange = big.NewInt(1 << 10) + biomarkerResultFieldIsBelowMinRange = big.NewInt(1 << 11) + biomarkerResultFieldInterpretation = big.NewInt(1 << 12) + biomarkerResultFieldLoinc = big.NewInt(1 << 13) + biomarkerResultFieldLoincSlug = big.NewInt(1 << 14) + biomarkerResultFieldProviderId = big.NewInt(1 << 15) + biomarkerResultFieldSourceMarkers = big.NewInt(1 << 16) + biomarkerResultFieldPerformingLaboratory = big.NewInt(1 << 17) + biomarkerResultFieldSourceSampleId = big.NewInt(1 << 18) +) + +type BiomarkerResult struct { + Name string `json:"name" url:"name"` + Slug *string `json:"slug,omitempty" url:"slug,omitempty"` + Result string `json:"result" url:"result"` + Type ResultType `json:"type" url:"type"` + Unit *string `json:"unit,omitempty" url:"unit,omitempty"` + Timestamp *time.Time `json:"timestamp,omitempty" url:"timestamp,omitempty"` + Notes *string `json:"notes,omitempty" url:"notes,omitempty"` + ReferenceRange *string `json:"reference_range,omitempty" url:"reference_range,omitempty"` + MinRangeValue *float64 `json:"min_range_value,omitempty" url:"min_range_value,omitempty"` + MaxRangeValue *float64 `json:"max_range_value,omitempty" url:"max_range_value,omitempty"` + IsAboveMaxRange *bool `json:"is_above_max_range,omitempty" url:"is_above_max_range,omitempty"` + IsBelowMinRange *bool `json:"is_below_min_range,omitempty" url:"is_below_min_range,omitempty"` + Interpretation *string `json:"interpretation,omitempty" url:"interpretation,omitempty"` + Loinc *string `json:"loinc,omitempty" url:"loinc,omitempty"` + LoincSlug *string `json:"loinc_slug,omitempty" url:"loinc_slug,omitempty"` + ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` + SourceMarkers []*ParentBiomarkerData `json:"source_markers,omitempty" url:"source_markers,omitempty"` + PerformingLaboratory *string `json:"performing_laboratory,omitempty" url:"performing_laboratory,omitempty"` + SourceSampleId *string `json:"source_sample_id,omitempty" url:"source_sample_id,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BiomarkerResult) GetName() string { + if b == nil { + return "" + } + return b.Name +} + +func (b *BiomarkerResult) GetSlug() *string { + if b == nil { + return nil + } + return b.Slug +} + +func (b *BiomarkerResult) GetResult() string { + if b == nil { + return "" + } + return b.Result +} + +func (b *BiomarkerResult) GetType() ResultType { + if b == nil { + return "" + } + return b.Type +} + +func (b *BiomarkerResult) GetUnit() *string { + if b == nil { + return nil + } + return b.Unit +} + +func (b *BiomarkerResult) GetTimestamp() *time.Time { + if b == nil { + return nil + } + return b.Timestamp +} + +func (b *BiomarkerResult) GetNotes() *string { + if b == nil { + return nil + } + return b.Notes +} + +func (b *BiomarkerResult) GetReferenceRange() *string { + if b == nil { + return nil + } + return b.ReferenceRange +} + +func (b *BiomarkerResult) GetMinRangeValue() *float64 { + if b == nil { + return nil + } + return b.MinRangeValue +} + +func (b *BiomarkerResult) GetMaxRangeValue() *float64 { + if b == nil { + return nil + } + return b.MaxRangeValue +} + +func (b *BiomarkerResult) GetIsAboveMaxRange() *bool { + if b == nil { + return nil + } + return b.IsAboveMaxRange +} + +func (b *BiomarkerResult) GetIsBelowMinRange() *bool { + if b == nil { + return nil + } + return b.IsBelowMinRange +} + +func (b *BiomarkerResult) GetInterpretation() *string { + if b == nil { + return nil + } + return b.Interpretation +} + +func (b *BiomarkerResult) GetLoinc() *string { + if b == nil { + return nil + } + return b.Loinc +} + +func (b *BiomarkerResult) GetLoincSlug() *string { + if b == nil { + return nil + } + return b.LoincSlug +} + +func (b *BiomarkerResult) GetProviderId() *string { + if b == nil { + return nil + } + return b.ProviderId +} + +func (b *BiomarkerResult) GetSourceMarkers() []*ParentBiomarkerData { + if b == nil { + return nil + } + return b.SourceMarkers +} + +func (b *BiomarkerResult) GetPerformingLaboratory() *string { + if b == nil { + return nil + } + return b.PerformingLaboratory +} + +func (b *BiomarkerResult) GetSourceSampleId() *string { + if b == nil { + return nil + } + return b.SourceSampleId +} + +func (b *BiomarkerResult) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BiomarkerResult) require(field *big.Int) { + if b.explicitFields == nil { + b.explicitFields = big.NewInt(0) + } + b.explicitFields.Or(b.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetName(name string) { + b.Name = name + b.require(biomarkerResultFieldName) +} + +// SetSlug sets the Slug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetSlug(slug *string) { + b.Slug = slug + b.require(biomarkerResultFieldSlug) +} + +// SetResult sets the Result field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetResult(result string) { + b.Result = result + b.require(biomarkerResultFieldResult) +} + +// SetType sets the Type field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetType(type_ ResultType) { + b.Type = type_ + b.require(biomarkerResultFieldType) +} + +// SetUnit sets the Unit field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetUnit(unit *string) { + b.Unit = unit + b.require(biomarkerResultFieldUnit) +} + +// SetTimestamp sets the Timestamp field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetTimestamp(timestamp *time.Time) { + b.Timestamp = timestamp + b.require(biomarkerResultFieldTimestamp) +} + +// SetNotes sets the Notes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetNotes(notes *string) { + b.Notes = notes + b.require(biomarkerResultFieldNotes) +} + +// SetReferenceRange sets the ReferenceRange field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetReferenceRange(referenceRange *string) { + b.ReferenceRange = referenceRange + b.require(biomarkerResultFieldReferenceRange) +} + +// SetMinRangeValue sets the MinRangeValue field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetMinRangeValue(minRangeValue *float64) { + b.MinRangeValue = minRangeValue + b.require(biomarkerResultFieldMinRangeValue) +} + +// SetMaxRangeValue sets the MaxRangeValue field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetMaxRangeValue(maxRangeValue *float64) { + b.MaxRangeValue = maxRangeValue + b.require(biomarkerResultFieldMaxRangeValue) +} + +// SetIsAboveMaxRange sets the IsAboveMaxRange field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetIsAboveMaxRange(isAboveMaxRange *bool) { + b.IsAboveMaxRange = isAboveMaxRange + b.require(biomarkerResultFieldIsAboveMaxRange) +} + +// SetIsBelowMinRange sets the IsBelowMinRange field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetIsBelowMinRange(isBelowMinRange *bool) { + b.IsBelowMinRange = isBelowMinRange + b.require(biomarkerResultFieldIsBelowMinRange) +} + +// SetInterpretation sets the Interpretation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetInterpretation(interpretation *string) { + b.Interpretation = interpretation + b.require(biomarkerResultFieldInterpretation) +} + +// SetLoinc sets the Loinc field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetLoinc(loinc *string) { + b.Loinc = loinc + b.require(biomarkerResultFieldLoinc) +} + +// SetLoincSlug sets the LoincSlug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetLoincSlug(loincSlug *string) { + b.LoincSlug = loincSlug + b.require(biomarkerResultFieldLoincSlug) +} + +// SetProviderId sets the ProviderId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetProviderId(providerId *string) { + b.ProviderId = providerId + b.require(biomarkerResultFieldProviderId) +} + +// SetSourceMarkers sets the SourceMarkers field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetSourceMarkers(sourceMarkers []*ParentBiomarkerData) { + b.SourceMarkers = sourceMarkers + b.require(biomarkerResultFieldSourceMarkers) +} + +// SetPerformingLaboratory sets the PerformingLaboratory field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetPerformingLaboratory(performingLaboratory *string) { + b.PerformingLaboratory = performingLaboratory + b.require(biomarkerResultFieldPerformingLaboratory) +} + +// SetSourceSampleId sets the SourceSampleId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (b *BiomarkerResult) SetSourceSampleId(sourceSampleId *string) { + b.SourceSampleId = sourceSampleId + b.require(biomarkerResultFieldSourceSampleId) +} + +func (b *BiomarkerResult) UnmarshalJSON(data []byte) error { + type embed BiomarkerResult + var unmarshaler = struct { + embed + Timestamp *internal.DateTime `json:"timestamp,omitempty"` + }{ + embed: embed(*b), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *b = BiomarkerResult(unmarshaler.embed) + b.Timestamp = unmarshaler.Timestamp.TimePtr() + extraProperties, err := internal.ExtractExtraProperties(data, *b) + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BiomarkerResult) MarshalJSON() ([]byte, error) { + type embed BiomarkerResult + var marshaler = struct { + embed + Timestamp *internal.DateTime `json:"timestamp,omitempty"` + }{ + embed: embed(*b), + Timestamp: internal.NewOptionalDateTime(b.Timestamp), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, b.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (b *BiomarkerResult) String() string { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + var ( clientFacingActivityChangedFieldEventType = big.NewInt(1 << 0) clientFacingActivityChangedFieldUserId = big.NewInt(1 << 1) @@ -12273,96 +12664,380 @@ func (c *ClientFacingLab) String() string { } var ( - clientFacingLabTestFieldId = big.NewInt(1 << 0) - clientFacingLabTestFieldSlug = big.NewInt(1 << 1) - clientFacingLabTestFieldName = big.NewInt(1 << 2) - clientFacingLabTestFieldSampleType = big.NewInt(1 << 3) - clientFacingLabTestFieldMethod = big.NewInt(1 << 4) - clientFacingLabTestFieldPrice = big.NewInt(1 << 5) - clientFacingLabTestFieldIsActive = big.NewInt(1 << 6) - clientFacingLabTestFieldStatus = big.NewInt(1 << 7) - clientFacingLabTestFieldFasting = big.NewInt(1 << 8) - clientFacingLabTestFieldLab = big.NewInt(1 << 9) - clientFacingLabTestFieldMarkers = big.NewInt(1 << 10) - clientFacingLabTestFieldIsDelegated = big.NewInt(1 << 11) - clientFacingLabTestFieldAutoGenerated = big.NewInt(1 << 12) - clientFacingLabTestFieldHasCollectionInstructions = big.NewInt(1 << 13) - clientFacingLabTestFieldCommonTatDays = big.NewInt(1 << 14) - clientFacingLabTestFieldWorstCaseTatDays = big.NewInt(1 << 15) + clientFacingLabReportParsingJobCreatedEventFieldUserId = big.NewInt(1 << 0) + clientFacingLabReportParsingJobCreatedEventFieldClientUserId = big.NewInt(1 << 1) + clientFacingLabReportParsingJobCreatedEventFieldTeamId = big.NewInt(1 << 2) + clientFacingLabReportParsingJobCreatedEventFieldData = big.NewInt(1 << 3) ) -type ClientFacingLabTest struct { - Id string `json:"id" url:"id"` - Slug string `json:"slug" url:"slug"` - Name string `json:"name" url:"name"` - SampleType LabTestSampleType `json:"sample_type" url:"sample_type"` - Method LabTestCollectionMethod `json:"method" url:"method"` - Price float64 `json:"price" url:"price"` - // Deprecated. Use status instead. - IsActive bool `json:"is_active" url:"is_active"` - Status LabTestStatus `json:"status" url:"status"` - // Defines whether a lab test requires fasting. - Fasting *bool `json:"fasting,omitempty" url:"fasting,omitempty"` - Lab *ClientFacingLab `json:"lab,omitempty" url:"lab,omitempty"` - Markers []*ClientFacingMarker `json:"markers,omitempty" url:"markers,omitempty"` - // Deprecated and always false. Delegation is now at the lab account level. Used to denote whether a lab test requires using non-Vital physician networks. - IsDelegated *bool `json:"is_delegated,omitempty" url:"is_delegated,omitempty"` - // Whether the lab test was auto-generated by Vital - AutoGenerated *bool `json:"auto_generated,omitempty" url:"auto_generated,omitempty"` - // Whether or not the lab test has collection instructions. - HasCollectionInstructions *bool `json:"has_collection_instructions,omitempty" url:"has_collection_instructions,omitempty"` - // The common turnaround time in days for the lab test. This is the expected time for the lab to process the test and return results. - CommonTatDays *int `json:"common_tat_days,omitempty" url:"common_tat_days,omitempty"` - // The worst-case turnaround time in days for the lab test. This is the maximum time the lab may take to process the test and return results. - WorstCaseTatDays *int `json:"worst_case_tat_days,omitempty" url:"worst_case_tat_days,omitempty"` +type ClientFacingLabReportParsingJobCreatedEvent struct { + UserId string `json:"user_id" url:"user_id"` + ClientUserId string `json:"client_user_id" url:"client_user_id"` + TeamId string `json:"team_id" url:"team_id"` + Data *ParsingJob `json:"data" url:"data"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` + eventType string extraProperties map[string]interface{} rawJSON json.RawMessage } -func (c *ClientFacingLabTest) GetId() string { +func (c *ClientFacingLabReportParsingJobCreatedEvent) GetUserId() string { if c == nil { return "" } - return c.Id + return c.UserId } -func (c *ClientFacingLabTest) GetSlug() string { +func (c *ClientFacingLabReportParsingJobCreatedEvent) GetClientUserId() string { if c == nil { return "" } - return c.Slug + return c.ClientUserId } -func (c *ClientFacingLabTest) GetName() string { +func (c *ClientFacingLabReportParsingJobCreatedEvent) GetTeamId() string { if c == nil { return "" } - return c.Name + return c.TeamId } -func (c *ClientFacingLabTest) GetSampleType() LabTestSampleType { +func (c *ClientFacingLabReportParsingJobCreatedEvent) GetData() *ParsingJob { if c == nil { - return "" + return nil } - return c.SampleType + return c.Data } -func (c *ClientFacingLabTest) GetMethod() LabTestCollectionMethod { - if c == nil { - return "" - } - return c.Method +func (c *ClientFacingLabReportParsingJobCreatedEvent) EventType() string { + return c.eventType } -func (c *ClientFacingLabTest) GetPrice() float64 { - if c == nil { - return 0 - } - return c.Price +func (c *ClientFacingLabReportParsingJobCreatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientFacingLabReportParsingJobCreatedEvent) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetUserId sets the UserId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobCreatedEvent) SetUserId(userId string) { + c.UserId = userId + c.require(clientFacingLabReportParsingJobCreatedEventFieldUserId) +} + +// SetClientUserId sets the ClientUserId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobCreatedEvent) SetClientUserId(clientUserId string) { + c.ClientUserId = clientUserId + c.require(clientFacingLabReportParsingJobCreatedEventFieldClientUserId) +} + +// SetTeamId sets the TeamId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobCreatedEvent) SetTeamId(teamId string) { + c.TeamId = teamId + c.require(clientFacingLabReportParsingJobCreatedEventFieldTeamId) +} + +// SetData sets the Data field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobCreatedEvent) SetData(data *ParsingJob) { + c.Data = data + c.require(clientFacingLabReportParsingJobCreatedEventFieldData) +} + +func (c *ClientFacingLabReportParsingJobCreatedEvent) UnmarshalJSON(data []byte) error { + type embed ClientFacingLabReportParsingJobCreatedEvent + var unmarshaler = struct { + embed + EventType string `json:"event_type"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = ClientFacingLabReportParsingJobCreatedEvent(unmarshaler.embed) + if unmarshaler.EventType != "lab_report.parsing_job.created" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "lab_report.parsing_job.created", unmarshaler.EventType) + } + c.eventType = unmarshaler.EventType + extraProperties, err := internal.ExtractExtraProperties(data, *c, "event_type") + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientFacingLabReportParsingJobCreatedEvent) MarshalJSON() ([]byte, error) { + type embed ClientFacingLabReportParsingJobCreatedEvent + var marshaler = struct { + embed + EventType string `json:"event_type"` + }{ + embed: embed(*c), + EventType: "lab_report.parsing_job.created", + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ClientFacingLabReportParsingJobCreatedEvent) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + clientFacingLabReportParsingJobUpdatedEventFieldUserId = big.NewInt(1 << 0) + clientFacingLabReportParsingJobUpdatedEventFieldClientUserId = big.NewInt(1 << 1) + clientFacingLabReportParsingJobUpdatedEventFieldTeamId = big.NewInt(1 << 2) + clientFacingLabReportParsingJobUpdatedEventFieldData = big.NewInt(1 << 3) +) + +type ClientFacingLabReportParsingJobUpdatedEvent struct { + UserId string `json:"user_id" url:"user_id"` + ClientUserId string `json:"client_user_id" url:"client_user_id"` + TeamId string `json:"team_id" url:"team_id"` + Data *ParsingJob `json:"data" url:"data"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + eventType string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) GetUserId() string { + if c == nil { + return "" + } + return c.UserId +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) GetClientUserId() string { + if c == nil { + return "" + } + return c.ClientUserId +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) GetTeamId() string { + if c == nil { + return "" + } + return c.TeamId +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) GetData() *ParsingJob { + if c == nil { + return nil + } + return c.Data +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) EventType() string { + return c.eventType +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetUserId sets the UserId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobUpdatedEvent) SetUserId(userId string) { + c.UserId = userId + c.require(clientFacingLabReportParsingJobUpdatedEventFieldUserId) +} + +// SetClientUserId sets the ClientUserId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobUpdatedEvent) SetClientUserId(clientUserId string) { + c.ClientUserId = clientUserId + c.require(clientFacingLabReportParsingJobUpdatedEventFieldClientUserId) +} + +// SetTeamId sets the TeamId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobUpdatedEvent) SetTeamId(teamId string) { + c.TeamId = teamId + c.require(clientFacingLabReportParsingJobUpdatedEventFieldTeamId) +} + +// SetData sets the Data field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingLabReportParsingJobUpdatedEvent) SetData(data *ParsingJob) { + c.Data = data + c.require(clientFacingLabReportParsingJobUpdatedEventFieldData) +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) UnmarshalJSON(data []byte) error { + type embed ClientFacingLabReportParsingJobUpdatedEvent + var unmarshaler = struct { + embed + EventType string `json:"event_type"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = ClientFacingLabReportParsingJobUpdatedEvent(unmarshaler.embed) + if unmarshaler.EventType != "lab_report.parsing_job.updated" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "lab_report.parsing_job.updated", unmarshaler.EventType) + } + c.eventType = unmarshaler.EventType + extraProperties, err := internal.ExtractExtraProperties(data, *c, "event_type") + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) MarshalJSON() ([]byte, error) { + type embed ClientFacingLabReportParsingJobUpdatedEvent + var marshaler = struct { + embed + EventType string `json:"event_type"` + }{ + embed: embed(*c), + EventType: "lab_report.parsing_job.updated", + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ClientFacingLabReportParsingJobUpdatedEvent) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + clientFacingLabTestFieldId = big.NewInt(1 << 0) + clientFacingLabTestFieldSlug = big.NewInt(1 << 1) + clientFacingLabTestFieldName = big.NewInt(1 << 2) + clientFacingLabTestFieldSampleType = big.NewInt(1 << 3) + clientFacingLabTestFieldMethod = big.NewInt(1 << 4) + clientFacingLabTestFieldPrice = big.NewInt(1 << 5) + clientFacingLabTestFieldIsActive = big.NewInt(1 << 6) + clientFacingLabTestFieldStatus = big.NewInt(1 << 7) + clientFacingLabTestFieldFasting = big.NewInt(1 << 8) + clientFacingLabTestFieldLab = big.NewInt(1 << 9) + clientFacingLabTestFieldMarkers = big.NewInt(1 << 10) + clientFacingLabTestFieldIsDelegated = big.NewInt(1 << 11) + clientFacingLabTestFieldAutoGenerated = big.NewInt(1 << 12) + clientFacingLabTestFieldHasCollectionInstructions = big.NewInt(1 << 13) + clientFacingLabTestFieldCommonTatDays = big.NewInt(1 << 14) + clientFacingLabTestFieldWorstCaseTatDays = big.NewInt(1 << 15) +) + +type ClientFacingLabTest struct { + Id string `json:"id" url:"id"` + Slug string `json:"slug" url:"slug"` + Name string `json:"name" url:"name"` + SampleType LabTestSampleType `json:"sample_type" url:"sample_type"` + Method LabTestCollectionMethod `json:"method" url:"method"` + Price float64 `json:"price" url:"price"` + // Deprecated. Use status instead. + IsActive bool `json:"is_active" url:"is_active"` + Status LabTestStatus `json:"status" url:"status"` + // Defines whether a lab test requires fasting. + Fasting *bool `json:"fasting,omitempty" url:"fasting,omitempty"` + Lab *ClientFacingLab `json:"lab,omitempty" url:"lab,omitempty"` + Markers []*ClientFacingMarker `json:"markers,omitempty" url:"markers,omitempty"` + // Deprecated and always false. Delegation is now at the lab account level. Used to denote whether a lab test requires using non-Vital physician networks. + IsDelegated *bool `json:"is_delegated,omitempty" url:"is_delegated,omitempty"` + // Whether the lab test was auto-generated by Vital + AutoGenerated *bool `json:"auto_generated,omitempty" url:"auto_generated,omitempty"` + // Whether or not the lab test has collection instructions. + HasCollectionInstructions *bool `json:"has_collection_instructions,omitempty" url:"has_collection_instructions,omitempty"` + // The common turnaround time in days for the lab test. This is the expected time for the lab to process the test and return results. + CommonTatDays *int `json:"common_tat_days,omitempty" url:"common_tat_days,omitempty"` + // The worst-case turnaround time in days for the lab test. This is the maximum time the lab may take to process the test and return results. + WorstCaseTatDays *int `json:"worst_case_tat_days,omitempty" url:"worst_case_tat_days,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClientFacingLabTest) GetId() string { + if c == nil { + return "" + } + return c.Id +} + +func (c *ClientFacingLabTest) GetSlug() string { + if c == nil { + return "" + } + return c.Slug +} + +func (c *ClientFacingLabTest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *ClientFacingLabTest) GetSampleType() LabTestSampleType { + if c == nil { + return "" + } + return c.SampleType +} + +func (c *ClientFacingLabTest) GetMethod() LabTestCollectionMethod { + if c == nil { + return "" + } + return c.Method +} + +func (c *ClientFacingLabTest) GetPrice() float64 { + if c == nil { + return 0 + } + return c.Price } func (c *ClientFacingLabTest) GetIsActive() bool { @@ -14626,24 +15301,27 @@ var ( clientFacingOrderFieldDetails = big.NewInt(1 << 6) clientFacingOrderFieldSampleId = big.NewInt(1 << 7) clientFacingOrderFieldNotes = big.NewInt(1 << 8) - clientFacingOrderFieldCreatedAt = big.NewInt(1 << 9) - clientFacingOrderFieldUpdatedAt = big.NewInt(1 << 10) - clientFacingOrderFieldEvents = big.NewInt(1 << 11) - clientFacingOrderFieldStatus = big.NewInt(1 << 12) - clientFacingOrderFieldPhysician = big.NewInt(1 << 13) - clientFacingOrderFieldHealthInsuranceId = big.NewInt(1 << 14) - clientFacingOrderFieldRequisitionFormUrl = big.NewInt(1 << 15) - clientFacingOrderFieldPriority = big.NewInt(1 << 16) - clientFacingOrderFieldShippingDetails = big.NewInt(1 << 17) - clientFacingOrderFieldActivateBy = big.NewInt(1 << 18) - clientFacingOrderFieldPassthrough = big.NewInt(1 << 19) - clientFacingOrderFieldBillingType = big.NewInt(1 << 20) - clientFacingOrderFieldIcdCodes = big.NewInt(1 << 21) - clientFacingOrderFieldHasAbn = big.NewInt(1 << 22) - clientFacingOrderFieldInterpretation = big.NewInt(1 << 23) - clientFacingOrderFieldHasMissingResults = big.NewInt(1 << 24) - clientFacingOrderFieldExpectedResultByDate = big.NewInt(1 << 25) - clientFacingOrderFieldWorstCaseResultByDate = big.NewInt(1 << 26) + clientFacingOrderFieldClinicalNotes = big.NewInt(1 << 9) + clientFacingOrderFieldCreatedAt = big.NewInt(1 << 10) + clientFacingOrderFieldUpdatedAt = big.NewInt(1 << 11) + clientFacingOrderFieldEvents = big.NewInt(1 << 12) + clientFacingOrderFieldStatus = big.NewInt(1 << 13) + clientFacingOrderFieldPhysician = big.NewInt(1 << 14) + clientFacingOrderFieldHealthInsuranceId = big.NewInt(1 << 15) + clientFacingOrderFieldRequisitionFormUrl = big.NewInt(1 << 16) + clientFacingOrderFieldPriority = big.NewInt(1 << 17) + clientFacingOrderFieldShippingDetails = big.NewInt(1 << 18) + clientFacingOrderFieldActivateBy = big.NewInt(1 << 19) + clientFacingOrderFieldPassthrough = big.NewInt(1 << 20) + clientFacingOrderFieldBillingType = big.NewInt(1 << 21) + clientFacingOrderFieldIcdCodes = big.NewInt(1 << 22) + clientFacingOrderFieldHasAbn = big.NewInt(1 << 23) + clientFacingOrderFieldInterpretation = big.NewInt(1 << 24) + clientFacingOrderFieldHasMissingResults = big.NewInt(1 << 25) + clientFacingOrderFieldExpectedResultByDate = big.NewInt(1 << 26) + clientFacingOrderFieldWorstCaseResultByDate = big.NewInt(1 << 27) + clientFacingOrderFieldOrigin = big.NewInt(1 << 28) + clientFacingOrderFieldOrderTransaction = big.NewInt(1 << 29) ) type ClientFacingOrder struct { @@ -14663,7 +15341,8 @@ type ClientFacingOrder struct { // Sample ID SampleId *string `json:"sample_id,omitempty" url:"sample_id,omitempty"` // Notes associated with the order - Notes *string `json:"notes,omitempty" url:"notes,omitempty"` + Notes *string `json:"notes,omitempty" url:"notes,omitempty"` + ClinicalNotes *string `json:"clinical_notes,omitempty" url:"clinical_notes,omitempty"` // When your order was created CreatedAt time.Time `json:"created_at" url:"created_at"` // When your order was last updated. @@ -14693,7 +15372,9 @@ type ClientFacingOrder struct { // The common-case date by which the order result is expected to be available. ExpectedResultByDate *string `json:"expected_result_by_date,omitempty" url:"expected_result_by_date,omitempty"` // The latest date by which the order result is expected to be available. - WorstCaseResultByDate *string `json:"worst_case_result_by_date,omitempty" url:"worst_case_result_by_date,omitempty"` + WorstCaseResultByDate *string `json:"worst_case_result_by_date,omitempty" url:"worst_case_result_by_date,omitempty"` + Origin *OrderOrigin `json:"origin,omitempty" url:"origin,omitempty"` + OrderTransaction *ClientFacingOrderTransaction `json:"order_transaction,omitempty" url:"order_transaction,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -14765,6 +15446,13 @@ func (c *ClientFacingOrder) GetNotes() *string { return c.Notes } +func (c *ClientFacingOrder) GetClinicalNotes() *string { + if c == nil { + return nil + } + return c.ClinicalNotes +} + func (c *ClientFacingOrder) GetCreatedAt() time.Time { if c == nil { return time.Time{} @@ -14891,6 +15579,20 @@ func (c *ClientFacingOrder) GetWorstCaseResultByDate() *string { return c.WorstCaseResultByDate } +func (c *ClientFacingOrder) GetOrigin() *OrderOrigin { + if c == nil { + return nil + } + return c.Origin +} + +func (c *ClientFacingOrder) GetOrderTransaction() *ClientFacingOrderTransaction { + if c == nil { + return nil + } + return c.OrderTransaction +} + func (c *ClientFacingOrder) GetExtraProperties() map[string]interface{} { return c.extraProperties } @@ -14965,6 +15667,13 @@ func (c *ClientFacingOrder) SetNotes(notes *string) { c.require(clientFacingOrderFieldNotes) } +// SetClinicalNotes sets the ClinicalNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrder) SetClinicalNotes(clinicalNotes *string) { + c.ClinicalNotes = clinicalNotes + c.require(clientFacingOrderFieldClinicalNotes) +} + // SetCreatedAt sets the CreatedAt field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (c *ClientFacingOrder) SetCreatedAt(createdAt time.Time) { @@ -15091,6 +15800,20 @@ func (c *ClientFacingOrder) SetWorstCaseResultByDate(worstCaseResultByDate *stri c.require(clientFacingOrderFieldWorstCaseResultByDate) } +// SetOrigin sets the Origin field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrder) SetOrigin(origin *OrderOrigin) { + c.Origin = origin + c.require(clientFacingOrderFieldOrigin) +} + +// SetOrderTransaction sets the OrderTransaction field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrder) SetOrderTransaction(orderTransaction *ClientFacingOrderTransaction) { + c.OrderTransaction = orderTransaction + c.require(clientFacingOrderFieldOrderTransaction) +} + func (c *ClientFacingOrder) UnmarshalJSON(data []byte) error { type embed ClientFacingOrder var unmarshaler = struct { @@ -15422,65 +16145,384 @@ func (c *ClientFacingOrderDetails) Accept(visitor ClientFacingOrderDetailsVisito if c.Testkit != nil { return visitor.VisitTestkit(c.Testkit) } - if c.AtHomePhlebotomy != nil { - return visitor.VisitAtHomePhlebotomy(c.AtHomePhlebotomy) + if c.AtHomePhlebotomy != nil { + return visitor.VisitAtHomePhlebotomy(c.AtHomePhlebotomy) + } + if c.OnSiteCollection != nil { + return visitor.VisitOnSiteCollection(c.OnSiteCollection) + } + return fmt.Errorf("type %T does not define a non-empty union type", c) +} + +func (c *ClientFacingOrderDetails) validate() error { + if c == nil { + return fmt.Errorf("type %T is nil", c) + } + var fields []string + if c.WalkInTest != nil { + fields = append(fields, "walk_in_test") + } + if c.Testkit != nil { + fields = append(fields, "testkit") + } + if c.AtHomePhlebotomy != nil { + fields = append(fields, "at_home_phlebotomy") + } + if c.OnSiteCollection != nil { + fields = append(fields, "on_site_collection") + } + if len(fields) == 0 { + if c.Type != "" { + return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.Type) + } + return fmt.Errorf("type %T is empty", c) + } + if len(fields) > 1 { + return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + } + if c.Type != "" { + field := fields[0] + if c.Type != field { + return fmt.Errorf( + "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", + c, + c.Type, + c, + ) + } + } + return nil +} + +var ( + clientFacingOrderEventFieldId = big.NewInt(1 << 0) + clientFacingOrderEventFieldCreatedAt = big.NewInt(1 << 1) + clientFacingOrderEventFieldStatus = big.NewInt(1 << 2) + clientFacingOrderEventFieldStatusDetail = big.NewInt(1 << 3) +) + +type ClientFacingOrderEvent struct { + Id int `json:"id" url:"id"` + CreatedAt time.Time `json:"created_at" url:"created_at"` + Status OrderStatus `json:"status" url:"status"` + StatusDetail *OrderStatusDetail `json:"status_detail,omitempty" url:"status_detail,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClientFacingOrderEvent) GetId() int { + if c == nil { + return 0 + } + return c.Id +} + +func (c *ClientFacingOrderEvent) GetCreatedAt() time.Time { + if c == nil { + return time.Time{} + } + return c.CreatedAt +} + +func (c *ClientFacingOrderEvent) GetStatus() OrderStatus { + if c == nil { + return "" + } + return c.Status +} + +func (c *ClientFacingOrderEvent) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientFacingOrderEvent) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetId sets the Id field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderEvent) SetId(id int) { + c.Id = id + c.require(clientFacingOrderEventFieldId) +} + +// SetCreatedAt sets the CreatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderEvent) SetCreatedAt(createdAt time.Time) { + c.CreatedAt = createdAt + c.require(clientFacingOrderEventFieldCreatedAt) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderEvent) SetStatus(status OrderStatus) { + c.Status = status + c.require(clientFacingOrderEventFieldStatus) +} + +// SetStatusDetail sets the StatusDetail field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderEvent) SetStatusDetail(statusDetail *OrderStatusDetail) { + c.StatusDetail = statusDetail + c.require(clientFacingOrderEventFieldStatusDetail) +} + +func (c *ClientFacingOrderEvent) UnmarshalJSON(data []byte) error { + type embed ClientFacingOrderEvent + var unmarshaler = struct { + embed + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = ClientFacingOrderEvent(unmarshaler.embed) + c.CreatedAt = unmarshaler.CreatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientFacingOrderEvent) MarshalJSON() ([]byte, error) { + type embed ClientFacingOrderEvent + var marshaler = struct { + embed + CreatedAt *internal.DateTime `json:"created_at"` + }{ + embed: embed(*c), + CreatedAt: internal.NewDateTime(c.CreatedAt), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ClientFacingOrderEvent) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +// Minimal order info for embedding in order_transaction payload. +var ( + clientFacingOrderInTransactionFieldId = big.NewInt(1 << 0) + clientFacingOrderInTransactionFieldLowLevelStatus = big.NewInt(1 << 1) + clientFacingOrderInTransactionFieldLowLevelStatusCreatedAt = big.NewInt(1 << 2) + clientFacingOrderInTransactionFieldOrigin = big.NewInt(1 << 3) + clientFacingOrderInTransactionFieldParentId = big.NewInt(1 << 4) + clientFacingOrderInTransactionFieldCreatedAt = big.NewInt(1 << 5) + clientFacingOrderInTransactionFieldUpdatedAt = big.NewInt(1 << 6) +) + +type ClientFacingOrderInTransaction struct { + Id string `json:"id" url:"id"` + LowLevelStatus *OrderLowLevelStatus `json:"low_level_status,omitempty" url:"low_level_status,omitempty"` + LowLevelStatusCreatedAt *time.Time `json:"low_level_status_created_at,omitempty" url:"low_level_status_created_at,omitempty"` + Origin *OrderOrigin `json:"origin,omitempty" url:"origin,omitempty"` + ParentId *string `json:"parent_id,omitempty" url:"parent_id,omitempty"` + CreatedAt time.Time `json:"created_at" url:"created_at"` + UpdatedAt time.Time `json:"updated_at" url:"updated_at"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClientFacingOrderInTransaction) GetId() string { + if c == nil { + return "" + } + return c.Id +} + +func (c *ClientFacingOrderInTransaction) GetLowLevelStatus() *OrderLowLevelStatus { + if c == nil { + return nil + } + return c.LowLevelStatus +} + +func (c *ClientFacingOrderInTransaction) GetLowLevelStatusCreatedAt() *time.Time { + if c == nil { + return nil + } + return c.LowLevelStatusCreatedAt +} + +func (c *ClientFacingOrderInTransaction) GetOrigin() *OrderOrigin { + if c == nil { + return nil } - if c.OnSiteCollection != nil { - return visitor.VisitOnSiteCollection(c.OnSiteCollection) + return c.Origin +} + +func (c *ClientFacingOrderInTransaction) GetParentId() *string { + if c == nil { + return nil } - return fmt.Errorf("type %T does not define a non-empty union type", c) + return c.ParentId } -func (c *ClientFacingOrderDetails) validate() error { +func (c *ClientFacingOrderInTransaction) GetCreatedAt() time.Time { if c == nil { - return fmt.Errorf("type %T is nil", c) + return time.Time{} } - var fields []string - if c.WalkInTest != nil { - fields = append(fields, "walk_in_test") + return c.CreatedAt +} + +func (c *ClientFacingOrderInTransaction) GetUpdatedAt() time.Time { + if c == nil { + return time.Time{} } - if c.Testkit != nil { - fields = append(fields, "testkit") + return c.UpdatedAt +} + +func (c *ClientFacingOrderInTransaction) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientFacingOrderInTransaction) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) } - if c.AtHomePhlebotomy != nil { - fields = append(fields, "at_home_phlebotomy") + c.explicitFields.Or(c.explicitFields, field) +} + +// SetId sets the Id field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetId(id string) { + c.Id = id + c.require(clientFacingOrderInTransactionFieldId) +} + +// SetLowLevelStatus sets the LowLevelStatus field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetLowLevelStatus(lowLevelStatus *OrderLowLevelStatus) { + c.LowLevelStatus = lowLevelStatus + c.require(clientFacingOrderInTransactionFieldLowLevelStatus) +} + +// SetLowLevelStatusCreatedAt sets the LowLevelStatusCreatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetLowLevelStatusCreatedAt(lowLevelStatusCreatedAt *time.Time) { + c.LowLevelStatusCreatedAt = lowLevelStatusCreatedAt + c.require(clientFacingOrderInTransactionFieldLowLevelStatusCreatedAt) +} + +// SetOrigin sets the Origin field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetOrigin(origin *OrderOrigin) { + c.Origin = origin + c.require(clientFacingOrderInTransactionFieldOrigin) +} + +// SetParentId sets the ParentId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetParentId(parentId *string) { + c.ParentId = parentId + c.require(clientFacingOrderInTransactionFieldParentId) +} + +// SetCreatedAt sets the CreatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetCreatedAt(createdAt time.Time) { + c.CreatedAt = createdAt + c.require(clientFacingOrderInTransactionFieldCreatedAt) +} + +// SetUpdatedAt sets the UpdatedAt field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientFacingOrderInTransaction) SetUpdatedAt(updatedAt time.Time) { + c.UpdatedAt = updatedAt + c.require(clientFacingOrderInTransactionFieldUpdatedAt) +} + +func (c *ClientFacingOrderInTransaction) UnmarshalJSON(data []byte) error { + type embed ClientFacingOrderInTransaction + var unmarshaler = struct { + embed + LowLevelStatusCreatedAt *internal.DateTime `json:"low_level_status_created_at,omitempty"` + CreatedAt *internal.DateTime `json:"created_at"` + UpdatedAt *internal.DateTime `json:"updated_at"` + }{ + embed: embed(*c), } - if c.OnSiteCollection != nil { - fields = append(fields, "on_site_collection") + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err } - if len(fields) == 0 { - if c.Type != "" { - return fmt.Errorf("type %T defines a discriminant set to %q but the field is not set", c, c.Type) - } - return fmt.Errorf("type %T is empty", c) + *c = ClientFacingOrderInTransaction(unmarshaler.embed) + c.LowLevelStatusCreatedAt = unmarshaler.LowLevelStatusCreatedAt.TimePtr() + c.CreatedAt = unmarshaler.CreatedAt.Time() + c.UpdatedAt = unmarshaler.UpdatedAt.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err } - if len(fields) > 1 { - return fmt.Errorf("type %T defines values for %s, but only one value is allowed", c, fields) + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientFacingOrderInTransaction) MarshalJSON() ([]byte, error) { + type embed ClientFacingOrderInTransaction + var marshaler = struct { + embed + LowLevelStatusCreatedAt *internal.DateTime `json:"low_level_status_created_at,omitempty"` + CreatedAt *internal.DateTime `json:"created_at"` + UpdatedAt *internal.DateTime `json:"updated_at"` + }{ + embed: embed(*c), + LowLevelStatusCreatedAt: internal.NewOptionalDateTime(c.LowLevelStatusCreatedAt), + CreatedAt: internal.NewDateTime(c.CreatedAt), + UpdatedAt: internal.NewDateTime(c.UpdatedAt), } - if c.Type != "" { - field := fields[0] - if c.Type != field { - return fmt.Errorf( - "type %T defines a discriminant set to %q, but it does not match the %T field; either remove or update the discriminant to match", - c, - c.Type, - c, - ) + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ClientFacingOrderInTransaction) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value } } - return nil + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) } +// Order transaction info. var ( - clientFacingOrderEventFieldId = big.NewInt(1 << 0) - clientFacingOrderEventFieldCreatedAt = big.NewInt(1 << 1) - clientFacingOrderEventFieldStatus = big.NewInt(1 << 2) + clientFacingOrderTransactionFieldId = big.NewInt(1 << 0) + clientFacingOrderTransactionFieldStatus = big.NewInt(1 << 1) + clientFacingOrderTransactionFieldOrders = big.NewInt(1 << 2) ) -type ClientFacingOrderEvent struct { - Id int `json:"id" url:"id"` - CreatedAt time.Time `json:"created_at" url:"created_at"` - Status OrderStatus `json:"status" url:"status"` +type ClientFacingOrderTransaction struct { + Id string `json:"id" url:"id"` + Status OrderTransactionStatus `json:"status" url:"status"` + Orders []*ClientFacingOrderInTransaction `json:"orders" url:"orders"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` @@ -15489,32 +16531,32 @@ type ClientFacingOrderEvent struct { rawJSON json.RawMessage } -func (c *ClientFacingOrderEvent) GetId() int { +func (c *ClientFacingOrderTransaction) GetId() string { if c == nil { - return 0 + return "" } return c.Id } -func (c *ClientFacingOrderEvent) GetCreatedAt() time.Time { +func (c *ClientFacingOrderTransaction) GetStatus() OrderTransactionStatus { if c == nil { - return time.Time{} + return "" } - return c.CreatedAt + return c.Status } -func (c *ClientFacingOrderEvent) GetStatus() OrderStatus { +func (c *ClientFacingOrderTransaction) GetOrders() []*ClientFacingOrderInTransaction { if c == nil { - return "" + return nil } - return c.Status + return c.Orders } -func (c *ClientFacingOrderEvent) GetExtraProperties() map[string]interface{} { +func (c *ClientFacingOrderTransaction) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *ClientFacingOrderEvent) require(field *big.Int) { +func (c *ClientFacingOrderTransaction) require(field *big.Int) { if c.explicitFields == nil { c.explicitFields = big.NewInt(0) } @@ -15523,38 +16565,32 @@ func (c *ClientFacingOrderEvent) require(field *big.Int) { // SetId sets the Id field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClientFacingOrderEvent) SetId(id int) { +func (c *ClientFacingOrderTransaction) SetId(id string) { c.Id = id - c.require(clientFacingOrderEventFieldId) + c.require(clientFacingOrderTransactionFieldId) } -// SetCreatedAt sets the CreatedAt field and marks it as non-optional; +// SetStatus sets the Status field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClientFacingOrderEvent) SetCreatedAt(createdAt time.Time) { - c.CreatedAt = createdAt - c.require(clientFacingOrderEventFieldCreatedAt) +func (c *ClientFacingOrderTransaction) SetStatus(status OrderTransactionStatus) { + c.Status = status + c.require(clientFacingOrderTransactionFieldStatus) } -// SetStatus sets the Status field and marks it as non-optional; +// SetOrders sets the Orders field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClientFacingOrderEvent) SetStatus(status OrderStatus) { - c.Status = status - c.require(clientFacingOrderEventFieldStatus) +func (c *ClientFacingOrderTransaction) SetOrders(orders []*ClientFacingOrderInTransaction) { + c.Orders = orders + c.require(clientFacingOrderTransactionFieldOrders) } -func (c *ClientFacingOrderEvent) UnmarshalJSON(data []byte) error { - type embed ClientFacingOrderEvent - var unmarshaler = struct { - embed - CreatedAt *internal.DateTime `json:"created_at"` - }{ - embed: embed(*c), - } - if err := json.Unmarshal(data, &unmarshaler); err != nil { +func (c *ClientFacingOrderTransaction) UnmarshalJSON(data []byte) error { + type unmarshaler ClientFacingOrderTransaction + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *c = ClientFacingOrderEvent(unmarshaler.embed) - c.CreatedAt = unmarshaler.CreatedAt.Time() + *c = ClientFacingOrderTransaction(value) extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err @@ -15564,20 +16600,18 @@ func (c *ClientFacingOrderEvent) UnmarshalJSON(data []byte) error { return nil } -func (c *ClientFacingOrderEvent) MarshalJSON() ([]byte, error) { - type embed ClientFacingOrderEvent +func (c *ClientFacingOrderTransaction) MarshalJSON() ([]byte, error) { + type embed ClientFacingOrderTransaction var marshaler = struct { embed - CreatedAt *internal.DateTime `json:"created_at"` }{ - embed: embed(*c), - CreatedAt: internal.NewDateTime(c.CreatedAt), + embed: embed(*c), } explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) return json.Marshal(explicitMarshaler) } -func (c *ClientFacingOrderEvent) String() string { +func (c *ClientFacingOrderTransaction) String() string { if len(c.rawJSON) > 0 { if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value @@ -24894,38 +25928,164 @@ type ClientUserIdConflictResponse struct { rawJSON json.RawMessage } -func (c *ClientUserIdConflictResponse) GetDetail() *ClientUserIdConflict { +func (c *ClientUserIdConflictResponse) GetDetail() *ClientUserIdConflict { + if c == nil { + return nil + } + return c.Detail +} + +func (c *ClientUserIdConflictResponse) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientUserIdConflictResponse) require(field *big.Int) { + if c.explicitFields == nil { + c.explicitFields = big.NewInt(0) + } + c.explicitFields.Or(c.explicitFields, field) +} + +// SetDetail sets the Detail field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClientUserIdConflictResponse) SetDetail(detail *ClientUserIdConflict) { + c.Detail = detail + c.require(clientUserIdConflictResponseFieldDetail) +} + +func (c *ClientUserIdConflictResponse) UnmarshalJSON(data []byte) error { + type unmarshaler ClientUserIdConflictResponse + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = ClientUserIdConflictResponse(value) + extraProperties, err := internal.ExtractExtraProperties(data, *c) + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientUserIdConflictResponse) MarshalJSON() ([]byte, error) { + type embed ClientUserIdConflictResponse + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (c *ClientUserIdConflictResponse) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +var ( + clinicalInformationFieldFasting = big.NewInt(1 << 0) + clinicalInformationFieldNotes = big.NewInt(1 << 1) + clinicalInformationFieldInformation = big.NewInt(1 << 2) + clinicalInformationFieldTotalVolume = big.NewInt(1 << 3) +) + +type ClinicalInformation struct { + Fasting *bool `json:"fasting,omitempty" url:"fasting,omitempty"` + Notes *string `json:"notes,omitempty" url:"notes,omitempty"` + Information *string `json:"information,omitempty" url:"information,omitempty"` + TotalVolume *string `json:"total_volume,omitempty" url:"total_volume,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClinicalInformation) GetFasting() *bool { + if c == nil { + return nil + } + return c.Fasting +} + +func (c *ClinicalInformation) GetNotes() *string { + if c == nil { + return nil + } + return c.Notes +} + +func (c *ClinicalInformation) GetInformation() *string { + if c == nil { + return nil + } + return c.Information +} + +func (c *ClinicalInformation) GetTotalVolume() *string { if c == nil { return nil } - return c.Detail + return c.TotalVolume } -func (c *ClientUserIdConflictResponse) GetExtraProperties() map[string]interface{} { +func (c *ClinicalInformation) GetExtraProperties() map[string]interface{} { return c.extraProperties } -func (c *ClientUserIdConflictResponse) require(field *big.Int) { +func (c *ClinicalInformation) require(field *big.Int) { if c.explicitFields == nil { c.explicitFields = big.NewInt(0) } c.explicitFields.Or(c.explicitFields, field) } -// SetDetail sets the Detail field and marks it as non-optional; +// SetFasting sets the Fasting field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (c *ClientUserIdConflictResponse) SetDetail(detail *ClientUserIdConflict) { - c.Detail = detail - c.require(clientUserIdConflictResponseFieldDetail) +func (c *ClinicalInformation) SetFasting(fasting *bool) { + c.Fasting = fasting + c.require(clinicalInformationFieldFasting) } -func (c *ClientUserIdConflictResponse) UnmarshalJSON(data []byte) error { - type unmarshaler ClientUserIdConflictResponse +// SetNotes sets the Notes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClinicalInformation) SetNotes(notes *string) { + c.Notes = notes + c.require(clinicalInformationFieldNotes) +} + +// SetInformation sets the Information field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClinicalInformation) SetInformation(information *string) { + c.Information = information + c.require(clinicalInformationFieldInformation) +} + +// SetTotalVolume sets the TotalVolume field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (c *ClinicalInformation) SetTotalVolume(totalVolume *string) { + c.TotalVolume = totalVolume + c.require(clinicalInformationFieldTotalVolume) +} + +func (c *ClinicalInformation) UnmarshalJSON(data []byte) error { + type unmarshaler ClinicalInformation var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *c = ClientUserIdConflictResponse(value) + *c = ClinicalInformation(value) extraProperties, err := internal.ExtractExtraProperties(data, *c) if err != nil { return err @@ -24935,8 +26095,8 @@ func (c *ClientUserIdConflictResponse) UnmarshalJSON(data []byte) error { return nil } -func (c *ClientUserIdConflictResponse) MarshalJSON() ([]byte, error) { - type embed ClientUserIdConflictResponse +func (c *ClinicalInformation) MarshalJSON() ([]byte, error) { + type embed ClinicalInformation var marshaler = struct { embed }{ @@ -24946,7 +26106,7 @@ func (c *ClientUserIdConflictResponse) MarshalJSON() ([]byte, error) { return json.Marshal(explicitMarshaler) } -func (c *ClientUserIdConflictResponse) String() string { +func (c *ClinicalInformation) String() string { if len(c.rawJSON) > 0 { if value, err := internal.StringifyJSON(c.rawJSON); err == nil { return value @@ -25371,6 +26531,56 @@ func (e Ethnicity) Ptr() *Ethnicity { return &e } +// ℹ️ This enum is non-exhaustive. +type FailureType string + +const ( + FailureTypeQuantityNotSufficientFailure FailureType = "quantity_not_sufficient_failure" + FailureTypeCollectionProcessFailure FailureType = "collection_process_failure" + FailureTypeDropOffFailure FailureType = "drop_off_failure" + FailureTypeInternalLabFailure FailureType = "internal_lab_failure" + FailureTypeOrderEntryFailure FailureType = "order_entry_failure" + FailureTypeNonFailure FailureType = "non_failure" + FailureTypeUnknownFailure FailureType = "unknown_failure" + FailureTypePatientConditionFailure FailureType = "patient_condition_failure" + FailureTypeMissingResultCalcFailure FailureType = "missing_result_calc_failure" + FailureTypeMissingDemoAoeCalcFailure FailureType = "missing_demo_aoe_calc_failure" + FailureTypeInsufficientVolume FailureType = "insufficient_volume" +) + +func NewFailureTypeFromString(s string) (FailureType, error) { + switch s { + case "quantity_not_sufficient_failure": + return FailureTypeQuantityNotSufficientFailure, nil + case "collection_process_failure": + return FailureTypeCollectionProcessFailure, nil + case "drop_off_failure": + return FailureTypeDropOffFailure, nil + case "internal_lab_failure": + return FailureTypeInternalLabFailure, nil + case "order_entry_failure": + return FailureTypeOrderEntryFailure, nil + case "non_failure": + return FailureTypeNonFailure, nil + case "unknown_failure": + return FailureTypeUnknownFailure, nil + case "patient_condition_failure": + return FailureTypePatientConditionFailure, nil + case "missing_result_calc_failure": + return FailureTypeMissingResultCalcFailure, nil + case "missing_demo_aoe_calc_failure": + return FailureTypeMissingDemoAoeCalcFailure, nil + case "insufficient_volume": + return FailureTypeInsufficientVolume, nil + } + var t FailureType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (f FailureType) Ptr() *FailureType { + return &f +} + var ( fallbackBirthDateFieldValue = big.NewInt(1 << 0) fallbackBirthDateFieldSourceSlug = big.NewInt(1 << 1) @@ -26524,106 +27734,596 @@ func NewInterpretationFromString(s string) (Interpretation, error) { case "unknown": return InterpretationUnknown, nil } - var t Interpretation - return "", fmt.Errorf("%s is not a valid %T", s, t) + var t Interpretation + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (i Interpretation) Ptr() *Interpretation { + return &i +} + +var ( + jpegFieldContent = big.NewInt(1 << 0) +) + +type Jpeg struct { + Content string `json:"content" url:"content"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + contentType string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (j *Jpeg) GetContent() string { + if j == nil { + return "" + } + return j.Content +} + +func (j *Jpeg) ContentType() string { + return j.contentType +} + +func (j *Jpeg) GetExtraProperties() map[string]interface{} { + return j.extraProperties +} + +func (j *Jpeg) require(field *big.Int) { + if j.explicitFields == nil { + j.explicitFields = big.NewInt(0) + } + j.explicitFields.Or(j.explicitFields, field) +} + +// SetContent sets the Content field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (j *Jpeg) SetContent(content string) { + j.Content = content + j.require(jpegFieldContent) +} + +func (j *Jpeg) UnmarshalJSON(data []byte) error { + type embed Jpeg + var unmarshaler = struct { + embed + ContentType string `json:"content_type"` + }{ + embed: embed(*j), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *j = Jpeg(unmarshaler.embed) + if unmarshaler.ContentType != "image/jpeg" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", j, "image/jpeg", unmarshaler.ContentType) + } + j.contentType = unmarshaler.ContentType + extraProperties, err := internal.ExtractExtraProperties(data, *j, "content_type") + if err != nil { + return err + } + j.extraProperties = extraProperties + j.rawJSON = json.RawMessage(data) + return nil +} + +func (j *Jpeg) MarshalJSON() ([]byte, error) { + type embed Jpeg + var marshaler = struct { + embed + ContentType string `json:"content_type"` + }{ + embed: embed(*j), + ContentType: "image/jpeg", + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, j.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (j *Jpeg) String() string { + if len(j.rawJSON) > 0 { + if value, err := internal.StringifyJSON(j.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(j); err == nil { + return value + } + return fmt.Sprintf("%#v", j) +} + +var ( + labResultsMetadataFieldAge = big.NewInt(1 << 0) + labResultsMetadataFieldDob = big.NewInt(1 << 1) + labResultsMetadataFieldClia = big.NewInt(1 << 2) + labResultsMetadataFieldPatient = big.NewInt(1 << 3) + labResultsMetadataFieldProvider = big.NewInt(1 << 4) + labResultsMetadataFieldLaboratory = big.NewInt(1 << 5) + labResultsMetadataFieldDateReported = big.NewInt(1 << 6) + labResultsMetadataFieldDateCollected = big.NewInt(1 << 7) + labResultsMetadataFieldSpecimenNumber = big.NewInt(1 << 8) + labResultsMetadataFieldDateReceived = big.NewInt(1 << 9) + labResultsMetadataFieldStatus = big.NewInt(1 << 10) + labResultsMetadataFieldInterpretation = big.NewInt(1 << 11) + labResultsMetadataFieldPatientId = big.NewInt(1 << 12) + labResultsMetadataFieldAccountId = big.NewInt(1 << 13) +) + +type LabResultsMetadata struct { + Age string `json:"age" url:"age"` + Dob string `json:"dob" url:"dob"` + Clia *string `json:"clia_#,omitempty" url:"clia_#,omitempty"` + Patient string `json:"patient" url:"patient"` + Provider *string `json:"provider,omitempty" url:"provider,omitempty"` + Laboratory *string `json:"laboratory,omitempty" url:"laboratory,omitempty"` + DateReported string `json:"date_reported" url:"date_reported"` + DateCollected *string `json:"date_collected,omitempty" url:"date_collected,omitempty"` + SpecimenNumber string `json:"specimen_number" url:"specimen_number"` + DateReceived *string `json:"date_received,omitempty" url:"date_received,omitempty"` + Status *string `json:"status,omitempty" url:"status,omitempty"` + Interpretation *string `json:"interpretation,omitempty" url:"interpretation,omitempty"` + PatientId *string `json:"patient_id,omitempty" url:"patient_id,omitempty"` + AccountId *string `json:"account_id,omitempty" url:"account_id,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (l *LabResultsMetadata) GetAge() string { + if l == nil { + return "" + } + return l.Age +} + +func (l *LabResultsMetadata) GetDob() string { + if l == nil { + return "" + } + return l.Dob +} + +func (l *LabResultsMetadata) GetClia() *string { + if l == nil { + return nil + } + return l.Clia +} + +func (l *LabResultsMetadata) GetPatient() string { + if l == nil { + return "" + } + return l.Patient +} + +func (l *LabResultsMetadata) GetProvider() *string { + if l == nil { + return nil + } + return l.Provider +} + +func (l *LabResultsMetadata) GetLaboratory() *string { + if l == nil { + return nil + } + return l.Laboratory +} + +func (l *LabResultsMetadata) GetDateReported() string { + if l == nil { + return "" + } + return l.DateReported +} + +func (l *LabResultsMetadata) GetDateCollected() *string { + if l == nil { + return nil + } + return l.DateCollected +} + +func (l *LabResultsMetadata) GetSpecimenNumber() string { + if l == nil { + return "" + } + return l.SpecimenNumber +} + +func (l *LabResultsMetadata) GetDateReceived() *string { + if l == nil { + return nil + } + return l.DateReceived +} + +func (l *LabResultsMetadata) GetStatus() *string { + if l == nil { + return nil + } + return l.Status +} + +func (l *LabResultsMetadata) GetInterpretation() *string { + if l == nil { + return nil + } + return l.Interpretation +} + +func (l *LabResultsMetadata) GetPatientId() *string { + if l == nil { + return nil + } + return l.PatientId +} + +func (l *LabResultsMetadata) GetAccountId() *string { + if l == nil { + return nil + } + return l.AccountId +} + +func (l *LabResultsMetadata) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LabResultsMetadata) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) + } + l.explicitFields.Or(l.explicitFields, field) +} + +// SetAge sets the Age field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetAge(age string) { + l.Age = age + l.require(labResultsMetadataFieldAge) +} + +// SetDob sets the Dob field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetDob(dob string) { + l.Dob = dob + l.require(labResultsMetadataFieldDob) +} + +// SetClia sets the Clia field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetClia(clia *string) { + l.Clia = clia + l.require(labResultsMetadataFieldClia) +} + +// SetPatient sets the Patient field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetPatient(patient string) { + l.Patient = patient + l.require(labResultsMetadataFieldPatient) +} + +// SetProvider sets the Provider field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetProvider(provider *string) { + l.Provider = provider + l.require(labResultsMetadataFieldProvider) +} + +// SetLaboratory sets the Laboratory field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetLaboratory(laboratory *string) { + l.Laboratory = laboratory + l.require(labResultsMetadataFieldLaboratory) +} + +// SetDateReported sets the DateReported field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetDateReported(dateReported string) { + l.DateReported = dateReported + l.require(labResultsMetadataFieldDateReported) +} + +// SetDateCollected sets the DateCollected field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetDateCollected(dateCollected *string) { + l.DateCollected = dateCollected + l.require(labResultsMetadataFieldDateCollected) +} + +// SetSpecimenNumber sets the SpecimenNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetSpecimenNumber(specimenNumber string) { + l.SpecimenNumber = specimenNumber + l.require(labResultsMetadataFieldSpecimenNumber) +} + +// SetDateReceived sets the DateReceived field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetDateReceived(dateReceived *string) { + l.DateReceived = dateReceived + l.require(labResultsMetadataFieldDateReceived) +} + +// SetStatus sets the Status field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetStatus(status *string) { + l.Status = status + l.require(labResultsMetadataFieldStatus) +} + +// SetInterpretation sets the Interpretation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetInterpretation(interpretation *string) { + l.Interpretation = interpretation + l.require(labResultsMetadataFieldInterpretation) +} + +// SetPatientId sets the PatientId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetPatientId(patientId *string) { + l.PatientId = patientId + l.require(labResultsMetadataFieldPatientId) +} + +// SetAccountId sets the AccountId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsMetadata) SetAccountId(accountId *string) { + l.AccountId = accountId + l.require(labResultsMetadataFieldAccountId) +} + +func (l *LabResultsMetadata) UnmarshalJSON(data []byte) error { + type unmarshaler LabResultsMetadata + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *l = LabResultsMetadata(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) + if err != nil { + return err + } + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) + return nil } -func (i Interpretation) Ptr() *Interpretation { - return &i +func (l *LabResultsMetadata) MarshalJSON() ([]byte, error) { + type embed LabResultsMetadata + var marshaler = struct { + embed + }{ + embed: embed(*l), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (l *LabResultsMetadata) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(l); err == nil { + return value + } + return fmt.Sprintf("%#v", l) } var ( - jpegFieldContent = big.NewInt(1 << 0) + labResultsRawFieldMetadata = big.NewInt(1 << 0) + labResultsRawFieldResults = big.NewInt(1 << 1) + labResultsRawFieldMissingResults = big.NewInt(1 << 2) + labResultsRawFieldSampleInformation = big.NewInt(1 << 3) + labResultsRawFieldOrderTransaction = big.NewInt(1 << 4) ) -type Jpeg struct { - Content string `json:"content" url:"content"` +type LabResultsRaw struct { + Metadata *LabResultsMetadata `json:"metadata" url:"metadata"` + Results *LabResultsRawResults `json:"results" url:"results"` + MissingResults []*MissingBiomarkerResult `json:"missing_results,omitempty" url:"missing_results,omitempty"` + SampleInformation map[string]*SampleData `json:"sample_information,omitempty" url:"sample_information,omitempty"` + OrderTransaction *ClientFacingOrderTransaction `json:"order_transaction,omitempty" url:"order_transaction,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted explicitFields *big.Int `json:"-" url:"-"` - contentType string extraProperties map[string]interface{} rawJSON json.RawMessage } -func (j *Jpeg) GetContent() string { - if j == nil { - return "" +func (l *LabResultsRaw) GetMetadata() *LabResultsMetadata { + if l == nil { + return nil } - return j.Content + return l.Metadata } -func (j *Jpeg) ContentType() string { - return j.contentType +func (l *LabResultsRaw) GetResults() *LabResultsRawResults { + if l == nil { + return nil + } + return l.Results } -func (j *Jpeg) GetExtraProperties() map[string]interface{} { - return j.extraProperties +func (l *LabResultsRaw) GetMissingResults() []*MissingBiomarkerResult { + if l == nil { + return nil + } + return l.MissingResults } -func (j *Jpeg) require(field *big.Int) { - if j.explicitFields == nil { - j.explicitFields = big.NewInt(0) +func (l *LabResultsRaw) GetSampleInformation() map[string]*SampleData { + if l == nil { + return nil } - j.explicitFields.Or(j.explicitFields, field) + return l.SampleInformation } -// SetContent sets the Content field and marks it as non-optional; -// this prevents an empty or null value for this field from being omitted during serialization. -func (j *Jpeg) SetContent(content string) { - j.Content = content - j.require(jpegFieldContent) +func (l *LabResultsRaw) GetOrderTransaction() *ClientFacingOrderTransaction { + if l == nil { + return nil + } + return l.OrderTransaction } -func (j *Jpeg) UnmarshalJSON(data []byte) error { - type embed Jpeg - var unmarshaler = struct { - embed - ContentType string `json:"content_type"` - }{ - embed: embed(*j), +func (l *LabResultsRaw) GetExtraProperties() map[string]interface{} { + return l.extraProperties +} + +func (l *LabResultsRaw) require(field *big.Int) { + if l.explicitFields == nil { + l.explicitFields = big.NewInt(0) } - if err := json.Unmarshal(data, &unmarshaler); err != nil { + l.explicitFields.Or(l.explicitFields, field) +} + +// SetMetadata sets the Metadata field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsRaw) SetMetadata(metadata *LabResultsMetadata) { + l.Metadata = metadata + l.require(labResultsRawFieldMetadata) +} + +// SetResults sets the Results field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsRaw) SetResults(results *LabResultsRawResults) { + l.Results = results + l.require(labResultsRawFieldResults) +} + +// SetMissingResults sets the MissingResults field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsRaw) SetMissingResults(missingResults []*MissingBiomarkerResult) { + l.MissingResults = missingResults + l.require(labResultsRawFieldMissingResults) +} + +// SetSampleInformation sets the SampleInformation field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsRaw) SetSampleInformation(sampleInformation map[string]*SampleData) { + l.SampleInformation = sampleInformation + l.require(labResultsRawFieldSampleInformation) +} + +// SetOrderTransaction sets the OrderTransaction field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (l *LabResultsRaw) SetOrderTransaction(orderTransaction *ClientFacingOrderTransaction) { + l.OrderTransaction = orderTransaction + l.require(labResultsRawFieldOrderTransaction) +} + +func (l *LabResultsRaw) UnmarshalJSON(data []byte) error { + type unmarshaler LabResultsRaw + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { return err } - *j = Jpeg(unmarshaler.embed) - if unmarshaler.ContentType != "image/jpeg" { - return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", j, "image/jpeg", unmarshaler.ContentType) - } - j.contentType = unmarshaler.ContentType - extraProperties, err := internal.ExtractExtraProperties(data, *j, "content_type") + *l = LabResultsRaw(value) + extraProperties, err := internal.ExtractExtraProperties(data, *l) if err != nil { return err } - j.extraProperties = extraProperties - j.rawJSON = json.RawMessage(data) + l.extraProperties = extraProperties + l.rawJSON = json.RawMessage(data) return nil } -func (j *Jpeg) MarshalJSON() ([]byte, error) { - type embed Jpeg +func (l *LabResultsRaw) MarshalJSON() ([]byte, error) { + type embed LabResultsRaw var marshaler = struct { embed - ContentType string `json:"content_type"` }{ - embed: embed(*j), - ContentType: "image/jpeg", + embed: embed(*l), } - explicitMarshaler := internal.HandleExplicitFields(marshaler, j.explicitFields) + explicitMarshaler := internal.HandleExplicitFields(marshaler, l.explicitFields) return json.Marshal(explicitMarshaler) } -func (j *Jpeg) String() string { - if len(j.rawJSON) > 0 { - if value, err := internal.StringifyJSON(j.rawJSON); err == nil { +func (l *LabResultsRaw) String() string { + if len(l.rawJSON) > 0 { + if value, err := internal.StringifyJSON(l.rawJSON); err == nil { return value } } - if value, err := internal.StringifyJSON(j); err == nil { + if value, err := internal.StringifyJSON(l); err == nil { return value } - return fmt.Sprintf("%#v", j) + return fmt.Sprintf("%#v", l) +} + +type LabResultsRawResults struct { + BiomarkerResultList []*BiomarkerResult + StringUnknownMap map[string]interface{} + + typ string +} + +func (l *LabResultsRawResults) GetBiomarkerResultList() []*BiomarkerResult { + if l == nil { + return nil + } + return l.BiomarkerResultList +} + +func (l *LabResultsRawResults) GetStringUnknownMap() map[string]interface{} { + if l == nil { + return nil + } + return l.StringUnknownMap +} + +func (l *LabResultsRawResults) UnmarshalJSON(data []byte) error { + var valueBiomarkerResultList []*BiomarkerResult + if err := json.Unmarshal(data, &valueBiomarkerResultList); err == nil { + l.typ = "BiomarkerResultList" + l.BiomarkerResultList = valueBiomarkerResultList + return nil + } + var valueStringUnknownMap map[string]interface{} + if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { + l.typ = "StringUnknownMap" + l.StringUnknownMap = valueStringUnknownMap + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, l) +} + +func (l LabResultsRawResults) MarshalJSON() ([]byte, error) { + if l.typ == "BiomarkerResultList" || l.BiomarkerResultList != nil { + return json.Marshal(l.BiomarkerResultList) + } + if l.typ == "StringUnknownMap" || l.StringUnknownMap != nil { + return json.Marshal(l.StringUnknownMap) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", l) +} + +type LabResultsRawResultsVisitor interface { + VisitBiomarkerResultList([]*BiomarkerResult) error + VisitStringUnknownMap(map[string]interface{}) error +} + +func (l *LabResultsRawResults) Accept(visitor LabResultsRawResultsVisitor) error { + if l.typ == "BiomarkerResultList" || l.BiomarkerResultList != nil { + return visitor.VisitBiomarkerResultList(l.BiomarkerResultList) + } + if l.typ == "StringUnknownMap" || l.StringUnknownMap != nil { + return visitor.VisitStringUnknownMap(l.StringUnknownMap) + } + return fmt.Errorf("type %T does not include a non-empty union type", l) } // The method used to perform a lab test. ℹ️ This enum is non-exhaustive. @@ -26721,6 +28421,7 @@ const ( LabsSpiriplex Labs = "spiriplex" LabsUssl Labs = "ussl" LabsQuest Labs = "quest" + LabsSonoraQuest Labs = "sonora_quest" LabsLabcorp Labs = "labcorp" LabsBioreference Labs = "bioreference" LabsUsBiotek Labs = "us_biotek" @@ -26729,6 +28430,7 @@ const ( LabsIhd Labs = "ihd" LabsNexus Labs = "nexus" LabsMyUti Labs = "my_uti" + LabsCrl Labs = "crl" ) func NewLabsFromString(s string) (Labs, error) { @@ -26741,6 +28443,8 @@ func NewLabsFromString(s string) (Labs, error) { return LabsUssl, nil case "quest": return LabsQuest, nil + case "sonora_quest": + return LabsSonoraQuest, nil case "labcorp": return LabsLabcorp, nil case "bioreference": @@ -26757,6 +28461,8 @@ func NewLabsFromString(s string) (Labs, error) { return LabsNexus, nil case "my_uti": return LabsMyUti, nil + case "crl": + return LabsCrl, nil } var t Labs return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -26833,6 +28539,196 @@ func (m Minerals) Ptr() *Minerals { return &m } +var ( + missingBiomarkerResultFieldName = big.NewInt(1 << 0) + missingBiomarkerResultFieldSlug = big.NewInt(1 << 1) + missingBiomarkerResultFieldInferredFailureType = big.NewInt(1 << 2) + missingBiomarkerResultFieldNote = big.NewInt(1 << 3) + missingBiomarkerResultFieldLoinc = big.NewInt(1 << 4) + missingBiomarkerResultFieldLoincSlug = big.NewInt(1 << 5) + missingBiomarkerResultFieldProviderId = big.NewInt(1 << 6) + missingBiomarkerResultFieldSourceMarkers = big.NewInt(1 << 7) +) + +type MissingBiomarkerResult struct { + Name string `json:"name" url:"name"` + Slug string `json:"slug" url:"slug"` + InferredFailureType FailureType `json:"inferred_failure_type" url:"inferred_failure_type"` + Note *string `json:"note,omitempty" url:"note,omitempty"` + Loinc *string `json:"loinc,omitempty" url:"loinc,omitempty"` + LoincSlug *string `json:"loinc_slug,omitempty" url:"loinc_slug,omitempty"` + ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` + SourceMarkers []*ParentBiomarkerData `json:"source_markers,omitempty" url:"source_markers,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (m *MissingBiomarkerResult) GetName() string { + if m == nil { + return "" + } + return m.Name +} + +func (m *MissingBiomarkerResult) GetSlug() string { + if m == nil { + return "" + } + return m.Slug +} + +func (m *MissingBiomarkerResult) GetInferredFailureType() FailureType { + if m == nil { + return "" + } + return m.InferredFailureType +} + +func (m *MissingBiomarkerResult) GetNote() *string { + if m == nil { + return nil + } + return m.Note +} + +func (m *MissingBiomarkerResult) GetLoinc() *string { + if m == nil { + return nil + } + return m.Loinc +} + +func (m *MissingBiomarkerResult) GetLoincSlug() *string { + if m == nil { + return nil + } + return m.LoincSlug +} + +func (m *MissingBiomarkerResult) GetProviderId() *string { + if m == nil { + return nil + } + return m.ProviderId +} + +func (m *MissingBiomarkerResult) GetSourceMarkers() []*ParentBiomarkerData { + if m == nil { + return nil + } + return m.SourceMarkers +} + +func (m *MissingBiomarkerResult) GetExtraProperties() map[string]interface{} { + return m.extraProperties +} + +func (m *MissingBiomarkerResult) require(field *big.Int) { + if m.explicitFields == nil { + m.explicitFields = big.NewInt(0) + } + m.explicitFields.Or(m.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetName(name string) { + m.Name = name + m.require(missingBiomarkerResultFieldName) +} + +// SetSlug sets the Slug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetSlug(slug string) { + m.Slug = slug + m.require(missingBiomarkerResultFieldSlug) +} + +// SetInferredFailureType sets the InferredFailureType field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetInferredFailureType(inferredFailureType FailureType) { + m.InferredFailureType = inferredFailureType + m.require(missingBiomarkerResultFieldInferredFailureType) +} + +// SetNote sets the Note field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetNote(note *string) { + m.Note = note + m.require(missingBiomarkerResultFieldNote) +} + +// SetLoinc sets the Loinc field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetLoinc(loinc *string) { + m.Loinc = loinc + m.require(missingBiomarkerResultFieldLoinc) +} + +// SetLoincSlug sets the LoincSlug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetLoincSlug(loincSlug *string) { + m.LoincSlug = loincSlug + m.require(missingBiomarkerResultFieldLoincSlug) +} + +// SetProviderId sets the ProviderId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetProviderId(providerId *string) { + m.ProviderId = providerId + m.require(missingBiomarkerResultFieldProviderId) +} + +// SetSourceMarkers sets the SourceMarkers field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (m *MissingBiomarkerResult) SetSourceMarkers(sourceMarkers []*ParentBiomarkerData) { + m.SourceMarkers = sourceMarkers + m.require(missingBiomarkerResultFieldSourceMarkers) +} + +func (m *MissingBiomarkerResult) UnmarshalJSON(data []byte) error { + type unmarshaler MissingBiomarkerResult + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *m = MissingBiomarkerResult(value) + extraProperties, err := internal.ExtractExtraProperties(data, *m) + if err != nil { + return err + } + m.extraProperties = extraProperties + m.rawJSON = json.RawMessage(data) + return nil +} + +func (m *MissingBiomarkerResult) MarshalJSON() ([]byte, error) { + type embed MissingBiomarkerResult + var marshaler = struct { + embed + }{ + embed: embed(*m), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, m.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (m *MissingBiomarkerResult) String() string { + if len(m.rawJSON) > 0 { + if value, err := internal.StringifyJSON(m.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(m); err == nil { + return value + } + return fmt.Sprintf("%#v", m) +} + var ( notFoundErrorBodyFieldDetail = big.NewInt(1 << 0) ) @@ -26899,16 +28795,137 @@ func (n *NotFoundErrorBody) MarshalJSON() ([]byte, error) { return json.Marshal(explicitMarshaler) } -func (n *NotFoundErrorBody) String() string { - if len(n.rawJSON) > 0 { - if value, err := internal.StringifyJSON(n.rawJSON); err == nil { - return value - } - } - if value, err := internal.StringifyJSON(n); err == nil { - return value - } - return fmt.Sprintf("%#v", n) +func (n *NotFoundErrorBody) String() string { + if len(n.rawJSON) > 0 { + if value, err := internal.StringifyJSON(n.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(n); err == nil { + return value + } + return fmt.Sprintf("%#v", n) +} + +// ℹ️ This enum is non-exhaustive. +type OrderLowLevelStatus string + +const ( + OrderLowLevelStatusOrdered OrderLowLevelStatus = "ordered" + OrderLowLevelStatusRequisitionCreated OrderLowLevelStatus = "requisition_created" + OrderLowLevelStatusRequisitionBypassed OrderLowLevelStatus = "requisition_bypassed" + OrderLowLevelStatusTransitCustomer OrderLowLevelStatus = "transit_customer" + OrderLowLevelStatusOutForDelivery OrderLowLevelStatus = "out_for_delivery" + OrderLowLevelStatusWithCustomer OrderLowLevelStatus = "with_customer" + OrderLowLevelStatusTransitLab OrderLowLevelStatus = "transit_lab" + OrderLowLevelStatusDeliveredToLab OrderLowLevelStatus = "delivered_to_lab" + OrderLowLevelStatusCompleted OrderLowLevelStatus = "completed" + OrderLowLevelStatusFailureToDeliverToLab OrderLowLevelStatus = "failure_to_deliver_to_lab" + OrderLowLevelStatusFailureToDeliverToCustomer OrderLowLevelStatus = "failure_to_deliver_to_customer" + OrderLowLevelStatusProblemInTransitLab OrderLowLevelStatus = "problem_in_transit_lab" + OrderLowLevelStatusProblemInTransitCustomer OrderLowLevelStatus = "problem_in_transit_customer" + OrderLowLevelStatusSampleError OrderLowLevelStatus = "sample_error" + OrderLowLevelStatusAppointmentScheduled OrderLowLevelStatus = "appointment_scheduled" + OrderLowLevelStatusAppointmentCancelled OrderLowLevelStatus = "appointment_cancelled" + OrderLowLevelStatusAppointmentPending OrderLowLevelStatus = "appointment_pending" + OrderLowLevelStatusDrawCompleted OrderLowLevelStatus = "draw_completed" + OrderLowLevelStatusCancelled OrderLowLevelStatus = "cancelled" + OrderLowLevelStatusLost OrderLowLevelStatus = "lost" + OrderLowLevelStatusDoNotProcess OrderLowLevelStatus = "do_not_process" + OrderLowLevelStatusPartialResults OrderLowLevelStatus = "partial_results" + OrderLowLevelStatusAwaitingRegistration OrderLowLevelStatus = "awaiting_registration" + OrderLowLevelStatusRegistered OrderLowLevelStatus = "registered" + OrderLowLevelStatusRedrawAvailable OrderLowLevelStatus = "redraw_available" + OrderLowLevelStatusCorrected OrderLowLevelStatus = "corrected" +) + +func NewOrderLowLevelStatusFromString(s string) (OrderLowLevelStatus, error) { + switch s { + case "ordered": + return OrderLowLevelStatusOrdered, nil + case "requisition_created": + return OrderLowLevelStatusRequisitionCreated, nil + case "requisition_bypassed": + return OrderLowLevelStatusRequisitionBypassed, nil + case "transit_customer": + return OrderLowLevelStatusTransitCustomer, nil + case "out_for_delivery": + return OrderLowLevelStatusOutForDelivery, nil + case "with_customer": + return OrderLowLevelStatusWithCustomer, nil + case "transit_lab": + return OrderLowLevelStatusTransitLab, nil + case "delivered_to_lab": + return OrderLowLevelStatusDeliveredToLab, nil + case "completed": + return OrderLowLevelStatusCompleted, nil + case "failure_to_deliver_to_lab": + return OrderLowLevelStatusFailureToDeliverToLab, nil + case "failure_to_deliver_to_customer": + return OrderLowLevelStatusFailureToDeliverToCustomer, nil + case "problem_in_transit_lab": + return OrderLowLevelStatusProblemInTransitLab, nil + case "problem_in_transit_customer": + return OrderLowLevelStatusProblemInTransitCustomer, nil + case "sample_error": + return OrderLowLevelStatusSampleError, nil + case "appointment_scheduled": + return OrderLowLevelStatusAppointmentScheduled, nil + case "appointment_cancelled": + return OrderLowLevelStatusAppointmentCancelled, nil + case "appointment_pending": + return OrderLowLevelStatusAppointmentPending, nil + case "draw_completed": + return OrderLowLevelStatusDrawCompleted, nil + case "cancelled": + return OrderLowLevelStatusCancelled, nil + case "lost": + return OrderLowLevelStatusLost, nil + case "do_not_process": + return OrderLowLevelStatusDoNotProcess, nil + case "partial_results": + return OrderLowLevelStatusPartialResults, nil + case "awaiting_registration": + return OrderLowLevelStatusAwaitingRegistration, nil + case "registered": + return OrderLowLevelStatusRegistered, nil + case "redraw_available": + return OrderLowLevelStatusRedrawAvailable, nil + case "corrected": + return OrderLowLevelStatusCorrected, nil + } + var t OrderLowLevelStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderLowLevelStatus) Ptr() *OrderLowLevelStatus { + return &o +} + +// ℹ️ This enum is non-exhaustive. +type OrderOrigin string + +const ( + OrderOriginInitial OrderOrigin = "initial" + OrderOriginRedraw OrderOrigin = "redraw" + OrderOriginRecreation OrderOrigin = "recreation" +) + +func NewOrderOriginFromString(s string) (OrderOrigin, error) { + switch s { + case "initial": + return OrderOriginInitial, nil + case "redraw": + return OrderOriginRedraw, nil + case "recreation": + return OrderOriginRecreation, nil + } + var t OrderOrigin + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderOrigin) Ptr() *OrderOrigin { + return &o } // ℹ️ This enum is non-exhaustive. @@ -26947,6 +28964,7 @@ const ( OrderStatusCollectingSampleTestkitWithCustomer OrderStatus = "collecting_sample.testkit.with_customer" OrderStatusCollectingSampleTestkitTransitLab OrderStatus = "collecting_sample.testkit.transit_lab" OrderStatusSampleWithLabTestkitDeliveredToLab OrderStatus = "sample_with_lab.testkit.delivered_to_lab" + OrderStatusSampleWithLabTestkitLabProcessingBlocked OrderStatus = "sample_with_lab.testkit.lab_processing_blocked" OrderStatusCompletedTestkitCompleted OrderStatus = "completed.testkit.completed" OrderStatusFailedTestkitFailureToDeliverToCustomer OrderStatus = "failed.testkit.failure_to_deliver_to_customer" OrderStatusFailedTestkitFailureToDeliverToLab OrderStatus = "failed.testkit.failure_to_deliver_to_lab" @@ -26964,6 +28982,10 @@ const ( OrderStatusCancelledOnSiteCollectionCancelled OrderStatus = "cancelled.on_site_collection.cancelled" OrderStatusSampleWithLabOnSiteCollectionPartialResults OrderStatus = "sample_with_lab.on_site_collection.partial_results" OrderStatusFailedOnSiteCollectionSampleError OrderStatus = "failed.on_site_collection.sample_error" + OrderStatusCompletedWalkInTestCorrected OrderStatus = "completed.walk_in_test.corrected" + OrderStatusCompletedAtHomePhlebotomyCorrected OrderStatus = "completed.at_home_phlebotomy.corrected" + OrderStatusCompletedOnSiteCollectionCorrected OrderStatus = "completed.on_site_collection.corrected" + OrderStatusCompletedTestkitCorrected OrderStatus = "completed.testkit.corrected" ) func NewOrderStatusFromString(s string) (OrderStatus, error) { @@ -27032,6 +29054,8 @@ func NewOrderStatusFromString(s string) (OrderStatus, error) { return OrderStatusCollectingSampleTestkitTransitLab, nil case "sample_with_lab.testkit.delivered_to_lab": return OrderStatusSampleWithLabTestkitDeliveredToLab, nil + case "sample_with_lab.testkit.lab_processing_blocked": + return OrderStatusSampleWithLabTestkitLabProcessingBlocked, nil case "completed.testkit.completed": return OrderStatusCompletedTestkitCompleted, nil case "failed.testkit.failure_to_deliver_to_customer": @@ -27066,6 +29090,14 @@ func NewOrderStatusFromString(s string) (OrderStatus, error) { return OrderStatusSampleWithLabOnSiteCollectionPartialResults, nil case "failed.on_site_collection.sample_error": return OrderStatusFailedOnSiteCollectionSampleError, nil + case "completed.walk_in_test.corrected": + return OrderStatusCompletedWalkInTestCorrected, nil + case "completed.at_home_phlebotomy.corrected": + return OrderStatusCompletedAtHomePhlebotomyCorrected, nil + case "completed.on_site_collection.corrected": + return OrderStatusCompletedOnSiteCollectionCorrected, nil + case "completed.testkit.corrected": + return OrderStatusCompletedTestkitCorrected, nil } var t OrderStatus return "", fmt.Errorf("%s is not a valid %T", s, t) @@ -27075,6 +29107,9 @@ func (o OrderStatus) Ptr() *OrderStatus { return &o } +// ℹ️ This enum is non-exhaustive. +type OrderStatusDetail = string + // ℹ️ This enum is non-exhaustive. type OrderTopLevelStatus string @@ -27110,6 +29145,158 @@ func (o OrderTopLevelStatus) Ptr() *OrderTopLevelStatus { return &o } +// ℹ️ This enum is non-exhaustive. +type OrderTransactionStatus string + +const ( + OrderTransactionStatusActive OrderTransactionStatus = "active" + OrderTransactionStatusCompleted OrderTransactionStatus = "completed" + OrderTransactionStatusCancelled OrderTransactionStatus = "cancelled" +) + +func NewOrderTransactionStatusFromString(s string) (OrderTransactionStatus, error) { + switch s { + case "active": + return OrderTransactionStatusActive, nil + case "completed": + return OrderTransactionStatusCompleted, nil + case "cancelled": + return OrderTransactionStatusCancelled, nil + } + var t OrderTransactionStatus + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (o OrderTransactionStatus) Ptr() *OrderTransactionStatus { + return &o +} + +var ( + parentBiomarkerDataFieldMarkerId = big.NewInt(1 << 0) + parentBiomarkerDataFieldName = big.NewInt(1 << 1) + parentBiomarkerDataFieldSlug = big.NewInt(1 << 2) + parentBiomarkerDataFieldProviderId = big.NewInt(1 << 3) +) + +type ParentBiomarkerData struct { + MarkerId int `json:"marker_id" url:"marker_id"` + Name string `json:"name" url:"name"` + Slug string `json:"slug" url:"slug"` + ProviderId *string `json:"provider_id,omitempty" url:"provider_id,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ParentBiomarkerData) GetMarkerId() int { + if p == nil { + return 0 + } + return p.MarkerId +} + +func (p *ParentBiomarkerData) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *ParentBiomarkerData) GetSlug() string { + if p == nil { + return "" + } + return p.Slug +} + +func (p *ParentBiomarkerData) GetProviderId() *string { + if p == nil { + return nil + } + return p.ProviderId +} + +func (p *ParentBiomarkerData) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *ParentBiomarkerData) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetMarkerId sets the MarkerId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ParentBiomarkerData) SetMarkerId(markerId int) { + p.MarkerId = markerId + p.require(parentBiomarkerDataFieldMarkerId) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ParentBiomarkerData) SetName(name string) { + p.Name = name + p.require(parentBiomarkerDataFieldName) +} + +// SetSlug sets the Slug field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ParentBiomarkerData) SetSlug(slug string) { + p.Slug = slug + p.require(parentBiomarkerDataFieldSlug) +} + +// SetProviderId sets the ProviderId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *ParentBiomarkerData) SetProviderId(providerId *string) { + p.ProviderId = providerId + p.require(parentBiomarkerDataFieldProviderId) +} + +func (p *ParentBiomarkerData) UnmarshalJSON(data []byte) error { + type unmarshaler ParentBiomarkerData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = ParentBiomarkerData(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ParentBiomarkerData) MarshalJSON() ([]byte, error) { + type embed ParentBiomarkerData + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *ParentBiomarkerData) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + var ( patientAddressCompatibleFieldReceiverName = big.NewInt(1 << 0) patientAddressCompatibleFieldFirstLine = big.NewInt(1 << 1) @@ -27118,7 +29305,8 @@ var ( patientAddressCompatibleFieldState = big.NewInt(1 << 4) patientAddressCompatibleFieldZip = big.NewInt(1 << 5) patientAddressCompatibleFieldCountry = big.NewInt(1 << 6) - patientAddressCompatibleFieldPhoneNumber = big.NewInt(1 << 7) + patientAddressCompatibleFieldAccessNotes = big.NewInt(1 << 7) + patientAddressCompatibleFieldPhoneNumber = big.NewInt(1 << 8) ) type PatientAddressCompatible struct { @@ -27129,6 +29317,7 @@ type PatientAddressCompatible struct { State string `json:"state" url:"state"` Zip string `json:"zip" url:"zip"` Country string `json:"country" url:"country"` + AccessNotes *string `json:"access_notes,omitempty" url:"access_notes,omitempty"` PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted @@ -27187,6 +29376,13 @@ func (p *PatientAddressCompatible) GetCountry() string { return p.Country } +func (p *PatientAddressCompatible) GetAccessNotes() *string { + if p == nil { + return nil + } + return p.AccessNotes +} + func (p *PatientAddressCompatible) GetPhoneNumber() *string { if p == nil { return nil @@ -27254,6 +29450,13 @@ func (p *PatientAddressCompatible) SetCountry(country string) { p.require(patientAddressCompatibleFieldCountry) } +// SetAccessNotes sets the AccessNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PatientAddressCompatible) SetAccessNotes(accessNotes *string) { + p.AccessNotes = accessNotes + p.require(patientAddressCompatibleFieldAccessNotes) +} + // SetPhoneNumber sets the PhoneNumber field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (p *PatientAddressCompatible) SetPhoneNumber(phoneNumber *string) { @@ -27308,7 +29511,8 @@ var ( patientAddressWithValidationFieldState = big.NewInt(1 << 4) patientAddressWithValidationFieldZip = big.NewInt(1 << 5) patientAddressWithValidationFieldCountry = big.NewInt(1 << 6) - patientAddressWithValidationFieldPhoneNumber = big.NewInt(1 << 7) + patientAddressWithValidationFieldAccessNotes = big.NewInt(1 << 7) + patientAddressWithValidationFieldPhoneNumber = big.NewInt(1 << 8) ) type PatientAddressWithValidation struct { @@ -27319,6 +29523,7 @@ type PatientAddressWithValidation struct { State string `json:"state" url:"state"` Zip string `json:"zip" url:"zip"` Country string `json:"country" url:"country"` + AccessNotes *string `json:"access_notes,omitempty" url:"access_notes,omitempty"` PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` // Private bitmask of fields set to an explicit value and therefore not to be omitted @@ -27377,6 +29582,13 @@ func (p *PatientAddressWithValidation) GetCountry() string { return p.Country } +func (p *PatientAddressWithValidation) GetAccessNotes() *string { + if p == nil { + return nil + } + return p.AccessNotes +} + func (p *PatientAddressWithValidation) GetPhoneNumber() *string { if p == nil { return nil @@ -27444,6 +29656,13 @@ func (p *PatientAddressWithValidation) SetCountry(country string) { p.require(patientAddressWithValidationFieldCountry) } +// SetAccessNotes sets the AccessNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PatientAddressWithValidation) SetAccessNotes(accessNotes *string) { + p.AccessNotes = accessNotes + p.require(patientAddressWithValidationFieldAccessNotes) +} + // SetPhoneNumber sets the PhoneNumber field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. func (p *PatientAddressWithValidation) SetPhoneNumber(phoneNumber *string) { @@ -27768,38 +29987,170 @@ func (p *PatientDetailsWithValidation) String() string { return fmt.Sprintf("%#v", p) } -// ℹ️ This enum is non-exhaustive. -type PayorCodeExternalProvider string - -const ( - PayorCodeExternalProviderChangeHealthcare PayorCodeExternalProvider = "change_healthcare" - PayorCodeExternalProviderAvaility PayorCodeExternalProvider = "availity" - PayorCodeExternalProviderStedi PayorCodeExternalProvider = "stedi" - PayorCodeExternalProviderWaystar PayorCodeExternalProvider = "waystar" - PayorCodeExternalProviderClaimMd PayorCodeExternalProvider = "claim_md" -) - -func NewPayorCodeExternalProviderFromString(s string) (PayorCodeExternalProvider, error) { - switch s { - case "change_healthcare": - return PayorCodeExternalProviderChangeHealthcare, nil - case "availity": - return PayorCodeExternalProviderAvaility, nil - case "stedi": - return PayorCodeExternalProviderStedi, nil - case "waystar": - return PayorCodeExternalProviderWaystar, nil - case "claim_md": - return PayorCodeExternalProviderClaimMd, nil - } - var t PayorCodeExternalProvider - return "", fmt.Errorf("%s is not a valid %T", s, t) -} - -func (p PayorCodeExternalProvider) Ptr() *PayorCodeExternalProvider { - return &p -} - +// ℹ️ This enum is non-exhaustive. +type PayorCodeExternalProvider string + +const ( + PayorCodeExternalProviderChangeHealthcare PayorCodeExternalProvider = "change_healthcare" + PayorCodeExternalProviderAvaility PayorCodeExternalProvider = "availity" + PayorCodeExternalProviderStedi PayorCodeExternalProvider = "stedi" + PayorCodeExternalProviderWaystar PayorCodeExternalProvider = "waystar" + PayorCodeExternalProviderClaimMd PayorCodeExternalProvider = "claim_md" + PayorCodeExternalProviderApero PayorCodeExternalProvider = "apero" + PayorCodeExternalProviderPverify PayorCodeExternalProvider = "pverify" +) + +func NewPayorCodeExternalProviderFromString(s string) (PayorCodeExternalProvider, error) { + switch s { + case "change_healthcare": + return PayorCodeExternalProviderChangeHealthcare, nil + case "availity": + return PayorCodeExternalProviderAvaility, nil + case "stedi": + return PayorCodeExternalProviderStedi, nil + case "waystar": + return PayorCodeExternalProviderWaystar, nil + case "claim_md": + return PayorCodeExternalProviderClaimMd, nil + case "apero": + return PayorCodeExternalProviderApero, nil + case "pverify": + return PayorCodeExternalProviderPverify, nil + } + var t PayorCodeExternalProvider + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (p PayorCodeExternalProvider) Ptr() *PayorCodeExternalProvider { + return &p +} + +var ( + performingLaboratoryFieldName = big.NewInt(1 << 0) + performingLaboratoryFieldPhoneNumber = big.NewInt(1 << 1) + performingLaboratoryFieldMedicalDirector = big.NewInt(1 << 2) + performingLaboratoryFieldAddress = big.NewInt(1 << 3) +) + +type PerformingLaboratory struct { + Name string `json:"name" url:"name"` + PhoneNumber *string `json:"phone_number,omitempty" url:"phone_number,omitempty"` + MedicalDirector *string `json:"medical_director,omitempty" url:"medical_director,omitempty"` + Address *Address `json:"address,omitempty" url:"address,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *PerformingLaboratory) GetName() string { + if p == nil { + return "" + } + return p.Name +} + +func (p *PerformingLaboratory) GetPhoneNumber() *string { + if p == nil { + return nil + } + return p.PhoneNumber +} + +func (p *PerformingLaboratory) GetMedicalDirector() *string { + if p == nil { + return nil + } + return p.MedicalDirector +} + +func (p *PerformingLaboratory) GetAddress() *Address { + if p == nil { + return nil + } + return p.Address +} + +func (p *PerformingLaboratory) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *PerformingLaboratory) require(field *big.Int) { + if p.explicitFields == nil { + p.explicitFields = big.NewInt(0) + } + p.explicitFields.Or(p.explicitFields, field) +} + +// SetName sets the Name field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerformingLaboratory) SetName(name string) { + p.Name = name + p.require(performingLaboratoryFieldName) +} + +// SetPhoneNumber sets the PhoneNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerformingLaboratory) SetPhoneNumber(phoneNumber *string) { + p.PhoneNumber = phoneNumber + p.require(performingLaboratoryFieldPhoneNumber) +} + +// SetMedicalDirector sets the MedicalDirector field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerformingLaboratory) SetMedicalDirector(medicalDirector *string) { + p.MedicalDirector = medicalDirector + p.require(performingLaboratoryFieldMedicalDirector) +} + +// SetAddress sets the Address field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (p *PerformingLaboratory) SetAddress(address *Address) { + p.Address = address + p.require(performingLaboratoryFieldAddress) +} + +func (p *PerformingLaboratory) UnmarshalJSON(data []byte) error { + type unmarshaler PerformingLaboratory + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PerformingLaboratory(value) + extraProperties, err := internal.ExtractExtraProperties(data, *p) + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *PerformingLaboratory) MarshalJSON() ([]byte, error) { + type embed PerformingLaboratory + var marshaler = struct { + embed + }{ + embed: embed(*p), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, p.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (p *PerformingLaboratory) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + var ( pngFieldContent = big.NewInt(1 << 0) ) @@ -28352,6 +30703,7 @@ const ( ProvidersZwift Providers = "zwift" ProvidersFreestyleLibre Providers = "freestyle_libre" ProvidersAbbottLibreview Providers = "abbott_libreview" + ProvidersTandemSource Providers = "tandem_source" ProvidersFreestyleLibreBle Providers = "freestyle_libre_ble" ProvidersEightSleep Providers = "eight_sleep" ProvidersWithings Providers = "withings" @@ -28371,6 +30723,7 @@ const ( ProvidersHammerhead Providers = "hammerhead" ProvidersMyFitnessPal Providers = "my_fitness_pal" ProvidersHealthConnect Providers = "health_connect" + ProvidersSamsungHealth Providers = "samsung_health" ProvidersPolar Providers = "polar" ProvidersCronometer Providers = "cronometer" ProvidersKardia Providers = "kardia" @@ -28405,6 +30758,8 @@ func NewProvidersFromString(s string) (Providers, error) { return ProvidersFreestyleLibre, nil case "abbott_libreview": return ProvidersAbbottLibreview, nil + case "tandem_source": + return ProvidersTandemSource, nil case "freestyle_libre_ble": return ProvidersFreestyleLibreBle, nil case "eight_sleep": @@ -28443,6 +30798,8 @@ func NewProvidersFromString(s string) (Providers, error) { return ProvidersMyFitnessPal, nil case "health_connect": return ProvidersHealthConnect, nil + case "samsung_health": + return ProvidersSamsungHealth, nil case "polar": return ProvidersPolar, nil case "cronometer": @@ -28621,147 +30978,536 @@ func (q *Question) SetAnswers(answers []*Answer) { q.require(questionFieldAnswers) } -// SetConstraint sets the Constraint field and marks it as non-optional; +// SetConstraint sets the Constraint field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (q *Question) SetConstraint(constraint *string) { + q.Constraint = constraint + q.require(questionFieldConstraint) +} + +// SetDefault sets the Default field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (q *Question) SetDefault(default_ *string) { + q.Default = default_ + q.require(questionFieldDefault) +} + +func (q *Question) UnmarshalJSON(data []byte) error { + type unmarshaler Question + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *q = Question(value) + extraProperties, err := internal.ExtractExtraProperties(data, *q) + if err != nil { + return err + } + q.extraProperties = extraProperties + q.rawJSON = json.RawMessage(data) + return nil +} + +func (q *Question) MarshalJSON() ([]byte, error) { + type embed Question + var marshaler = struct { + embed + }{ + embed: embed(*q), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, q.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (q *Question) String() string { + if len(q.rawJSON) > 0 { + if value, err := internal.StringifyJSON(q.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(q); err == nil { + return value + } + return fmt.Sprintf("%#v", q) +} + +// ℹ️ This enum is non-exhaustive. +type QuestionType string + +const ( + QuestionTypeChoice QuestionType = "choice" + QuestionTypeText QuestionType = "text" + QuestionTypeNumeric QuestionType = "numeric" + QuestionTypeMultiChoice QuestionType = "multi_choice" +) + +func NewQuestionTypeFromString(s string) (QuestionType, error) { + switch s { + case "choice": + return QuestionTypeChoice, nil + case "text": + return QuestionTypeText, nil + case "numeric": + return QuestionTypeNumeric, nil + case "multi_choice": + return QuestionTypeMultiChoice, nil + } + var t QuestionType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (q QuestionType) Ptr() *QuestionType { + return &q +} + +// ℹ️ This enum is non-exhaustive. +type Race string + +const ( + RaceAfricanAmericanOrBlack Race = "african_american_or_black" + RaceAsian Race = "asian" + RaceIndigenousNativeAmericanAlaskaNative Race = "indigenous_native_american_alaska_native" + RaceOther Race = "other" + RacePacificIslanderOrHawaiian Race = "pacific_islander_or_hawaiian" + RaceWhiteCaucasian Race = "white_caucasian" +) + +func NewRaceFromString(s string) (Race, error) { + switch s { + case "african_american_or_black": + return RaceAfricanAmericanOrBlack, nil + case "asian": + return RaceAsian, nil + case "indigenous_native_american_alaska_native": + return RaceIndigenousNativeAmericanAlaskaNative, nil + case "other": + return RaceOther, nil + case "pacific_islander_or_hawaiian": + return RacePacificIslanderOrHawaiian, nil + case "white_caucasian": + return RaceWhiteCaucasian, nil + } + var t Race + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r Race) Ptr() *Race { + return &r +} + +// ℹ️ This enum is non-exhaustive. +type ResponsibleRelationship string + +const ( + ResponsibleRelationshipSelf ResponsibleRelationship = "Self" + ResponsibleRelationshipSpouse ResponsibleRelationship = "Spouse" + ResponsibleRelationshipOther ResponsibleRelationship = "Other" +) + +func NewResponsibleRelationshipFromString(s string) (ResponsibleRelationship, error) { + switch s { + case "Self": + return ResponsibleRelationshipSelf, nil + case "Spouse": + return ResponsibleRelationshipSpouse, nil + case "Other": + return ResponsibleRelationshipOther, nil + } + var t ResponsibleRelationship + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r ResponsibleRelationship) Ptr() *ResponsibleRelationship { + return &r +} + +// ℹ️ This enum is non-exhaustive. +type ResultType string + +const ( + ResultTypeNumeric ResultType = "numeric" + ResultTypeRange ResultType = "range" + ResultTypeComment ResultType = "comment" + ResultTypeCodedValue ResultType = "coded_value" +) + +func NewResultTypeFromString(s string) (ResultType, error) { + switch s { + case "numeric": + return ResultTypeNumeric, nil + case "range": + return ResultTypeRange, nil + case "comment": + return ResultTypeComment, nil + case "coded_value": + return ResultTypeCodedValue, nil + } + var t ResultType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (r ResultType) Ptr() *ResultType { + return &r +} + +var ( + sampleDataFieldSampleId = big.NewInt(1 << 0) + sampleDataFieldControlNumber = big.NewInt(1 << 1) + sampleDataFieldDateCollected = big.NewInt(1 << 2) + sampleDataFieldDateReceived = big.NewInt(1 << 3) + sampleDataFieldDateReported = big.NewInt(1 << 4) + sampleDataFieldPerformingLaboratories = big.NewInt(1 << 5) + sampleDataFieldClinicalInformation = big.NewInt(1 << 6) +) + +type SampleData struct { + SampleId *string `json:"sample_id,omitempty" url:"sample_id,omitempty"` + ControlNumber *string `json:"control_number,omitempty" url:"control_number,omitempty"` + DateCollected *SampleDataDateCollected `json:"date_collected,omitempty" url:"date_collected,omitempty"` + DateReceived *SampleDataDateReceived `json:"date_received,omitempty" url:"date_received,omitempty"` + DateReported *SampleDataDateReported `json:"date_reported,omitempty" url:"date_reported,omitempty"` + PerformingLaboratories map[string]*PerformingLaboratory `json:"performing_laboratories,omitempty" url:"performing_laboratories,omitempty"` + ClinicalInformation *ClinicalInformation `json:"clinical_information,omitempty" url:"clinical_information,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SampleData) GetSampleId() *string { + if s == nil { + return nil + } + return s.SampleId +} + +func (s *SampleData) GetControlNumber() *string { + if s == nil { + return nil + } + return s.ControlNumber +} + +func (s *SampleData) GetDateCollected() *SampleDataDateCollected { + if s == nil { + return nil + } + return s.DateCollected +} + +func (s *SampleData) GetDateReceived() *SampleDataDateReceived { + if s == nil { + return nil + } + return s.DateReceived +} + +func (s *SampleData) GetDateReported() *SampleDataDateReported { + if s == nil { + return nil + } + return s.DateReported +} + +func (s *SampleData) GetPerformingLaboratories() map[string]*PerformingLaboratory { + if s == nil { + return nil + } + return s.PerformingLaboratories +} + +func (s *SampleData) GetClinicalInformation() *ClinicalInformation { + if s == nil { + return nil + } + return s.ClinicalInformation +} + +func (s *SampleData) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SampleData) require(field *big.Int) { + if s.explicitFields == nil { + s.explicitFields = big.NewInt(0) + } + s.explicitFields.Or(s.explicitFields, field) +} + +// SetSampleId sets the SampleId field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SampleData) SetSampleId(sampleId *string) { + s.SampleId = sampleId + s.require(sampleDataFieldSampleId) +} + +// SetControlNumber sets the ControlNumber field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SampleData) SetControlNumber(controlNumber *string) { + s.ControlNumber = controlNumber + s.require(sampleDataFieldControlNumber) +} + +// SetDateCollected sets the DateCollected field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SampleData) SetDateCollected(dateCollected *SampleDataDateCollected) { + s.DateCollected = dateCollected + s.require(sampleDataFieldDateCollected) +} + +// SetDateReceived sets the DateReceived field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SampleData) SetDateReceived(dateReceived *SampleDataDateReceived) { + s.DateReceived = dateReceived + s.require(sampleDataFieldDateReceived) +} + +// SetDateReported sets the DateReported field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (s *SampleData) SetDateReported(dateReported *SampleDataDateReported) { + s.DateReported = dateReported + s.require(sampleDataFieldDateReported) +} + +// SetPerformingLaboratories sets the PerformingLaboratories field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (q *Question) SetConstraint(constraint *string) { - q.Constraint = constraint - q.require(questionFieldConstraint) +func (s *SampleData) SetPerformingLaboratories(performingLaboratories map[string]*PerformingLaboratory) { + s.PerformingLaboratories = performingLaboratories + s.require(sampleDataFieldPerformingLaboratories) } -// SetDefault sets the Default field and marks it as non-optional; +// SetClinicalInformation sets the ClinicalInformation field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (q *Question) SetDefault(default_ *string) { - q.Default = default_ - q.require(questionFieldDefault) +func (s *SampleData) SetClinicalInformation(clinicalInformation *ClinicalInformation) { + s.ClinicalInformation = clinicalInformation + s.require(sampleDataFieldClinicalInformation) } -func (q *Question) UnmarshalJSON(data []byte) error { - type unmarshaler Question +func (s *SampleData) UnmarshalJSON(data []byte) error { + type unmarshaler SampleData var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *q = Question(value) - extraProperties, err := internal.ExtractExtraProperties(data, *q) + *s = SampleData(value) + extraProperties, err := internal.ExtractExtraProperties(data, *s) if err != nil { return err } - q.extraProperties = extraProperties - q.rawJSON = json.RawMessage(data) + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) return nil } -func (q *Question) MarshalJSON() ([]byte, error) { - type embed Question +func (s *SampleData) MarshalJSON() ([]byte, error) { + type embed SampleData var marshaler = struct { embed }{ - embed: embed(*q), + embed: embed(*s), } - explicitMarshaler := internal.HandleExplicitFields(marshaler, q.explicitFields) + explicitMarshaler := internal.HandleExplicitFields(marshaler, s.explicitFields) return json.Marshal(explicitMarshaler) } -func (q *Question) String() string { - if len(q.rawJSON) > 0 { - if value, err := internal.StringifyJSON(q.rawJSON); err == nil { +func (s *SampleData) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { return value } } - if value, err := internal.StringifyJSON(q); err == nil { + if value, err := internal.StringifyJSON(s); err == nil { return value } - return fmt.Sprintf("%#v", q) + return fmt.Sprintf("%#v", s) } -// ℹ️ This enum is non-exhaustive. -type QuestionType string +type SampleDataDateCollected struct { + UtcTimestampWithTimezoneOffset *UtcTimestampWithTimezoneOffset + String string -const ( - QuestionTypeChoice QuestionType = "choice" - QuestionTypeText QuestionType = "text" - QuestionTypeNumeric QuestionType = "numeric" - QuestionTypeMultiChoice QuestionType = "multi_choice" -) + typ string +} -func NewQuestionTypeFromString(s string) (QuestionType, error) { - switch s { - case "choice": - return QuestionTypeChoice, nil - case "text": - return QuestionTypeText, nil - case "numeric": - return QuestionTypeNumeric, nil - case "multi_choice": - return QuestionTypeMultiChoice, nil +func (s *SampleDataDateCollected) GetUtcTimestampWithTimezoneOffset() *UtcTimestampWithTimezoneOffset { + if s == nil { + return nil } - var t QuestionType - return "", fmt.Errorf("%s is not a valid %T", s, t) + return s.UtcTimestampWithTimezoneOffset } -func (q QuestionType) Ptr() *QuestionType { - return &q +func (s *SampleDataDateCollected) GetString() string { + if s == nil { + return "" + } + return s.String } -// ℹ️ This enum is non-exhaustive. -type Race string +func (s *SampleDataDateCollected) UnmarshalJSON(data []byte) error { + valueUtcTimestampWithTimezoneOffset := new(UtcTimestampWithTimezoneOffset) + if err := json.Unmarshal(data, &valueUtcTimestampWithTimezoneOffset); err == nil { + s.typ = "UtcTimestampWithTimezoneOffset" + s.UtcTimestampWithTimezoneOffset = valueUtcTimestampWithTimezoneOffset + return nil + } + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typ = "String" + s.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} -const ( - RaceAfricanAmericanOrBlack Race = "african_american_or_black" - RaceAsian Race = "asian" - RaceIndigenousNativeAmericanAlaskaNative Race = "indigenous_native_american_alaska_native" - RaceOther Race = "other" - RacePacificIslanderOrHawaiian Race = "pacific_islander_or_hawaiian" - RaceWhiteCaucasian Race = "white_caucasian" -) +func (s SampleDataDateCollected) MarshalJSON() ([]byte, error) { + if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { + return json.Marshal(s.UtcTimestampWithTimezoneOffset) + } + if s.typ == "String" || s.String != "" { + return json.Marshal(s.String) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} -func NewRaceFromString(s string) (Race, error) { - switch s { - case "african_american_or_black": - return RaceAfricanAmericanOrBlack, nil - case "asian": - return RaceAsian, nil - case "indigenous_native_american_alaska_native": - return RaceIndigenousNativeAmericanAlaskaNative, nil - case "other": - return RaceOther, nil - case "pacific_islander_or_hawaiian": - return RacePacificIslanderOrHawaiian, nil - case "white_caucasian": - return RaceWhiteCaucasian, nil +type SampleDataDateCollectedVisitor interface { + VisitUtcTimestampWithTimezoneOffset(*UtcTimestampWithTimezoneOffset) error + VisitString(string) error +} + +func (s *SampleDataDateCollected) Accept(visitor SampleDataDateCollectedVisitor) error { + if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { + return visitor.VisitUtcTimestampWithTimezoneOffset(s.UtcTimestampWithTimezoneOffset) } - var t Race - return "", fmt.Errorf("%s is not a valid %T", s, t) + if s.typ == "String" || s.String != "" { + return visitor.VisitString(s.String) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) } -func (r Race) Ptr() *Race { - return &r +type SampleDataDateReceived struct { + UtcTimestampWithTimezoneOffset *UtcTimestampWithTimezoneOffset + String string + + typ string } -// ℹ️ This enum is non-exhaustive. -type ResponsibleRelationship string +func (s *SampleDataDateReceived) GetUtcTimestampWithTimezoneOffset() *UtcTimestampWithTimezoneOffset { + if s == nil { + return nil + } + return s.UtcTimestampWithTimezoneOffset +} -const ( - ResponsibleRelationshipSelf ResponsibleRelationship = "Self" - ResponsibleRelationshipSpouse ResponsibleRelationship = "Spouse" - ResponsibleRelationshipOther ResponsibleRelationship = "Other" -) +func (s *SampleDataDateReceived) GetString() string { + if s == nil { + return "" + } + return s.String +} -func NewResponsibleRelationshipFromString(s string) (ResponsibleRelationship, error) { - switch s { - case "Self": - return ResponsibleRelationshipSelf, nil - case "Spouse": - return ResponsibleRelationshipSpouse, nil - case "Other": - return ResponsibleRelationshipOther, nil +func (s *SampleDataDateReceived) UnmarshalJSON(data []byte) error { + valueUtcTimestampWithTimezoneOffset := new(UtcTimestampWithTimezoneOffset) + if err := json.Unmarshal(data, &valueUtcTimestampWithTimezoneOffset); err == nil { + s.typ = "UtcTimestampWithTimezoneOffset" + s.UtcTimestampWithTimezoneOffset = valueUtcTimestampWithTimezoneOffset + return nil } - var t ResponsibleRelationship - return "", fmt.Errorf("%s is not a valid %T", s, t) + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typ = "String" + s.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) } -func (r ResponsibleRelationship) Ptr() *ResponsibleRelationship { - return &r +func (s SampleDataDateReceived) MarshalJSON() ([]byte, error) { + if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { + return json.Marshal(s.UtcTimestampWithTimezoneOffset) + } + if s.typ == "String" || s.String != "" { + return json.Marshal(s.String) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SampleDataDateReceivedVisitor interface { + VisitUtcTimestampWithTimezoneOffset(*UtcTimestampWithTimezoneOffset) error + VisitString(string) error +} + +func (s *SampleDataDateReceived) Accept(visitor SampleDataDateReceivedVisitor) error { + if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { + return visitor.VisitUtcTimestampWithTimezoneOffset(s.UtcTimestampWithTimezoneOffset) + } + if s.typ == "String" || s.String != "" { + return visitor.VisitString(s.String) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SampleDataDateReported struct { + UtcTimestampWithTimezoneOffset *UtcTimestampWithTimezoneOffset + String string + + typ string +} + +func (s *SampleDataDateReported) GetUtcTimestampWithTimezoneOffset() *UtcTimestampWithTimezoneOffset { + if s == nil { + return nil + } + return s.UtcTimestampWithTimezoneOffset +} + +func (s *SampleDataDateReported) GetString() string { + if s == nil { + return "" + } + return s.String +} + +func (s *SampleDataDateReported) UnmarshalJSON(data []byte) error { + valueUtcTimestampWithTimezoneOffset := new(UtcTimestampWithTimezoneOffset) + if err := json.Unmarshal(data, &valueUtcTimestampWithTimezoneOffset); err == nil { + s.typ = "UtcTimestampWithTimezoneOffset" + s.UtcTimestampWithTimezoneOffset = valueUtcTimestampWithTimezoneOffset + return nil + } + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typ = "String" + s.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s SampleDataDateReported) MarshalJSON() ([]byte, error) { + if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { + return json.Marshal(s.UtcTimestampWithTimezoneOffset) + } + if s.typ == "String" || s.String != "" { + return json.Marshal(s.String) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", s) +} + +type SampleDataDateReportedVisitor interface { + VisitUtcTimestampWithTimezoneOffset(*UtcTimestampWithTimezoneOffset) error + VisitString(string) error +} + +func (s *SampleDataDateReported) Accept(visitor SampleDataDateReportedVisitor) error { + if s.typ == "UtcTimestampWithTimezoneOffset" || s.UtcTimestampWithTimezoneOffset != nil { + return visitor.VisitUtcTimestampWithTimezoneOffset(s.UtcTimestampWithTimezoneOffset) + } + if s.typ == "String" || s.String != "" { + return visitor.VisitString(s.String) + } + return fmt.Errorf("type %T does not include a non-empty union type", s) } // ℹ️ This enum is non-exhaustive. @@ -29369,6 +32115,108 @@ func (u *UserRefreshErrorResponse) String() string { return fmt.Sprintf("%#v", u) } +var ( + utcTimestampWithTimezoneOffsetFieldTimestamp = big.NewInt(1 << 0) + utcTimestampWithTimezoneOffsetFieldTimezoneOffset = big.NewInt(1 << 1) +) + +type UtcTimestampWithTimezoneOffset struct { + Timestamp time.Time `json:"timestamp" url:"timestamp"` + TimezoneOffset int `json:"timezone_offset" url:"timezone_offset"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *UtcTimestampWithTimezoneOffset) GetTimestamp() time.Time { + if u == nil { + return time.Time{} + } + return u.Timestamp +} + +func (u *UtcTimestampWithTimezoneOffset) GetTimezoneOffset() int { + if u == nil { + return 0 + } + return u.TimezoneOffset +} + +func (u *UtcTimestampWithTimezoneOffset) GetExtraProperties() map[string]interface{} { + return u.extraProperties +} + +func (u *UtcTimestampWithTimezoneOffset) require(field *big.Int) { + if u.explicitFields == nil { + u.explicitFields = big.NewInt(0) + } + u.explicitFields.Or(u.explicitFields, field) +} + +// SetTimestamp sets the Timestamp field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UtcTimestampWithTimezoneOffset) SetTimestamp(timestamp time.Time) { + u.Timestamp = timestamp + u.require(utcTimestampWithTimezoneOffsetFieldTimestamp) +} + +// SetTimezoneOffset sets the TimezoneOffset field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UtcTimestampWithTimezoneOffset) SetTimezoneOffset(timezoneOffset int) { + u.TimezoneOffset = timezoneOffset + u.require(utcTimestampWithTimezoneOffsetFieldTimezoneOffset) +} + +func (u *UtcTimestampWithTimezoneOffset) UnmarshalJSON(data []byte) error { + type embed UtcTimestampWithTimezoneOffset + var unmarshaler = struct { + embed + Timestamp *internal.DateTime `json:"timestamp"` + }{ + embed: embed(*u), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *u = UtcTimestampWithTimezoneOffset(unmarshaler.embed) + u.Timestamp = unmarshaler.Timestamp.Time() + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *UtcTimestampWithTimezoneOffset) MarshalJSON() ([]byte, error) { + type embed UtcTimestampWithTimezoneOffset + var marshaler = struct { + embed + Timestamp *internal.DateTime `json:"timestamp"` + }{ + embed: embed(*u), + Timestamp: internal.NewDateTime(u.Timestamp), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (u *UtcTimestampWithTimezoneOffset) String() string { + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + var ( validationErrorFieldLoc = big.NewInt(1 << 0) validationErrorFieldMsg = big.NewInt(1 << 1) diff --git a/user.go b/user.go index 0363a10..f9e7e39 100644 --- a/user.go +++ b/user.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) @@ -77,6 +77,27 @@ func (u *UserCreateBody) SetIngestionEnd(ingestionEnd *string) { u.require(userCreateBodyFieldIngestionEnd) } +func (u *UserCreateBody) UnmarshalJSON(data []byte) error { + type unmarshaler UserCreateBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *u = UserCreateBody(body) + return nil +} + +func (u *UserCreateBody) MarshalJSON() ([]byte, error) { + type embed UserCreateBody + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( createInsuranceRequestFieldPayorCode = big.NewInt(1 << 0) createInsuranceRequestFieldMemberId = big.NewInt(1 << 1) @@ -92,7 +113,7 @@ type CreateInsuranceRequest struct { MemberId string `json:"member_id" url:"-"` GroupId *string `json:"group_id,omitempty" url:"-"` Relationship ResponsibleRelationship `json:"relationship" url:"-"` - Insured *VitalCoreSchemasDbSchemasLabTestInsurancePersonDetails `json:"insured,omitempty" url:"-"` + Insured *VitalCoreSchemasDbSchemasLabTestInsurancePersonDetails `json:"insured" url:"-"` Guarantor *GuarantorDetails `json:"guarantor,omitempty" url:"-"` IsPrimary *bool `json:"is_primary,omitempty" url:"-"` @@ -156,6 +177,27 @@ func (c *CreateInsuranceRequest) SetIsPrimary(isPrimary *bool) { c.require(createInsuranceRequestFieldIsPrimary) } +func (c *CreateInsuranceRequest) UnmarshalJSON(data []byte) error { + type unmarshaler CreateInsuranceRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CreateInsuranceRequest(body) + return nil +} + +func (c *CreateInsuranceRequest) MarshalJSON() ([]byte, error) { + type embed CreateInsuranceRequest + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( createUserPortalUrlBodyFieldContext = big.NewInt(1 << 0) createUserPortalUrlBodyFieldOrderId = big.NewInt(1 << 1) @@ -198,6 +240,27 @@ func (c *CreateUserPortalUrlBody) SetOrderId(orderId *string) { c.require(createUserPortalUrlBodyFieldOrderId) } +func (c *CreateUserPortalUrlBody) UnmarshalJSON(data []byte) error { + type unmarshaler CreateUserPortalUrlBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *c = CreateUserPortalUrlBody(body) + return nil +} + +func (c *CreateUserPortalUrlBody) MarshalJSON() ([]byte, error) { + type embed CreateUserPortalUrlBody + var marshaler = struct { + embed + }{ + embed: embed(*c), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, c.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( userGetAllRequestFieldOffset = big.NewInt(1 << 0) userGetAllRequestFieldLimit = big.NewInt(1 << 1) @@ -324,6 +387,27 @@ func (u *UserPatchBody) SetClientUserId(clientUserId *string) { u.require(userPatchBodyFieldClientUserId) } +func (u *UserPatchBody) UnmarshalJSON(data []byte) error { + type unmarshaler UserPatchBody + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *u = UserPatchBody(body) + return nil +} + +func (u *UserPatchBody) MarshalJSON() ([]byte, error) { + type embed UserPatchBody + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + var ( userRefreshRequestFieldTimeout = big.NewInt(1 << 0) ) @@ -2168,6 +2252,180 @@ func (t *TimeseriesMetricPoint) String() string { return fmt.Sprintf("%#v", t) } +var ( + userAddressFieldFirstLine = big.NewInt(1 << 0) + userAddressFieldSecondLine = big.NewInt(1 << 1) + userAddressFieldCountry = big.NewInt(1 << 2) + userAddressFieldZip = big.NewInt(1 << 3) + userAddressFieldCity = big.NewInt(1 << 4) + userAddressFieldState = big.NewInt(1 << 5) + userAddressFieldAccessNotes = big.NewInt(1 << 6) +) + +type UserAddress struct { + FirstLine string `json:"first_line" url:"first_line"` + SecondLine *string `json:"second_line,omitempty" url:"second_line,omitempty"` + Country string `json:"country" url:"country"` + Zip string `json:"zip" url:"zip"` + City string `json:"city" url:"city"` + State string `json:"state" url:"state"` + AccessNotes *string `json:"access_notes,omitempty" url:"access_notes,omitempty"` + + // Private bitmask of fields set to an explicit value and therefore not to be omitted + explicitFields *big.Int `json:"-" url:"-"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *UserAddress) GetFirstLine() string { + if u == nil { + return "" + } + return u.FirstLine +} + +func (u *UserAddress) GetSecondLine() *string { + if u == nil { + return nil + } + return u.SecondLine +} + +func (u *UserAddress) GetCountry() string { + if u == nil { + return "" + } + return u.Country +} + +func (u *UserAddress) GetZip() string { + if u == nil { + return "" + } + return u.Zip +} + +func (u *UserAddress) GetCity() string { + if u == nil { + return "" + } + return u.City +} + +func (u *UserAddress) GetState() string { + if u == nil { + return "" + } + return u.State +} + +func (u *UserAddress) GetAccessNotes() *string { + if u == nil { + return nil + } + return u.AccessNotes +} + +func (u *UserAddress) GetExtraProperties() map[string]interface{} { + return u.extraProperties +} + +func (u *UserAddress) require(field *big.Int) { + if u.explicitFields == nil { + u.explicitFields = big.NewInt(0) + } + u.explicitFields.Or(u.explicitFields, field) +} + +// SetFirstLine sets the FirstLine field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetFirstLine(firstLine string) { + u.FirstLine = firstLine + u.require(userAddressFieldFirstLine) +} + +// SetSecondLine sets the SecondLine field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetSecondLine(secondLine *string) { + u.SecondLine = secondLine + u.require(userAddressFieldSecondLine) +} + +// SetCountry sets the Country field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetCountry(country string) { + u.Country = country + u.require(userAddressFieldCountry) +} + +// SetZip sets the Zip field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetZip(zip string) { + u.Zip = zip + u.require(userAddressFieldZip) +} + +// SetCity sets the City field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetCity(city string) { + u.City = city + u.require(userAddressFieldCity) +} + +// SetState sets the State field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetState(state string) { + u.State = state + u.require(userAddressFieldState) +} + +// SetAccessNotes sets the AccessNotes field and marks it as non-optional; +// this prevents an empty or null value for this field from being omitted during serialization. +func (u *UserAddress) SetAccessNotes(accessNotes *string) { + u.AccessNotes = accessNotes + u.require(userAddressFieldAccessNotes) +} + +func (u *UserAddress) UnmarshalJSON(data []byte) error { + type unmarshaler UserAddress + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UserAddress(value) + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *UserAddress) MarshalJSON() ([]byte, error) { + type embed UserAddress + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} + +func (u *UserAddress) String() string { + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + var ( userInfoFieldFirstName = big.NewInt(1 << 0) userInfoFieldLastName = big.NewInt(1 << 1) @@ -2190,7 +2448,7 @@ type UserInfo struct { PhoneNumber string `json:"phone_number" url:"phone_number"` Gender string `json:"gender" url:"gender"` Dob string `json:"dob" url:"dob"` - Address *Address `json:"address" url:"address"` + Address *UserAddress `json:"address" url:"address"` MedicalProxy *GuarantorDetails `json:"medical_proxy,omitempty" url:"medical_proxy,omitempty"` Race *Race `json:"race,omitempty" url:"race,omitempty"` Ethnicity *Ethnicity `json:"ethnicity,omitempty" url:"ethnicity,omitempty"` @@ -2246,7 +2504,7 @@ func (u *UserInfo) GetDob() string { return u.Dob } -func (u *UserInfo) GetAddress() *Address { +func (u *UserInfo) GetAddress() *UserAddress { if u == nil { return nil } @@ -2343,7 +2601,7 @@ func (u *UserInfo) SetDob(dob string) { // SetAddress sets the Address field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UserInfo) SetAddress(address *Address) { +func (u *UserInfo) SetAddress(address *UserAddress) { u.Address = address u.require(userInfoFieldAddress) } @@ -3000,7 +3258,7 @@ type UserInfoCreateRequest struct { PhoneNumber string `json:"phone_number" url:"-"` Gender string `json:"gender" url:"-"` Dob string `json:"dob" url:"-"` - Address *Address `json:"address,omitempty" url:"-"` + Address *UserAddress `json:"address" url:"-"` MedicalProxy *GuarantorDetails `json:"medical_proxy,omitempty" url:"-"` Race *Race `json:"race,omitempty" url:"-"` Ethnicity *Ethnicity `json:"ethnicity,omitempty" url:"-"` @@ -3062,7 +3320,7 @@ func (u *UserInfoCreateRequest) SetDob(dob string) { // SetAddress sets the Address field and marks it as non-optional; // this prevents an empty or null value for this field from being omitted during serialization. -func (u *UserInfoCreateRequest) SetAddress(address *Address) { +func (u *UserInfoCreateRequest) SetAddress(address *UserAddress) { u.Address = address u.require(userInfoCreateRequestFieldAddress) } @@ -3101,3 +3359,24 @@ func (u *UserInfoCreateRequest) SetGenderIdentity(genderIdentity *GenderIdentity u.GenderIdentity = genderIdentity u.require(userInfoCreateRequestFieldGenderIdentity) } + +func (u *UserInfoCreateRequest) UnmarshalJSON(data []byte) error { + type unmarshaler UserInfoCreateRequest + var body unmarshaler + if err := json.Unmarshal(data, &body); err != nil { + return err + } + *u = UserInfoCreateRequest(body) + return nil +} + +func (u *UserInfoCreateRequest) MarshalJSON() ([]byte, error) { + type embed UserInfoCreateRequest + var marshaler = struct { + embed + }{ + embed: embed(*u), + } + explicitMarshaler := internal.HandleExplicitFields(marshaler, u.explicitFields) + return json.Marshal(explicitMarshaler) +} diff --git a/user/client.go b/user/client.go index 5e8cdbd..1655df5 100644 --- a/user/client.go +++ b/user/client.go @@ -4,10 +4,10 @@ package user import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/user/raw_client.go b/user/raw_client.go index 901a688..600a3c6 100644 --- a/user/raw_client.go +++ b/user/raw_client.go @@ -4,10 +4,10 @@ package user import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/vitals.go b/vitals.go index d23f979..d4a7f98 100644 --- a/vitals.go +++ b/vitals.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/vitals/client.go b/vitals/client.go index e1037bc..f126601 100644 --- a/vitals/client.go +++ b/vitals/client.go @@ -4,10 +4,10 @@ package vitals import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/vitals/raw_client.go b/vitals/raw_client.go index 4d46628..43bc373 100644 --- a/vitals/raw_client.go +++ b/vitals/raw_client.go @@ -4,10 +4,10 @@ package vitals import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" ) diff --git a/workouts.go b/workouts.go index 25eacf9..12d3902 100644 --- a/workouts.go +++ b/workouts.go @@ -5,7 +5,7 @@ package api import ( json "encoding/json" fmt "fmt" - internal "github.com/tryVital/vital-go/internal" + internal "github.com/tryVital/vital-go/v2/internal" big "math/big" time "time" ) diff --git a/workouts/client.go b/workouts/client.go index 52e93ef..b5dbe03 100644 --- a/workouts/client.go +++ b/workouts/client.go @@ -4,10 +4,10 @@ package workouts import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" ) type Client struct { diff --git a/workouts/raw_client.go b/workouts/raw_client.go index 00b8d09..113c443 100644 --- a/workouts/raw_client.go +++ b/workouts/raw_client.go @@ -4,10 +4,10 @@ package workouts import ( context "context" - vitalgo "github.com/tryVital/vital-go" - core "github.com/tryVital/vital-go/core" - internal "github.com/tryVital/vital-go/internal" - option "github.com/tryVital/vital-go/option" + vitalgo "github.com/tryVital/vital-go/v2" + core "github.com/tryVital/vital-go/v2/core" + internal "github.com/tryVital/vital-go/v2/internal" + option "github.com/tryVital/vital-go/v2/option" http "net/http" )