apiresource

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

apiresource

This package defines canonical, shared API resource types used in public API responses.

These types:

  • Represent what is returned to clients (e.g. Address, Customer)
  • Contain json tags and flatten/compose internal data for client consumption
  • Are version-stable and reused across endpoints
  • Follow strict conventions for nullable vs optional fields

Use these in handlers as response types Do not use these internally in services or repositories

Tag Reference

Purpose Tag Nullable
Required value Field string json:"field" validate:"required" No
Required, but nullable Field *string json:"field" Yes

Fields are always present in the response — either with a value or null. Never use omitempty.

Enum fields carry the value set in the tag (validate:"required,enum=address"), and every field needs a doc comment: both feed the generated OpenAPI spec, and from there the SDKs and docs site.

docs/patterns/api-resource-conventions.md and docs/patterns/nullable-field-patterns.md are the full spec for this layer.

Documentation

Overview

! Note: this will be refactored in the future - okay to leave as is.

! Note: this will be refactored in the future - okay to leave as is.

Index

Constants

View Source
const (
	SampleConversationID            = "cv_w35z4ck68yq7"
	SampleConversationParticipantID = "cvpt_be2h3ul14cts"
)
View Source
const (
	SampleMessagingGroupID       = "cvgp_wjlypugna7s4"
	SampleMessagingGroupMemberID = "cvgppt_obu4df48t1xx"
)
View Source
const (
	SampleOperatingCalendarID        = "occd_7f2m9qk4wzxb"
	SampleOperatingCalendarClosureID = "occdcn_3vh8yt5nqp1r"
)
View Source
const RedactedRequestLogHost = "https://api.openmrp.ai"

RedactedRequestLogHost is the host shown for internal/agent request logs in customer-facing responses, so the gateway's internal listener hostname (a k8s service name:port) never leaks. We surface the public API host the agent's call is logically equivalent to, rather than a meaningless "internal" placeholder. The true internal host stays in platform-service storage for operator debugging.

View Source
const SampleAPIKeyID = "apke_eiylmwr6q7oz" // #nosec G101 - sample data for API docs
View Source
const SampleAPIKeyName = "Production API Key" // #nosec G101 - sample data for API docs
View Source
const SampleAccessToken = "" /* 256-byte string literal not displayed */

#nosec G101 - This is sample data for API documentation, not a real credential

View Source
const SampleAccountBrandingID = "abr_2rygb4fof28b"
View Source
const SampleAccountGroupID = "acgp_6p4z57e9alaf"
View Source
const SampleAccountGroupName = "Wholesale Customers"
View Source
const SampleAccountID = "ac_ykxoradjoeb3"
View Source
const SampleAccountIntegrationID = "acig_5ilahyezrs63"
View Source
const SampleAccountIntegrationName = "My Stripe Integration"
View Source
const SampleAccountName = "Acme Inc."
View Source
const SampleAccountPortalID = "apo_u2esi5el78uv"
View Source
const SampleAccountPortalSlug = "acme"
View Source
const SampleAccountPriceID = "acpr_7l4j483kf32p"
View Source
const SampleAccountStatusID = "acss_st5zyjmzm30k"
View Source
const SampleAccountStatusName = "Normal"
View Source
const SampleAccountUserID = "acus_e5zu8bde0z3h"
View Source
const SampleAddressCity = "San Francisco"
View Source
const SampleAddressCountry = "US"
View Source
const SampleAddressID = "ad_npqa5y43q26z"
View Source
const SampleAddressLine1 = "123 Main Street"
View Source
const SampleAddressLine2 = "Suite 100"
View Source
const SampleAddressPostalCode = "94105"
View Source
const SampleAddressState = "CA"
View Source
const SampleAdjustmentTypeCode = string(constants.AdjustmentTypeDiscount)
View Source
const SampleAdjustmentTypeID = "adjt_e2t6ruyqik5q"
View Source
const SampleAdjustmentTypeName = "Discount"
View Source
const SampleAgentActionID = "agax_5ycfhxhjc74z"
View Source
const SampleAgentDefinitionID = "agdf_ah7tkyfxk8jl"
View Source
const SampleAgentDefinitionToolID = "agdftl_iyc1asmsg1pu"
View Source
const SampleAgentMemoryID = "agmm_o7tjkr16gfmh"
View Source
const SampleAgentRunID = "agrn_l6ob5relrd7t"
View Source
const SampleAgentRunStepID = "agrnev_8582tkfekiua"
View Source
const SampleAllocationEntryID = "txal_2o8lu50zvphn"
View Source
const SampleAnnouncementID = "an_m4vwgn2t8cqs"
View Source
const SampleAttributeID = "at_rf1w295jt5ia"
View Source
const SampleAttributeValue = "Premium"
View Source
const SampleAuditEventAction = constants.AuditActionUpdate
View Source
const SampleAuditEventID = "ae_emripvn8t1xl"
View Source
const SampleAuditEventIdempotencyKey = "3f2504e0-4f89-41d3-9a0c-0305e82c3301"
View Source
const SampleAuditEventMetadataReason = `{"reason":"operator override"}`
View Source
const SampleAuditEventResourceID = SampleUserID
View Source
const SampleAuditEventResourceType = constants.ObjectTypeUser
View Source
const SampleAuditEventSourceIP = "198.51.100.8"
View Source
const SampleAvailableToolSlug = constants.ToolReadDoc
View Source
const SampleBatchID = "bt_fuies8j4pk45"
View Source
const SampleBillingPortalURL = "https://billing.stripe.com/p/session/test_YWNjdF8xTTJKVGtMa3E0Z3Bic"
View Source
const SampleCRUDAddressID = "ad_j8cz0b79pwdb"
View Source
const SampleCarrierID = "cr_tv5vfjtgu1n3"
View Source
const SampleCarrierName = "FedEx"
View Source
const SampleCheckoutSessionID = "cs_test_a1VnbGQ4ZTFRdGRqUWpYR3h6OG"
View Source
const SampleChildAccountExternalNumber = "CUST-001"
View Source
const SampleChildAccountRelationID = "acre_c76d97madwo3"
View Source
const SampleConsumptionID = "cp_blst8ze24dy3"
View Source
const SampleContactMatchID = SampleAccountUserID
View Source
const SampleConversationLinkID = "cvlk_cjaz69kz9dvn"
View Source
const SampleCustomerID = "ac_opnlh43ymyee"
View Source
const SampleCustomerName = "Acme Inc."
View Source
const SampleCustomerNumber = "100042"
View Source
const SampleCustomerRelationID = "acre_f9nhgnzecfjm"
View Source
const SampleDCLocationID = "dclo_qucvv7xm6trv"
View Source
const SampleDeliveryID = "dlv_9xsjlqx5753y"
View Source
const SampleDeliveryLineID = "dlvl_9vn001g1rc2t"
View Source
const SampleDemandOverrideID = "deov_p8roudstrung"
View Source
const SampleDemandOverrideTypeID = "deovtp_z8ir1rabbsmt"
View Source
const SampleDepartmentID = "dp_m0jayebxnkos"
View Source
const SampleDepartmentName = "Fabrication"
View Source
const SampleEDIRunID = "edru_bpgd8fix7eeh"
View Source
const SampleEmailContactID = "ec_dmyas2bqcm95"
View Source
const SampleEmailDomainID = "emdom_2rk3omr8vshb"
View Source
const SampleEmailInboxID = "eminb_2s9kobr9s7tp"
View Source
const SampleEmailLogID = "eml_h2j1q1nfibwb"
View Source
const SampleEnterpriseInquiryID = "enir_w61ojhgj9sna"
View Source
const SampleFilterDateOnly = sampleYear + "-" + sampleMonth + "-" + sampleDay

SampleFilterDateOnly is used in OpenAPI examples for query parameters that take a plain calendar date rather than an instant.

View Source
const SampleFilterEndDateRFC3339 = sampleUpdatedAtTimestamp

SampleFilterEndDateRFC3339 is used in OpenAPI examples for date-range query parameters.

View Source
const SampleFilterStartDateRFC3339 = sampleCreatedAtTimestamp

SampleFilterStartDateRFC3339 is used in OpenAPI examples for date-range query parameters.

View Source
const SampleGeolocationID = "gl_betrf3v346k5"
View Source
const SampleHubspotCompanyReviewID = "igrv_w88uo6y5g8bu"
View Source
const SampleHubspotSyncJobID = "igjb_pbxu4l5ujuym"
View Source
const SampleHubspotSyncRecordID = "igrd_30op4afvch45"
View Source
const SampleInventoryChangeLogID = "icl_kb4dlhqx4voe"
View Source
const SampleInvoiceAllocationID = SampleAllocationEntryID

Same allocation row as SampleAllocationEntryID (invoice example embeds that entry).

View Source
const SampleInvoiceID = "iv_m982ezb0fgp7"
View Source
const SampleInvoiceLineID = "ivln_q6k84g39xlnk"
View Source
const SampleItemCategoryID = "ic_d06g9c6yc9ck"
View Source
const SampleItemCategoryName = "Electronics"
View Source
const SampleItemID = "it_pej07ckhvu62"
View Source
const SampleItemSKU = "ALM-2024-1001"
View Source
const SampleJobID = "jb_grz7cdpnz8jr"
View Source
const SampleLocationChildID = "lc_huci6mict6ys"
View Source
const SampleLocationID = "lc_yonnys0hx3ju"
View Source
const SampleLocationName = "Warehouse A"
View Source
const SampleLocationTypeCode = constants.LocationTypeCodeBuilding
View Source
const SampleLocationTypeID = "lc_ra08sngd0fxr"
View Source
const SampleLocationTypeName = "Building"
View Source
const SampleLotID = "lot_t1ge2m2qt3cw"
View Source
const SampleMachineDowntimeEventID = "mcdt_ff5te1hqttco"
View Source
const SampleMachineDowntimeReasonID = "mcdttp_3i7rols6wxyq"
View Source
const SampleMachineID = "mc_ffcfk9dxixis"
View Source
const SampleMachineName = "CNC Router"
View Source
const SampleMachineSerialNumber = "SN-2024-0001"
View Source
const SampleMaterialID = "ml_ow202v78slbl"
View Source
const SampleMessageAttachmentID = "mgah_v17axle2mcff"
View Source
const SampleMessageID = "mg_fdny8633ebgw"
View Source
const SampleMessagingBlockID = "mgbk_4azq38nghg78"
View Source
const SampleNewUserPassword = "50iR2X0r@bvIH" // #nosec G101 -- sample data for API docs
View Source
const SampleNotificationID = "nf_yvw2bfj2guyn"
View Source
const SampleNotificationPreferenceID = "nfpf_thr6wg569txs"
View Source
const SampleOpenCreditEntryID = "txn_wq90iimtw6ct" // #nosec G101 -- sample ID, not a credential
View Source
const SampleOrderDiscountID = "ords_qnbrjvq5ih2q"
View Source
const SamplePaginationInternalID int64 = 9000000000000001

SamplePaginationInternalID is the internal_id value encoded in signed int64 pagination cursors for OpenAPI examples (API keys, sandboxes, pricing plans, etc.).

View Source
const SamplePartID = "pt_coba9fgvd84c"
View Source
const SamplePartSKU = "BRG-6204-2RS"
View Source
const SamplePaymentTermID = "pytm_skssmsy21lem"
View Source
const SamplePaymentTermName = "Net 30"
View Source
const SamplePermissionGroupID = "pg_584hkihly2mh"
View Source
const SamplePermissionID = "perm_gum1nfdm75ro"
View Source
const SamplePickID = "pk_6eilj488bq8d"
View Source
const SamplePickLineID = "pkln_z86fsg001g4d"
View Source
const SamplePickNumber = "PK-001"
View Source
const SamplePlanTypeIDFree = "pl_1nz4huuc8n5n"
View Source
const SamplePlanTypeIDPro = "pl_ahxp2c58ykmk"
View Source
const SamplePlanTypeIDStarter = "pl_ktxa0uvfgxe9"
View Source
const SamplePortalDomainID = "podn_ml44z5ggf169"
View Source
const SamplePortalRegistrationSessionID = "porgse_q1hs0mapqh6x"
View Source
const SamplePriorityCode = constants.PriorityCodeNormal
View Source
const SamplePriorityID = "pi_dubkbqpnz45f"
View Source
const SamplePriorityName = "Normal"
View Source
const SampleProdAPIKeyRedactedValue = "mrp_sk_prod_****hjt4" // #nosec G101 - sample data for API docs
View Source
const SampleProdAPIKeyValue = "mrp_sk_prod_RhxFDvTdDnb0bgtcoA5P79_60EmH4h9j9ZldsuU9XyngXlpu8NqdIlGTQw8OM8cGeCadyhjtr"

#nosec G101 - This is sample data for API documentation, not a real credential

View Source
const SampleProductID = "pd_07oe0r7adh2w"
View Source
const SampleProductLineID = "pdln_k9bnlgvxhxjh"
View Source
const SampleProductLineName = "Industrial Fasteners"
View Source
const SampleProductTypeCode = "sale"
View Source
const SampleProductTypeID = "prty_bdu6hiasyjl4"
View Source
const SampleProductTypeName = "Sale"
View Source
const SampleProductionID = "pn_1owzkrw3c81l"
View Source
const SampleProductionRunID = "prru_sglzcyflxk59"
View Source
const SampleProductionScheduleDerivedLineID = "pnscdl_z9ri1nidq75s"
View Source
const SampleProductionScheduleDeviationID = "pnscdw_i8t5f51qxket"
View Source
const SampleProductionScheduleFinishedPolicyID = "pnscfipc_zqj2r338xv68"
View Source
const SampleProductionScheduleFinishingLineID = "pnscfiln_8dq4mv71pzko"
View Source
const SampleProductionScheduleID = "pnsc_m4zt3z8g8src"
View Source
const SampleProductionScheduleItemPolicyID = "pnscitpc_xbmyu4qgfew5"
View Source
const SampleProductionScheduleItemSettingID = "pnscitsd_kw83nzq4mrt6"
View Source
const SampleProductionScheduleLineID = "pnscln_l28dutdpl81r"
View Source
const SampleProductionScheduleResourceSettingID = "pnscrrsd_hegthjeksw87"
View Source
const SampleProductionStepID = "prst_0ht5mkqx5a6t"
View Source
const SamplePropertyID = "pp_fhnnvtt3q3ov"
View Source
const SamplePropertyName = "Color"
View Source
const SamplePurchaseOrderID = "po_3ov2ym1pca8m"
View Source
const SamplePurchaseOrderLineID = "poln_lechc7ak8sp9"
View Source
const SamplePurchaseOrderNumber = "PO-001"
View Source
const SampleQuantityID = "qty_8hnxbigf0bod"
View Source
const SampleRateID = "ra_jhgtyileng4s"
View Source
const SampleRateValue = "25.50"
View Source
const SampleReceivingOrderID = "rcor_iy0usuxcrjj8"
View Source
const SampleReceivingOrderLineID = "rcorln_7f39n28j00fr"
View Source
const SampleRefreshTokenToken = "d7842e40d46df9033f68a761ddd866bb1eafefbff887806fd7918c82f74bc13a"

#nosec G101 - This is sample data for API documentation, not a real credential

View Source
const SampleRegistrationFlowID = "rgfw_5jo86wzvfpgn"
View Source
const SampleRegistrationFlowName = "Default Registration Flow"
View Source
const SampleRegistrationFlowOptionID = "rgfwo_y0bcxsctjq8x"
View Source
const SampleRegistrationFlowOptionName = "Standard Option"
View Source
const SampleRegistrationSessionID = "rgfw_6xab8u2fun46"
View Source
const SampleRequestLogAPIVersion = "2026-01-01"
View Source
const SampleRequestLogClientIP = "198.51.100.7"
View Source
const SampleRequestLogHost = "https://api.openmrp.ai"
View Source
const SampleRequestLogID = "rq_0lhl3kkhme40"
View Source
const SampleRequestLogPath = "/v1/core/sandboxes"
View Source
const SampleRequestLogQueryJSON = `{"limit":10}`
View Source
const SampleRequestLogResponseBody = `` /* 131-byte string literal not displayed */
View Source
const SampleRequestLogUserAgent = "Mozilla/5.0"
View Source
const SampleRoleID = "rl_3xknmfqflhvb"
View Source
const SampleRoleName = "Admin"
View Source
const SampleRolePermissionID = "rlpm_5wfzi61dig0c"
View Source
const SampleSalesOrderID = "or_9lqo07quiwyb"
View Source
const SampleSalesOrderLineID = "orln_la01fxgrwcnr"
View Source
const SampleSalesOrderLineID2 = "orln_vwp43e1rq2zb"
View Source
const SampleSalesOrderNumber = "SO-001"
View Source
const SampleSalesOrderStatusID = "orss_5p539sex5bva"
View Source
const SampleSalesOrderStatusName = "Estimate"
View Source
const SampleSalesTargetID = "ta_n5b6sbefrmii"
View Source
const SampleSandboxID = "sbac_d8ci32xggml9"
View Source
const SampleSandboxName = "Integration Testing"
View Source
const SampleScanningStationID = "scst_t71bn7lq5yov"
View Source
const SampleScanningStationName = "Packaging Line 1"
View Source
const SampleScheduleDeviationTypeID = "pnscdwtp_rn4exnxfywn5"
View Source
const SampleServiceLevelID = "crop_4ilk9p6gccrx"
View Source
const SampleServiceLevelName = "FedEx Ground"
View Source
const SampleSettlementID = "sl_2k5juz0yf5a7"
View Source
const SampleSettlementSummaryID = "sl_a21jaxz7ehs1"
View Source
const SampleShipmentID = "sh_pfygp2gl45y4"
View Source
const SampleShipmentLineID = "shln_ysbxu08n6bbj"
View Source
const SampleShipmentNumber = "SH-001"
View Source
const SampleShippingCaseID = "shcs_fgqy1eu256af"
View Source
const SampleShippingTermID = "shtm_c5gxy05whw6r"
View Source
const SampleShippingTermName = "Prepaid"
View Source
const SampleStripeCustomerID = "cus_OG9R5zKr5xJHHp"
View Source
const SampleSupplierID = "ac_gwy8tfbc074f"
View Source
const SampleSupplierMaterialID = "suml_gegrad0aqkhj"
View Source
const SampleSupplierName = "Acme Supplies Inc."
View Source
const SampleSupplierNumber = "SUP-001"
View Source
const SampleSupportRouteID = "spru_m7jti68mins7"
View Source
const SampleSysPropertyID = "sypp_1czynnv1b8kc"
View Source
const SampleSysPropertyTypeCode = "transaction_number"
View Source
const SampleSysPropertyTypeID = "sypptp_qxmnkeq1ig5c"
View Source
const SampleSysPropertyTypeName = "Transaction Number"
View Source
const SampleSysPropertyValueInt int32 = 42
View Source
const SampleTerritoryID = "te_gfs3vr2jpwgm"
View Source
const SampleTestAPIKeyRedactedValue = "mrp_sk_test_****kuIb" // #nosec G101 - sample data for API docs
View Source
const SampleTestAPIKeyValue = "mrp_sk_test_RhxFDvTdDnb0bgtcoA5P79_60EmH4h9j9ZldsuU9XyngXlpu8NqdIlGTQw8OM8cGeCadykuIb"

#nosec G101 - This is sample data for API documentation, not a real credential

View Source
const SampleToolGroupID = "tgrp_imjaqprzuqv5"
View Source
const SampleTransactionDetailID = "tx_hvh9thtzaezn"
View Source
const SampleTransactionMethodID = "txmd_hvm86tao3zbx"
View Source
const SampleTransactionTypeID = "txtp_vnml00fjmorb"
View Source
const SampleUnitAbbreviation = "kg"
View Source
const SampleUnitGroupID = "ug_andst6m79n41"
View Source
const SampleUnitGroupName = "Weight"
View Source
const SampleUnitGroupUnitID = "ugu_sfrqqziz49dw"
View Source
const SampleUnitID = "un_82bd37dae5po"
View Source
const SampleUnitName = "Kilogram"
View Source
const SampleUserEmail = "jdoe@openmrp.ai"
View Source
const SampleUserID = "us_43irtlt2ajz6"
View Source
const SampleUserImageUrl = "https://cdn.openmrp.ai/avatars/us_43irtlt2ajz6.jpg"
View Source
const SampleUserName = "John Doe"
View Source
const SampleUserPassword = "QgS7Z8Hhj3&1" // #nosec G101 -- sample data for API docs
View Source
const SampleUserUsername = "jdoe"
View Source
const SampleVolumeDiscountID = "quds_bn7hto9s10pp"
View Source
const SampleVolumeDiscountTierID = "qudstr_iylnkrlr3uhm"

Variables

View Source
var SampleAPIKey = &APIKey{
	ID:            SampleAPIKeyID,
	Object:        constants.ObjectTypeAPIKey,
	Name:          SampleAPIKeyName,
	RedactedValue: SampleProdAPIKeyRedactedValue,
	Role:          SampleRole,
	LastUsedAt:    timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	ExpiresAt:     timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	RevokedAt:     nil,
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:     timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccount = &Account{
	ID:                     SampleAccountID,
	Object:                 constants.ObjectTypeAccount,
	Name:                   SampleAccountName,
	DefaultBillingAddress:  SampleAddress,
	DefaultShippingAddress: SampleAddress,
	Branding:               SampleAccountBranding,
	Portal:                 SampleAccountPortal,
	CreatedAt:              timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:              timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountBranding = &AccountBranding{
	ID:              SampleAccountBrandingID,
	Object:          constants.ObjectTypeAccountBranding,
	SupportEmail:    new("support@acme.example.com"),
	PhoneNumber:     new("+1-614-555-0100"),
	LogoURL:         new("https://cdn.openmrp.ai/branding/abr_2rygb4fof28b/logo.png"),
	FaviconURL:      new("https://cdn.openmrp.ai/branding/abr_2rygb4fof28b/favicon.png"),
	FacebookHandle:  new("acmeinc"),
	InstagramHandle: new("acmeinc"),
	LinkedInHandle:  new("acme-inc"),
	TwitterHandle:   new("acmeinc"),
	WebsiteURL:      new("https://www.acme.example.com"),
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountFaviconURL = &AccountFaviconURL{
	Object: constants.ObjectTypeAccountFaviconURL,
	URL:    new("https://augno-logos.s3.amazonaws.com/ac_ykxoradjoeb3/favicon.png?X-Amz-Expires=3600&X-Amz-Signature=example"),
}
View Source
var SampleAccountGroup = &AccountGroup{
	ID:               SampleAccountGroupID,
	Object:           constants.ObjectTypeAccountGroup,
	Type:             constants.AccountGroupTypeTypeGroup,
	Name:             SampleAccountGroupName,
	Description:      nil,
	CommissionPolicy: constants.CommissionPolicyApplied,
	FreightPolicy:    constants.FreightPolicyBilled,
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountGroupProductLineAccess = &AccountGroupProductLineAccess{
	Object: constants.ObjectTypeAccountGroupProductLineAccess,
	AccountGroup: &AccountGroup{
		ID:               SampleAccountGroupID,
		Object:           constants.ObjectTypeAccountGroup,
		Name:             SampleAccountGroupName,
		CommissionPolicy: constants.CommissionPolicyApplied,
		FreightPolicy:    constants.FreightPolicyBilled,
		Type:             constants.AccountGroupTypePricingGroup,
		CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
	ProductLines: NewList([]ProductLine{*SampleProductLine}, PageInfo{}),
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountIntegration = &AccountIntegration{
	ID:              SampleAccountIntegrationID,
	Object:          constants.ObjectTypeAccountIntegration,
	Name:            SampleAccountIntegrationName,
	IntegrationCode: constants.IntegrationCodeStripe,
	Status:          constants.AccountIntegrationStatusActive,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountLogoURL = &AccountLogoURL{
	Object: constants.ObjectTypeAccountLogoURL,
	URL:    new("https://augno-logos.s3.amazonaws.com/ac_ykxoradjoeb3/logo.png?X-Amz-Expires=3600&X-Amz-Signature=example"),
}
View Source
var SampleAccountPhotoUploadResult = &AccountPhotoUploadResult{
	Object:  constants.ObjectTypeAccountPhotoUploadResult,
	Success: true,
}
View Source
var SampleAccountPortal = &AccountPortal{
	ID:        SampleAccountPortalID,
	Object:    constants.ObjectTypeAccountPortal,
	Slug:      SampleAccountPortalSlug,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountPrice = &AccountPrice{
	ID:               SampleAccountPriceID,
	Object:           constants.ObjectTypeAccountPrice,
	RecipientAccount: SampleCustomer,
	ProductLine:      SampleProductLine,
	Rate:             SampleRate,
	Categories:       NewList([]ItemCategory{*SampleItemCategory}, PageInfo{}),
	Attributes:       NewList([]Attribute{*SampleAttribute}, PageInfo{}),
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountStatus = &AccountStatus{
	ID:        SampleAccountStatusID,
	Object:    constants.ObjectTypeAccountStatus,
	Code:      SampleAccountStatusCode,
	Name:      SampleAccountStatusName,
	Owner:     SampleOwnerSystem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAccountStatusCode = constants.AccountStatusCodeNormal
View Source
var SampleAccountUsageResponse = &AccountUsageResponse{
	Object:          constants.ObjectTypeAccountUsageResponse,
	Seats:           *SampleUsageItem,
	Invoices:        *SampleUsageItemUnlimited,
	Batches:         *SampleUsageItemUnlimited,
	Sandboxes:       *SampleUsageItem,
	Subscription:    SampleSubscriptionInfo,
	AgentSpend:      SampleAgentSpendInfo,
	PlanName:        "Founder",
	BaseFeeCents:    100,
	BaseFeeInterval: "month",
}
View Source
var SampleAccountUser = &AccountUser{
	ID:                   SampleAccountUserID,
	Object:               constants.ObjectTypeAccountUser,
	Status:               constants.AccountUserStatusActive,
	Role:                 SampleRole,
	Department:           SampleDepartment,
	User:                 SampleUser,
	IsCommissionEligible: false,
	LastUsedAt:           new(timeutil.TimestampToTime(sampleUpdatedAtTimestamp)),
	CreatedAt:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:            timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleActor = &Actor{
	ID:        SampleUserID,
	Object:    constants.ObjectTypeActor,
	Type:      constants.ActorTypeUser,
	Name:      new(SampleUserName),
	Handle:    new(SampleUserEmail),
	AvatarURL: new(SampleUserImageUrl),
	Role:      SampleRole,
}
View Source
var SampleAddress = &Address{
	ID:     SampleCRUDAddressID,
	Object: constants.ObjectTypeAddress,
	Name:   "Headquarters",
	Phone:  &sampleAddressPhone,
	Email:  &sampleAddressEmail,
	Type:   constants.AddressTypeStandard,
	Geolocation: &Geolocation{
		ID:          SampleGeolocationID,
		Object:      constants.ObjectTypeGeolocation,
		StreetLine1: &sampleStreetLine1,
		Locality:    &sampleLocality,
		State:       &sampleState,
		PostalCode:  &samplePostalCode,
		Country:     "US",
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAddressDetailsResult = &AddressDetailsResult{
	Object: constants.ObjectTypeAddressDetailsResult,
	Address: &AddressComponents{
		Object:       constants.ObjectTypeAddressComponents,
		AddressLine1: "123 Main St",
		City:         "Springfield",
		State:        "IL",
		PostalCode:   "62701",
		Country:      "United States",
		CountryCode:  "US",
	},
	FormattedAddress: "123 Main St, Springfield, IL 62701, USA",
}
View Source
var SampleAddressSuggestion = &AddressSuggestion{
	ID:            "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
	Object:        constants.ObjectTypeAddressSuggestion,
	Description:   "123 Main St, Springfield, IL 62701, USA",
	MainText:      "123 Main St",
	SecondaryText: "Springfield, IL 62701, USA",
}
View Source
var SampleAdjustmentType = &AdjustmentType{
	ID:        SampleAdjustmentTypeID,
	Object:    constants.ObjectTypeAdjustmentType,
	Name:      SampleAdjustmentTypeName,
	Code:      constants.AdjustmentTypeDiscount,
	Owner:     SampleOwnerSystem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAgentAction = &AgentAction{
	ID:          SampleAgentActionID,
	Object:      constants.ObjectTypeAgentAction,
	Tool:        constants.ToolReadDoc,
	Status:      constants.AgentActionStatusExecuted,
	Label:       new("Read Doc"),
	Description: new("Read the OpenMRP documentation page on creating sales orders."),
	Run: &AgentRun{
		ID:          SampleAgentRunID,
		Object:      constants.ObjectTypeAgentRun,
		TriggerType: constants.AgentTriggerTypeManual,
		Status:      constants.AgentRunStatusCompleted,
		CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt:   timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
	Input:             json.RawMessage(`{"path":"/api/sales-orders/create"}`),
	Output:            json.RawMessage(`{"title":"Create a sales order","url":"https://docs.openmrp.ai/api-reference/sales-orders/create-sales-order"}`),
	ReviewRequirement: constants.ReviewRequirementNotRequired,
	ExecutedAt:        new(timeutil.TimestampToTime(sampleUpdatedAtTimestamp)),
	CreatedAt:         timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:         timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAgentDefinition = &AgentDefinition{
	ID:             SampleAgentDefinitionID,
	Object:         constants.ObjectTypeAgentDefinition,
	DefinitionType: constants.AgentDefinitionTypeSystem,
	CategoryCode:   "order_processing",
	TriggerType:    constants.AgentTriggerTypeEvent,
	Name:           "Email Order Agent",
	Slug:           "email_order",
	Description:    new("Processes incoming emails and creates draft orders."),
	Editability:    constants.EditabilityReadOnly,
	AccountStatus:  constants.AgentAccountStatusInactive,
	Role:           SampleRole,
	Config:         &SampleAgentDefinitionConfig,
	Tools: NewList([]AgentDefinitionTool{
		*SampleAgentDefinitionTool,
	}, PageInfo{}),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAgentDefinitionConfig = AgentDefinitionConfig{
	Object:             constants.ObjectTypeAgentDefinitionConfig,
	SystemPrompt:       new("You are an order processing agent. Parse incoming emails and create draft orders."),
	Tier:               new(constants.ModelTierHigh),
	Temperature:        new(0.2),
	TriggerConfig:      SampleTriggerConfig,
	EndpointToolSlugs:  []string{"create_account_group"},
	EndpointToolReview: map[string]bool{"create_account_group": true},
}

SampleAgentDefinitionConfig is a realistic example config for docs.

View Source
var SampleAgentDefinitionTool = &AgentDefinitionTool{
	ID:                SampleAgentDefinitionToolID,
	Object:            constants.ObjectTypeAgentDefinitionTool,
	Tool:              *SampleAvailableTool,
	ReviewRequirement: constants.ReviewRequirementNotRequired,
	Config:            json.RawMessage(`{}`),
	SortOrder:         0,
}
View Source
var SampleAgentMemory = &AgentMemory{
	ID:         SampleAgentMemoryID,
	Object:     constants.ObjectTypeAgentMemory,
	Category:   constants.AgentMemoryCategoryPreference,
	Content:    "Customer prefers express shipping for all orders.",
	Metadata:   json.RawMessage(`{}`),
	Entity:     SampleCustomerEntity,
	Importance: 0.8,
	ExpiresAt:  timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAgentRun = &AgentRun{
	ID:          SampleAgentRunID,
	Object:      constants.ObjectTypeAgentRun,
	TriggerType: constants.AgentTriggerTypeManual,
	Status:      constants.AgentRunStatusCompleted,
	Definition:  SampleAgentDefinition,
	TriggeredBy: SampleActor,
	Input:       json.RawMessage(`{"message":"Process order #1234"}`),
	Output:      json.RawMessage(`{"response":"Order processed successfully"}`),
	StartedAt:   new(timeutil.TimestampToTime(sampleCreatedAtTimestamp)),
	CompletedAt: new(timeutil.TimestampToTime(sampleUpdatedAtTimestamp)),
	DurationMs:  new(int32(1250)),
	Actions:     NewList([]AgentAction{*SampleAgentAction}, PageInfo{}),
	Steps:       NewList([]AgentRunStep{*SampleAgentRunStep}, PageInfo{}),
	CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:   timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAgentRunStep = &AgentRunStep{
	ID:         SampleAgentRunStepID,
	Object:     constants.ObjectTypeAgentRunStep,
	StepType:   "trigger_received",
	Title:      "Run triggered",
	Content:    new("Process order #1234"),
	Sequence:   0,
	Actor:      SampleActor,
	DurationMs: new(int32(12)),
	Metadata:   json.RawMessage(`{"trigger_type":"manual"}`),
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleAgentSpendInfo = &AgentSpendInfo{
	Object:              constants.ObjectTypeAgentSpendInfo,
	EstimatedSpendCents: 1875,
	CapCents:            &sampleCapCents,
}
View Source
var SampleAllocationEntry = &AllocationEntry{
	ID:            SampleAllocationEntryID,
	Object:        constants.ObjectTypeAllocationEntry,
	Amount:        "500.000000000000000000000000000000",
	DisplayAmount: "$500.00",
	Customer: &AllocationCustomer{
		Object: constants.ObjectTypeAllocationCustomer,
		Name:   SampleCustomerName,
	},
	Transaction: &AllocationTransaction{
		ID:     SampleTransactionDetailID,
		Object: constants.ObjectTypeTransaction,
		Type:   "payment",
	},
	Invoice: &AllocationInvoice{
		ID:     SampleInvoiceID,
		Object: constants.ObjectTypeInvoiceSummary,
		Number: "INV-001",
	},
	Note:      new("Applied to the oldest open invoice first."),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleAnalyticsPeriodEnd = timeutil.TimestampToTime(sampleUpdatedAtTimestamp)

SampleAnalyticsPeriodEnd is the canonical analytics range end for OpenAPI request examples.

View Source
var SampleAnalyticsPeriodStart = timeutil.TimestampToTime(sampleCreatedAtTimestamp)

SampleAnalyticsPeriodStart is the canonical analytics range start for OpenAPI request examples.

View Source
var SampleAnalyzeCustomerPricingResponse = &AnalyzeCustomerPricingResponse{
	Object:   constants.ObjectTypeAnalyzeCustomerPricingResponse,
	Findings: NewList([]CustomerPricingFinding{*SampleCustomerPricingFinding}, PageInfo{}),
	Summary: CustomerPricingSummary{
		Object:                 constants.ObjectTypeCustomerPricingSummary,
		PricesAnalyzed:         412,
		BelowPeerMedianCount:   18,
		BelowTargetMarginCount: 7,
		MarginNotAssessedCount: 22,
		Notes:                  []string{},
	},
}
View Source
var SampleAnalyzeDeliveryPerformanceResponse = &AnalyzeDeliveryPerformanceResponse{
	Object: constants.ObjectTypeAnalyzeDeliveryPerformanceResponse,
	Overall: &DeliveryPerformance{
		Object:                       constants.ObjectTypeDeliveryPerformance,
		CommittedOrderCount:          26,
		ShippedOrderCount:            24,
		OnTimeOrderCount:             24,
		OnTimeInFullCount:            23,
		LateOrderCount:               2,
		NotYetShippedCount:           2,
		OnTimePct:                    &sampleOnTimePct,
		OnTimeInFullPct:              &sampleOnTimeInFullPct,
		AverageDaysLate:              &sampleAvgDaysLate,
		AverageLeadTimeDays:          &sampleAvgLeadTime,
		AverageCommittedLeadTimeDays: &sampleAvgCommittedLeadTime,
	},
	Periods: NewList([]DeliveryPerformance{}, PageInfo{}),
	Backlog: NewList([]DeliveryBacklogBucket{{
		Object:      constants.ObjectTypeDeliveryBacklogBucket,
		Label:       "1_7_days",
		MinDaysLate: 1,
		MaxDaysLate: 7,
		OrderCount:  2,
		Units:       340,
	}}, PageInfo{}),
	Lateness: NewList([]DeliveryLatenessBucket{{
		Object:       constants.ObjectTypeDeliveryLatenessBucket,
		Label:        "1_3_days",
		MinDaysLate:  1,
		MaxDaysLate:  3,
		OrderCount:   2,
		ShippedCount: 0,
		Units:        340,
	}}, PageInfo{}),
	ByCustomer: NewList([]DeliveryBreakdown{{
		Object:      constants.ObjectTypeDeliveryBreakdown,
		Key:         SampleCustomerID,
		Label:       "Northwind Textiles",
		Performance: sampleDeliveryBreakdownPerformance,
	}}, PageInfo{}),
	ByCustomerGroup: NewList([]DeliveryBreakdown{}, PageInfo{}),
	ByProductLine:   NewList([]DeliveryBreakdown{}, PageInfo{}),
	ByCommitmentSource: NewList([]DeliveryBreakdown{{
		Object:      constants.ObjectTypeDeliveryBreakdown,
		Key:         string(constants.LeadTimeSourceCustomer),
		Label:       string(constants.LeadTimeSourceCustomer),
		Performance: sampleDeliveryBreakdownPerformance,
	}}, PageInfo{}),
	UncommittedOrderCount: 0,
}
View Source
var SampleAnalyzeDemandForecastResponse = &AnalyzeDemandForecastResponse{
	Object: constants.ObjectTypeAnalyzeDemandForecastResponse,
	Data: NewList([]DemandForecastRow{
		{
			Item:                NewEntity(SampleItemID, constants.ObjectTypeItem, nil, nil),
			ProductLine:         NewEntity(SampleProductLineID, constants.ObjectTypeProductLine, nil, nil),
			ProductSku:          SampleItemSKU,
			Unit:                SampleUnitAbbreviation,
			Currency:            "USD",
			History:             []DemandForecastPoint{sampleDemandForecastHistoryPoint},
			Forecast:            []DemandForecastForecastPoint{sampleDemandForecastForecastPoint},
			RevenueHistory:      []RevenueForecastPoint{sampleRevenueForecastPoint},
			RevenueForecast:     []DemandForecastForecastPoint{sampleDemandForecastForecastPoint},
			SalesHistory:        []RevenueForecastPoint{sampleRevenueForecastPoint},
			SalesForecast:       []DemandForecastForecastPoint{sampleDemandForecastForecastPoint},
			CurrentMonthDemand:  120,
			CurrentMonthRevenue: 2400,
			CurrentMonthSales:   120,
		},
	}, PageInfo{}),
	CurrentMonthFraction: 0.35,
}
View Source
var SampleAnalyzeOeeResponse = &AnalyzeOeeResponse{
	Object: constants.ObjectTypeAnalyzeOeeResponse,
	Departments: NewList([]OeeDepartment{
		{
			Department:              NewEntity(SampleDepartmentID, constants.ObjectTypeDepartment, new(SampleDepartmentName), nil),
			GoodUnits:               980,
			WasteUnits:              20,
			SecondsUnits:            5,
			StandardSecondsEarned:   126000,
			EstimatedRuntimeHours:   40,
			AvailabilityLossSeconds: 14850,
			NotScheduledSeconds:     3600,
			DowntimeEventCount:      6,
			ScheduledSeconds:        165000,
			RunTimeSeconds:          150150,
			AvailabilityPct:         &sampleOeeTrendAvailabilityPct,
			PerformancePct:          &sampleOeeTrendPerformancePct,
			QualityPct:              &sampleOeeTrendQualityPct,
			OeePct:                  &sampleOeeTrendOeePct,
			MeasurementStatus:       constants.OeeMeasurementStatusMeasured,
		},
	}, PageInfo{}),
}
View Source
var SampleAnalyzeOeeTrendResponse = &AnalyzeOeeTrendResponse{
	Object: constants.ObjectTypeAnalyzeOeeTrendResponse,
	Periods: NewList([]OeeTrendPeriod{
		{
			StartsAt:                SampleAnalyticsPeriodStart,
			EndsAt:                  SampleAnalyticsPeriodEnd,
			GoodUnits:               980,
			WasteUnits:              20,
			SecondsUnits:            5,
			StandardSecondsEarned:   126000,
			ScheduledSeconds:        165000,
			RunTimeSeconds:          150150,
			AvailabilityLossSeconds: 14850,
			NotScheduledSeconds:     3600,
			AvailabilityPct:         &sampleOeeTrendAvailabilityPct,
			PerformancePct:          &sampleOeeTrendPerformancePct,
			QualityPct:              &sampleOeeTrendQualityPct,
			OeePct:                  &sampleOeeTrendOeePct,
			MeasurementStatus:       constants.OeeMeasurementStatusMeasured,
			DowntimeEventCount:      6,
		},
	}, PageInfo{}),
}
View Source
var SampleAnalyzeRealizedMarginsResponse = &AnalyzeRealizedMarginsResponse{
	Object:   constants.ObjectTypeAnalyzeRealizedMarginsResponse,
	Findings: NewList([]RealizedMarginFinding{*SampleRealizedMarginFinding}, PageInfo{}),
	Summary: RealizedMarginSummary{
		Object:                 constants.ObjectTypeRealizedMarginSummary,
		LinesAnalyzed:          9840,
		RelationshipsAnalyzed:  1260,
		BelowPeerMedianCount:   31,
		BelowTargetMarginCount: 12,
		MarginNotAssessedCount: 48,
		Notes:                  []string{},
	},
}
View Source
var SampleAnalyzeScheduleAttainmentResponse = &AnalyzeScheduleAttainmentResponse{
	Object:    constants.ObjectTypeAnalyzeScheduleAttainmentResponse,
	StartDate: SampleAnalyticsPeriodStart,
	EndDate:   SampleAnalyticsPeriodEnd,
	GroupBy:   constants.AttainmentGroupByWeek,
	BaselineSchedules: NewList([]Entity{
		*NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	}, PageInfo{}),
	Buckets: NewList([]AttainmentBucket{
		{
			Key:               "2026-07-27T00:00:00Z",
			Label:             "2026-07-27T00:00:00Z",
			PlannedQuantity:   4200,
			ActualQuantity:    4032,
			MatchedQuantity:   3885,
			WasteQuantity:     48,
			UnplannedQuantity: 147,
			PlannedRunHours:   63,
			PlannedLines:      7,
			BatchCount:        58,
			AttainmentPct:     &sampleAttainmentPct,
			OutputRatioPct:    &sampleOutputRatioPct,
		},
	}, PageInfo{}),
	Totals: AttainmentBucket{
		Key:               "total",
		Label:             "Total",
		PlannedQuantity:   4200,
		ActualQuantity:    4032,
		MatchedQuantity:   3885,
		WasteQuantity:     48,
		UnplannedQuantity: 147,
		PlannedRunHours:   63,
		PlannedLines:      7,
		BatchCount:        58,
		AttainmentPct:     &sampleAttainmentPct,
		OutputRatioPct:    &sampleOutputRatioPct,
	},
	FrozenAdherence: NewList([]FrozenAdherence{
		{
			Schedule:              NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
			Version:               1,
			FrozenLineCount:       8,
			FrozenPlannedQuantity: 4200,
			DeviatedLines:         1,
			AddedLines:            0,
			AbsDeltaUnits:         252,
			OffPlanLines:          1,
			OffPlanQuantity:       147,
			LineAdherencePct:      &sampleLineAdherencePct,
			UnitsAdherencePct:     &sampleUnitsAdherencePct,
		},
	}, PageInfo{}),
	BaselineStatus:        constants.AttainmentBaselineStatusMeasured,
	ScheduledMachineCount: 2,
}
View Source
var SampleAnnouncement = &Announcement{
	ID:        SampleAnnouncementID,
	Object:    constants.ObjectTypeAnnouncement,
	Scope:     constants.AnnouncementScopeAccount,
	Category:  constants.NotificationCategoryOrderUpdated,
	Status:    constants.NotificationStatusUnseen,
	Title:     "Scheduled maintenance",
	Body:      new("The platform will be briefly unavailable tonight at 2am UTC."),
	Priority:  constants.NotificationPriorityNormal,
	Resource:  NewEntity(SampleSalesOrderID, constants.ObjectTypeSalesOrder, new("Order #1042"), nil),
	PublishAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	ExpiresAt: timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAttachmentUploadTarget = &AttachmentUploadTarget{
	Object:     constants.ObjectTypeAttachmentUploadTarget,
	Attachment: SampleMessageAttachment,
	UploadURL:  "https://chat-bucket.s3.amazonaws.com/staged/ac/cv/mgah/diagram.png?X-Amz-Signature=...",
	S3Key:      "staged/ac_01h9z8q1w2e3r4t5y6u7i8o9/cv_w35z4ck68yq7/mgah_v17axle2mcff/diagram.png",
	ExpiresAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAttribute = &Attribute{
	ID:        SampleAttributeID,
	Object:    constants.ObjectTypeAttribute,
	Value:     SampleAttributeValue,
	ColorCode: constants.ColorRed,
	SortOrder: 1,
	Property: &Property{
		ID:        SamplePropertyID,
		Object:    constants.ObjectTypeProperty,
		Name:      SamplePropertyName,
		CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleAuditEvent = &AuditEvent{
	ID:           SampleAuditEventID,
	Object:       constants.ObjectTypeAuditEvent,
	Action:       SampleAuditEventAction,
	ResourceType: SampleAuditEventResourceType,
	ResourceID:   SampleAuditEventResourceID,
	Actor:        SampleActor,
	Account:      SampleAccount,
	Changes: NewList([]AuditFieldChange{
		{
			Object:   constants.ObjectTypeAuditFieldChange,
			Field:    "email",
			OldValue: json.RawMessage(`"old@example.com"`),
			NewValue: json.RawMessage(`"new@example.com"`),
		},
	}, PageInfo{}),
	Metadata:       json.RawMessage(SampleAuditEventMetadataReason),
	Request:        SampleRequestLog,
	IdempotencyKey: new(SampleAuditEventIdempotencyKey),
	SourceIP:       new(SampleAuditEventSourceIP),
	OccurredAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleAvailableTool = &AvailableTool{
	Object:              constants.ObjectTypeAvailableTool,
	Slug:                string(SampleAvailableToolSlug),
	Category:            "built_in",
	Name:                "Lookup Customer",
	Description:         new("Look up a customer by their email address."),
	ConfigSchema:        nil,
	RequiredPermissions: []string{"customers:read"},
}
View Source
var SampleBatch = &Batch{
	ID:              SampleBatchID,
	Object:          constants.ObjectTypeBatch,
	Item:            SampleItem,
	Quantity:        SampleQuantity,
	Seconds:         SampleQuantity,
	Waste:           SampleQuantity,
	ScanningStation: SampleScanningStation,
	Department:      SampleDepartment,
	ProductionStep:  nil,
	ProductionRun:   SampleProductionRunReference,
	Machines:        NewList([]Machine{*SampleMachine}, PageInfo{}),
	Lots:            NewList([]BatchLot{*SampleBatchLot}, PageInfo{}),
	InputBatches:    NewList([]BatchReference{}, PageInfo{}),
	OutputBatches:   NewList([]BatchReference{}, PageInfo{}),
	ClosedAt:        nil,
	ScannedAt:       &sampleScannedAt,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleBatchFlowNode = &BatchFlowNode{
	Object:        constants.ObjectTypeBatchFlowNode,
	Batch:         *SampleBatch,
	InputBatches:  NewList([]BatchReference{}, PageInfo{}),
	OutputBatches: NewList([]BatchReference{}, PageInfo{}),
}
View Source
var SampleBatchLot = &BatchLot{
	Object:    constants.ObjectTypeBatchLot,
	LotNumber: "LOT-001",
	Type:      "material",
}
View Source
var SampleBatchReference = &BatchReference{
	ID:     SampleBatchID,
	Object: constants.ObjectTypeBatch,
}
View Source
var SampleBulkReconcileItemsResponse = &BulkReconcileItemsResponse{
	Object: constants.ObjectTypeBulkReconcileItemsResponse,
	ReconciledItems: NewList([]ReconciledItemResult{
		{
			ItemID:           SampleItemID,
			SKU:              SampleItemSKU,
			PreviousQuantity: "10",
			NewQuantity:      "12",
		},
	}, PageInfo{}),
	SkippedItems: NewList([]SkippedItemResult{}, PageInfo{}),
	Errors:       NewList([]ReconcileErrorResult{}, PageInfo{}),
}
View Source
var SampleCarrier = &Carrier{
	ID:                       SampleCarrierID,
	Object:                   constants.ObjectTypeCarrier,
	Name:                     SampleCarrierName,
	Code:                     &sampleCarrierCode,
	AccountNumber:            &sampleCarrierAccountNumber,
	CustomerPortalVisibility: constants.CustomerPortalVisibilityVisible,
	Owner:                    SampleOwnerAccount,
	ServiceLevels:            NewList([]ServiceLevel{*SampleServiceLevel}, PageInfo{}),
	CreatedAt:                timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleCatalogAttribute = &CatalogAttribute{
	ID:     SampleAttributeID,
	Object: constants.ObjectTypeCatalogAttribute,
	Name:   "Red",
	Property: &CatalogProperty{
		ID:     SamplePropertyID,
		Object: constants.ObjectTypeCatalogProperty,
		Name:   "Color",
	},
}
View Source
var SampleCatalogCategory = &CatalogCategory{
	ID:         SampleItemCategoryID,
	Object:     constants.ObjectTypeCatalogCategory,
	Name:       "Finished Goods",
	Properties: NewList([]CatalogProperty{*SampleCatalogProperty}, PageInfo{}),
	Products:   NewList([]CatalogProduct{*SampleCatalogProduct}, PageInfo{}),
}
View Source
var SampleCatalogProduct = &CatalogProduct{
	Object:      constants.ObjectTypeCatalogProduct,
	Item:        SampleItem,
	Description: "Hex Bolt M10x30 Zinc",
	Attributes:  NewList([]CatalogAttribute{*SampleCatalogAttribute}, PageInfo{}),
}
View Source
var SampleCatalogProductLine = &CatalogProductLine{
	ID:     SampleProductLineID,
	Object: constants.ObjectTypeCatalogProductLine,
	Name:   "Industrial Fasteners",
}
View Source
var SampleCatalogProperty = &CatalogProperty{
	ID:     SamplePropertyID,
	Object: constants.ObjectTypeCatalogProperty,
	Name:   "Color",
}
View Source
var SampleCheckDuplicateResult = &CheckDuplicateResult{
	Object:      constants.ObjectTypeCheckDuplicateResult,
	IsDuplicate: true,
	Message:     new("This invoice number INV-001 already exists"),
}
View Source
var SampleChildAccount = &ChildAccount{
	ID:     SampleChildAccountRelationID,
	Object: constants.ObjectTypeChildAccount,
	Account: &Account{
		ID:     SampleAccountID,
		Object: constants.ObjectTypeAccount,
		Name:   "Child Customer Inc",
	},
	ExternalNumber: new(SampleChildAccountExternalNumber),
	Email:          new("support@childcustomer.com"),
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleCompleteRegistrationResponse = &CompleteRegistrationResponse{
	ID:     SampleAccountID,
	Object: constants.ObjectTypeAccount,
}
View Source
var SampleComputedQuantity = &ComputedQuantity{
	Object:       constants.ObjectTypeComputedQuantity,
	Value:        "1200",
	DisplayValue: "1,200 " + SampleUnitAbbreviation,
}
View Source
var SampleComputedRate = &ComputedRate{
	Object:       constants.ObjectTypeComputedRate,
	Value:        SampleRateValue,
	DisplayValue: "$25.50 / " + SampleUnitAbbreviation,
}
View Source
var SampleConfirmPaymentResponse = &ConfirmPaymentResponse{
	Object:          constants.ObjectTypeConfirmPaymentResponse,
	Status:          "succeeded",
	PaymentMethodID: new("pm_1QXmZ2AbCdEfGhIjKlMnOpQr"),
}
View Source
var SampleConsumption = &Consumption{
	ID:            SampleConsumptionID,
	Object:        constants.ObjectTypeConsumption,
	Quantity:      SampleQuantity,
	WasteQuantity: SampleQuantity,
	ConsumedItem:  SampleItem,
	Instructions:  &sampleConsumptionInstructions,
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:     timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleContactMatch = &ContactMatch{
	ID:           SampleContactMatchID,
	Object:       constants.ObjectTypeContactMatch,
	Relationship: constants.ContactRelationshipCustomer,
	Email:        "buyer@acme-co.example",
	AccountUser:  SampleAccountUser,
	Account:      SampleAccount,
}
View Source
var SampleConversation = &Conversation{
	ID:            SampleConversationID,
	Object:        constants.ObjectTypeConversation,
	Type:          constants.ConversationTypeDM,
	Audience:      constants.ConversationAudienceInternal,
	Status:        constants.ConversationStatusActive,
	LegalHold:     constants.LegalHoldStatusReleased,
	Participants:  NewList([]ConversationParticipant{*SampleConversationParticipant}, PageInfo{}),
	Unread:        2,
	LastMessageAt: timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	LastMessage: &Message{
		ID:         SampleMessageID,
		Object:     constants.ObjectTypeChatMessage,
		Kind:       constants.MessageKindChat,
		Status:     constants.MessageStatusSent,
		Visibility: constants.MessageVisibilityInternal,
		Channel:    constants.MessageChannelMessage,
		Sequence:   42,
		Body:       new("Sounds good — shipping it today."),
		Sender:     NewActor(SampleAccountUserID, constants.ActorTypeUser, new("Jie Yan"), nil),
		CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleConversationLink = &ConversationLink{
	ID:           SampleConversationLinkID,
	Object:       constants.ObjectTypeConversationLink,
	Conversation: SampleConversation,
	Resource:     NewEntity(SampleSalesOrderID, constants.ObjectTypeSalesOrder, new("Order #1042"), nil),
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleCreateUserResponse = &CreateUserResponse{
	ID:     SampleUserID,
	Object: constants.ObjectTypeUser,
}
View Source
var SampleCreatedAPIKey = &CreatedAPIKey{
	Object:       constants.ObjectTypeCreatedAPIKey,
	APIKeySecret: SampleProdAPIKeyValue,
	APIKeyInfo:   *SampleAPIKey,
}
View Source
var SampleCreatedBy = &CreatedBy{
	Object:   constants.ObjectTypeCreatedBy,
	Relation: constants.CreatedByRelationInternal,
	Actor:    SampleActor,
}
View Source
var SampleCurrencyUnit = newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency)

SampleCurrencyUnit is a fully presented US Dollar unit for embedding in rate examples as a numerator (price) unit.

View Source
var SampleCustomer = &Customer{
	ID:               SampleCustomerID,
	Object:           constants.ObjectTypeCustomer,
	Name:             SampleCustomerName,
	Number:           SampleCustomerNumber,
	Status:           constants.AccountStatusCodeNormal,
	EDIStatus:        constants.EDIStatusDisabled,
	RelationshipType: constants.CustomerRelationshipTypeStandalone,
	CommissionPolicy: constants.CommissionPolicyApplied,
	Note:             &sampleCustomerNote,
	CreditLimit:      SampleQuantity,
	ContactInfo: &CustomerContactInfo{
		Object: constants.ObjectTypeCustomerContactInfo,
		Email:  &sampleCustomerEmail,
		Phone:  &sampleCustomerPhone,
		URL:    &sampleCustomerURL,
	},
	FreightPreferences: &CustomerFreightPreferences{
		Object:         constants.ObjectTypeCustomerFreightPreferences,
		Status:         constants.FreightPolicyBilled,
		Carrier:        SampleCarrier,
		ServiceLevel:   SampleServiceLevel,
		BillingType:    &sampleCarrierBillingType,
		BillingAccount: &sampleCarrierBillingAccount,
	},
	Defaults: &CustomerDefaults{
		Object:            constants.ObjectTypeCustomerDefaults,
		PaymentTerm:       SamplePaymentTerm,
		ShippingTerm:      SampleShippingTerm,
		Priority:          SamplePriority,
		SalesRep:          SampleAccountUser,
		FulfillmentPolicy: &sampleCustomerFulfillmentPolicy,
	},
	NotificationPreferences: &CustomerNotificationPreferences{
		Object:               constants.ObjectTypeCustomerNotificationPreferences,
		AcceptsInvoiceEmails: true,
	},
	BillToAddress: SampleAddress,
	ShipToAddress: SampleAddress,
	Type:          SampleAccountGroup,
	PriceGroups:   NewList([]AccountGroup{*SampleAccountGroup}, PageInfo{}),
	ParentAccount: nil,
	ChildAccounts: nil,
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:     timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleCustomerPricingFinding = &CustomerPricingFinding{
	ID:             SampleAccountPriceID + ":" + SampleCustomerID,
	Object:         constants.ObjectTypeCustomerPricingFinding,
	AccountPriceID: SampleAccountPriceID,
	Reason:         constants.PricingFindingReasonBelowPeerMedianAndTargetMargin,
	Origin:         constants.AccountPriceOriginDirect,
	UnitPrice: &ComputedRate{
		Object:       constants.ObjectTypeComputedRate,
		Value:        "8.5000",
		DisplayValue: "$8.50 / " + SampleUnitAbbreviation,
	},
	PeerMedianPrice: &ComputedRate{
		Object:       constants.ObjectTypeComputedRate,
		Value:        "12.5000",
		DisplayValue: "$12.50 / " + SampleUnitAbbreviation,
	},
	BelowPeerMedianFraction: &samplePricingBelowPeer,
	GrossMargin:             &samplePricingGrossMargin,
}
View Source
var SampleCustomerProductLineAccess = &CustomerProductLineAccess{
	Object:       constants.ObjectTypeCustomerProductLineAccess,
	Customer:     SampleCustomer,
	ProductLines: NewList([]ProductLine{*SampleProductLine}, PageInfo{}),
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleDCLocation = &DCLocation{
	ID:       SampleDCLocationID,
	Object:   constants.ObjectTypeDCLocation,
	Location: "Warehouse A - Bay 3",
	Customer: &DCLocationCustomer{
		ID:     SampleCustomerID,
		Object: constants.ObjectTypeCustomer,
		Name:   SampleCustomerName,
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleDelivery = &Delivery{
	ID:            SampleDeliveryID,
	Object:        constants.ObjectTypeDelivery,
	Number:        "DLV-001",
	PurchaseOrder: SamplePurchaseOrder,
	Status:        constants.DeliveryStatusAccepted,
	Lines:         NewList([]DeliveryLine{*SampleDeliveryLine}, PageInfo{}),
	AcceptedAt:    timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:     timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleDeliveryLine = &DeliveryLine{
	ID:         SampleDeliveryLineID,
	Object:     constants.ObjectTypeDeliveryLine,
	Item:       SampleItem,
	Quantity:   SampleQuantity,
	UnitCost:   SampleRate,
	Location:   SampleLocation,
	Lot:        SampleLot,
	AcceptedAt: timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleDemandOverride = &DemandOverride{
	ID:             SampleDemandOverrideID,
	Object:         constants.ObjectTypeDemandOverride,
	ScopeType:      constants.DemandOverrideScopeItem,
	Scope:          NewEntity(SampleItemID, constants.ObjectTypeItem, nil, new(SampleItemSKU)),
	PeriodStartsAt: timeutil.TimestampToTime(sampleDemandOverridePeriodStart),
	PeriodEndsAt:   timeutil.TimestampToTime(sampleDemandOverridePeriodEnd),
	Adjustment:     constants.DemandOverrideAdjustmentDeltaUnits,
	Value:          5000,
	Unit:           newSampleUnit("Pair", "pr", constants.UnitTypeQuantity),
	Reason:         &sampleDemandOverrideReason,
	Note:           &sampleDemandOverrideNote,
	CreatedBy:      SampleActor,
	EffectiveAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	ExpiresAt:      timeutil.TimestampToTimePtr(sampleDemandOverrideExpiry),
	Status:         constants.ActivationStatusActive,
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleDemandOverrideType = &DemandOverrideType{
	ID:        SampleDemandOverrideTypeID,
	Object:    constants.ObjectTypeDemandOverrideType,
	Code:      constants.DemandOverrideAdjustmentDeltaUnits,
	Name:      "Delta Units",
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleDepartment = &Department{
	ID:               SampleDepartmentID,
	Object:           constants.ObjectTypeDepartment,
	Name:             SampleDepartmentName,
	Notes:            nil,
	Location:         SampleLocation,
	ScanningStations: NewList([]ScanningStation{*SampleScanningStation}, PageInfo{}),
	Machines:         NewList([]Machine{*SampleMachine}, PageInfo{}),
	LaborRate:        nil,
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleEDIRun = &EDIRun{
	ID:           SampleEDIRunID,
	Object:       constants.ObjectTypeEDIRun,
	CompletedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	HasSucceeded: true,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleEachUnit = newSampleUnit("Each", "ea", constants.UnitTypeQuantity)

SampleEachUnit is a fully presented discrete-count unit for embedding in rate examples as a per-each denominator.

View Source
var SampleEmailContact = &EmailContact{
	ID:          SampleEmailContactID,
	Object:      constants.ObjectTypeEmailContact,
	AccountUser: SampleAccountUser,
}
View Source
var SampleEmailDomain = &EmailDomain{
	ID:         SampleEmailDomainID,
	Object:     constants.ObjectTypeEmailDomain,
	Domain:     "support.acme.com",
	Status:     "pending",
	DkimTokens: []string{"abc123._domainkey.support.acme.com", "def456._domainkey.support.acme.com"},
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleEmailInbox = &EmailInbox{
	ID:                 SampleEmailInboxID,
	Object:             constants.ObjectTypeEmailInbox,
	EmailDomain:        SampleEmailDomain,
	Address:            "support@acme.com",
	FromName:           &sampleEmailInboxFromName,
	Status:             "active",
	AgentConfig:        SampleAgentDefinition,
	AgentTriggerPolicy: &sampleEmailInboxTriggerPolicy,
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:          timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleEmailLog = &EmailLog{
	ID:         SampleEmailLogID,
	Object:     constants.ObjectTypeEmailLog,
	SendStatus: constants.EmailSendStatusSent,
	Recipients: []string{"customer@example.com"},
	Subject:    &sampleEmailLogSubject,
	Filename:   &sampleEmailLogFilename,
	SentBy:     SampleActor,
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleEnsureBillingCustomerResponse = &EnsureBillingCustomerResponse{
	Object:           constants.ObjectTypeEnsureBillingCustomerResponse,
	StripeCustomerID: SampleStripeCustomerID,
	Created:          true,
	BillingProfileID: &sampleBillingProfileID,
}
View Source
var SampleEnterpriseInquiry = &EnterpriseInquiry{
	ID:        SampleEnterpriseInquiryID,
	Object:    constants.ObjectTypeEnterpriseInquiry,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleEstimateRateResult = &EstimateRateResult{
	Object: constants.ObjectTypeEstimateRateResult,
	Rate:   42.5,
}
View Source
var SampleExportInventoryChangeLogsResponse = &ExportInventoryChangeLogsResponse{
	Object: constants.ObjectTypeList,
	Items:  []*InventoryChangeLog{SampleInventoryChangeLog},
	Count:  1,
}
View Source
var SampleExportItem = &ExportItem{
	ID:             SampleItemID,
	Object:         constants.ObjectTypeItem,
	SKU:            SampleItemSKU,
	Description:    &sampleDescription,
	Notes:          nil,
	ItemTypeCode:   constants.ItemTypeCodeProduct,
	CategoryName:   SampleItemCategoryName,
	OnHandQuantity: "100.000000000000000000000000000000",
	OnHandUnit:     SampleUnit,
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleExportItemsResponse = &ExportItemsResponse{
	Object: constants.ObjectTypeList,
	Items:  []*ExportItem{SampleExportItem},
	Count:  1,
}
View Source
var SampleFreight = &Freight{
	Object:               constants.ObjectTypeFreight,
	Policy:               &sampleFreightPolicy,
	Carrier:              SampleCarrier,
	ServiceLevel:         SampleServiceLevel,
	BillingType:          &sampleFreightBillingType,
	BillingAccountNumber: &sampleFreightBillingAccountNumber,
}
View Source
var SampleFrequentlyOrderedProduct = &FrequentlyOrderedProduct{
	Object:     constants.ObjectTypeFrequentlyOrderedProduct,
	Item:       SampleItem,
	Unit:       newSampleUnit(SampleUnitName, SampleUnitAbbreviation, constants.UnitTypeMass),
	OrderCount: 42,
}
View Source
var SampleFulfillmentRecommendation = &FulfillmentRecommendation{
	Object:                     constants.ObjectTypeFulfillmentRecommendation,
	Item:                       NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSettingsSKU),
	SKU:                        sampleScheduleSettingsSKU,
	ProductLine:                NewEntity(SampleProductLineID, constants.ObjectTypeProductLine, nil, nil),
	CurrentPolicy:              constants.FulfillmentPolicyMakeToStock,
	RecommendedPolicy:          constants.FulfillmentPolicyMakeToOrder,
	Changes:                    true,
	Reason:                     constants.FulfillmentRecommendationReasonLumpyDemand,
	AverageDemandInterval:      3,
	CoefficientOfVariation:     1.8,
	TopCustomerSharePct:        95,
	TopCustomerName:            &sampleTopCustomerName,
	DemandWeightedLeadTimeDays: 90,
	AnnualCOGS:                 4000,
	MonthsSinceLastSale:        1,
	MixedStreamSharePct:        95,
}
View Source
var SampleHubspotCompanyReview = &HubspotCompanyReview{
	ID:       SampleHubspotCompanyReviewID,
	Object:   constants.ObjectTypeHubspotCompanyReview,
	Job:      SampleHubspotSyncJob,
	Customer: SampleCustomer,
	Candidates: NewList([]HubspotCompanyCandidate{
		{Object: constants.ObjectTypeHubspotCompanyCandidate, HubspotID: "12345", Name: "Acme Manufacturing", Domain: "acme.com"},
		{Object: constants.ObjectTypeHubspotCompanyCandidate, HubspotID: "67890", Name: "Acme Mfg Inc", Domain: "acme.com"},
	}, PageInfo{}),
	Status:    constants.HubspotCompanyReviewStatusPending,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleHubspotSyncJob = &HubspotSyncJob{
	ID:             SampleHubspotSyncJobID,
	Object:         constants.ObjectTypeHubspotSyncJob,
	Status:         constants.HubspotSyncJobStatusReviewPending,
	GoLiveCutoffAt: &sampleHubspotGoLiveCutoffAt,
	Report: &HubspotSyncReport{
		Object:             constants.ObjectTypeHubspotSyncReport,
		CustomersTotal:     120,
		CompaniesConfident: 80,
		CompaniesAmbiguous: 12,
		CompaniesToCreate:  28,
		ContactsWithEmail:  95,
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleHubspotSyncRecord = &HubspotSyncRecord{
	ID:           SampleHubspotSyncRecordID,
	Object:       constants.ObjectTypeHubspotSyncRecord,
	AugnoType:    constants.HubspotSyncRecordAugnoTypeCustomer,
	AugnoID:      SampleCustomer.ID,
	AugnoName:    SampleCustomer.Name,
	HubspotType:  constants.HubspotSyncRecordHubspotTypeCompanies,
	HubspotID:    "12345",
	LastSyncedAt: &sampleHubspotSyncRecordSyncedAt,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleInventoryChangeLog = &InventoryChangeLog{
	ID:                         SampleInventoryChangeLogID,
	Object:                     constants.ObjectTypeInventoryChangeLog,
	ActionTypeCode:             constants.InventoryActionTypeScan,
	Quantity:                   SampleQuantity,
	Item:                       SampleItem,
	ResponsibleUser:            SampleUser,
	ResponsibleScanningStation: SampleScanningStation,
	CreatedAt:                  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleInventoryItem = &InventoryItem{
	Object:   constants.ObjectTypeInventoryItem,
	Item:     *SampleItem,
	Quantity: SampleQuantity,
}
View Source
var SampleInvoice = &Invoice{
	ID:       SampleInvoiceID,
	Object:   constants.ObjectTypeInvoice,
	Number:   "INV-001",
	Note:     &sampleInvoiceNote,
	Customer: SampleCustomer,
	Order:    SampleSalesOrder,
	Shipment: &Shipment{
		ID:        SampleShipmentID,
		Object:    constants.ObjectTypeShipment,
		Number:    SampleShipmentNumber,
		Status:    constants.ShipmentStatusShipped,
		Priority:  SamplePriorityCode,
		CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
	LineCount:            3,
	BillingAddress:       SampleAddress,
	PriorityCode:         constants.PriorityCodeNormal,
	PaymentTerm:          SamplePaymentTerm,
	PaymentStatus:        constants.InvoicePaymentStatusUnpaid,
	IsEdiSent:            false,
	HasBeenSent:          true,
	TotalInvoiced:        "1234.56",
	AcceptsInvoiceEmails: true,
	CustomerIsEdiEnabled: false,
	Lines:                NewList([]InvoiceLine{*SampleInvoiceLine}, PageInfo{}),
	Allocations:          NewList([]InvoiceAllocation{*SampleInvoiceAllocation}, PageInfo{}),
	Related:              &InvoiceRelated{Object: constants.ObjectTypeInvoiceRelated},
	CreatedAt:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:            timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleInvoiceAllocation = &InvoiceAllocation{
	ID:          SampleInvoiceAllocationID,
	Object:      constants.ObjectTypeInvoiceAllocation,
	Transaction: SampleTransactionDetail,
	Note:        &sampleInvoiceAllocationNote,
	Amount: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "500.000000000000000000000000000000",
		DisplayValue: "$500.00",
		Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleInvoiceForPayment = &InvoiceForPayment{
	ID:              SampleInvoiceID,
	Object:          constants.ObjectTypeInvoiceForPayment,
	Number:          "INV-001",
	CustomerPO:      &sampleInvoiceForPaymentCustomerPO,
	Customer:        SampleCustomer,
	IsParentAccount: true,
	ParentAccount:   SampleAccount,
	IsPrepaid:       false,
	BillingAddress:  SampleAddress,
	InvoiceTotal:    "1234.56",
	IsPaidInFull:    false,
	Allocations:     NewList([]InvoiceAllocation{*SampleInvoiceAllocation}, PageInfo{}),
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleInvoiceLine = &InvoiceLine{
	ID:     SampleInvoiceLineID,
	Object: constants.ObjectTypeInvoiceLine,
	Quantity: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "100.000000000000000000000000000000",
		DisplayValue: "100 lb",
		Unit:         newSampleUnit(SampleUnitName, SampleUnitAbbreviation, constants.UnitTypeMass),
	},
	UnitPrice: SampleRate,
	OrderLine: SampleSalesOrderLine,
	Item:      SampleItem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleItem = &Item{
	ID:           SampleItemID,
	Object:       constants.ObjectTypeItem,
	SKU:          SampleItemSKU,
	Description:  &sampleDescription,
	Notes:        nil,
	ItemTypeCode: constants.ItemTypeCodeProduct,
	Category:     SampleItemCategory,
	UnitValue:    SampleRate,
	UnitCost:     SampleRate,
	BurnRate:     SampleRate,
	Attributes:   NewList([]Attribute{*SampleAttribute}, PageInfo{}),
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleItemCategory = &ItemCategory{
	ID:         SampleItemCategoryID,
	Object:     constants.ObjectTypeItemCategory,
	Name:       SampleItemCategoryName,
	Notes:      &sampleItemCategoryNotes,
	Type:       constants.ItemCategoryTypeMaterial,
	Owner:      SampleOwnerSystem,
	Properties: NewList([]Property{*SampleProperty}, PageInfo{}),
	UnitGroup:  SampleUnitGroup,
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleItemCosts = &ItemCosts{
	Object:             constants.ObjectTypeItem,
	DirectMaterialCost: "5.000000000000000000000000000000",
	DirectLaborCost:    "3.000000000000000000000000000000",
	OverheadCost:       "2.000000000000000000000000000000",
	TotalCost:          "10.000000000000000000000000000000",
	Unit:               SampleUnit,
}
View Source
var SampleItemInventory = &ItemInventory{
	Object:             constants.ObjectTypeItemInventory,
	OnHand:             SampleComputedQuantity,
	Reserved:           SampleComputedQuantity,
	AvailableToPromise: SampleComputedQuantity,
	Short:              SampleComputedQuantity,
}
View Source
var SampleItemTrends = &ItemTrends{
	Object:    constants.ObjectTypeItem,
	TrendType: "on_hand",
	Points: NewList([]ItemTrendPoint{
		{
			Object:     constants.ObjectTypeItemTrendPoint,
			OccurredAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
			Value:      "100.000000000000000000000000000000",
		},
	}, PageInfo{}),
}
View Source
var SampleJob = &Job{
	ID:           SampleJobID,
	Object:       constants.ObjectTypeJob,
	Type:         constants.JobTypeBulkCreate,
	ResourceType: new(constants.ObjectTypeProductionRun),
	Status:       constants.JobStatusCompleted,
	Results: NewList([]JobResult{{
		Object:   constants.ObjectTypeJobResult,
		Index:    0,
		Status:   constants.JobResultStatusCreated,
		Resource: NewEntity(SampleProductionRunID, constants.ObjectTypeProductionRun, nil, nil),
		SubResources: NewList([]Entity{
			*NewEntity(SampleBatchID, constants.ObjectTypeBatch, nil, nil),
		}, PageInfo{}),
	}}, PageInfo{}),
	StartedAt:   timeutil.TimestampToTimePtr(sampleCreatedAtTimestamp),
	CompletedAt: timeutil.TimestampToTimePtr(sampleCreatedAtTimestamp),
	CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleJobExport = NewJobExport("https://files.openmrp.ai/exports/" + SampleAccountID + "/production_runs/" + SampleJobID + "/production_runs_20260817.xlsx?X-Amz-Signature=example")
View Source
var SampleJobResult = &SampleJob.Results.Data[0]
View Source
var SampleLocation = &Location{
	ID:       SampleLocationID,
	Object:   constants.ObjectTypeLocation,
	Name:     SampleLocationName,
	TypeCode: SampleLocationTypeCode,
	Parent:   nil,
	Children: NewList([]Location{
		{
			ID:        SampleLocationChildID,
			Object:    constants.ObjectTypeLocation,
			Name:      "Shelf A1",
			TypeCode:  SampleLocationTypeCode,
			CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
			UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
		},
	}, PageInfo{}),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleLocationType = &LocationType{
	ID:        SampleLocationTypeID,
	Object:    constants.ObjectTypeLocationType,
	Code:      SampleLocationTypeCode,
	Name:      SampleLocationTypeName,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleLot = &Lot{
	ID:        SampleLotID,
	Object:    constants.ObjectTypeLot,
	LotNumber: "LOT-001",
}
View Source
var SampleMachine = &Machine{
	ID:           SampleMachineID,
	Object:       constants.ObjectTypeMachine,
	Name:         SampleMachineName,
	SerialNumber: SampleMachineSerialNumber,
	Notes:        &sampleMachineNotes,
	Department:   nil,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}

Department is left nil here because SampleDepartment embeds SampleMachine in its machines list, and a back-reference would be an initialization cycle.

View Source
var SampleMachineDowntimeEvent = &MachineDowntimeEvent{
	ID:         SampleMachineDowntimeEventID,
	Object:     constants.ObjectTypeMachineDowntimeEvent,
	Machine:    SampleMachine,
	Department: SampleDepartment,
	Reason: &MachineDowntimeReasonSummary{
		Object:    constants.ObjectTypeMachineDowntimeReason,
		Code:      constants.MachineDowntimeReasonCodeBreakdown,
		Name:      &sampleDowntimeReasonName,
		OeeBucket: &sampleDowntimeOeeBucket,
	},
	StartedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	EndedAt:         timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	DurationSeconds: &sampleDowntimeDuration,
	ShiftDate:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	ShiftCode:       &sampleDowntimeShiftCode,
	Item:            SampleItem,
	ProductionRun:   NewEntity(SampleProductionRunID, constants.ObjectTypeProductionRun, nil, nil),
	Batch:           NewEntity(SampleBatchID, constants.ObjectTypeBatch, nil, nil),
	ScheduleLine:    NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
	Note:            &sampleDowntimeNote,
	ReportedBy:      SampleActor,
	Source:          constants.MachineDowntimeSourceManual,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleMachineDowntimeReason = &MachineDowntimeReason{
	ID:             SampleMachineDowntimeReasonID,
	Object:         constants.ObjectTypeMachineDowntimeReason,
	Code:           constants.MachineDowntimeReasonCodeBreakdown,
	Name:           "Breakdown",
	OeeBucket:      constants.OeeBucketAvailability,
	PlanningStatus: constants.DowntimePlanningStatusUnplanned,
	SortOrder:      10,
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleMachineStatus = &MachineStatus{
	Object:              constants.ObjectTypeMachineStatus,
	Machine:             NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleMachineStatusMachineName, nil),
	Department:          NewEntity(SampleDepartmentID, constants.ObjectTypeDepartment, new(SampleDepartmentName), nil),
	Status:              constants.MachineWorkStatusRunning,
	WeekPlannedQuantity: 600,
	WeekScannedQuantity: 120,
	WeekPlannedRunHours: 5,
	Unit:                &sampleMachineStatusUnit,
	Current: &MachineCampaign{
		ScheduleLine:       NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
		Item:               NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleMachineStatusSKU),
		SKU:                sampleMachineStatusSKU,
		WeekStartDate:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		PlannedQuantity:    360,
		ScannedQuantity:    120,
		RemainingQuantity:  240,
		Unit:               &sampleMachineStatusUnit,
		ReleasedBatchCount: 6,
		ScannedBatchCount:  2,
		PlannedRunHours:    3,
		Status:             constants.ProductionScheduleLineStatusReleased,
		ProductionRun:      NewEntity(SampleProductionRunID, constants.ObjectTypeProductionRun, nil, nil),
	},
	Next: &MachineCampaign{
		ScheduleLine:      NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
		Item:              NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleMachineStatusNextSKU),
		SKU:               sampleMachineStatusNextSKU,
		WeekStartDate:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		PlannedQuantity:   240,
		ScannedQuantity:   0,
		RemainingQuantity: 240,
		Unit:              &sampleMachineStatusUnit,
		PlannedRunHours:   2,
		Status:            constants.ProductionScheduleLineStatusPlanned,
	},
}
View Source
var SampleMaterial = &Material{
	ID:         SampleMaterialID,
	Object:     constants.ObjectTypeMaterial,
	Item:       SampleItem,
	OrderPoint: SampleQuantity,
	LeadTime:   SampleQuantity,
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleMessage = &Message{
	ID:           SampleMessageID,
	Object:       constants.ObjectTypeChatMessage,
	Kind:         constants.MessageKindChat,
	Status:       constants.MessageStatusSent,
	Visibility:   constants.MessageVisibilityInternal,
	Channel:      constants.MessageChannelMessage,
	Conversation: SampleConversation,
	Sequence:     42,
	Body:         new("Sounds good — shipping it today."),
	Sender:       NewActor(SampleAccountUserID, constants.ActorTypeUser, new("Jie Yan"), nil),
	Author:       NewActor(SampleAccountUserID, constants.ActorTypeUser, new("Jie Yan"), nil),
	Attachments:  NewList([]MessageAttachment{*SampleMessageAttachment}, PageInfo{}),
	Resource:     NewEntity(SampleSalesOrderID, constants.ObjectTypeSalesOrder, new("Order #1042"), nil),
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleMessageAttachment = &MessageAttachment{
	ID:          SampleMessageAttachmentID,
	Object:      constants.ObjectTypeMessageAttachment,
	Kind:        constants.MessageAttachmentKindImage,
	Filename:    new("diagram.png"),
	ContentType: new("image/png"),
	SizeBytes:   new(int64(48213)),
	URL:         new("https://chat-bucket.s3.amazonaws.com/chat/ac/cv/mgah/diagram.png?X-Amz-Signature=..."),
	CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleMessageResource = &MessageResource{
	Object:  constants.ObjectTypeMessage,
	Message: "Operation completed successfully.",
}
View Source
var SampleMessagingBlock = &MessagingBlock{
	ID:          SampleMessagingBlockID,
	Object:      constants.ObjectTypeMessagingBlock,
	BlockedUser: SampleAccountUser,
	CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleMessagingGroup = &MessagingGroup{
	ID:        SampleMessagingGroupID,
	Object:    constants.ObjectTypeMessagingGroup,
	Name:      "Operations Team",
	Members:   NewList([]MessagingGroupMember{*SampleMessagingGroupMember}, PageInfo{}),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleNotification = &Notification{
	ID:        SampleNotificationID,
	Object:    constants.ObjectTypeNotification,
	Category:  constants.NotificationCategoryOrderUpdated,
	Status:    constants.NotificationStatusUnseen,
	Title:     "Order updated",
	Body:      new("Order #1024 changed from estimate to confirmed."),
	Sender:    NewActor(SampleAccountUserID, constants.ActorTypeUser, new("Jie Yan"), nil),
	Resource:  NewEntity(SampleSalesOrderID, constants.ObjectTypeSalesOrder, new(SampleSalesOrderNumber), nil),
	Priority:  constants.NotificationPriorityNormal,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleNotificationPreference = &NotificationPreference{
	ID:           SampleNotificationPreferenceID,
	Object:       constants.ObjectTypeNotificationPreference,
	Category:     new(constants.NotificationCategoryChatMessage),
	InAppEnabled: true,
	EmailEnabled: true,
	PushEnabled:  false,
	Digest:       constants.NotificationDigestInstant,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleNotificationSendResult = &NotificationSendResult{
	Object:   constants.ObjectTypeNotificationSendResult,
	Enqueued: 1,
}
View Source
var SampleNotificationUnreadCount = &NotificationUnreadCount{
	Object:        constants.ObjectTypeNotificationUnreadCount,
	Notifications: 3,
	Conversations: 0,
	Total:         3,
}
View Source
var SampleOAuthResponse = &OAuthResponse{
	Object:   constants.ObjectTypeOAuthResponse,
	OAuthURL: "https://oauth.fedex.com/authorize?client_id=abc123&redirect_uri=https://www.openmrp.ai/carriers/oauth/callback",
}
View Source
var SampleOpenBatchSummary = &OpenBatchSummary{
	Object:          constants.ObjectTypeOpenBatchSummary,
	DepartmentName:  "Production",
	Item:            SampleItem,
	ScanningStation: SampleScanningStation,
	Count:           "5.000000000000000000000000000000",
	Unit:            "kg",
}
View Source
var SampleOpenCreditEntry = &OpenCreditEntry{
	ID:              SampleOpenCreditEntryID,
	Object:          constants.ObjectTypeOpenCreditEntry,
	Number:          "TXN-001",
	OriginalAmount:  "1000.000000000000000000000000000000",
	AllocatedAmount: "500.000000000000000000000000000000",
	LeftoverAmount:  "500.000000000000000000000000000000",
	Customer: &AllocationCustomer{
		ID:     new(SampleCustomerID),
		Object: constants.ObjectTypeAllocationCustomer,
		Name:   SampleCustomerName,
	},
	TransactionType:     "payment",
	TransactionMethod:   new("check"),
	ResponsibleUserName: new(SampleUserName),
	Note:                new("Customer check deposited; partially applied."),
	InvoiceAllocations: NewList([]InvoiceAllocationEntry{
		{Object: constants.ObjectTypeInvoiceAllocationEntry, InvoiceNumber: "INV-001", Amount: "500.000000000000000000000000000000"},
	}, PageInfo{}),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleOperatingCalendar = &OperatingCalendar{
	Object:     constants.ObjectTypeOperatingCalendar,
	ID:         SampleOperatingCalendarID,
	Code:       "default_ship",
	Name:       "Shipping days",
	Kind:       constants.OperatingCalendarKindShip,
	DaysOfWeek: "1111000",
	CutoffAt:   &sampleCalendarCutoffAt,
	Timezone:   &sampleCalendarTimezone,
	IsDefault:  true,
	CreatedAt:  sampleCalendarCreated,
	UpdatedAt:  sampleCalendarCreated,
}

The sample is the configuration the feature exists for: a plant that ships Monday to Thursday and hands freight over by 3pm.

View Source
var SampleOperatingCalendarClosure = &OperatingCalendarClosure{
	Object:              constants.ObjectTypeOperatingCalendarClosure,
	ID:                  SampleOperatingCalendarClosureID,
	OperatingCalendarID: SampleOperatingCalendarID,
	ClosedOn:            time.Date(2026, time.November, 26, 0, 0, 0, 0, time.UTC),
	Name:                "Thanksgiving Day",
	CreatedAt:           sampleCalendarCreated,
	UpdatedAt:           sampleCalendarCreated,
}
View Source
var SampleOrderDiscount = &OrderDiscount{
	ID:           SampleOrderDiscountID,
	Object:       constants.ObjectTypeOrderDiscount,
	Name:         "10% Off",
	Code:         "SAVE10",
	Percentage:   "10.000000000000000000000000000000",
	Amount:       "0.000000000000000000000000000000",
	DiscountType: constants.OrderDiscountTypePercentage,
	OrderCount:   5,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleOwnerAccount = &Owner{
	Object: constants.ObjectTypeOwner,
	Type:   constants.OwnerTypeAccount,
	Account: &Account{
		ID:        SampleAccountID,
		Object:    constants.ObjectTypeAccount,
		Name:      SampleAccountName,
		CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
}
View Source
var SampleOwnerSystem = &Owner{
	Object: constants.ObjectTypeOwner,
	Type:   constants.OwnerTypeSystem,
}
View Source
var SamplePackList = &PackList{
	Object:             constants.ObjectTypePackList,
	AccountName:        "Acme Manufacturing",
	AccountLogoURL:     &samplePackListLogoURL,
	SalesOrderNumber:   "000123",
	CustomerPO:         &samplePackListCustomerPO,
	ShipmentNumber:     SampleShipmentNumber,
	ShippedAt:          &samplePackListShippedAt,
	BillTo:             SamplePackListParty,
	ShipTo:             SamplePackListParty,
	ContactInformation: []string{"receiving@acme.example.com", "+1-614-555-0142"},
	Carrier:            &samplePackListCarrier,
	CarrierOption:      &samplePackListOption,
	Priority:           &samplePackListPriority,
	PaymentTerm:        &samplePackListTerm,
	SalesRep:           &samplePackListSalesRep,
	ShippingCases:      NewList([]PackListCase{*SamplePackListCase}, PageInfo{}),
	LineItems:          NewList([]PackListLineItem{*SamplePackListLineItem}, PageInfo{}),
	BackOrders:         NewList([]PackListBackOrder{*SamplePackListBackOrder}, PageInfo{}),
}
View Source
var SamplePackListBackOrder = &PackListBackOrder{
	Object:              constants.ObjectTypePackListBackOrder,
	LineItemNumber:      &samplePackListLineNumber,
	SKU:                 "WIDGET-RED",
	Description:         "Red Widget, 10mm",
	QuantityOrdered:     "50",
	QuantityShipped:     "20",
	QuantityBackOrdered: "30",
	Unit:                "each",
}
View Source
var SamplePackListCase = &PackListCase{
	Object:         constants.ObjectTypePackListCase,
	Number:         "CASE-001",
	Weight:         "12.5",
	WeightUnit:     "lb",
	TrackingNumber: &samplePackListTracking,
	Carrier:        &samplePackListCarrier,
}
View Source
var SamplePackListLineItem = &PackListLineItem{
	Object:         constants.ObjectTypePackListLineItem,
	LineItemNumber: &samplePackListLineNumber,
	SKU:            "WIDGET-BLUE",
	Description:    "Blue Widget, 10mm",
	Quantity:       "24",
	Unit:           "each",
}
View Source
var SamplePackListParty = &PackListParty{
	Object:      constants.ObjectTypePackListParty,
	Name:        "Acme Manufacturing",
	StreetLine1: &samplePackListBillStreet1,
	Locality:    &samplePackListBillCity,
	State:       &samplePackListBillState,
	PostalCode:  &samplePackListBillZip,
	Country:     &samplePackListBillCountry,
	Phone:       &samplePackListBillPhone,
}
View Source
var SamplePart = &Part{
	ID:        SamplePartID,
	Object:    constants.ObjectTypePart,
	Item:      SampleItem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePaymentTerm = &PaymentTerm{
	ID:        SamplePaymentTermID,
	Object:    constants.ObjectTypePaymentTerm,
	Name:      SamplePaymentTermName,
	Status:    constants.PaymentTermStatusActive,
	Owner:     SampleOwnerSystem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePermission = &Permission{
	ID:                  SamplePermissionID,
	Object:              constants.ObjectTypePermission,
	Code:                "customers:read",
	Name:                "Read Customers",
	Description:         nil,
	PermissionGroupCode: "customers",
	CreatedAt:           timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:           timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePermissionGroup = &PermissionGroup{
	ID:          SamplePermissionGroupID,
	Object:      constants.ObjectTypePermissionGroup,
	Code:        "customers",
	Name:        "Customers",
	Description: nil,
	Permissions: NewList([]Permission{*SamplePermission}, PageInfo{}),
	Owner:       SampleOwnerSystem,
	CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:   timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePick = &Pick{
	ID:        SamplePickID,
	Object:    constants.ObjectTypePick,
	Number:    SamplePickNumber,
	Customer:  SampleCustomer,
	Priority:  SamplePriorityCode,
	ShipTo:    SampleAddress,
	LineCount: 1,
	Totals: &PickTotals{
		Object: constants.ObjectTypePickTotals,
		Picked: PickStageTotal{Object: constants.ObjectTypePickStageTotal, Completion: 1},
		Packed: PickStageTotal{Object: constants.ObjectTypePickStageTotal, Completion: 0.5},
	},
	Lines:          NewList([]PickLine{*SamplePickLine}, PageInfo{}),
	Related:        &PickRelated{Object: constants.ObjectTypePickRelated},
	PromisedAt:     timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	ShipByDate:     timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	LeadTimeDays:   &samplePickLeadTimeDays,
	LeadTimeSource: &samplePickLeadTimeSource,
	TransitDays:    &samplePickTransitDays,
	TransitSource:  &samplePickTransitSource,
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePickLine = &PickLine{
	ID:              SamplePickLineID,
	Object:          constants.ObjectTypePickLine,
	Item:            SampleItem,
	Quantity:        SampleQuantity,
	OrderedQuantity: SampleQuantity,
	SalesOrderLine:  SampleSalesOrderLine,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePickShipmentsResponse = &PickShipmentsResponse{
	Object:          constants.ObjectTypePickShipmentsResponse,
	ShipmentNumbers: []string{"SH-001", "SH-002"},
	Count:           2,
}
View Source
var SamplePlanChangeProration = &PlanChangeProration{
	Object:                     constants.ObjectTypePlanChangeProration,
	NetAmount:                  4900,
	FormattedNetAmount:         "$49.00",
	MonthlyBillAmount:          4900,
	FormattedMonthlyBillAmount: "$49.00",
	LineItems: NewList([]PlanChangeLineItem{
		{Object: constants.ObjectTypePlanChangeLineItem, Description: "Professional plan \u2014 1 seat(s) \u00d7 $49.00/mo", Amount: 4900},
	}, PageInfo{}),
	IsEstimate: true,
}
View Source
var SamplePlanLimitInvoices = &PlanLimit{
	Object: constants.ObjectTypePlanLimit,
	Key:    "invoices_maximum",
	Value:  new(10000),
}
View Source
var SamplePlanLimitSandboxes = &PlanLimit{
	Object: constants.ObjectTypePlanLimit,
	Key:    "sandboxes_maximum",
	Value:  new(1),
}
View Source
var SamplePlanLimitSeats = &PlanLimit{
	Object: constants.ObjectTypePlanLimit,
	Key:    "seats_maximum",
	Value:  new(5),
}
View Source
var SamplePortalDomain = &PortalDomain{
	ID:     SamplePortalDomainID,
	Object: constants.ObjectTypePortalDomain,
	Domain: "shop.acme.com",
	Status: constants.PortalDomainStatusPending,
	DNSRecords: NewList([]DNSRecord{
		{
			Object: constants.ObjectTypeDNSRecord,
			Type:   constants.DNSRecordTypeCNAME,
			Name:   "shop.acme.com",
			Value:  "cname.vercel-dns.com",
			Reason: constants.DNSRecordReasonRouting,
		},
	}, PageInfo{}),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePricingPlanFree = &PricingPlan{
	ID:           SamplePlanTypeIDFree,
	Object:       constants.ObjectTypePricingPlan,
	Name:         "Free",
	PlanTypeCode: constants.PublicPlanCodeFree,
	PricePerSeat: 0,
	PricePerMonth: func() *float64 {
		v := 0.0
		return &v
	}(),
	SeatMinimum: new(1),
	Limits: NewList([]PlanLimit{
		{Object: constants.ObjectTypePlanLimit, Key: "sandboxes_maximum", Value: new(1)},
		{Object: constants.ObjectTypePlanLimit, Key: "seats_maximum", Value: new(1)},
		{Object: constants.ObjectTypePlanLimit, Key: "invoices_maximum", Value: new(100)},
		{Object: constants.ObjectTypePlanLimit, Key: "batches_maximum", Value: new(10000)},
	}, PageInfo{}),
	DisplayFeatures: []string{
		"1 sandbox environment",
		"Up to 100 invoices per month",
		"Basic support",
	},
	DisplayOrder:  1,
	IsHighlighted: false,
	ButtonText:    "Get Started",
	IncludesPreviousPlan: func() *string {
		v := ""
		return &v
	}(),
}
View Source
var SamplePricingPlanPro = &PricingPlan{
	ID:           SamplePlanTypeIDPro,
	Name:         "Professional",
	Object:       constants.ObjectTypePricingPlan,
	PlanTypeCode: constants.PublicPlanCodePro,
	PricePerSeat: 49,
	PricePerMonth: func() *float64 {
		v := 147.0
		return &v
	}(),
	SeatMinimum: new(3),
	Limits: NewList([]PlanLimit{
		{Object: constants.ObjectTypePlanLimit, Key: "sandboxes_maximum", Value: new(999)},
		{Object: constants.ObjectTypePlanLimit, Key: "seats_maximum", Value: new(999)},
		{Object: constants.ObjectTypePlanLimit, Key: "invoices_maximum", Value: new(999)},
		{Object: constants.ObjectTypePlanLimit, Key: "batches_maximum", Value: new(10000)},
	}, PageInfo{}),
	DisplayFeatures: []string{
		"Unlimited sandbox environments",
		"Unlimited team seats",
		"Unlimited invoices",
		"Dedicated support",
		"Custom integrations",
	},
	DisplayOrder:  3,
	IsHighlighted: false,
	ButtonText:    "Contact Sales",
	IncludesPreviousPlan: func() *string {
		v := "Starter"
		return &v
	}(),
}
View Source
var SamplePricingPlanStarter = &PricingPlan{
	ID:           SamplePlanTypeIDStarter,
	Object:       constants.ObjectTypePricingPlan,
	Name:         "Starter",
	PlanTypeCode: constants.PublicPlanCodeStarter,
	PricePerSeat: 19,
	PricePerMonth: func() *float64 {
		v := 19.0
		return &v
	}(),
	SeatMinimum: new(1),
	Limits: NewList([]PlanLimit{
		{Object: constants.ObjectTypePlanLimit, Key: "sandboxes_maximum", Value: new(3)},
		{Object: constants.ObjectTypePlanLimit, Key: "seats_maximum", Value: new(5)},
		{Object: constants.ObjectTypePlanLimit, Key: "invoices_maximum", Value: new(10000)},
		{Object: constants.ObjectTypePlanLimit, Key: "batches_maximum", Value: new(10000)},
	}, PageInfo{}),
	DisplayFeatures: []string{
		"3 sandbox environments",
		"Up to 5 team seats",
		"Unlimited invoices",
		"Priority email support",
	},
	DisplayOrder:  2,
	IsHighlighted: true,
	ButtonText:    "Get Started",
	IncludesPreviousPlan: func() *string {
		v := "Free"
		return &v
	}(),
}
View Source
var SamplePriority = &Priority{
	ID:        SamplePriorityID,
	Object:    constants.ObjectTypePriority,
	Code:      SamplePriorityCode,
	Name:      SamplePriorityName,
	Owner:     SampleOwnerSystem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProduct = &Product{
	ID:               SampleProductID,
	Object:           constants.ObjectTypeProduct,
	Type:             SampleProductTypeCode,
	PortalVisibility: constants.CustomerPortalVisibilityVisible,
	ProductLine:      SampleProductLine,
	Item:             SampleItem,
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductLine = &ProductLine{
	ID:               SampleProductLineID,
	Object:           constants.ObjectTypeProductLine,
	Name:             SampleProductLineName,
	Description:      &sampleProductLineDescription,
	Notes:            &sampleProductLineNotes,
	CommissionPolicy: constants.CommissionPolicyExempt,
	FreightPolicy:    constants.FreightPolicyBilled,
	Owner:            SampleOwnerSystem,
	UnitGroup:        SampleUnitGroup,
	DefaultLot:       SampleQuantity,
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductType = &ProductType{
	ID:        SampleProductTypeID,
	Object:    constants.ObjectTypeProductType,
	Name:      SampleProductTypeName,
	Code:      SampleProductTypeCode,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionFlowConsumption = ProductionFlowConsumption{
	ID:            SampleConsumptionID,
	Object:        constants.ObjectTypeConsumption,
	ConsumedItem:  SampleItem,
	Quantity:      SampleQuantity,
	WasteQuantity: SampleQuantity,
	Instructions:  &sampleFlowInstructions,
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:     timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionFlowProduction = &ProductionFlowProduction{
	ID:           SampleProductionID,
	Object:       constants.ObjectTypeProduction,
	ProducedItem: SampleItem,
	Quantity:     SampleQuantity,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionFlowStep = ProductionFlowStep{
	ID:              SampleProductionStepID,
	Object:          constants.ObjectTypeProductionStep,
	Name:            "Final Assembly",
	Notes:           &sampleProductionFlowStepNotes,
	Production:      SampleProductionFlowProduction,
	Consumptions:    NewList([]ProductionFlowConsumption{SampleProductionFlowConsumption}, PageInfo{}),
	InSteps:         NewList([]ProductionStep{}, PageInfo{}),
	OutSteps:        NewList([]ProductionStep{}, PageInfo{}),
	Machines:        NewList([]Machine{*SampleMachine}, PageInfo{}),
	Department:      SampleDepartment,
	ScanningStation: SampleScanningStation,
	LevelingFactor:  "1.000000000000000000000000000000",
	Allowances:      "0.000000000000000000000000000000",
	LaborRate:       SampleRate,
	LaborTime:       SampleRate,
	OverheadRate:    SampleRate,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionOutput = &ProductionOutput{
	ID:           SampleProductionID,
	Object:       constants.ObjectTypeProduction,
	ProducedItem: SampleItem,
	Quantity:     SampleQuantity,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionRun = &ProductionRun{
	ID:              SampleProductionRunID,
	Object:          constants.ObjectTypeProductionRun,
	Number:          "1",
	ResponsibleUser: SampleAccountUser,
	BatchCount:      3,
	StartedAt:       timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionRunReference = &ProductionRunReference{
	ID:     SampleProductionRunID,
	Object: constants.ObjectTypeProductionRun,
	Number: "PR-001",
}
View Source
var SampleProductionSchedule = &ProductionSchedule{
	ID:                SampleProductionScheduleID,
	Object:            constants.ObjectTypeProductionSchedule,
	Version:           3,
	Status:            constants.ProductionScheduleStatusPublished,
	Name:              new("May planning cycle"),
	PlanningAsOf:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	HorizonStartDate:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	HorizonEndDate:    timeutil.TimestampToTime(sampleHorizonEndTimestamp),
	HorizonWeeks:      13,
	FrozenWeeks:       1,
	FrozenThroughDate: timeutil.TimestampToTimePtr(sampleFrozenThroughTimestamp),
	DemandBasis:       constants.ScheduleDemandBasisTrailing12,
	GenerationSource:  constants.ScheduleGenerationSourceManual,
	SolverVersion:     "v1",
	SettingsSnapshot: map[string]any{
		"planning_horizon_weeks": 13,
		"frozen_weeks":           1,
		"capacity_headroom_pct":  0.9,
		"shifts_per_day":         2,
		"hours_per_shift":        7,
	},
	Diagnostics:           sampleScheduleDiagnostics,
	FrozenLineCount:       6,
	FrozenPlannedQuantity: 4320,
	GeneratedBy:           SampleActor,
	PublishedBy:           SampleActor,
	PublishedAt:           timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	CreatedAt:             timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:             timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionScheduleDerivedLine = &ProductionScheduleDerivedLine{
	ID:                 SampleProductionScheduleDerivedLineID,
	Object:             constants.ObjectTypeProductionScheduleDerivedLine,
	ProductionSchedule: NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	SourceLine:         NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
	ProductionStep:     NewEntity(SampleProductionStepID, constants.ObjectTypeProductionStep, new("Final Assembly"), nil),
	Department:         NewEntity(SampleDepartmentID, constants.ObjectTypeDepartment, new(SampleDepartmentName), nil),
	Item:               NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
	WeekIndex:          1,
	WeekStartDate:      timeutil.TimestampToTime(sampleWeekTwoStartTimestamp),
	Quantity:           600,
	PlannedUnit:        NewEntity(SampleUnitID, constants.ObjectTypeUnit, &samplePlannedUnitName, nil),
	ExplosionDepth:     1,
	OffsetWeeks:        1,
	Status:             constants.ProductionScheduleLineStatusPlanned,
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:          timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionScheduleDeviation = &ProductionScheduleDeviation{
	ID:                 SampleProductionScheduleDeviationID,
	Object:             constants.ObjectTypeProductionScheduleDeviation,
	ProductionSchedule: NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	Line:               NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
	DeviationType:      constants.ScheduleDeviationTypeQuantityChanged,
	FreezeStatus:       constants.ScheduleFreezeStatusFrozen,
	WeekIndex:          &sampleDeviationWeekIndex,
	Machine:            NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
	Item:               NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
	Before:             json.RawMessage(`{"planned_quantity":600,"planned_lots":10,"planned_run_hours":5}`),
	After:              json.RawMessage(`{"planned_quantity":900,"planned_lots":15,"planned_run_hours":7.5}`),
	DeltaQuantity:      300,
	DeltaRunHours:      2.5,
	Reason:             &sampleDeviationReasonCode,
	ReasonNote:         &sampleDeviationReasonNote,
	Actor:              SampleActor,
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleProductionScheduleFinishedPolicy = &ProductionScheduleFinishedPolicy{
	ID:                 SampleProductionScheduleFinishedPolicyID,
	Object:             constants.ObjectTypeProductionScheduleFinishedPolicy,
	ProductionSchedule: NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	Item:               NewEntity(SampleItemID, constants.ObjectTypeItem, nil, nil),
	SKU:                "MZ-CREW-BLK-L",
	GreigeItem:         NewEntity(SampleItemID, constants.ObjectTypeItem, nil, nil),
	GreigeSKU:          "MZ-GREIGE-CREW",
	AnnualDemand:       26000,
	WeeklyDemand:       500,
	SigmaWeekly:        130,
	SafetyStock:        524,
	ReorderPoint:       3524,
	OnHand:             3000,
	WeeksOfCover:       6,
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:          timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionScheduleFinishingLine = &ProductionScheduleFinishingLine{
	ID:                    SampleProductionScheduleFinishingLineID,
	Object:                constants.ObjectTypeProductionScheduleFinishingLine,
	ProductionSchedule:    NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	WeekIndex:             2,
	WeekStartDate:         timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	Item:                  NewEntity(SampleItemID, constants.ObjectTypeItem, nil, nil),
	SKU:                   "MZ-CREW-BLK-L",
	GreigeItem:            NewEntity(SampleItemID, constants.ObjectTypeItem, nil, nil),
	GreigeSKU:             "MZ-GREIGE-CREW",
	Department:            NewEntity(SampleDepartmentID, constants.ObjectTypeDepartment, nil, nil),
	PlannedQuantity:       240,
	Unit:                  &sampleFinishingUnit,
	PlannedLots:           4,
	PlannedLotUnits:       60,
	PlannedRunHours:       19.2,
	GreigeConsumed:        240,
	FirmUnits:             120,
	ProjectedOnHandBefore: 180,
	ProjectedOnHandAfter:  420,
	Status:                constants.ProductionScheduleLineStatusPlanned,
	Source:                constants.ScheduleLineSourceSolver,
	CreatedAt:             timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:             timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionScheduleItemPolicy = &ProductionScheduleItemPolicy{
	ID:                      SampleProductionScheduleItemPolicyID,
	Object:                  constants.ObjectTypeProductionScheduleItemPolicy,
	ProductionSchedule:      NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	Item:                    NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
	FulfillmentPolicy:       constants.FulfillmentPolicyMakeToStock,
	PolicySource:            constants.FulfillmentPolicySourceProductLine,
	SKU:                     sampleScheduleSKU,
	Unit:                    NewEntity(SampleUnitID, constants.ObjectTypeUnit, &samplePlannedUnitName, nil),
	UnitAbbreviation:        &samplePlannedUnitAbbreviation,
	ProductionStep:          NewEntity(SampleProductionStepID, constants.ObjectTypeProductionStep, &sampleScheduleStepName, nil),
	PrimaryMachine:          NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
	AnnualDemand:            5200,
	WeeklyDemand:            100,
	SecondsPerUnit:          30,
	UnitCost:                4,
	SetupCost:               50,
	HoldingCost:             1,
	EOQUnits:                720,
	ConstraintLeadTimeWeeks: 1.3,
	FinishLeadTimeWeeks:     6,
	SigmaWeeklyPooled:       130,
	SigmaDownstreamSum:      180,
	SafetyStockPrimary:      244,
	SafetyStockDownstream:   524,
	ReorderPoint:            974,
	OrderUpTo:               1694,
	OnHandEchelon:           1450,
	OnHandGreige:            320,
	AverageGreigeInventory:  604,
	MaxGreigeInventory:      964,
	WeeksOfCover:            14.5,
	ProjectedOnHand:         sampleScheduleProjectedOnHand,
	ProjectedGreigeOnHand:   sampleScheduleProjectedGreigeOnHand,
	AnnualRunHours:          43.3,
	ABCClass:                &sampleABCClassA,
	Constraints:             []constants.SchedulePolicyConstraint{},
	CreatedAt:               timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:               timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionScheduleItemSetting = &ProductionScheduleItemSetting{
	ID:                  SampleProductionScheduleItemSettingID,
	Object:              constants.ObjectTypeProductionScheduleItemSetting,
	Item:                NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSettingsSKU),
	ParticipationStatus: constants.ParticipationStatusIncluded,
	LotMultipleUnits:    &sampleItemSettingLotMultiple,
	FulfillmentPolicy:   &sampleItemSettingPolicy,
	CreatedAt:           timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:           timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionScheduleLine = &ProductionScheduleLine{
	ID:                       SampleProductionScheduleLineID,
	Object:                   constants.ObjectTypeProductionScheduleLine,
	ProductionSchedule:       NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	WeekIndex:                0,
	WeekStartDate:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	Machine:                  NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
	ProductionStep:           NewEntity(SampleProductionStepID, constants.ObjectTypeProductionStep, &sampleScheduleStepName, nil),
	Department:               NewEntity(SampleDepartmentID, constants.ObjectTypeDepartment, new(SampleDepartmentName), nil),
	Item:                     NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
	PlannedQuantity:          720,
	PlannedUnit:              NewEntity(SampleUnitID, constants.ObjectTypeUnit, &samplePlannedUnitName, nil),
	PlannedUnitAbbreviation:  &samplePlannedUnitAbbreviation,
	PlannedLots:              12,
	PlannedLotUnits:          60,
	PlannedRunHours:          6,
	PlannedChangeoverMinutes: 25,
	SequenceIndex:            0,
	ProjectedOnHandBefore:    1450,
	ProjectedOnHandAfter:     2070,
	Status:                   constants.ProductionScheduleLineStatusReleased,
	Source:                   constants.ScheduleLineSourceSolver,
	FreezeStatus:             constants.ScheduleFreezeStatusFrozen,
	ProductionRun:            NewEntity(SampleProductionRunID, constants.ObjectTypeProductionRun, nil, nil),
	ReleasedBatchCount:       12,
	ScannedBatchCount:        4,
	ScannedQuantity:          240,
	CreatedAt:                timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionSchedulePreview = &ProductionSchedulePreview{
	Object:        constants.ObjectTypeProductionSchedulePreview,
	SolverVersion: "v1",
	PlanningAsOf:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	Policies: NewList([]SchedulePolicy{{
		Item:                    NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
		SKU:                     sampleScheduleSKU,
		FulfillmentPolicy:       constants.FulfillmentPolicyMakeToStock,
		PolicySource:            constants.FulfillmentPolicySourceProductLine,
		AnnualDemand:            5200,
		WeeklyDemand:            100,
		SecondsPerUnit:          30,
		UnitCost:                4,
		SetupCost:               50,
		HoldingCost:             1,
		EOQUnits:                720,
		ConstraintLeadTimeWeeks: 1.3,
		FinishLeadTimeWeeks:     6,
		SafetyStockPrimary:      244,
		SafetyStockDownstream:   524,
		ReorderPoint:            974,
		OrderUpTo:               1694,
		OnHandEchelon:           1450,
		OnHandGreige:            320,
		AverageGreigeInventory:  604,
		MaxGreigeInventory:      964,
		WeeksOfCover:            14.5,
		ABCClass:                &sampleABCClassA,
		AnnualRunHours:          43.3,
	}}, PageInfo{}),
	Campaigns: NewList([]ScheduleCampaign{{
		Item:      NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
		SKU:       sampleScheduleSKU,
		Machine:   NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
		WeekIndex: 0,
		Units:     720,
		Lots:      12,
		RunHours:  6,
	}}, PageInfo{}),
	Projections: NewList([]ScheduleProjection{{
		Item:         NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
		OnHandByWeek: sampleScheduleProjectedOnHand,
	}}, PageInfo{}),
	Diagnostics: sampleScheduleDiagnostics,
}
View Source
var SampleProductionScheduleRegeneratePreview = &ProductionScheduleRegeneratePreview{
	Object:             constants.ObjectTypeProductionScheduleRegeneratePreview,
	ProductionSchedule: NewEntity(SampleProductionScheduleID, constants.ObjectTypeProductionSchedule, nil, nil),
	SolverVersion:      "v1",
	PlanningAsOf:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	Lines: NewList([]ScheduleDiffLine{
		{
			Change:           constants.ScheduleDiffChangeChanged,
			Item:             NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
			SKU:              sampleScheduleSKU,
			Machine:          NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
			WeekIndex:        2,
			CurrentQuantity:  600,
			ProposedQuantity: 720,
		},
		{
			Change:           constants.ScheduleDiffChangeAdded,
			Item:             NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
			SKU:              sampleScheduleSKU,
			Machine:          NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
			WeekIndex:        7,
			CurrentQuantity:  0,
			ProposedQuantity: 720,
		},
		{
			Change:           constants.ScheduleDiffChangeRemoved,
			Item:             NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
			SKU:              sampleScheduleSKU,
			Machine:          NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
			WeekIndex:        5,
			CurrentQuantity:  300,
			ProposedQuantity: 0,
			CurrentIsManual:  true,
		},
	}, PageInfo{}),
	AddedCount:           1,
	RemovedCount:         1,
	ChangedCount:         1,
	ManualLineCount:      1,
	DiscardedManualCount: 1,
}
View Source
var SampleProductionScheduleSettings = &ProductionScheduleSettings{
	Object:                         constants.ObjectTypeProductionScheduleSettings,
	ConstraintDepartment:           NewEntity(SampleDepartmentID, constants.ObjectTypeDepartment, new(SampleDepartmentName), nil),
	PlanningHorizonWeeks:           13,
	FrozenWeeks:                    1,
	WeekStartDay:                   1,
	DemandWindowMonths:             12,
	ForecastHistoryMonths:          24,
	ForecastMonths:                 12,
	DemandBasis:                    constants.ScheduleDemandBasisTrailing12,
	ForecastZ:                      1.645,
	ChangeoverAvgMinutes:           30,
	ChangeoverMinMinutes:           15,
	ChangeoverMaxMinutes:           90,
	ChangeoverLaborRate:            20,
	HoldingRatePct:                 0.25,
	ServiceLevelZ:                  1.645,
	FinishLeadTimeWeeks:            6,
	DefaultConstraintLeadTimeWeeks: 1.3,
	MaxWeeksSupply:                 12,
	MaxFlowDepth:                   10,
	ShiftsPerDay:                   2,
	HoursPerShift:                  7,
	WorkDaysPerWeek:                5,
	WeeksPerYear:                   52,
	CapacityHeadroomPct:            0.9,
	DefaultLotUnits:                60,
	DefaultCustomerLeadTimeDays:    30,
	DefaultFulfillmentPolicy:       constants.FulfillmentPolicyMakeToStock,
	CadenceStatus:                  constants.ActivationStatusActive,
	GenerationCron:                 &sampleGenerationCron,
	GenerationTimezone:             "America/New_York",
	AutoPublishStatus:              constants.ActivationStatusInactive,
	LastGeneratedAt:                timeutil.TimestampToTimePtr(sampleCreatedAtTimestamp),
	SettingsStatus:                 constants.SettingsStatusStored,
	CreatedAt:                      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProductionStep = &ProductionStep{
	ID:              SampleProductionStepID,
	Object:          constants.ObjectTypeProductionStep,
	Name:            "Final Assembly",
	Notes:           &sampleProductionStepNotes,
	LevelingFactor:  "1.000000000000000000000000000000",
	Allowances:      "0.000000000000000000000000000000",
	LaborRate:       SampleRate,
	LaborTime:       SampleRate,
	OverheadRate:    SampleRate,
	Production:      SampleProductionOutput,
	Consumptions:    NewList([]Consumption{*SampleConsumption}, PageInfo{}),
	Machines:        NewList([]Machine{*SampleMachine}, PageInfo{}),
	ScanningStation: SampleScanningStation,
	Department:      SampleDepartment,
	InSteps:         NewList([]ProductionStep{}, PageInfo{}),
	OutSteps:        NewList([]ProductionStep{}, PageInfo{}),
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleProperty = &Property{
	ID:         SamplePropertyID,
	Object:     constants.ObjectTypeProperty,
	Name:       SamplePropertyName,
	Attributes: NewList([]Attribute{*SampleAttribute}, PageInfo{}),
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePublicAccount = &PublicAccount{
	ID:                    SampleAccountID,
	Object:                constants.ObjectTypePublicAccount,
	Name:                  SampleAccountName,
	Slug:                  SampleAccountPortalSlug,
	DefaultBillingAddress: SampleAddress,
	SupportEmail:          new("support@acme.example.com"),
	LogoURL:               new("https://cdn.openmrp.ai/branding/abr_2rygb4fof28b/logo.png"),
	PortalDomain:          new("shop.acme.com"),
	FaviconURL:            new("https://cdn.openmrp.ai/branding/abr_2rygb4fof28b/favicon.png"),
}
View Source
var SamplePurchaseOrder = &PurchaseOrder{
	ID:                   SamplePurchaseOrderID,
	Object:               constants.ObjectTypePurchaseOrder,
	Number:               SamplePurchaseOrderNumber,
	Note:                 &samplePurchaseOrderNote,
	Status:               constants.SalesOrderStatusCodeEstimate,
	Priority:             SamplePriorityCode,
	AcknowledgmentStatus: constants.AcknowledgmentStatusNotSent,
	Supplier:             SampleSupplier,
	BillToAddress:        SampleAddress,
	ShipToAddress:        SampleAddress,
	Freight:              SampleFreight,
	PaymentTerm:          SamplePaymentTerm,
	ShippingTerm:         SampleShippingTerm,
	Lines:                NewList([]PurchaseOrderLine{*SamplePurchaseOrderLine}, PageInfo{}),
	LineCount:            1,
	Contacts:             NewList([]EmailContact{*SampleEmailContact}, PageInfo{}),
	ScheduledAt:          timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	CreatedAt:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:            timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SamplePurchaseOrderLine = &PurchaseOrderLine{
	ID:                 SamplePurchaseOrderLineID,
	Object:             constants.ObjectTypePurchaseOrderLine,
	LineItemNumber:     1,
	ProductSKU:         SampleItemSKU,
	ProductDescription: &samplePurchaseOrderLineProductDescription,
	Item:               SampleItem,
	QuantityOrdered:    SampleQuantity,
	QuantityReceived:   SampleQuantity,
	UnitPrice:          SampleRate,
	UnitCost:           SampleRate,
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:          timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleQuantity = &Quantity{
	ID:           SampleQuantityID,
	Object:       constants.ObjectTypeQuantity,
	Value:        "1234.56",
	DisplayValue: "$1,234.56",
	Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
}
View Source
var SampleRate = &Rate{
	ID:              SampleRateID,
	Object:          constants.ObjectTypeRate,
	Value:           SampleRateValue,
	NumeratorUnit:   newSampleUnit("US Dollar", "USD", constants.UnitTypeCurrency),
	DenominatorUnit: newSampleUnit(SampleUnitName, SampleUnitAbbreviation, constants.UnitTypeMass),
	DisplayValue:    "$25.50 / " + SampleUnitAbbreviation,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleRateShopOption = &RateShopOption{
	Object:        constants.ObjectTypeRateShopOption,
	Carrier:       SampleCarrier,
	ServiceLevel:  SampleServiceLevel,
	Rate:          12.34,
	EstimatedDays: &sampleRateShopEstimatedDays,
}
View Source
var SampleRealizedMarginFinding = &RealizedMarginFinding{
	ID:     SampleCustomerID + ":" + SampleItemID,
	Object: constants.ObjectTypeRealizedMarginFinding,
	Reason: constants.PricingFindingReasonBelowTargetMargin,
	QuantityInvoiced: &ComputedQuantity{
		Object:       constants.ObjectTypeComputedQuantity,
		Value:        "1200",
		DisplayValue: "1,200 " + SampleUnitAbbreviation,
	},
	Revenue: &ComputedQuantity{
		Object:       constants.ObjectTypeComputedQuantity,
		Value:        "16200.00",
		DisplayValue: "16,200.00",
	},
	Cost: &ComputedQuantity{
		Object:       constants.ObjectTypeComputedQuantity,
		Value:        "12800.00",
		DisplayValue: "12,800.00",
	},
	AverageUnitPrice: &ComputedRate{
		Object:       constants.ObjectTypeComputedRate,
		Value:        "13.5000",
		DisplayValue: "$13.50 / " + SampleUnitAbbreviation,
	},
	PeerMedianPrice: &ComputedRate{
		Object:       constants.ObjectTypeComputedRate,
		Value:        "18.0000",
		DisplayValue: "$18.00 / " + SampleUnitAbbreviation,
	},
	LineCount:               14,
	BelowPeerMedianFraction: &sampleRealizedBelowPeer,
	GrossMargin:             &sampleRealizedGrossMargin,
}
View Source
var SampleReceivableEntry = ReceivableEntry{
	Object:           constants.ObjectTypeReceivableEntry,
	Invoice:          SampleInvoice,
	Customer:         SampleCustomer,
	PONumber:         nil,
	InvoicedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	RemainingBalance: "1234.56",
	IsPaidInFull:     false,
}
View Source
var SampleReceivingOrder = &ReceivingOrder{
	ID:                   SampleReceivingOrderID,
	Object:               constants.ObjectTypeReceivingOrder,
	Number:               "RO-001",
	Note:                 &sampleReceivingOrderNote,
	PurchaseOrder:        SamplePurchaseOrder,
	Supplier:             SampleSupplier,
	Lines:                NewList([]ReceivingOrderLine{*SampleReceivingOrderLine}, PageInfo{}),
	LineCount:            2,
	CompletionPercentage: 50.0,
	CreatedAt:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:            timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleReceivingOrderLine = &ReceivingOrderLine{
	ID:        SampleReceivingOrderLineID,
	Object:    constants.ObjectTypeReceivingOrderLine,
	Quantity:  SampleQuantity,
	OrderLine: SampleSalesOrderLine,
	Item:      SampleItem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleRecord = &Record{
	ID:     SampleShipmentID,
	Object: constants.ObjectTypeRecord,
	Type:   constants.RecordTypeShipment,
	Number: &sampleRecordNumber,
	Status: new("fulfilled"),
	Metadata: map[string]string{
		"carrier":         "UPS",
		"tracking_number": "1Z999AA10123456784",
	},
}
View Source
var SampleRegistrationFlow = &RegistrationFlow{
	ID:                   SampleRegistrationFlowID,
	Object:               constants.ObjectTypeRegistrationFlow,
	Name:                 SampleRegistrationFlowName,
	CustomerGroupOptions: NewList([]RegistrationFlowOption{SampleRegistrationFlowOption}, PageInfo{}),
	PaymentTermOptions:   NewList([]RegistrationFlowOption{SampleRegistrationFlowOption}, PageInfo{}),
	ShippingTermOptions:  NewList([]RegistrationFlowOption{SampleRegistrationFlowOption}, PageInfo{}),
	CreatedAt:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:            timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleRegistrationSession = &RegistrationSession{
	ID:                      SampleRegistrationSessionID,
	Object:                  constants.ObjectTypeRegistrationSession,
	PlanCode:                constants.PlanCodeStarter,
	Step:                    constants.RegistrationStepVerification,
	StripeCustomerID:        new(SampleStripeCustomerID),
	StripeCheckoutSessionID: new(SampleCheckoutSessionID),
	PaymentCompleted:        false,
	Account:                 SampleRegistrationSessionAccount,
	User:                    *SampleRegistrationSessionUser,
	CompletedAt:             nil,
	CreatedAt:               timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:               timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleRegistrationSessionAccount = &RegistrationSessionAccount{
	ID:             new(SampleAccountID),
	Object:         constants.ObjectTypeAccount,
	Name:           SampleAccountName,
	BillingAddress: *SampleRegistrationSessionAddress,
}
View Source
var SampleRegistrationSessionUser = &RegistrationSessionUser{
	ID:              new(SampleUserID),
	Object:          constants.ObjectTypeUser,
	Email:           SampleUserEmail,
	Name:            new(SampleUserName),
	EmailVerifiedAt: timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
}
View Source
var SampleReleaseScheduleWeekPreview = &ReleaseScheduleWeekPreview{
	Object:        constants.ObjectTypeProductionScheduleWeekReleasePreview,
	WeekIndex:     0,
	WeekStartDate: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	LineCount:     1,
	BatchCount:    6,
	TotalQuantity: 360,
	IsReleasable:  true,
	Lines: NewList([]ReleasedScheduleLine{
		{
			Line:            NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
			Item:            NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
			SKU:             sampleScheduleSKU,
			Machine:         NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
			PlannedQuantity: 360,
			LotUnits:        60,
			BatchCount:      6,
			Batches: NewList([]ReleaseScheduleBatch{
				{Item: NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU), SKU: sampleScheduleSKU, Quantity: 60},
			}, PageInfo{}),
		},
	}, PageInfo{}),
}
View Source
var SampleReleaseScheduleWeekResult = &ReleaseScheduleWeekResult{
	Object:            constants.ObjectTypeProductionScheduleWeekRelease,
	ProductionRun:     SampleProductionRun,
	WeekIndex:         0,
	WeekStartDate:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	ReleasedLineCount: 1,
	BatchCount:        6,
	TotalQuantity:     360,
	Lines: NewList([]ReleasedScheduleLine{
		{
			Line:            NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
			Item:            NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
			SKU:             sampleScheduleSKU,
			Machine:         NewEntity(SampleMachineID, constants.ObjectTypeMachine, &sampleReleasedMachineName, nil),
			PlannedQuantity: 360,
			LotUnits:        60,
			BatchCount:      6,
			Batches: NewList([]ReleaseScheduleBatch{
				{
					Item:     NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
					SKU:      sampleScheduleSKU,
					Quantity: 60,
					Batch:    NewEntity(SampleBatchID, constants.ObjectTypeBatch, nil, nil),
				},
			}, PageInfo{}),
		},
	}, PageInfo{}),
}
View Source
var SampleRequestLog = &RequestLog{
	ID:               SampleRequestLogID,
	Object:           constants.ObjectTypeRequestLog,
	Method:           "GET",
	Host:             SampleRequestLogHost,
	Path:             SampleRequestLogPath,
	NormalizedRoute:  SampleRequestLogPath,
	QueryJSON:        json.RawMessage(SampleRequestLogQueryJSON),
	StatusCode:       200,
	LatencyUs:        12345,
	APIVersion:       new(SampleRequestLogAPIVersion),
	ClientIP:         new(SampleRequestLogClientIP),
	UserAgent:        new(SampleRequestLogUserAgent),
	Referrer:         new("https://www.openmrp.ai"),
	OccurredAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	Account:          SampleAccount,
	Actor:            SampleRequestLogActor,
	ResponseBodyJSON: json.RawMessage(SampleRequestLogResponseBody),
}
View Source
var SampleRequestLogActor = &Actor{
	ID:        SampleUserID,
	Object:    constants.ObjectTypeActor,
	Type:      constants.ActorTypeUser,
	Name:      new(SampleUserName),
	Handle:    new(SampleUserEmail),
	AvatarURL: new(SampleUserImageUrl),
	Role:      SampleRole,
}
View Source
var SampleRole = &Role{
	ID:          SampleRoleID,
	Name:        SampleRoleName,
	Object:      constants.ObjectTypeRole,
	TypeCode:    constants.RoleTypeAdmin,
	Owner:       SampleOwnerAccount,
	Permissions: &SampleRolePermissions,
	CreatedAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:   timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleRolePermission = &RolePermission{
	ID:             SampleRolePermissionID,
	Object:         constants.ObjectTypeRolePermission,
	PermissionCode: "customers",
	Create:         true,
	Read:           true,
	Update:         true,
	Delete:         false,
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleRolePermissions = []string{"customers:create", "customers:read", "customers:update", "customers:delete"}
View Source
var SampleSalesOrder = &SalesOrder{
	ID:                          SampleSalesOrderID,
	Object:                      constants.ObjectTypeSalesOrder,
	Number:                      SampleSalesOrderNumber,
	CustomerPurchaseOrderNumber: &sampleCustomerPurchaseOrderNumber,
	Note:                        &sampleNote,
	Status:                      constants.SalesOrderStatusCodeEstimate,
	Priority:                    SamplePriorityCode,
	PaymentStatus:               constants.SalesOrderPaymentStatusUnpaid,
	PaymentIntentIDs:            []string{},
	AcknowledgmentStatus:        constants.AcknowledgmentStatusNotSent,
	Customer:                    SampleCustomer,
	SalesRep:                    SampleActor,
	CreatedBy:                   SampleCreatedBy,
	BillToAddress:               SampleAddress,
	ShipToAddress:               SampleAddress,
	Freight:                     SampleFreight,
	PaymentTerm:                 SamplePaymentTerm,
	ShippingTerm:                SampleShippingTerm,
	OrderDiscount:               SampleOrderDiscount,
	Lines:                       NewList([]SalesOrderLine{*SampleSalesOrderLine}, PageInfo{}),
	LineCount:                   1,
	Totals:                      SampleSalesOrderTotals,
	Related:                     &SalesOrderRelated{Object: constants.ObjectTypeSalesOrderRelated},
	Contacts: &OrderContact{
		Object:          constants.ObjectTypeOrderContact,
		Invoice:         []string{"ap@acme.example.com"},
		Acknowledgement: []string{"purchasing@acme.example.com"},
	},
	PromisedAt: timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	CreatedAt:  timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:  timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSalesOrderLine = &SalesOrderLine{
	ID:                 SampleSalesOrderLineID,
	Object:             constants.ObjectTypeSalesOrderLine,
	LineItemNumber:     1,
	ProductSKU:         SampleItemSKU,
	ProductDescription: &sampleProductDescription,
	Item:               SampleItem,
	Product:            SampleProduct,
	QuantityOrdered:    SampleQuantity,
	UnitPrice:          SampleRate,
	UnitCost:           SampleRate,
	Totals:             SampleSalesOrderTotals,
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:          timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSalesOrderStatus = &SalesOrderStatus{
	ID:        SampleSalesOrderStatusID,
	Object:    constants.ObjectTypeSalesOrderStatus,
	Code:      SampleSalesOrderStatusCode,
	Name:      SampleSalesOrderStatusName,
	Owner:     SampleOwnerSystem,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSalesOrderStatusCode = constants.SalesOrderStatusCodeEstimate
View Source
var SampleSalesOrderStatusDetail = &SalesOrderStatusDetail{
	Code:   "estimate",
	Object: constants.ObjectTypeSalesOrderStatus,
	Name:   "Estimate",
}
View Source
var SampleSalesOrderTotals = &SalesOrderTotals{
	Object:   constants.ObjectTypeSalesOrderTotals,
	Ordered:  "1234.56",
	Picked:   SalesOrderStageTotal{Object: constants.ObjectTypeSalesOrderStageTotal, Amount: "617.280000000000000000000000000000", Completion: 0.5},
	Packed:   SalesOrderStageTotal{Object: constants.ObjectTypeSalesOrderStageTotal, Amount: "308.640000000000000000000000000000", Completion: 0.25},
	Invoiced: SalesOrderStageTotal{Object: constants.ObjectTypeSalesOrderStageTotal, Amount: "0.000000000000000000000000000000", Completion: 0},
}
View Source
var SampleSalesOrderType = &SalesOrderType{
	Code:   "standard",
	Object: constants.ObjectTypeSalesOrderType,
	Name:   "Standard",
}
View Source
var SampleSalesTarget = &SalesTarget{
	ID:        SampleSalesTargetID,
	Object:    constants.ObjectTypeSalesTarget,
	StartAt:   timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	EndAt:     timeutil.TimestampToTime(sampleExpiresAtTimestamp),
	SalesRep:  NewEntity(SampleAccountUserID, constants.ObjectTypeAccountUser, nil, nil),
	Amount:    SampleQuantity,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSandbox = &Sandbox{
	ID:     SampleSandboxID,
	Object: constants.ObjectTypeSandbox,
	Name:   SampleSandboxName,
	OwnerAccount: &Account{
		ID:        SampleAccountID,
		Object:    constants.ObjectTypeAccount,
		Name:      SampleAccountName,
		CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleScanningConsumption = &ScanningConsumption{
	SKU:              SampleItemSKU,
	Object:           constants.ObjectTypeScanningConsumption,
	DemandMeasure:    "10.000000000000000000000000000000",
	DemandUnit:       "kg",
	InventoryMeasure: "100.000000000000000000000000000000",
	InventoryUnit:    "kg",
	Instructions:     nil,
}
View Source
var SampleScanningProductionStepInfo = &ScanningProductionStepInfo{
	ID:          SampleProductionStepID,
	Object:      constants.ObjectTypeScanningProductionStepInfo,
	Name:        "Mixing",
	IsMultiPart: false,
}
View Source
var SampleScanningStation = &ScanningStation{
	ID:                  SampleScanningStationID,
	Object:              constants.ObjectTypeScanningStation,
	Name:                SampleScanningStationName,
	Notes:               &sampleScanningStationNotes,
	Type:                constants.ScanningStationTypeInitBatch,
	LabelSizeCode:       new(constants.LabelSizeCodeTwoByFour),
	LabelTypeCode:       new(constants.LabelTypeCodeTraveler),
	OperatorRequirement: constants.OperatorRequirementNone,
	Department:          nil,
	ProductionSteps:     nil,
	CreatedAt:           timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:           timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleScheduleDeviationType = &ScheduleDeviationType{
	ID:        SampleScheduleDeviationTypeID,
	Object:    constants.ObjectTypeScheduleDeviationType,
	Code:      constants.ScheduleDeviationTypeQuantityChanged,
	Name:      "Quantity Changed",
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleScheduleOrderCoverage = &ScheduleOrderCoverage{
	Object:      constants.ObjectTypeScheduleOrderCoverage,
	SalesOrder:  NewEntity(SampleSalesOrderID, constants.ObjectTypeSalesOrder, nil, nil),
	Item:        NewEntity(SampleItemID, constants.ObjectTypeItem, nil, &sampleScheduleSKU),
	SKU:         sampleScheduleSKU,
	UnitsAtRisk: 200,
	DueWeek:     0,
	Reason:      constants.ScheduleAtRiskReasonPastDue,
	CoveringLines: NewList([]ScheduleOrderCoverageLine{{
		Object:                 constants.ObjectTypeScheduleOrderCoverageLine,
		ProductionScheduleLine: NewEntity(SampleProductionScheduleLineID, constants.ObjectTypeProductionScheduleLine, nil, nil),
		WeekIndex:              0,
		Machine:                NewEntity(SampleMachineID, constants.ObjectTypeMachine, nil, nil),
		AllocatedQuantity:      300,
	}}, PageInfo{}),
}
View Source
var SampleServiceLevel = &ServiceLevel{
	ID:                       SampleServiceLevelID,
	Object:                   constants.ObjectTypeServiceLevel,
	Name:                     SampleServiceLevelName,
	ServiceLevelToken:        "fedex_ground",
	CustomerPortalVisibility: constants.CustomerPortalVisibilityVisible,
	IsDefault:                true,
	DefaultTransitDays:       &sampleServiceLevelTransitDays,
	Owner:                    SampleOwnerAccount,
	CreatedAt:                timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSettlement = &Settlement{
	ID:              SampleSettlementID,
	Object:          constants.ObjectTypeSettlement,
	Number:          "1",
	Note:            &sampleSettlementNote,
	ResponsibleUser: SampleAccountUser,
	Allocations:     NewList([]TransactionAllocation{*SampleTransactionAllocation2}, PageInfo{}),
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSettlementSummary = &SettlementSummary{
	ID:               SampleSettlementSummaryID,
	Object:           constants.ObjectTypeSettlementSummary,
	Number:           "1",
	AllocationCount:  2,
	TotalPayments:    new("500.000000000000000000000000000000"),
	TotalRebates:     new("0.000000000000000000000000000000"),
	TotalAdjustments: new("0.000000000000000000000000000000"),
	TotalCredits:     new("250.000000000000000000000000000000"),
	InvoiceNumbers:   []string{"INV-001", "INV-002"},
	CustomerNames:    []string{"Acme Corp"},
	CreatedAt:        timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:        timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSetupBillingResponse = &SetupBillingResponse{
	Object:           constants.ObjectTypeSetupBillingResponse,
	StripeCustomerID: SampleStripeCustomerID,
	ClientSecret:     "seti_1234_secret_5678",
	PublishableKey:   "pk_test_example",
}
View Source
var SampleShipment = &Shipment{
	ID:                   SampleShipmentID,
	Object:               constants.ObjectTypeShipment,
	Number:               SampleShipmentNumber,
	Note:                 &sampleShipmentNote,
	BillOfLading:         &sampleBillOfLading,
	MasterTrackingNumber: &sampleMasterTrackingNumber,
	Status:               constants.ShipmentStatusShipped,
	ShippedAt:            timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	Priority:             SamplePriorityCode,
	CaseCount:            1,
	Customer:             SampleCustomer,
	Freight:              SampleFreight,
	ShippingAddress:      SampleAddress,
	ShippedBy:            SampleCreatedBy,
	Lines:                NewList([]ShipmentLine{*SampleShipmentLine}, PageInfo{}),
	ShippingCases:        NewList([]ShippingCaseDetail{sampleShippingCaseDetail}, PageInfo{}),
	Related:              &ShipmentRelated{Object: constants.ObjectTypeShipmentRelated},
	CreatedAt:            timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:            timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleShipmentLine = &ShipmentLine{
	ID:             SampleShipmentLineID,
	Object:         constants.ObjectTypeShipmentLine,
	SalesOrderLine: SampleSalesOrderLine,
	Item:           SampleItem,
	Quantity:       SampleQuantity,
	CreatedAt:      timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:      timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}

TODO: Totals sample

View Source
var SampleShippingCase = &ShippingCase{
	ID:             SampleShippingCaseID,
	Object:         constants.ObjectTypeShippingCase,
	Number:         "SC-0001",
	SSCC:           new("003456789000000018"),
	TrackingNumber: new("1Z999AA10123456784"),
	ShippedAt:      timeutil.TimestampToTimePtr(sampleUpdatedAtTimestamp),
	FreightAmount: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "12.500000000000000000000000000000",
		DisplayValue: "$12.50",
		Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
	},
	FreightWeight: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "5.000000000000000000000000000000",
		DisplayValue: "5 lb",
		Unit:         newSampleUnit("Pound", "lb", constants.UnitTypeMass),
	},
	Shipment:  nil,
	Carrier:   nil,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleShippingCaseLabelURL = &ShippingCaseLabelURL{
	Object: constants.ObjectTypeShippingCaseLabelURL,
	URL:    nil,
}
View Source
var SampleShippingTerm = &ShippingTerm{
	ID:                        SampleShippingTermID,
	Object:                    constants.ObjectTypeShippingTerm,
	Name:                      SampleShippingTermName,
	Type:                      constants.ShippingTermTypeCarrierRateFreight,
	Owner:                     SampleOwnerSystem,
	FlatRate:                  nil,
	MinimumOrderValue:         nil,
	FreeShippingServiceLevels: NewList([]ServiceLevel{}, PageInfo{}),
	CreatedAt:                 timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                 timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSpendingCapResponse = &SpendingCapResponse{
	Object:   constants.ObjectTypeSpendingCapResponse,
	CapCents: &sampleCapCents,
}
View Source
var SampleStripePublishableKey = &StripePublishableKey{
	Object:         constants.ObjectTypeStripePublishableKey,
	PublishableKey: "pk_test_example123",
}
View Source
var SampleSubscriptionInfo = &SubscriptionInfo{
	Object:           constants.ObjectTypeSubscriptionInfo,
	ServicingStatus:  "active",
	CollectionStatus: "current",
}
View Source
var SampleSupplierDetail = &SupplierDetail{
	ID:            SampleSupplierID,
	Object:        constants.ObjectTypeSupplier,
	Name:          SampleSupplierName,
	Number:        SampleSupplierNumber,
	Note:          nil,
	BillToAddress: SampleAddress,
	ShipToAddress: SampleAddress,
	MaterialCount: 5,
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:     timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSupplierMaterial = &SupplierMaterial{
	ID:                  SampleSupplierMaterialID,
	Object:              constants.ObjectTypeSupplierMaterial,
	Material:            SampleMaterial,
	SupplierPartNumber:  sampleSupplierPartNumber,
	SupplierDescription: &sampleSupplierDescription,
	Status:              constants.SupplierMaterialStatusActive,
	CreatedAt:           timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:           timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSupplierSummary = &SupplierSummary{
	ID:            SampleSupplierID,
	Object:        constants.ObjectTypeSupplierSummary,
	Name:          SampleSupplierName,
	Number:        SampleSupplierNumber,
	MaterialCount: 5,
	CreatedAt:     timeutil.TimestampToTime(sampleCreatedAtTimestamp),
}
View Source
var SampleSupportAvailability = &SupportAvailability{
	Object:    constants.ObjectTypeSupportAvailability,
	Available: true,
}
View Source
var SampleSupportRoute = &SupportRoute{
	ID:                SampleSupportRouteID,
	Object:            constants.ObjectTypeSupportRoute,
	RelationAccount:   NewEntity(SampleAccountID, constants.ObjectTypeAccount, new(SampleAccountName), nil),
	GroupConversation: NewEntity(SampleConversationID, constants.ObjectTypeConversation, nil, nil),
	CreatedAt:         timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:         timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSwitchPlanResponse = &SwitchPlanResponse{
	Object:   constants.ObjectTypeSwitchPlanResponse,
	Success:  true,
	IntentID: &sampleSwitchPlanIntentID,
}
View Source
var SampleSysProperty = &SysProperty{
	ID:     SampleSysPropertyID,
	Object: constants.ObjectTypeSysProperty,
	Type: &SysPropertyType{
		ID:     SampleSysPropertyTypeID,
		Object: constants.ObjectTypeSysPropertyType,
		Name:   SampleSysPropertyTypeName,
		Code:   SampleSysPropertyTypeCode,
	},
	Value:     SampleSysPropertyValueInt,
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleSysPropertyValue = &SysPropertyValue{
	Object: constants.ObjectTypeSysPropertyValue,
	Value:  "42",
}
View Source
var SampleTenancy = &Tenancy{
	Object: constants.ObjectTypeTenancy,
	CurrentAccount: &TenancyCurrentAccount{
		ID:               SampleAccountID,
		Object:           constants.ObjectTypeAccount,
		Name:             SampleAccountName,
		Type:             constants.AccountTypeCodeStandard,
		OnboardingStatus: constants.OnboardingStatusActive,
		Plan:             constants.PlanCodeStarter,
		Role:             SampleRole,
		AccountUserID:    SampleAccountUserID,
		AccountPlan: &TenancyAccountPlan{
			TypeID:        SamplePlanTypeIDStarter,
			Object:        constants.ObjectTypeAccountPlan,
			Name:          "Starter",
			PlanTypeCode:  constants.PlanCodeStarter,
			Version:       1,
			PricePerSeat:  19,
			PricePerMonth: new(19.0),
			SeatMinimum:   new(int32(1)),
			Limits: map[string]*int32{
				"sandboxes_maximum": new(int32(3)),
				"seats_maximum":     new(int32(5)),
				"invoices_maximum":  nil,
			},
			Features: map[string]bool{
				"customer_portal":      true,
				"sales_rep_dashboards": false,
			},
		},
	},
	Sandboxes: NewList([]TenancySandboxAccount{}, PageInfo{}),
	OwnerAccount: &TenancyOwnerAccount{
		ID:     SampleAccountID,
		Object: constants.ObjectTypeAccount,
		Name:   SampleAccountName,
	},
	OtherAccounts: NewList([]TenancyOtherAccount{}, PageInfo{}),
}

SampleTenancy describes a fully registered user operating in their owner account, so pending_registration is null — a pending registration only exists mid-signup, before the account does.

View Source
var SampleTerritory = &Territory{
	ID:           SampleTerritoryID,
	Object:       constants.ObjectTypeTerritory,
	State:        "NY",
	StartZipcode: &sampleTerritoryStartZipcode,
	EndZipcode:   &sampleTerritoryEndZipcode,
	SalesRep:     nil,
	ProductLine:  nil,
	CreatedAt:    timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:    timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleToolGroup = &ToolGroup{
	ID:          SampleToolGroupID,
	Object:      constants.ObjectTypeToolGroup,
	Name:        "Customer Tools",
	Description: new("Tools for looking up and managing customers."),
	Slug:        "customer_tools",
	Icon:        "people",
	SortOrder:   0,
	Tools:       NewList([]AvailableTool{*SampleAvailableTool}, PageInfo{}),
}
View Source
var SampleTransactionAllocation2 = &TransactionAllocation{
	ID:     SampleAllocationEntryID,
	Object: constants.ObjectTypeTransactionAllocation,
	Amount: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "500.000000000000000000000000000000",
		DisplayValue: "$500.00",
		Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
	},
	Note:        &sampleTransactionAllocation2Note,
	Transaction: SampleTransactionDetail,
	Invoice: &AllocationInvoice{
		ID:     SampleInvoiceID,
		Object: constants.ObjectTypeInvoiceSummary,
		Number: "INV-001",
	},
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleTransactionDetail = &TransactionDetail{
	ID:     SampleTransactionDetailID,
	Object: constants.ObjectTypeTransaction,
	Number: "1",
	Amount: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "500.000000000000000000000000000000",
		DisplayValue: "$500.00",
		Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
	},
	Customer:          nil,
	ResponsibleUser:   SampleAccountUser,
	Note:              &sampleTransactionNote,
	TransactionType:   SampleTransactionType,
	TransactionMethod: SampleTransactionMethod,
	IsFullyAllocated:  false,
	StripePaymentID:   new("pi_3PqR8s2eZvKYlo2C0AbCdEfG"),
	AllocationCount:   1,
	Allocations: NewList([]TransactionAllocation{{
		ID:     SampleAllocationEntryID,
		Object: constants.ObjectTypeTransactionAllocation,
		Amount: &Quantity{
			ID:           SampleQuantityID,
			Object:       constants.ObjectTypeQuantity,
			Value:        "500.000000000000000000000000000000",
			DisplayValue: "$500.00",
			Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
		},
		Invoice: &AllocationInvoice{
			ID:     SampleInvoiceID,
			Object: constants.ObjectTypeInvoiceSummary,
			Number: "INV-001",
		},
		CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
		UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
	}}, PageInfo{}),
	CreatedAt: timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt: timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleTransactionMethod = &TransactionMethod{
	ID:     SampleTransactionMethodID,
	Object: constants.ObjectTypeTransactionMethod,
	Name:   "Credit Card",
	Code:   constants.TransactionMethodCreditCard,
}
View Source
var SampleTransactionSummary = &TransactionSummary{
	ID:     SampleTransactionDetailID,
	Object: constants.ObjectTypeTransactionSummary,
	Number: "1",
	Amount: &Quantity{
		ID:           SampleQuantityID,
		Object:       constants.ObjectTypeQuantity,
		Value:        "500.000000000000000000000000000000",
		DisplayValue: "$500.00",
		Unit:         newSampleUnit("US Dollar", "$", constants.UnitTypeCurrency),
	},
	Customer:          nil,
	TransactionType:   SampleTransactionType,
	TransactionMethod: SampleTransactionMethod,
	IsFullyAllocated:  false,
	AllocationCount:   1,
	CreatedAt:         timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:         timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleTransactionType = &TransactionType{
	ID:     SampleTransactionTypeID,
	Object: constants.ObjectTypeTransactionType,
	Name:   "Payment",
	Code:   constants.TransactionTypePayment,
}
View Source
var SampleTriggerConfig = &TriggerConfig{
	Object:       constants.ObjectTypeTriggerConfig,
	EventFilters: []string{"email.received"},
}
View Source
var SampleUnit = &Unit{
	ID:                SampleUnitID,
	Object:            constants.ObjectTypeUnit,
	Name:              SampleUnitName,
	Abbreviation:      SampleUnitAbbreviation,
	Type:              constants.UnitTypeMass,
	RatioNumerator:    "1000",
	RatioDenominator:  "1",
	OffsetNumerator:   "0",
	OffsetDenominator: "1",
	IsBaseUnit:        false,
	Owner:             SampleOwnerSystem,
	CreatedAt:         timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:         timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleUnitGroup = &UnitGroup{
	ID:              SampleUnitGroupID,
	Object:          constants.ObjectTypeUnitGroup,
	Name:            SampleUnitGroupName,
	Notes:           &sampleUnitGroupNotes,
	Type:            constants.UnitTypeMass,
	BaseUnit:        SampleUnit,
	AssociatedUnits: NewList([]UnitGroupUnit{*SampleUnitGroupUnit}, PageInfo{}),
	Owner:           SampleOwnerSystem,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleUnitGroupUnit = &UnitGroupUnit{
	ID:                       SampleUnitGroupUnitID,
	Object:                   constants.ObjectTypeUnitGroupUnit,
	Unit:                     SampleUnit,
	DiscountPercentage:       1,
	DiscountFixed:            0,
	CustomerPortalVisibility: constants.CustomerPortalVisibilityVisible,
	CreatedAt:                timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:                timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleUsageItem = &UsageItem{
	Object:  constants.ObjectTypeUsageItem,
	Current: 5,
	Limit:   new(10),
}
View Source
var SampleUsageItemUnlimited = &UsageItem{
	Object:  constants.ObjectTypeUsageItem,
	Current: 100,
	Limit:   nil,
}
View Source
var SampleUser = &User{
	ID:              SampleUserID,
	Object:          constants.ObjectTypeUser,
	Username:        new(SampleUserUsername),
	Email:           new(SampleUserEmail),
	Name:            new(SampleUserName),
	ImageUrl:        new(SampleUserImageUrl),
	EmailVerifiedAt: timeutil.TimestampToTimePtr(sampleExpiresAtTimestamp),
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleUserEntity = &Entity{
	ID:     SampleUserID,
	Object: constants.ObjectTypeEntity,
	Type:   constants.ObjectTypeUser,
	Name:   new(SampleUserName),
	Handle: new(SampleUserEmail),
}
View Source
var SampleUserPhotoURL = &UserPhotoURL{
	Object: constants.ObjectTypeUserPhotoURL,
	URL:    new("https://cdn.openmrp.ai/avatars/us_43irtlt2ajz6.jpg?X-Amz-Expires=3600&X-Amz-Signature=example"),
}
View Source
var SampleUserPhotoUploadResult = &UserPhotoUploadResult{
	Object:  constants.ObjectTypeUserPhotoUploadResult,
	Success: true,
}
View Source
var SampleValidateProductsResponse = &ValidateProductsResponse{
	Object:   constants.ObjectTypeMap,
	Products: map[string]*Product{"0": SampleProduct},
}
View Source
var SampleValidateUnitsResponse = &ValidateUnitsResponse{
	Object: constants.ObjectTypeMap,
	Units:  map[string]*Unit{"0": SampleUnit},
}
View Source
var SampleValidatedAddress = &ValidatedAddress{
	Object:           constants.ObjectTypeValidatedAddress,
	Status:           constants.AddressValidationStatusValid,
	FormattedAddress: &sampleValidatedFormattedAddress,
	Components: &AddressComponents{
		Object:       constants.ObjectTypeAddressComponents,
		AddressLine1: "123 Main St",
		City:         "Springfield",
		State:        "IL",
		PostalCode:   "62701",
		Country:      "United States",
		CountryCode:  "US",
	},
	ValidationMessages: []string{},
}
View Source
var SampleVolumeDiscount = &VolumeDiscount{
	ID:              SampleVolumeDiscountID,
	Object:          constants.ObjectTypeVolumeDiscount,
	Name:            "Bulk Order Discount",
	Tiers:           NewList([]VolumeDiscountTier{SampleVolumeDiscountTier}, PageInfo{}),
	CustomerGroups:  nil,
	ProductLines:    nil,
	Categories:      nil,
	Attributes:      nil,
	AcceptableUnits: nil,
	CreatedAt:       timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:       timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleVolumeDiscountTier = VolumeDiscountTier{
	ID:                 SampleVolumeDiscountTierID,
	Object:             constants.ObjectTypeVolumeDiscountTier,
	Name:               "100+ Units",
	DiscountPercentage: "5.000000000000000000000000000000",
	Threshold:          "100.000000000000000000000000000000",
	CreatedAt:          timeutil.TimestampToTime(sampleCreatedAtTimestamp),
	UpdatedAt:          timeutil.TimestampToTime(sampleUpdatedAtTimestamp),
}
View Source
var SampleWebhookResponse = &WebhookResponse{
	Object:   constants.ObjectTypeWebhookResponse,
	Received: true,
}

Functions

func FormatDisplayValue

func FormatDisplayValue(value, unitAbbreviation, unitType string) string

FormatDisplayValue formats a decimal value string with a unit abbreviation. For currency units, the abbreviation is placed before the value (e.g. "$1,234.56"). For other units, the abbreviation is placed after the value (e.g. "100 kg").

func FormatRateDisplay

func FormatRateDisplay(value, numeratorAbbr, denominatorAbbr string) string

FormatRateDisplay renders a rate the way a person reads it, e.g. "$25.50 / pr". Either abbreviation may be empty, in which case that half is simply left off.

func FormatRateDisplayValue

func FormatRateDisplayValue(value, numeratorAbbreviation, numeratorUnitType, denominatorAbbreviation string) string

FormatRateDisplayValue formats a rate as "numerator / denominator" (e.g. "$25.50 / kg").

func NormalizeMonetaryQuantityValue

func NormalizeMonetaryQuantityValue(value string) string

NormalizeMonetaryQuantityValue returns a decimal string with exactly two fractional digits. Use for price-like quantities whose unit dimension is not currency (e.g. shipping flat rates).

func NormalizeQuantityValue

func NormalizeQuantityValue(value, unitType string) string

NormalizeQuantityValue returns a canonical decimal string for API quantity values, trimming database fixed-point padding. Currency units use two fractional digits; other dimensions trim trailing fractional zeros.

func NormalizeRateValue

func NormalizeRateValue(value string) string

NormalizeRateValue returns a canonical decimal string for API rate values. It trims database fixed-point padding while preserving at least two fractional digits when the source value is fractional.

func SampleCommitmentEstimatedDeliveryDate

func SampleCommitmentEstimatedDeliveryDate() *time.Time

func SampleCommitmentLeadTimeDays

func SampleCommitmentLeadTimeDays() *int32

func SampleCommitmentLeadTimeSource

func SampleCommitmentLeadTimeSource() *constants.LeadTimeSource

func SampleCommitmentTransitDays

func SampleCommitmentTransitDays() *int32

func SampleCommitmentTransitSource

func SampleCommitmentTransitSource() *constants.TransitSource

func SampleShipByCutoffAt

func SampleShipByCutoffAt() *time.Time

func SampleShipByDate

func SampleShipByDate() *time.Time

The sample walks one lane end to end: a Saturday delivery promised to a customer who receives Monday to Friday, shipped by a plant that tenders Monday to Thursday with a 3pm pickup.

Types

type APIKey

type APIKey struct {
	// API key ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=api_key"`
	// Human-readable name for the API key.
	Name string `json:"name" validate:"required"`
	// Redacted key value safe for display.
	//
	// The key's prefix followed by its last four characters, e.g. `mrp_sk_prod_****hjt4`.
	RedactedValue string `json:"redacted_value" validate:"required"`
	// Role assigned to the key, which determines the permissions of requests made with it.
	Role *Role `json:"role" expandable:"true"`
	// When the key was last used to authenticate a request.
	//
	// Recorded at most once every 24 hours, so it can lag the key's most recent use by up to a day.
	LastUsedAt *time.Time `json:"last_used_at"`
	// When the key expires and stops authenticating requests.
	//
	// A key with no expiration keeps working until it is revoked or rotated.
	ExpiresAt *time.Time `json:"expires_at"`
	// When the key's revocation takes effect.
	//
	// A future timestamp means revocation was scheduled (for example, by a rotation) and the key continues to authenticate requests until that time.
	RevokedAt *time.Time `json:"revoked_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An API key used to authenticate requests to the OpenMRP API.

A key always acts on behalf of the account it was created under, with the permissions of the role assigned to it.

func (*APIKey) SchemaExample

func (*APIKey) SchemaExample() any

type Account

type Account struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// The account's display name.
	Name string `json:"name" validate:"required"`
	// The address billed by default on orders for this account.
	DefaultBillingAddress *Address `json:"default_billing_address" expandable:"true"`
	// The address shipped to by default on orders for this account.
	DefaultShippingAddress *Address `json:"default_shipping_address" expandable:"true"`
	// Customer-facing branding for the account, such as the logo, support contacts, and social links.
	Branding *AccountBranding `json:"branding" expandable:"true"`
	// The account's customer portal settings, including the portal URL slug.
	Portal *AccountPortal `json:"portal" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An organization on OpenMRP, including its branding and customer portal sub-resources.

Your own account and any customer or supplier account you trade with are both represented by this object.

func (*Account) SchemaExample

func (*Account) SchemaExample() any

type AccountBranding

type AccountBranding struct {
	// Branding ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_branding"`
	// The email address customers are directed to for support.
	SupportEmail *string `json:"support_email"`
	// The account's public contact phone number.
	PhoneNumber *string `json:"phone_number"`
	// Stored location of the account's logo image.
	//
	// Logos uploaded through the API are stored as an object key rather than a fetchable link, so use the Get Account Logo URL endpoint to obtain a short-lived download URL.
	LogoURL *string `json:"logo_url"`
	// Stored location of the account's customer-portal favicon.
	//
	// Favicons uploaded through the API are stored as an object key rather than a fetchable link, so use the Get Account Favicon URL endpoint to obtain a short-lived download URL.
	FaviconURL *string `json:"favicon_url"`
	// Facebook handle.
	FacebookHandle *string `json:"facebook_handle"`
	// Instagram handle.
	InstagramHandle *string `json:"instagram_handle"`
	// LinkedIn handle.
	LinkedInHandle *string `json:"linkedin_handle"`
	// Twitter handle.
	TwitterHandle *string `json:"twitter_handle"`
	// The account's public website.
	WebsiteURL *string `json:"website_url"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The customer-facing branding an account presents on its portal, emails, and documents.

func (*AccountBranding) SchemaExample

func (*AccountBranding) SchemaExample() any

type AccountFaviconURL

type AccountFaviconURL struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_favicon_url"`
	// Presigned URL for downloading the account's favicon.
	//
	// The URL expires one hour after it is generated, so fetch the favicon promptly rather than caching this URL. No URL is returned when the account has never uploaded a favicon or the stored image is no longer available.
	URL *string `json:"url"`
}

Presigned URL for an account's customer-portal favicon.

func (*AccountFaviconURL) SchemaExample

func (*AccountFaviconURL) SchemaExample() any

type AccountGroup

type AccountGroup struct {
	// Account group ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_group"`
	// How this account group is used.
	//
	// - `pricing_group`: used for pricing rules, such as a "Preferred" group that receives a special discount.
	// - `type_group`: used to categorize accounts, such as "Consumers" or "Distributors".
	//
	// A group's type is fixed when it is created and cannot be changed afterwards.
	Type constants.AccountGroupType `json:"type" validate:"required"`
	// Display name of the account group.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// Free-form description of the account group.
	Description *string `json:"description"`
	// How sales commission applies to accounts in this group.
	//
	// - `commission_applied`: sales commission is calculated on orders from accounts in this group.
	// - `commission_exempt`: orders from accounts in this group are exempt from commission.
	CommissionPolicy constants.CommissionPolicy `json:"commission_policy" validate:"required"`
	// How freight charges apply to orders from accounts in this group.
	//
	// - `free_freight`: customers within this group will not have to pay for freight.
	// - `billed_freight`: freight will be applied to any order within this account group, unless overridden elsewhere.
	FreightPolicy constants.FreightPolicy `json:"freight_policy" validate:"required"`
	// Calendar days between an order being issued and it being due to ship, inherited by every customer in this group that has neither set its own nor inherited one from a parent account.
	DefaultLeadTimeDays *int32 `json:"default_lead_time_days"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A named grouping of customer accounts, used for pricing rules or to categorize accounts.

A customer carries at most one group of type `type_group` as its customer type, plus any number of groups of type `pricing_group`. Membership of either kind can scope a volume discount to the customer and open up product lines for it to order from.

func (*AccountGroup) SchemaExample

func (*AccountGroup) SchemaExample() any

type AccountGroupProductLineAccess

type AccountGroupProductLineAccess struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_group_product_line_access"`
	// The account group this access record belongs to.
	//
	// There is at most one access record per account group, so this also identifies the record.
	AccountGroup *AccountGroup `json:"account_group" validate:"required"`
	// Product lines accessible to this account group.
	//
	// Only product lines your account owns can be granted; the shared system product lines never appear here.
	ProductLines *List[ProductLine] `json:"product_lines" validate:"required"`
	// When the account group was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When the account group was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The set of product lines that accounts in an account group are allowed to order from.

A customer reaches these product lines when the group is its type group or one of its pricing groups. Group access is additive with the customer's own direct access — a customer can order anything granted by either route.

func (*AccountGroupProductLineAccess) SchemaExample

func (*AccountGroupProductLineAccess) SchemaExample() any

type AccountIntegration

type AccountIntegration struct {
	// Account integration ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_integration"`
	// Display name of the integration.
	Name string `json:"name" validate:"required"`
	// Integration provider code.
	//
	// - `stripe`: Stripe payment processing.
	// - `shippo`: Shippo shipping and label generation.
	// - `hubspot`: HubSpot CRM.
	IntegrationCode constants.IntegrationCode `json:"provider" validate:"required"`
	// Lifecycle status of the integration.
	//
	// Integrations are created `active`. Setting an integration to `inactive` keeps its stored credentials but stops it from being used (for example, the Stripe publishable key cannot be retrieved while the Stripe integration is inactive).
	Status constants.AccountIntegrationStatus `json:"status" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Third-party integration connected to an account.

An account can have at most one integration per provider. The credentials supplied when the integration was connected are encrypted at rest and are never returned by the API.

func (*AccountIntegration) SchemaExample

func (*AccountIntegration) SchemaExample() any

type AccountLogoURL

type AccountLogoURL struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_logo_url"`
	// Presigned URL for downloading the account's logo.
	//
	// The URL expires one hour after it is generated, so fetch the logo promptly rather than caching this URL. No URL is returned when the account has never uploaded a logo or the stored image is no longer available.
	URL *string `json:"url"`
}

Presigned URL for an account's logo.

func (*AccountLogoURL) SchemaExample

func (*AccountLogoURL) SchemaExample() any

type AccountPhotoUploadResult

type AccountPhotoUploadResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_photo_upload_result"`
	// Whether the upload was successful.
	Success bool `json:"success"`
}

Result of an account logo upload.

func (*AccountPhotoUploadResult) SchemaExample

func (*AccountPhotoUploadResult) SchemaExample() any

type AccountPortal

type AccountPortal struct {
	// Portal ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_portal"`
	// URL slug that identifies the account's customer portal.
	//
	// Unique across all accounts.
	Slug string `json:"slug" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The customer portal an account publishes for its customers to sign in to.

func (*AccountPortal) SchemaExample

func (*AccountPortal) SchemaExample() any

type AccountPrice

type AccountPrice struct {
	// Account price ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_price"`
	// The customer this price is offered to.
	//
	// A price recorded against a parent customer account also applies to orders placed by its child accounts.
	RecipientAccount *Customer `json:"recipient_account" expandable:"true"`
	// The product line whose products this price applies to.
	//
	// A product that is not assigned to a product line never matches an account price.
	ProductLine *ProductLine `json:"product_line" expandable:"true"`
	// The price, expressed as a rate.
	//
	// The rate's numerator unit is typically a currency and its denominator unit is the quantity unit being priced (e.g. `$25.50 / kg`). A matching order line takes both its unit price and its price units from this rate, exactly as entered.
	Rate *Rate `json:"rate" validate:"required"`
	// Item categories recorded on this price.
	//
	// Order pricing matches an account price on its product line and attributes only, so categories recorded here do not narrow which products the price applies to.
	Categories *List[ItemCategory] `json:"categories" validate:"required" expandable:"true"`
	// Attributes this price is constrained to.
	//
	// When set, the price applies only to items that have every listed attribute; when empty, attributes are not considered.
	Attributes *List[Attribute] `json:"attributes" validate:"required" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A customer-specific price for a product line.

When a sales order line matches an account price, that price replaces the unit price the line would otherwise be given — including the effect of any volume discount — rather than discounting it. If more than one account price matches a line, the most recently created one wins.

func (*AccountPrice) SchemaExample

func (*AccountPrice) SchemaExample() any

type AccountStatus

type AccountStatus struct {
	// Account status ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_status"`
	// Machine-readable status code.
	//
	// - `normal`: standard account with no restrictions.
	// - `preferred`: account flagged for prioritized handling.
	// - `hold_shipment`: the account's shipments should be held, typically over a credit problem, while orders can still be placed.
	// - `hold_all`: all activity for the account should be held.
	//
	// The hold statuses are advisory: they are surfaced as credit-hold warnings on the customer's orders, but they do not by themselves cause order or shipment requests to be rejected.
	Code constants.AccountStatusCode `json:"code" validate:"required"`
	// Human-readable label for the status.
	Name string `json:"name" validate:"required"`
	// Owner of this resource.
	//
	// Account statuses are platform-provided and shared across all accounts, so the owner is always the OpenMRP system owner.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A lookup value describing the standing of a customer account, such as whether shipments or all activity should be held.

The set of statuses is fixed by OpenMRP and cannot be added to or edited; you apply one to a customer by setting the customer's `status`.

func (*AccountStatus) SchemaExample

func (*AccountStatus) SchemaExample() any

type AccountUsageResponse

type AccountUsageResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_usage_response"`
	// Seat usage: users on the account counted against the plan's seat limit.
	Seats UsageItem `json:"seats" validate:"required"`
	// Invoice usage, counted within the current billing period.
	Invoices UsageItem `json:"invoices" validate:"required"`
	// Batch usage, counted within the current billing period.
	Batches UsageItem `json:"batches" validate:"required"`
	// Sandbox usage: sandbox environments on the account counted against the plan's sandbox limit.
	Sandboxes UsageItem `json:"sandboxes" validate:"required"`
	// Status of the account's billing subscription.
	Subscription *SubscriptionInfo `json:"subscription"`
	// Estimated agent LLM spending for the current billing month, and the cap it is measured against.
	AgentSpend *AgentSpendInfo `json:"agent_spend"`
	// Display name of the plan the account is actually billed on, resolved live from Stripe (e.g. `Founder`).
	//
	// Empty when the account has no Stripe pricing plan.
	PlanName string `json:"plan_name"`
	// Flat base fee in cents charged each `base_fee_interval`, resolved live from Stripe.
	//
	// `0` when the plan is priced per seat rather than a flat base fee.
	BaseFeeCents int64 `json:"base_fee_cents"`
	// Interval the base fee recurs on (e.g. `month`).
	//
	// Empty when there is no base fee.
	BaseFeeInterval string `json:"base_fee_interval"`
}

Account usage metrics across all resource types.

Per-period counts are measured from the start of the account's current billing period, which falls back to the start of the calendar month when the account has no active subscription.

func (*AccountUsageResponse) SchemaExample

func (*AccountUsageResponse) SchemaExample() any

type AccountUser

type AccountUser struct {
	// Account user ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_user"`
	// The current state of this user's membership in the account.
	//
	// - `active`: the user can sign in to the account and occupies one of the plan's seats.
	// - `disabled`: the user is locked out of the account and their sessions have been revoked, but the membership is retained.
	// - `removed`: the membership has been soft-deleted; it is hidden from listings by default and can be restored with the activate action.
	Status constants.AccountUserStatus `json:"status" validate:"required"`
	// The role that determines what this user is permitted to do in the account.
	Role *Role `json:"role" expandable:"true"`
	// The department this user belongs to within the account.
	Department *Department `json:"department" expandable:"true"`
	// The underlying user profile, shared across every account this person belongs to.
	User *User `json:"user" expandable:"true"`
	// Whether this user can be assigned as a sales representative on orders, territories, and targets.
	//
	// Independent of the `sales_rep` role type, which still scopes analytics and hides cost. Users with the `sales_rep` role are always eligible.
	IsCommissionEligible bool `json:"is_commission_eligible" validate:"required"`
	// When the user last accessed this account.
	LastUsedAt *time.Time `json:"last_used_at"`
	// When the account user was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When the account user was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A user's membership in an account, carrying the account-specific status, role, and department.

Profile fields (name, email, username, image URL) live on the `user` sub-resource, which is shared across every account the user belongs to.

func (*AccountUser) SchemaExample

func (*AccountUser) SchemaExample() any

type Actor

type Actor struct {
	// Unique identifier of the actor.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=actor"`
	// Actor type.
	//
	// - `user`: a human user account.
	// - `api_key`: a programmatic caller authenticating with an API key.
	// - `agent`: an automated agent acting on the account's behalf.
	// - `group`: a shared group identity, such as a "Customer Service" persona, rather than a single individual.
	Type constants.ActorType `json:"type" validate:"required"`
	// The actor's display name.
	Name *string `json:"name"`
	// Human-readable handle identifying the actor.
	//
	// - For `user` actors: the user's email address.
	// - For `api_key` actors: the redacted key value.
	//
	// Other actor types carry no handle.
	Handle *string `json:"handle"`
	// URL of the actor's profile photo, if one is set.
	//
	// Only populated for `user` actors.
	AvatarURL *string `json:"avatar_url"`
	// The role the actor holds in the account, which determines what it is permitted to do.
	Role *Role `json:"role" expandable:"true"`
}

Reference to an actor — the user, API key, agent, or group identity associated with an action.

func NewActor

func NewActor(id string, actorType constants.ActorType, name, handle *string) *Actor

NewActor constructs an Actor reference with the canonical "actor" object type and the supplied actor subtype (user, api_key, agent).

func (*Actor) SchemaExample

func (*Actor) SchemaExample() any

type Address

type Address struct {
	// Address ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=address"`
	// Display name of the address.
	Name string `json:"name" validate:"required"`
	// Phone number associated with the address.
	Phone *string `json:"phone"`
	// Email address associated with the address.
	Email *string `json:"email"`
	// How the address is used.
	//
	// - `standard`: a normal shipping or billing address.
	// - `drop_ship`: an address an order is shipped to directly, typically a third party or end customer rather than the account itself.
	Type constants.AddressType `json:"type" validate:"required"`
	// The operating calendar naming the days this dock accepts freight.
	//
	// The most specific link in the receiving chain: set it when one of a customer's sites keeps different days from the rest. Null falls through to the customer, then their group, then the account default.
	ReceiveCalendarID *string `json:"receive_calendar_id"`
	// Street-level location details for the address.
	Geolocation *Geolocation `json:"geolocation" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A saved address that can be used for billing and shipping on sales orders, invoices, and shipments.

func (*Address) SchemaExample

func (*Address) SchemaExample() any

type AddressComponents

type AddressComponents struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=address_components"`
	// First line of the street address.
	AddressLine1 string `json:"address_line_1" validate:"required"`
	// Second line of the street address.
	AddressLine2 *string `json:"address_line_2"`
	// City or locality.
	City string `json:"city" validate:"required"`
	// State or administrative area.
	State string `json:"state" validate:"required"`
	// Postal or ZIP code.
	PostalCode string `json:"postal_code" validate:"required"`
	// Country name or code.
	Country string `json:"country" validate:"required"`
	// Two-letter country code.
	CountryCode string `json:"country_code" validate:"required"`
}

Parsed address components.

type AddressDetailsResult

type AddressDetailsResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=address_details_result"`
	// Parsed address components.
	Address *AddressComponents `json:"address" validate:"required"`
	// Full address formatted as a single line.
	FormattedAddress string `json:"formatted_address" validate:"required"`
}

The full address behind an autocomplete suggestion.

func (*AddressDetailsResult) SchemaExample

func (*AddressDetailsResult) SchemaExample() any

type AddressSuggestion

type AddressSuggestion struct {
	// Identifier of the suggested place.
	//
	// Pass this value as the `id` path parameter of the address details endpoint to retrieve the full parsed address. It is issued by the underlying address provider rather than by OpenMRP, so it is not a durable OpenMRP resource ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=address_suggestion"`
	// Full description of the address.
	Description string `json:"description" validate:"required"`
	// Main text (typically the street address).
	MainText string `json:"main_text" validate:"required"`
	// Secondary text (typically city, state, country).
	SecondaryText string `json:"secondary_text" validate:"required"`
}

A candidate address returned by address autocomplete.

A suggestion is a lookup result from the address provider, not a saved address in your account. Creating an address from one is a separate step.

func (*AddressSuggestion) SchemaExample

func (*AddressSuggestion) SchemaExample() any

type AdjustmentType

type AdjustmentType struct {
	// Adjustment type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=adjustment_type"`
	// Human-readable name of the adjustment type (e.g. "Discount").
	Name string `json:"name" validate:"required"`
	// Machine-readable code identifying what kind of adjustment this is.
	//
	// - `discount`: a price reduction.
	// - `shipping_discrepancy`: corrects a difference between quoted and actual freight.
	// - `short_payment`: reconciles an invoice paid for less than the amount due.
	// - `write_off`: cancels an uncollectible balance.
	// - `fee`: an additional charge.
	// - `refund`: returns money to the customer.
	Code constants.AdjustmentType `json:"code" validate:"required"`
	// Owner of this resource.
	//
	// Adjustment types are platform-provided and shared across all accounts, so the owner is always the OpenMRP system owner.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A category of financial adjustment, such as a discount, fee, or write-off.

Adjustment types classify the `adjustment` transactions recorded against a customer.

func (*AdjustmentType) SchemaExample

func (*AdjustmentType) SchemaExample() any

type AgentAction

type AgentAction struct {
	// Agent action ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_action"`
	// The tool the agent invoked for this action.
	//
	// - `create_artifact`: create an artifact such as a report, document, or data export.
	// - `read_doc`: read OpenMRP documentation pages.
	// - `fetch_url`: fetch content from a public URL.
	// - `draft_reply`: propose a reply to the case's external party as a draft held for human approval (not sent).
	// - `send_email`: send an email reply through the conversation's bound inbox.
	Tool constants.Tool `json:"tool" validate:"required"`
	// Current action status.
	//
	// - `pending_review`: awaiting human review before it can execute.
	// - `auto_approved`: automatically approved by policy.
	// - `approved`: manually approved by a user.
	// - `rejected`: rejected by a user; will not execute.
	// - `executed`: successfully executed.
	// - `failed`: errored during execution; see `error_message`.
	Status constants.AgentActionStatus `json:"status" validate:"required"`
	// Short human-readable label summarizing the action.
	Label *string `json:"label"`
	// Longer description of what the action does.
	Description *string `json:"description"`
	// Agent run this action belongs to.
	Run *AgentRun `json:"run" validate:"required" expandable:"true"`
	// Arguments passed to the tool, as JSON.
	//
	// Shape depends on `tool`.
	Input json.RawMessage `json:"input"`
	// Result returned by the tool, as JSON.
	//
	// The shape depends on `tool`. An action that has not executed — because it is still waiting on a review decision, or was rejected — carries `{}`.
	Output json.RawMessage `json:"output"`
	// Error message if the action failed.
	ErrorMessage *string `json:"error_message"`
	// The resource this action operated on, when the tool targets a specific entity such as a customer or product.
	Entity *Entity `json:"entity"`
	// Whether a person must approve this action before it takes effect.
	//
	// Fixed when the action is recorded, from the agent's review setting for that tool; tools that take an externally visible action, such as `send_email`, always require review and cannot be exempted. When review is required the action starts in `pending_review` and stays there until someone approves or rejects it; otherwise it is `auto_approved`.
	ReviewRequirement constants.ReviewRequirement `json:"review_requirement" validate:"required"`
	// When a human review decision was recorded for the action.
	ReviewedAt *time.Time `json:"reviewed_at"`
	// Who reviewed the action.
	ReviewedBy *Actor `json:"reviewed_by"`
	// When the action was executed.
	ExecutedAt *time.Time `json:"executed_at"`
	// When this action was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this action was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single tool invocation performed by an agent during a run.

Each action records the tool that was called, its input and output, and any human review decision.

func (*AgentAction) SchemaExample

func (*AgentAction) SchemaExample() any

type AgentDefinition

type AgentDefinition struct {
	// Agent definition ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_definition"`
	// Whether the agent is provided by OpenMRP or created in this account.
	//
	// - `system`: provided by OpenMRP; cannot be edited or deleted.
	// - `custom`: created by a user in this account.
	DefinitionType constants.AgentDefinitionType `json:"definition_type" validate:"required"`
	// Category grouping for the agent (e.g. `order_processing`), used to organize agents in the UI.
	CategoryCode string `json:"category_code" validate:"required"`
	// How runs of this agent are initiated.
	//
	// - `scheduled`: runs on a cron schedule (see `config.trigger_config.cron_schedule`).
	// - `event`: runs in response to platform events (see `config.trigger_config.event_filters`).
	// - `manual`: runs only when explicitly invoked.
	// - `chat`: runs in response to a chat message; the run is linked to a conversation and posts its reply back into it.
	TriggerType constants.AgentTriggerType `json:"trigger_type" validate:"required"`
	// Human-readable name of the agent.
	Name string `json:"name" validate:"required"`
	// URL-friendly identifier for the agent.
	//
	// Unique within the account.
	Slug string `json:"slug" validate:"required"`
	// Description of what the agent does.
	Description *string `json:"description"`
	// Whether this agent definition can be edited.
	//
	// Always `read_only` for `system` definitions.
	Editability constants.Editability `json:"editability" validate:"required"`
	// Whether this agent is enabled for the current account.
	//
	// Activation is per-account: a `system` agent shared across accounts can be `active` for one account and `inactive` for another. An `inactive` agent cannot be triggered.
	AccountStatus constants.AgentAccountStatus `json:"status" validate:"required"`
	// Role defining the permissions the agent operates with.
	//
	// The agent acts as its own actor, and everything it does is authorized against this role — it can never reach data or actions the role does not grant. An agent with no role cannot execute: its runs fail immediately.
	Role *Role `json:"role" expandable:"true"`
	// Agent-level configuration controlling LLM behavior and trigger settings.
	Config *AgentDefinitionConfig `json:"config" expandable:"true"`
	// Tools attached to this agent.
	Tools *List[AgentDefinitionTool] `json:"tools" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An AI agent available to the account.

The definition describes what the agent does, how its runs are triggered, the tools it can use, and whether it is currently enabled for the account.

func (*AgentDefinition) SchemaExample

func (*AgentDefinition) SchemaExample() any

type AgentDefinitionConfig

type AgentDefinitionConfig struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_definition_config"`
	// Standing instructions that define the agent's role and how it should behave on every run.
	SystemPrompt *string `json:"system_prompt"`
	// Intelligence and cost tier for the agent's reasoning.
	//
	// Selects how capable and expensive a model the agent uses without pinning a specific model; higher tiers reason better but cost more. Each tier resolves to an ordered chain of equivalent models, so a run automatically fails over to another provider's model if the preferred one is unavailable.
	//
	// - `frontier`: the most capable tier, for multi-step planning, ambiguous agent work, and hard coding or architecture tasks.
	// - `high`: for normal planning, code edits, synthesis, and customer-facing reasoning.
	// - `balanced`: for research, summarization, classification, structured extraction, and light tool use.
	// - `cheap`: for simple transforms, validation, formatting, and routing.
	// - `legacy`: older-generation models kept for compatibility and regression comparison; avoid unless you specifically need them.
	//
	// Leaving the tier unset picks one from how the agent is triggered: chat and manual runs use `high`, while scheduled and event-driven runs use `balanced` so background work stays cheap.
	Tier *constants.ModelTier `json:"tier"`
	// LLM sampling temperature between 0 and 1.
	//
	// Lower values make the agent's output more repeatable and literal; higher values make it more varied.
	Temperature *float64 `json:"temperature"`
	// Trigger-specific configuration.
	//
	// Shape depends on the agent's `trigger_type`.
	TriggerConfig *TriggerConfig `json:"trigger_config"`
	// API-endpoint tools the agent may discover and use, by slug (e.g. `create_account_group`).
	//
	// These correspond to tools listed by the List Tools endpoint with category `api_endpoint`. A single entry `*` grants the entire endpoint-tool catalog.
	EndpointToolSlugs []string `json:"endpoint_tool_slugs"`
	// Per-endpoint-tool human-review overrides, keyed by tool slug.
	//
	// When an entry is `true`, the run pauses in `awaiting_approval` each time the agent calls that endpoint-tool until it is approved via the Continue Agent Run endpoint. Slugs absent from the map do not require review.
	EndpointToolReview map[string]bool `json:"endpoint_tool_review"`
}

Agent-level configuration controlling LLM behavior and trigger settings.

Distinct from per-tool configuration (`tools[].config`), which configures individual tools attached to the agent.

func (*AgentDefinitionConfig) SchemaExample

func (*AgentDefinitionConfig) SchemaExample() any

type AgentDefinitionTool

type AgentDefinitionTool struct {
	// Agent definition tool ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_definition_tool"`
	// Attached tool.
	Tool AvailableTool `json:"tool" validate:"required"`
	// Whether calls to this tool must be approved by a user before they execute.
	//
	// When `required`, the run pauses in the `awaiting_approval` status each time the agent invokes this tool; approve or allow the tool via the Continue Agent Run endpoint to proceed. A tool whose `mutating` flag is true still pauses for approval even when this is `not_required`.
	ReviewRequirement constants.ReviewRequirement `json:"review_requirement" validate:"required"`
	// Instance-specific configuration for this tool.
	//
	// Must conform to the tool's `config_schema`.
	Config json.RawMessage `json:"config"`
	// Sort order within the agent.
	SortOrder int32 `json:"sort_order"`
}

Tool attached to an agent definition.

Pairs an AvailableTool with agent-specific config values.

func (*AgentDefinitionTool) SchemaExample

func (*AgentDefinitionTool) SchemaExample() any

type AgentMemory

type AgentMemory struct {
	// Memory ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_memory"`
	// The kind of information this memory holds, used to group related memories.
	//
	// - `preference`: how someone likes things done, such as a customer who always wants express shipping.
	// - `fact`: a durable detail worth remembering about the account or one of its records, such as a customer's typical order size.
	// - `instruction`: standing guidance for agents to follow, such as always confirming freight before issuing an order.
	Category constants.AgentMemoryCategory `json:"category" validate:"required"`
	// The information itself, written as plain text for an agent to read.
	Content string `json:"content" validate:"required"`
	// Arbitrary metadata as JSON.
	Metadata json.RawMessage `json:"metadata"`
	// The platform record this memory is about (e.g. a specific customer or product).
	Entity *Entity `json:"entity"`
	// Relative importance from `0` to `1`, used to prioritize which memories the agent recalls.
	//
	// An agent takes in only a limited number of memories per run, and the highest-importance ones are recalled first.
	Importance float64 `json:"importance"`
	// When this memory stops being used.
	//
	// Past this time the memory is no longer recalled by agents and is omitted from list results, but it is not deleted and can still be retrieved by ID. A memory with no expiration is used indefinitely.
	ExpiresAt *time.Time `json:"expires_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A piece of information an agent has saved for recall in future runs.

func (*AgentMemory) SchemaExample

func (*AgentMemory) SchemaExample() any

type AgentRun

type AgentRun struct {
	// Agent run ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_run"`
	// How this run was initiated.
	//
	// - `scheduled`: started by the agent's cron schedule.
	// - `event`: started in response to a platform event.
	// - `manual`: started by an explicit request; see `triggered_by`.
	// - `chat`: started by a message in a conversation, with the agent's reply posted back into that conversation.
	TriggerType constants.AgentTriggerType `json:"trigger_type" validate:"required"`
	// Current run status.
	//
	// - `pending`: queued but not yet started.
	// - `running`: currently executing.
	// - `awaiting_input`: paused, waiting for user input before continuing.
	// - `awaiting_approval`: paused, waiting for a pending action to be approved.
	// - `completed`: finished successfully.
	// - `failed`: stopped after an error; see `error_message`.
	// - `cancelled`: stopped before completion by a user.
	Status constants.AgentRunStatus `json:"status" validate:"required"`
	// The agent definition this run executes.
	Definition *AgentDefinition `json:"definition" expandable:"true"`
	// Input provided to the agent at the start of the run.
	//
	// The shape depends on what started the run; a manually triggered run records `{"message": "<your input>"}`.
	Input json.RawMessage `json:"input"`
	// Final output produced by the agent.
	//
	// Present once the agent has produced a result, including on a run that paused for more input or was cancelled part-way through. A run that has not produced one yet carries an empty object.
	Output json.RawMessage `json:"output"`
	// Error message if the run failed.
	ErrorMessage *string `json:"error_message"`
	// Actor that triggered this run.
	//
	// Set only for runs started through the Trigger Agent Run endpoint; runs started by a schedule, a platform event, or a chat message have no triggering actor.
	TriggeredBy *Actor `json:"triggered_by" expandable:"true"`
	// When the run started executing.
	StartedAt *time.Time `json:"started_at"`
	// When the run completed.
	CompletedAt *time.Time `json:"completed_at"`
	// How long the run took, in milliseconds.
	DurationMs *int32 `json:"duration_ms"`
	// Tool invocations the agent made during this run.
	//
	// Includes calls that were held for human review and never executed, so an entry here does not by itself mean the tool ran.
	Actions *List[AgentAction] `json:"actions" expandable:"true"`
	// Step-by-step timeline of what happened during the run.
	//
	// Ordered by `sequence`, oldest first.
	Steps *List[AgentRunStep] `json:"steps" expandable:"true"`
	// When this run was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this run was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single execution of an agent, from trigger through completion.

func (*AgentRun) SchemaExample

func (*AgentRun) SchemaExample() any

type AgentRunStep

type AgentRunStep struct {
	// Agent run step ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_run_step"`
	// The kind of timeline event.
	//
	// Common values are `trigger_received`, `user_message`, `thinking`, `assistant_message`, `tool_call`, `tool_result`, `tool_blocked`, `awaiting_approval`, `completion`, and `error`. This is an open set — new step types are added as the agent runtime evolves, so treat unrecognized values as informational rather than failing on them.
	StepType string `json:"step_type" validate:"required"`
	// Short title for the step.
	Title string `json:"title" validate:"required"`
	// Text payload for the step, such as a message body or a tool result.
	Content *string `json:"content"`
	// Zero-based position of this step within the run's timeline.
	Sequence int32 `json:"sequence"`
	// Actor who produced this step.
	Actor *Actor `json:"actor"`
	// How long this step took, in milliseconds.
	DurationMs *int32 `json:"duration_ms"`
	// Additional structured data for the step.
	//
	// The shape depends on `step_type` — for example a `tool_call` step carries the tool's arguments.
	Metadata json.RawMessage `json:"metadata"`
	// When this step was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A single event in an agent run's execution timeline.

func (*AgentRunStep) SchemaExample

func (*AgentRunStep) SchemaExample() any

type AgentSpendInfo

type AgentSpendInfo struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=agent_spend_info"`
	// Estimated spend in cents for the current billing month.
	//
	// Priced at the same token rates the account is billed at, and cached briefly, so it can trail live usage by a short interval.
	EstimatedSpendCents int64 `json:"estimated_spend_cents"`
	// Ceiling in cents on estimated agent spending per billing month.
	//
	// Null means agent spending is uncapped.
	CapCents *int64 `json:"cap_cents"`
}

Estimated agent LLM spending for the current billing month.

type AllocationCustomer

type AllocationCustomer struct {
	// Customer account ID.
	ID *string `json:"id"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=allocation_customer"`
	// Customer display name.
	Name string `json:"name" validate:"required"`
	// The customer number for this customer, matching the `number` on your customer record for it.
	Number *string `json:"number"`
}

Minimal customer reference carried by allocation entries and open-credit entries.

Open-credit entries identify the customer by `id`; allocation entries carry only the customer's name and number.

type AllocationEntry

type AllocationEntry struct {
	// Allocation ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=allocation_entry"`
	// The part of the transaction's amount applied to this invoice, as a decimal string in US dollars.
	Amount string `json:"amount" validate:"required"`
	// Human-readable formatted amount (e.g. "$500.00").
	DisplayAmount string `json:"display_amount" validate:"required"`
	// The customer whose transaction was applied.
	Customer *AllocationCustomer `json:"customer" validate:"required"`
	// The transaction the money came from.
	Transaction *AllocationTransaction `json:"transaction" validate:"required"`
	// The invoice the money was applied to.
	Invoice *AllocationInvoice `json:"invoice" validate:"required"`
	// Free-form note carried by the underlying transaction, not a note specific to this allocation.
	Note *string `json:"note"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

An application of part of a transaction's amount against a specific invoice, as returned in list views.

func (*AllocationEntry) SchemaExample

func (*AllocationEntry) SchemaExample() any

type AllocationInvoice

type AllocationInvoice struct {
	// Invoice ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice_summary"`
	// Invoice number.
	Number string `json:"number" validate:"required"`
}

Minimal invoice sub-resource for allocation entries.

type AllocationTransaction

type AllocationTransaction struct {
	// Transaction ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=transaction"`
	// Type code of the transaction the money came from.
	Type constants.TransactionType `json:"type" validate:"required"`
	// Payment method code.
	//
	// Typically set only when `type` is `payment`.
	Method *constants.TransactionMethod `json:"method"`
	// Adjustment category code (e.g. `discount`, `write_off`).
	//
	// Typically set only when `type` is `adjustment`.
	AdjustmentType *string `json:"adjustment_type"`
}

Minimal transaction sub-resource for allocation entries.

type AnalyticsItem

type AnalyticsItem struct {
	// The item ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item"`
	// The item SKU.
	Sku string `json:"sku" validate:"required"`
	// The item description.
	Description *string `json:"description"`
}

AnalyticsItem represents a lightweight item reference.

type AnalyticsLot

type AnalyticsLot struct {
	// The lot ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=lot"`
	// The lot number.
	Number string `json:"number" validate:"required"`
}

AnalyticsLot represents a lot for analytics.

type AnalyticsRate

type AnalyticsRate struct {
	// The numerator quantity.
	Numerator *Quantity `json:"numerator" validate:"required"`
	// The denominator quantity.
	Denominator *Quantity `json:"denominator" validate:"required"`
}

AnalyticsRate represents a rate with numerator and denominator quantities.

type AnalyticsUnitGroup

type AnalyticsUnitGroup struct {
	// The unit group ID.
	ID string `json:"id" validate:"required"`
	// The unit group name.
	Name string `json:"name" validate:"required"`
	// The units in the group.
	Units []AnalyticsUnitGroupUnit `json:"units" validate:"required"`
}

AnalyticsUnitGroup represents a unit group for analytics.

type AnalyticsUnitGroupUnit

type AnalyticsUnitGroupUnit struct {
	// The unit ID.
	ID string `json:"id" validate:"required"`
	// The unit name.
	Name string `json:"name" validate:"required"`
	// The unit abbreviation.
	Abbreviation string `json:"abbreviation" validate:"required"`
	// The conversion factor.
	ConversionFactor float64 `json:"conversion_factor" validate:"required"`
	// Whether this is the base unit.
	IsBaseUnit bool `json:"is_base_unit" validate:"required"`
}

AnalyticsUnitGroupUnit represents a unit within a unit group.

type AnalyzeCustomerPricingResponse

type AnalyzeCustomerPricingResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_customer_pricing_response"`
	// The flagged prices, worst first.
	Findings *List[CustomerPricingFinding] `json:"findings" validate:"required"`
	// What the analysis covered.
	Summary CustomerPricingSummary `json:"summary" validate:"required"`
}

AnalyzeCustomerPricingResponse represents the response from the customer pricing analysis.

func (*AnalyzeCustomerPricingResponse) SchemaExample

func (*AnalyzeCustomerPricingResponse) SchemaExample() any

type AnalyzeDeliveriesResponse

type AnalyzeDeliveriesResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_deliveries_response"`
	// The delivery statistics.
	Statistics DeliveryStatistics `json:"statistics" validate:"required"`
	// The chart data for delivery analytics.
	ChartData DeliveryChartData `json:"chart_data" validate:"required"`
}

AnalyzeDeliveriesResponse represents the response from the analyze deliveries endpoint.

func (*AnalyzeDeliveriesResponse) SchemaExample

func (*AnalyzeDeliveriesResponse) SchemaExample() any

type AnalyzeDeliveryPerformanceResponse

type AnalyzeDeliveryPerformanceResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_delivery_performance_response"`
	// The whole window as one figure.
	Overall *DeliveryPerformance `json:"overall" validate:"required"`
	// The same figures broken into periods, by the date each order was due.
	Periods *List[DeliveryPerformance] `json:"periods" validate:"required"`
	// Orders already past their promise and still unshipped, by how late they are.
	Backlog *List[DeliveryBacklogBucket] `json:"backlog" validate:"required"`
	// Every miss in the window banded by how far it missed by, shipped and unshipped alike.
	//
	// The companion to `average_days_late`, which cannot tell "everything slips a day" from "most orders are fine and four are two months late". Those are opposite problems with opposite fixes, and one mean reports them identically.
	Lateness *List[DeliveryLatenessBucket] `json:"lateness" validate:"required"`
	// The same window by customer, worst first.
	ByCustomer *List[DeliveryBreakdown] `json:"by_customer" validate:"required"`
	// The same window by customer group, worst first.
	ByCustomerGroup *List[DeliveryBreakdown] `json:"by_customer_group" validate:"required"`
	// The same window by product line, worst first. An order spanning two lines is counted under both — a late order is late for every line on it — so these counts sum to more than the overall total.
	ByProductLine *List[DeliveryBreakdown] `json:"by_product_line" validate:"required"`
	// The same window by which rule produced each ship-by date: an explicitly promised date, the customer's lead time, their parent's, their group's, or the account default.
	//
	// This is what says how much of the score rests on a default nobody deliberately set. A plant whose on-time rate is carried by `account`-sourced commitments is measuring itself against a number it invented.
	ByCommitmentSource *List[DeliveryBreakdown] `json:"by_commitment_source" validate:"required"`
	// Issued orders in the window carrying no ship-by date, excluded from every rate above.
	//
	// Reported so the exclusion is visible: a delivery score computed over half the order book, silently, is worse than one that says which half. A non-zero count here means orders placed before commitments were tracked still need a ship-by date.
	UncommittedOrderCount int32 `json:"uncommitted_order_count"`
}

How reliably promised delivery dates were met.

func (*AnalyzeDeliveryPerformanceResponse) SchemaExample

func (*AnalyzeDeliveryPerformanceResponse) SchemaExample() any

type AnalyzeDemandForecastResponse

type AnalyzeDemandForecastResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_demand_forecast_response"`
	// The demand forecast rows.
	Data *List[DemandForecastRow] `json:"data" validate:"required"`
	// The fraction of the current month elapsed.
	CurrentMonthFraction float64 `json:"current_month_fraction" validate:"required"`
}

AnalyzeDemandForecastResponse represents the response from the demand forecast endpoint.

func (*AnalyzeDemandForecastResponse) SchemaExample

func (*AnalyzeDemandForecastResponse) SchemaExample() any

type AnalyzeInventoryReceiptsResponse

type AnalyzeInventoryReceiptsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The inventory receipt summary data.
	Data []InventoryReceiptSummaryEntry `json:"data" validate:"required"`
}

AnalyzeInventoryReceiptsResponse represents the response from the analyze inventory receipts endpoint.

func (*AnalyzeInventoryReceiptsResponse) SchemaExample

func (*AnalyzeInventoryReceiptsResponse) SchemaExample() any

type AnalyzeManufacturingBatchResponse

type AnalyzeManufacturingBatchResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_manufacturing_batch_response"`
	// The current period metrics.
	Current ManufacturingMetrics `json:"current" validate:"required"`
	// The comparison period metrics.
	Comparison ManufacturingMetrics `json:"comparison" validate:"required"`
}

AnalyzeManufacturingBatchResponse represents the response from the analyze manufacturing batch endpoint.

func (*AnalyzeManufacturingBatchResponse) SchemaExample

func (*AnalyzeManufacturingBatchResponse) SchemaExample() any

type AnalyzeManufacturingResponse

type AnalyzeManufacturingResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_manufacturing_response"`
	// The computed manufacturing value.
	Value float64 `json:"value" validate:"required"`
}

AnalyzeManufacturingResponse represents the response from the analyze manufacturing endpoint.

func (*AnalyzeManufacturingResponse) SchemaExample

func (*AnalyzeManufacturingResponse) SchemaExample() any

type AnalyzeMaterialsResponse

type AnalyzeMaterialsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The material analytics data.
	Data []MaterialAnalyticsEntry `json:"data" validate:"required"`
}

AnalyzeMaterialsResponse represents the response from the analyze materials endpoint.

func (*AnalyzeMaterialsResponse) SchemaExample

func (*AnalyzeMaterialsResponse) SchemaExample() any

type AnalyzeNewCustomersResponse

type AnalyzeNewCustomersResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_new_customers_response"`
	// The new customers data.
	NewCustomers NewCustomersData `json:"new_customers" validate:"required"`
}

AnalyzeNewCustomersResponse represents the response from the analyze new customers endpoint.

func (*AnalyzeNewCustomersResponse) SchemaExample

func (*AnalyzeNewCustomersResponse) SchemaExample() any

type AnalyzeOeeResponse

type AnalyzeOeeResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_oee_response"`
	// The OEE data by department.
	Departments *List[OeeDepartment] `json:"departments" validate:"required"`
}

AnalyzeOeeResponse represents the response from the analyze OEE endpoint.

func (*AnalyzeOeeResponse) SchemaExample

func (*AnalyzeOeeResponse) SchemaExample() any

type AnalyzeOeeTrendResponse

type AnalyzeOeeTrendResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_oee_trend_response"`
	// One entry per production week in the requested window, oldest first.
	Periods *List[OeeTrendPeriod] `json:"periods" validate:"required"`
}

AnalyzeOeeTrendResponse represents the response from the OEE trend endpoint.

func (*AnalyzeOeeTrendResponse) SchemaExample

func (*AnalyzeOeeTrendResponse) SchemaExample() any

type AnalyzeOpenBatchesResponse

type AnalyzeOpenBatchesResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The open batch summary data.
	Data []OpenBatchSummary `json:"data" validate:"required"`
}

AnalyzeOpenBatchesResponse represents the response from the analyze open batches endpoint. Uses the existing OpenBatchSummary type from batch_resource.go.

func (*AnalyzeOpenBatchesResponse) SchemaExample

func (*AnalyzeOpenBatchesResponse) SchemaExample() any

type AnalyzeOrdersResponse

type AnalyzeOrdersResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The order entry data.
	Data []OrderEntry `json:"data" validate:"required"`
}

AnalyzeOrdersResponse represents the response from the analyze orders endpoint.

func (*AnalyzeOrdersResponse) SchemaExample

func (*AnalyzeOrdersResponse) SchemaExample() any

type AnalyzeProductionCostsResponse

type AnalyzeProductionCostsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The production cost data.
	Data []ProductionCostItem `json:"data" validate:"required"`
}

AnalyzeProductionCostsResponse represents the response from the analyze production costs endpoint.

func (*AnalyzeProductionCostsResponse) SchemaExample

func (*AnalyzeProductionCostsResponse) SchemaExample() any

type AnalyzeQuarterlyOrdersResponse

type AnalyzeQuarterlyOrdersResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_quarterly_orders_response"`
	// The yearly sales data keyed by year string.
	Data map[string]QuarterlySalesData `json:"data" validate:"required"`
}

AnalyzeQuarterlyOrdersResponse represents the response from the analyze quarterly orders endpoint.

func (*AnalyzeQuarterlyOrdersResponse) SchemaExample

func (*AnalyzeQuarterlyOrdersResponse) SchemaExample() any

type AnalyzeRealizedMarginsResponse

type AnalyzeRealizedMarginsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_realized_margins_response"`
	// The flagged relationships, most money at stake first.
	Findings *List[RealizedMarginFinding] `json:"findings" validate:"required"`
	// What the analysis covered.
	Summary RealizedMarginSummary `json:"summary" validate:"required"`
}

AnalyzeRealizedMarginsResponse represents the response from the realized margin analysis.

func (*AnalyzeRealizedMarginsResponse) SchemaExample

func (*AnalyzeRealizedMarginsResponse) SchemaExample() any

type AnalyzeSalesResponse

type AnalyzeSalesResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The sales entry data.
	Data []SalesEntry `json:"data" validate:"required"`
}

AnalyzeSalesResponse represents the response from the analyze sales endpoint.

func (*AnalyzeSalesResponse) SchemaExample

func (*AnalyzeSalesResponse) SchemaExample() any

type AnalyzeScheduleAttainmentResponse

type AnalyzeScheduleAttainmentResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_schedule_attainment_response"`
	// Start of the measured period.
	StartDate time.Time `json:"starts_at" validate:"required"`
	// End of the measured period.
	EndDate time.Time `json:"ends_at" validate:"required"`
	// The dimension the breakdown is grouped by.
	GroupBy constants.AttainmentGroupBy `json:"group_by" validate:"required"`
	// The published versions the measurement was taken against.
	BaselineSchedules *List[Entity] `json:"baseline_schedules"`
	// The breakdown.
	Buckets *List[AttainmentBucket] `json:"buckets"`
	// Every bucket combined.
	Totals AttainmentBucket `json:"totals"`
	// Frozen-week adherence per baseline version.
	FrozenAdherence *List[FrozenAdherence] `json:"frozen_adherence"`
	// Whether the period had a plan to measure against. When `no_baseline`, every ratio is null and the period has no plan rather than a missed one.
	BaselineStatus constants.AttainmentBaselineStatus `json:"baseline_status" validate:"required"`
	// Machines the plan asked for over this window.
	//
	// Every figure in this response covers those machines only. Production scanned onto a machine no published version scheduled is excluded outright, so the score measures the plan that was made rather than the whole plant against it.
	ScheduledMachineCount int64 `json:"scheduled_machine_count"`
}

Actual production measured against the plan that was live at the time.

The baseline for each week is the version that was published on or before that week began, so republishing mid-horizon cannot rewrite a week the floor has already worked. `baseline_schedules` names the versions used, so any number here can be traced back to the plan that produced it.

func (*AnalyzeScheduleAttainmentResponse) SchemaExample

func (*AnalyzeScheduleAttainmentResponse) SchemaExample() any

type AnalyzeWeeksOfSalesResponse

type AnalyzeWeeksOfSalesResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=analyze_weeks_of_sales_response"`
	// The weeks-of-sales items.
	Data []WeeksOfSalesItem `json:"data" validate:"required"`
	// The total count.
	Count int64 `json:"count" validate:"required"`
}

AnalyzeWeeksOfSalesResponse represents the response from the weeks-of-sales analytics endpoint.

func (*AnalyzeWeeksOfSalesResponse) SchemaExample

func (*AnalyzeWeeksOfSalesResponse) SchemaExample() any

type Announcement

type Announcement struct {
	// Announcement ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=announcement"`
	// Who the announcement reaches.
	//
	// - `account`: published to a single account and shown only to that account's users.
	// - `platform`: published by OpenMRP and shown to every user across all accounts.
	Scope constants.AnnouncementScope `json:"scope" validate:"required"`
	// The kind of event the announcement is about.
	//
	// Announcements draw on the same categories as notifications, such as `system.broadcast` or `order.updated`, and the category is chosen by whoever publishes the announcement. The set is open-ended and may grow over time, so clients should tolerate values they do not recognize.
	Category constants.NotificationCategory `json:"category" validate:"required"`
	// Short headline shown in the feed.
	Title string `json:"title" validate:"required"`
	// Supporting detail shown beneath the title.
	Body *string `json:"body"`
	// Where the announcement is in its lifecycle for the calling user.
	//
	// - `unseen`: not yet surfaced to the caller.
	// - `seen`: surfaced in the caller's feed but not opened.
	// - `read`: explicitly opened by the caller.
	// - `dismissed`: removed from the caller's feed.
	//
	// The status is derived from the caller's own seen, read, and dismissed timestamps and only ever moves forward, so the same announcement can show a different status for each user in the account.
	Status constants.NotificationStatus `json:"status" validate:"required"`
	// How prominently the announcement should be surfaced, from `low` through `urgent`.
	Priority constants.NotificationPriority `json:"priority" validate:"required"`
	// The resource the announcement is about, which the client can link to.
	Resource *Entity `json:"resource" expandable:"true"`
	// When the announcement becomes visible in the feed.
	//
	// An announcement scheduled for the future is not returned by the announcement endpoints until this time passes.
	PublishAt time.Time `json:"publish_at" validate:"required"`
	// When the announcement stops being shown.
	//
	// Once it expires the announcement leaves every user's feed and can no longer be retrieved; an announcement with no expiry stays until each user dismisses it.
	ExpiresAt *time.Time `json:"expires_at"`
	// When the calling user first saw the announcement.
	SeenAt *time.Time `json:"seen_at"`
	// When the calling user opened the announcement.
	ReadAt *time.Time `json:"read_at"`
	// When the calling user dismissed the announcement.
	DismissedAt *time.Time `json:"dismissed_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A broadcast announcement shown in the notification (bell) feed, carrying the calling user's own read state.

A single announcement is published to everyone in an account, or to every user on the platform, and each user keeps their own seen, read, and dismissed state for it. The status and timestamps you read are therefore always the caller's, and never reflect what anyone else has done with the same announcement. Notifications addressed to one user are a separate resource.

func (*Announcement) SchemaExample

func (*Announcement) SchemaExample() any

type AttachmentUploadTarget

type AttachmentUploadTarget struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=attachment_upload_target"`
	// A preview of the attachment the file becomes once it is sent with a message.
	Attachment *MessageAttachment `json:"attachment" expandable:"true"`
	// The presigned URL to PUT the file to.
	//
	// Send the file with the same content type used to mint the target, or the upload is rejected.
	UploadURL string `json:"upload_url" validate:"required"`
	// The object-storage key identifying the uploaded file.
	//
	// Pass it back as an attachment's `s3_key` when sending a message. It is bound to the conversation it was minted for and cannot be attached in another one.
	S3Key string `json:"s3_key" validate:"required"`
	// When the upload URL stops working.
	//
	// Targets are short-lived (about fifteen minutes); request a new one if the upload has not finished by then.
	ExpiresAt time.Time `json:"expires_at" validate:"required"`
}

A presigned target for uploading a chat attachment directly to object storage.

PUT the file to `upload_url`, then send a message carrying an attachment whose `s3_key` is the key returned here. An upload that is never sent with a message is discarded automatically, so abandoning a target costs nothing.

func (*AttachmentUploadTarget) SchemaExample

func (*AttachmentUploadTarget) SchemaExample() any

type AttainmentBucket

type AttainmentBucket struct {
	// Identifies the bucket within the chosen grouping — a week start, machine ID, department ID or item ID.
	Key string `json:"key" validate:"required"`
	// Display label for the bucket.
	Label string `json:"label" validate:"required"`
	// First day of the week, when grouping by week.
	WeekStartDate *time.Time `json:"week_starts_at"`
	// Units the live plan called for.
	PlannedQuantity float64 `json:"planned_quantity"`
	// Units actually produced.
	ActualQuantity float64 `json:"actual_quantity"`
	// Units produced that were planned for, capped per campaign at what was asked.
	MatchedQuantity float64 `json:"matched_quantity"`
	// Units scrapped.
	WasteQuantity float64 `json:"waste_quantity"`
	// Units produced with no matching planned campaign.
	UnplannedQuantity float64 `json:"unplanned_quantity"`
	// Machine hours the plan called for.
	PlannedRunHours float64 `json:"planned_run_hours"`
	// Planned campaigns in this bucket.
	PlannedLines int64 `json:"planned_lines"`
	// Batches scanned in this bucket.
	BatchCount int64 `json:"batch_count"`
	// Share of the plan that was met. Null when nothing was planned.
	AttainmentPct *float64 `json:"attainment_pct"`
	// Output as a share of plan, uncapped. Null when nothing was planned.
	OutputRatioPct *float64 `json:"output_ratio_pct"`
}

One row of a schedule-attainment breakdown.

Both ratios are reported because either alone misleads. `attainment_pct` caps each SKU at what was asked for, so over-building one easy item cannot paper over a total miss on another; `output_ratio_pct` does not cap, so it is the only one that reveals over-production.

type Attribute

type Attribute struct {
	// Attribute ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=attribute"`
	// The selectable value this attribute represents, such as `Red` for a `Color` property or `Large` for a `Size` property.
	Value string `json:"value" validate:"required"`
	// Swatch color used to display this attribute in the UI.
	//
	// The named colors are arbitrary display choices; `default` is a neutral fallback used when no specific swatch applies.
	ColorCode constants.Color `json:"color" validate:"required"`
	// Position of this attribute relative to its siblings within the property, starting at `1`.
	//
	// Positions are kept contiguous: creating, reordering, or deleting an attribute automatically shifts its siblings.
	SortOrder int32 `json:"sort_order"`
	// The property this attribute belongs to.
	//
	// Populated only when the attribute is returned under an item's or a volume discount's `attributes` list.
	Property *Property `json:"property"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A selectable value within a property, such as `Red` for a `Color` property.

Attributes are assigned to items to classify them.

func (*Attribute) SchemaExample

func (*Attribute) SchemaExample() any

type AuditEvent

type AuditEvent struct {
	// Audit event ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=audit_event"`
	// The type of action this event records.
	//
	// - `create`: the resource was created.
	// - `update`: one or more fields were changed.
	// - `delete`: the resource was deleted.
	// - `restore`: a previously deleted resource was restored.
	// - `archive`: the resource was archived.
	// - `approve`: a human approved a gated action, such as allowing a review-gated agent tool to run.
	// - `deny`: a human denied a gated action, such as rejecting a review-gated agent tool.
	Action constants.AuditAction `json:"action" validate:"required"`
	// Resource type of the audited entity.
	ResourceType constants.ObjectType `json:"resource_type" validate:"required"`
	// Audited resource ID.
	ResourceID string `json:"resource_id" validate:"required"`
	// Actor who performed the mutation.
	Actor *Actor `json:"actor" expandable:"true"`
	// Account the audited mutation was performed against.
	//
	// For a mutation on one of your own resources this is your account; when you act on a customer's or supplier's account, it is that account.
	Account *Account `json:"account" expandable:"true"`
	// Field-level changes recorded for this event.
	//
	// Only fields OpenMRP tracks for that resource type are compared, and only those whose value actually differs are listed. Actions that do not alter stored fields, such as `approve` and `deny`, generally record no changes.
	Changes *List[AuditFieldChange] `json:"changes" expandable:"true"`
	// Arbitrary JSON metadata for the mutation (e.g. reason, source, tags).
	Metadata json.RawMessage `json:"metadata"`
	// Log of the API request that caused the mutation.
	//
	// Changes that did not originate from an API request have no originating request log.
	Request *RequestLog `json:"request" expandable:"true"`
	// Idempotency key of the originating request.
	IdempotencyKey *string `json:"idempotency_key"`
	// Originating client IP address.
	SourceIP *string `json:"source_ip"`
	// When the audited mutation occurred.
	//
	// Audit events are ordered and date-filtered by this timestamp rather than by `created_at`.
	OccurredAt time.Time `json:"occurred_at" validate:"required"`
	// When the audit event record was written.
	//
	// Slightly later than `occurred_at`, since events are recorded out of band from the request that caused them.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

An immutable record of a single change to a resource, capturing who made the change, what changed, and when.

Audit events are recorded automatically as mutations happen; they cannot be created, edited, or deleted through the API. Recording is asynchronous, so an event may take a moment to become readable after the request that caused it has returned. An update that leaves every tracked field at its existing value records no event unless the mutation attaches metadata of its own — a password rotation, for example, records metadata and no field changes.

func (*AuditEvent) SchemaExample

func (*AuditEvent) SchemaExample() any

type AuditFieldChange

type AuditFieldChange struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=audit_field_change"`
	// Name of the changed field.
	//
	// Field names come from the audited record's stored representation and can differ slightly from the corresponding field on the API resource — for example `commission_policy_code` rather than `commission_policy`.
	Field string `json:"field" validate:"required"`
	// Previous value as a JSON fragment.
	//
	// `null` on `create` events, where the field had no prior value.
	OldValue json.RawMessage `json:"old_value"`
	// New value as a JSON fragment.
	//
	// `null` on `delete` events, where the field has no remaining value.
	NewValue json.RawMessage `json:"new_value"`
}

Field-level before/after transition recorded during a mutation.

type AvailableTool

type AvailableTool struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=available_tool"`
	// A stable identifier used when attaching the tool to an agent.
	Slug string `json:"slug" validate:"required"`
	// Where the tool's behavior comes from.
	//
	// - `built_in`: a capability implemented by the agent runtime itself, such as fetching a web page or drafting a reply for a teammate to approve.
	// - `api_endpoint`: an operation of this API exposed as a tool, letting the agent perform it on the account's behalf.
	Category constants.AgentToolCategory `json:"category" validate:"required"`
	// Human-readable name for the tool.
	Name string `json:"name" validate:"required"`
	// Explanation of what the tool does.
	//
	// This is also the description the agent's model reads when deciding whether to call the tool.
	Description *string `json:"description"`
	// JSON schema describing the configuration options this tool accepts.
	//
	// Defines the shape of the `config` field on AgentDefinitionTool: a schema declaring a `max_results` integer property means that tool's `config` may set `max_results`.
	ConfigSchema json.RawMessage `json:"config_schema"`
	// Permission scopes the agent's role must hold for this tool to be usable (e.g. `products:read`).
	RequiredPermissions []string `json:"required_permissions"`
	// Role type the caller must have for this tool, when the operation is gated by role rather than a permission (e.g. `admin`).
	RequiredRoleType *constants.RoleType `json:"required_role_type"`
	// Whether invoking this tool takes an action rather than only reading data.
	//
	// True for any `api_endpoint` tool whose underlying operation is not a read, and for `built_in` tools that do something externally visible or hard to undo, such as sending an email. A mutating `built_in` tool always pauses its run for human approval and that gate cannot be turned off for an individual agent; for `api_endpoint` tools the flag is advisory and review stays configurable per agent.
	Mutating bool `json:"mutating"`
}

A capability an agent can be granted, allowing it to take that action during a run.

The catalog of available tools is the same for every account; granting one to an agent is what makes it callable.

func (*AvailableTool) SchemaExample

func (*AvailableTool) SchemaExample() any

type Batch

type Batch struct {
	// Batch ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=batch"`
	// The item the batch produces.
	Item *Item `json:"item" expandable:"true"`
	// Good (first-quality) quantity produced by the batch, as a measure and unit.
	Quantity *Quantity `json:"quantity" expandable:"true"`
	// Seconds-quality (B-grade) output recorded for the batch, as a measure and unit.
	//
	// Recorded when splitting a batch; seconds consume input materials but are not added to inventory.
	Seconds *Quantity `json:"seconds" expandable:"true"`
	// Scrap quantity generated by the batch, as a measure and unit.
	//
	// Recorded when splitting a batch; scrap consumes input materials but is not added to inventory.
	Waste *Quantity `json:"waste" expandable:"true"`
	// The scanning station the batch was last processed at.
	ScanningStation *ScanningStation `json:"scanning_station" expandable:"true"`
	// The department that the batch's scanning station belongs to.
	Department *Department `json:"department" expandable:"true"`
	// The production step the batch was produced at.
	//
	// Initializing a batch at a scanning station attaches the step at that station that produces the batch's item; a batch that is still only planned work on a production run may not have a step yet.
	ProductionStep *ProductionStep `json:"production_step" expandable:"true"`
	// The production run the batch was created under.
	//
	// Only batches created by a production run have one; batches created by a move, merge, or split do not.
	ProductionRun *ProductionRunReference `json:"production_run" expandable:"true"`
	// Machines used to produce the batch.
	Machines *List[Machine] `json:"machines" expandable:"true"`
	// Lot numbers that trace the batch's consumed materials and its production run.
	Lots *List[BatchLot] `json:"lots"`
	// Batches that feed into this batch.
	InputBatches *List[BatchReference] `json:"input_batches"`
	// Batches this batch feeds into.
	OutputBatches *List[BatchReference] `json:"output_batches"`
	// When the batch was closed.
	//
	// A batch closes automatically when it reaches the last production step, when it is moved or merged into a downstream batch, and when everything split off it accounts for its whole quantity; it can also be closed explicitly.
	ClosedAt *time.Time `json:"closed_at"`
	// When the batch was scanned at its scanning station.
	//
	// Only initializing a batch stamps this timestamp. Batches created by a move, merge, or split are attached to the station that produced them but are never marked as scanned.
	ScannedAt *time.Time `json:"scanned_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last-updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A quantity of an item tracked as it moves through production.

Batches are created by production runs and advanced through production steps by scanning them at scanning stations — initializing, moving, merging, or splitting them. Input and output references link batches into a production flow graph.

func (*Batch) SchemaExample

func (*Batch) SchemaExample() any

type BatchFlowNode

type BatchFlowNode struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=batch_flow_node"`
	// Batch at this node.
	Batch Batch `json:"batch"`
	// Batches that feed into this batch.
	InputBatches *List[BatchReference] `json:"input_batches"`
	// Batches this batch feeds into.
	OutputBatches *List[BatchReference] `json:"output_batches"`
}

Batch within a production flow graph, including input and output edges.

func (*BatchFlowNode) SchemaExample

func (*BatchFlowNode) SchemaExample() any

type BatchLot

type BatchLot struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=batch_lot"`
	// Lot number.
	LotNumber string `json:"lot_number" validate:"required"`
	// Source of the lot number.
	//
	// - `material`: the lot number traces a raw material consumed by the batch.
	// - `productionRun`: the lot number is the production run number the batch belongs to.
	Type constants.BatchLotType `json:"type" validate:"required"`
}

A lot number recorded against a batch for traceability.

type BatchReference

type BatchReference struct {
	// Batch ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=batch"`
}

Minimal reference to another batch, carrying only the id and object discriminator.

type BillingPortalSessionResponse

type BillingPortalSessionResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=billing_portal_session_response"`
	// URL to send the admin to.
	//
	// The link is issued by Stripe for a single visit and expires; generate a new session each time. On leaving the portal the admin is returned to the dashboard's billing page.
	URL string `json:"url" validate:"required"`
}

A short-lived link into the Stripe billing portal, where an account admin can manage payment methods, invoices, and the subscription.

func (*BillingPortalSessionResponse) SchemaExample

func (*BillingPortalSessionResponse) SchemaExample() any

type BulkCreateItemResult

type BulkCreateItemResult struct {
	// The SKU of the item.
	SKU string `json:"sku" validate:"required"`
	// Outcome of the create attempt.
	Status constants.BulkResultStatus `json:"status" validate:"required"`
	// The error message if the item failed to create.
	Error *string `json:"error"`
	// The ID of the created item.
	ItemID *string `json:"item_id"`
}

BulkCreateItemResult represents the result of creating a single item in a bulk operation.

type BulkCreateItemsResponse

type BulkCreateItemsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The results of each item creation.
	Data []BulkCreateItemResult `json:"data" validate:"required"`
}

BulkCreateItemsResponse represents the response from the bulk create items endpoint.

func (*BulkCreateItemsResponse) SchemaExample

func (*BulkCreateItemsResponse) SchemaExample() any

type BulkCreateProductionStepResult

type BulkCreateProductionStepResult struct {
	// The name of the production step.
	Name string `json:"name" validate:"required"`
	// Outcome of the operation for this step.
	Status constants.BulkResultStatus `json:"status" validate:"required"`
	// The error message if the step failed.
	Error *string `json:"error"`
	// The ID of the created or updated production step.
	ProductionStepID *string `json:"production_step_id"`
	// The action taken on the underlying production step.
	Action constants.BulkResultAction `json:"action" validate:"required"`
}

BulkCreateProductionStepResult represents the result of creating a single production step.

type BulkCreateProductionStepsResponse

type BulkCreateProductionStepsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// The results of each production step creation.
	Data []BulkCreateProductionStepResult `json:"data" validate:"required"`
}

BulkCreateProductionStepsResponse represents the response from the bulk create production steps endpoint.

func (*BulkCreateProductionStepsResponse) SchemaExample

func (*BulkCreateProductionStepsResponse) SchemaExample() any

type BulkReconcileItemsResponse

type BulkReconcileItemsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=bulk_reconcile_items_response"`
	// Items whose inventory was successfully reconciled.
	ReconciledItems *List[ReconciledItemResult] `json:"reconciled_items" validate:"required"`
	// Items that were skipped, e.g. because no item with the given SKU exists.
	SkippedItems *List[SkippedItemResult] `json:"skipped_items" validate:"required"`
	// Items that failed to reconcile, e.g. because the given unit does not exist or the inventory write failed.
	Errors *List[ReconcileErrorResult] `json:"errors" validate:"required"`
}

The outcome of a bulk inventory reconciliation, reported as three separate lists.

func (*BulkReconcileItemsResponse) SchemaExample

func (*BulkReconcileItemsResponse) SchemaExample() any

type Carrier

type Carrier struct {
	// Carrier ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=carrier"`
	// Human-readable name for the carrier, unique among the carriers visible to your account.
	Name string `json:"name" validate:"required"`
	// Well-known carrier identifier, set only for recognized carriers and absent for custom ones.
	//
	// - `fedex`, `ups`, `usps`: integrated carriers managed through Shippo (live rating and labels).
	// - `will_call`: customer picks the order up; no carrier shipment.
	// - `delivery`: delivered by your own vehicles/drivers.
	// - `ltl`, `ltl1`: less-than-truckload freight carriers.
	// - `freight_collect`: freight billed to and arranged by the receiver.
	Code *constants.CarrierCode `json:"code"`
	// Your account number with this carrier.
	//
	// UPS and USPS carrier accounts are connected to Shippo using this number; FedEx carriers authorize through OAuth instead, so their account number is not used to connect them.
	AccountNumber *string `json:"account_number"`
	// Whether customers can see and select this carrier at checkout in the customer portal.
	CustomerPortalVisibility constants.CustomerPortalVisibility `json:"customer_portal_visibility" validate:"required"`
	// Provenance of this carrier.
	//
	// System-owned carriers are platform-provided defaults shared across all accounts and cannot be updated or deleted; account-owned carriers are custom to your account.
	Owner *Owner `json:"owner" expandable:"true"`
	// Shipping service levels offered by this carrier (e.g. ground, overnight).
	//
	// At most 10 service levels are returned inline; use the carrier's service levels endpoint to page through the full set.
	ServiceLevels *List[ServiceLevel] `json:"service_levels" expandable:"true"`
	// Soft-delete timestamp.
	DeletedAt *time.Time `json:"deleted_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A shipping carrier configured for fulfilling orders.

Carriers with a Shippo-supported `code` (`fedex`, `ups`, `usps`) are connected through Shippo for live rating and label purchase; other carriers represent self-managed shipping methods such as will call or local delivery.

func (*Carrier) SchemaExample

func (*Carrier) SchemaExample() any

type CatalogAttribute

type CatalogAttribute struct {
	// Attribute ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=catalog_attribute"`
	// The attribute's value, e.g. `Red`.
	//
	// This is the specific value the product takes for its `property`.
	Name string `json:"name" validate:"required"`
	// Property this attribute is a value of, e.g. `Color`.
	Property *CatalogProperty `json:"property" validate:"required"`
}

Attribute of a product in the catalog: a single value of a property, e.g. `Red` for the `Color` property.

func (*CatalogAttribute) SchemaExample

func (*CatalogAttribute) SchemaExample() any

type CatalogCategory

type CatalogCategory struct {
	// Item category ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=catalog_category"`
	// Display name of the category.
	Name string `json:"name" validate:"required"`
	// Properties shared by products in this category, such as `Color` or `Size`.
	//
	// These are the dimensions along which the category's products vary; each product's specific values appear under its `attributes`.
	Properties *List[CatalogProperty] `json:"properties" validate:"required"`
	// Products belonging to this category.
	//
	// Every product the category contributes to the requested product line is returned here — pagination applies to categories, not to the products inside them.
	Products *List[CatalogProduct] `json:"products" validate:"required"`
}

Category of products in the catalog.

func (*CatalogCategory) SchemaExample

func (*CatalogCategory) SchemaExample() any

type CatalogProduct

type CatalogProduct struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=catalog_product"`
	// Inventory item this catalog product represents.
	//
	// Use its `id` and `sku` to look up the full item.
	Item *Item `json:"item" validate:"required"`
	// Human-readable description of the product, carried over from the item.
	Description string `json:"description" validate:"required"`
	// Attribute values that distinguish this product within its category, e.g. `Red` for the `Color` property.
	Attributes *List[CatalogAttribute] `json:"attributes" validate:"required"`
}

Product in the catalog.

A catalog product is identified by its underlying `item` rather than a product ID of its own.

func (*CatalogProduct) SchemaExample

func (*CatalogProduct) SchemaExample() any

type CatalogProductLine

type CatalogProductLine struct {
	// Product line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=catalog_product_line"`
	// Display name of the product line.
	Name string `json:"name" validate:"required"`
}

Product line available in the catalog.

A product line is the top-level grouping of the catalog; browse its products by passing this product line's ID to the list-catalog-products endpoint.

func (*CatalogProductLine) SchemaExample

func (*CatalogProductLine) SchemaExample() any

type CatalogProperty

type CatalogProperty struct {
	// Property ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=catalog_property"`
	// Display name of the property, e.g. `Color`.
	Name string `json:"name" validate:"required"`
}

Property associated with an item category, e.g. `Color`.

A property defines a dimension along which products in a category vary; its possible values are represented as catalog attributes.

func (*CatalogProperty) SchemaExample

func (*CatalogProperty) SchemaExample() any

type ChartData

type ChartData struct {
	// The chart name/label.
	Name string `json:"name" validate:"required"`
	// The chart type.
	Type string `json:"type" validate:"required"`
	// The chart data points.
	Data []Coordinate `json:"data" validate:"required"`
}

ChartData represents data for a chart visualization.

type CheckDuplicateResult

type CheckDuplicateResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=check_duplicate_result"`
	// Whether a record with the submitted number already exists.
	//
	// Invoice and sales order numbers are matched across the whole account; a customer PO number is matched only against the orders of the customer given in the request, so the same PO number may exist on another customer's orders without being reported here.
	IsDuplicate bool `json:"is_duplicate" validate:"required"`
	// Human-readable message describing the duplicate.
	//
	// Populated only when `is_duplicate` is `true`; names the type and value that already exists.
	Message *string `json:"message"`
}

The outcome of checking whether a record number is already in use.

func (*CheckDuplicateResult) SchemaExample

func (*CheckDuplicateResult) SchemaExample() any

type ChildAccount

type ChildAccount struct {
	// Account relation ID.
	//
	// Identifies the relationship record, not the child account itself; use `account.id` for the account.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=child_account"`
	// The child account itself.
	//
	// Only the identifying fields are populated here; fetch the account or its customer record for full detail.
	Account *Account `json:"account" validate:"required"`
	// The customer number for the child account, matching the `number` on your customer record for it.
	ExternalNumber *string `json:"external_number"`
	// Support email address published in the child account's branding.
	Email *string `json:"email"`
	// When this relation was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this relation was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Child customer account in a parent-child relationship.

Parent-child links let you model a customer hierarchy, such as a chain's individual store locations sitting beneath its head office. Both accounts are customers of your own account, and the hierarchy is visible only to you.

func (*ChildAccount) SchemaExample

func (*ChildAccount) SchemaExample() any

type CommitmentQuoteStep

type CommitmentQuoteStep struct {
	// Which rule applied.
	Code constants.CommitmentStep `json:"code" validate:"required"`
	// Where the running date stood after this rule.
	Date time.Time `json:"date" validate:"required"`
	// How far this rule pulled the date back. Zero means the rule applied and changed nothing, which is worth showing: it says the date was already on an open day.
	DaysMoved int32 `json:"days_moved"`
	// The rule's own parameter — where a transit estimate came from, or the cutoff time applied. Null for a rule that takes none, rather than an empty string: snapping onto an open day has no parameter to report.
	Detail *string `json:"detail"`
}

CommitmentQuoteStep is one rule's contribution to a previewed ship-by date.

Returned as an ordered list so a caller can show why a date is what it is without reimplementing the arithmetic, and so the explanation cannot drift from the calculation that produced it.

func SampleCommitmentQuoteSteps

func SampleCommitmentQuoteSteps() []CommitmentQuoteStep

type CompleteRegistrationResponse

type CompleteRegistrationResponse struct {
	// ID of the newly created account.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
}

Result of completing a registration.

func (*CompleteRegistrationResponse) SchemaExample

func (*CompleteRegistrationResponse) SchemaExample() any

type ComputedQuantity

type ComputedQuantity struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=computed_quantity"`
	// Raw decimal value, as a string to preserve precision.
	//
	// This is the unformatted machine value; see `display_value` for the human-readable rendering.
	Value string `json:"value" validate:"required" format:"decimal"`
	// Formatted value with unit abbreviation (e.g. "1,200 pr").
	DisplayValue string `json:"display_value" validate:"required"`
	// Unit of measure for this value.
	Unit *Unit `json:"unit" expandable:"true"`
}

An amount calculated on demand rather than stored.

The same shape as a quantity minus the ID, because nothing was written: it is derived per request, such as a total rolled up across invoiced lines for one analysis.

func (*ComputedQuantity) SchemaExample

func (*ComputedQuantity) SchemaExample() any

type ComputedRate

type ComputedRate struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=computed_rate"`
	// Decimal value of the rate, as a string to preserve precision.
	//
	// Expressed as the amount of the numerator unit per one denominator unit.
	Value string `json:"value" validate:"required" format:"decimal"`
	// Unit of the rate's numerator (e.g. the currency of a price).
	NumeratorUnit *Unit `json:"numerator_unit" expandable:"true"`
	// Unit of the rate's denominator (the per-unit basis, e.g. pairs for a price per pair).
	DenominatorUnit *Unit `json:"denominator_unit" expandable:"true"`
	// Human-readable formatted value (e.g. "$25.50 / pr").
	DisplayValue string `json:"display_value" validate:"required"`
}

A rate calculated on demand rather than stored.

The same shape as a rate minus the fields only a persisted row can have: it carries no ID and no timestamps because nothing was written. Used where a figure is derived per request, such as an analysis comparing one customer's price against the median other customers pay.

func NewComputedRate

func NewComputedRate(value string, numeratorUnit, denominatorUnit *Unit) *ComputedRate

NewComputedRate builds a computed rate with its units already attached, for the endpoints that resolve units eagerly rather than behind an include.

The value is carried through exactly as the caller computed it. A quoted price has to equal the price the order will actually charge, and rounding it here to a fixed number of places would make the two disagree by a cent; callers that want a normalized scale apply it themselves.

func (*ComputedRate) SchemaExample

func (*ComputedRate) SchemaExample() any

type ConfirmPaymentResponse

type ConfirmPaymentResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=confirm_payment_response"`
	// Status of the Stripe Setup Intent.
	//
	// Always `succeeded` on a successful response; any other Setup Intent status results in a validation error instead.
	Status string `json:"status" validate:"required"`
	// Payment method ID attached by the Setup Intent.
	//
	// Returned only the first time payment is confirmed; a repeat confirmation of an already-completed session succeeds but omits it.
	PaymentMethodID *string `json:"payment_method_id"`
}

Result of confirming payment for a registration.

func (*ConfirmPaymentResponse) SchemaExample

func (*ConfirmPaymentResponse) SchemaExample() any

type Consumption

type Consumption struct {
	// Consumption ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=consumption"`
	// Quantity of the material consumed by the production step.
	Quantity *Quantity `json:"quantity" expandable:"true"`
	// Quantity of the material expected to be lost as waste.
	//
	// Tracked separately from the consumed quantity, but added to it when material requirements are worked out, since the waste has to be bought as well.
	WasteQuantity *Quantity `json:"waste_quantity" expandable:"true"`
	// The item consumed by the production step.
	ConsumedItem *Item `json:"consumed_item" expandable:"true"`
	// Instructions for how this material is consumed.
	Instructions *string `json:"instructions"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Material consumed by a production step.

Each consumption records one input item and how much of it the step uses. Consumptions also determine the production flow: when another step produces the consumed item, the two steps are linked upstream/downstream automatically.

The quantities are stated against the step's own output, so a step producing 100 pairs and consuming 5 kg of yarn needs 5 kg per 100 pairs. Material requirements for an order scale every consumption in the flow by how much of the finished item is wanted.

func (*Consumption) SchemaExample

func (*Consumption) SchemaExample() any

type ContactMatch

type ContactMatch struct {
	// Contact match ID.
	//
	// This is the matched account user's ID, so the same value also appears as `account_user.id`.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=contact_match"`
	// How you relate to the account this contact belongs to.
	//
	// - `customer`: the account is one of your customers.
	// - `supplier`: the account is one of your suppliers.
	// - `self`: the account is your own.
	Relationship constants.ContactRelationship `json:"relationship" validate:"required"`
	// The email address that was matched.
	Email string `json:"email" validate:"required"`
	// The matched account user.
	AccountUser *AccountUser `json:"account_user" expandable:"true"`
	// The account this contact belongs to.
	Account *Account `json:"account" expandable:"true"`
}

A contact found by email on an account you have a relationship with — one of your customers, your suppliers, or your own account.

The same email can be a contact on many accounts across the platform; only accounts you relate to are returned.

Only active people are matched — someone who has been disabled or removed on an account never produces a match for that account.

func (*ContactMatch) SchemaExample

func (*ContactMatch) SchemaExample() any

type Conversation

type Conversation struct {
	// Conversation ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=conversation"`
	// What kind of conversation this is.
	//
	// - `direct_message`: a 1:1 thread between two users.
	// - `group`: a named thread with multiple user or agent members (including customer-facing support cases).
	// - `system`: a system channel that delivers automated account alerts.
	Type constants.ConversationType `json:"type" validate:"required"`
	// Whether this is a team-only conversation (`internal`) or a customer-facing case (`customer`).
	//
	// A customer never sees an `internal` conversation, even one that is about them; within a `customer` case they see only the messages that were sent to them, not the team's internal notes on the case.
	Audience constants.ConversationAudience `json:"audience" validate:"required"`
	// The display title of a group conversation.
	//
	// Direct messages carry no stored title; clients derive one from the participants.
	Title *string `json:"title"`
	// The triage lane of a customer-facing case.
	//
	// Only conversations with a `customer` audience have a triage lane. It drives the support inbox and is independent of `status`, which is about visibility rather than progress.
	//
	// - `new`: opened but not yet triaged.
	// - `open`: actively being worked.
	// - `waiting_internal`: blocked on the internal team.
	// - `waiting_external`: blocked on an external reply.
	// - `needs_approval`: a drafted reply is awaiting human approval.
	// - `resolved`: closed out.
	WorkflowStatus *constants.ConversationWorkflowStatus `json:"workflow_status"`
	// The reusable roster this conversation was started from.
	//
	// This is provenance only: the roster's members were copied into the conversation when it was created, so later edits to the roster never add or remove participants here, and deleting the roster only clears this reference.
	Group *MessagingGroup `json:"group" expandable:"true"`
	// The conversation's state from the caller's point of view.
	//
	// - `active`: a normal, visible conversation.
	// - `archived`: archived for the whole account.
	// - `hidden`: the caller dismissed the conversation from their own list while everyone else still sees it, which takes precedence over an account-level archive.
	Status constants.ConversationStatus `json:"status" validate:"required"`
	// Whether the conversation is under legal hold.
	//
	// While held, the conversation is exempt from automatic retention purging and from redaction until the hold is released.
	LegalHold constants.LegalHoldStatus `json:"legal_hold" validate:"required"`
	// The owner of the case: either a `user` actor (an individual team member) or a `group` actor (a team).
	Assignee *Actor `json:"assignee" expandable:"true"`
	// The participants of the conversation.
	//
	// Only current members are listed; anyone who left or was removed is omitted, even though their past messages remain in the thread.
	Participants *List[ConversationParticipant] `json:"participants" expandable:"true"`
	// The app record this conversation is anchored to, such as a sales order.
	//
	// Anchored conversations surface as the discussion thread on that record.
	Topic *Entity `json:"topic" expandable:"true"`
	// Number of messages the caller has not yet read.
	Unread int64 `json:"unread"`
	// When the most recent message was sent.
	LastMessageAt *time.Time `json:"last_message_at"`
	// The most recent message in the conversation.
	LastMessage *Message `json:"last_message" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A conversation thread the caller participates in.

func (*Conversation) SchemaExample

func (*Conversation) SchemaExample() any
type ConversationLink struct {
	// Conversation link ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=conversation_link"`
	// The conversation this link belongs to.
	Conversation *Conversation `json:"conversation" expandable:"true"`
	// The linked business record.
	Resource *Entity `json:"resource"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A reference from a conversation to a business record it concerns, such as an order, invoice, shipment, or customer.

Links sit alongside the conversation's primary `topic` anchor, so one thread can reference several records. Listing conversations by business record matches the topic anchor and these links alike, which is what surfaces a conversation on the record's own page.

func (*ConversationLink) SchemaExample

func (*ConversationLink) SchemaExample() any

type ConversationParticipant

type ConversationParticipant struct {
	// Participant ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=conversation_participant"`
	// The kind of participant.
	//
	// - `user`: an account user (a teammate).
	// - `agent`: an AI agent.
	// - `system`: the system itself, which posts automated messages.
	// - `customer`: an external customer in a support case.
	Type constants.ParticipantType `json:"type" validate:"required"`
	// The participant's permission level in the conversation.
	//
	// - `owner`: can rename or delete the conversation and manage its members and their roles.
	// - `admin`: can add or remove members and rename the conversation.
	// - `member`: can post, react, mute, and leave.
	// - `viewer`: read-only access.
	Role constants.ParticipantRole `json:"role" validate:"required"`
	// The participant's membership in the conversation.
	//
	// - `active`: currently a member.
	// - `left`: voluntarily left the conversation.
	// - `removed`: removed by an admin.
	// - `hidden`: still a member but has hidden the conversation from their own list.
	//
	// Membership records are kept rather than deleted, so re-adding someone who left or was removed reactivates their original record and their earlier messages stay attributed to them.
	Membership constants.ParticipantMembership `json:"membership" validate:"required"`
	// The participant's notification preference for the conversation.
	//
	// - `unmuted`: receives notifications for new messages.
	// - `muted`: new-message notifications are suppressed, though a direct @mention still raises an in-app alert (never an email), and the conversation still counts toward the unread total.
	Notifications constants.ParticipantNotifications `json:"notifications" validate:"required"`
	// The user or agent behind this participant.
	//
	// A customer participant resolves to the `user` actor of the person who opened the case; the `system` participant that posts automated messages has no actor.
	Actor *Actor `json:"actor"`
	// For agent participants, when the agent is invoked in response to messages.
	//
	// - `mention`: only when the agent is @mentioned.
	// - `keyword`: when a message contains one of the agent's trigger keywords.
	// - `always`: on every human message in the conversation.
	AgentTriggerPolicy *constants.AgentTriggerPolicy `json:"agent_trigger_policy"`
	// For agent participants with a keyword or mention policy, the keywords that trigger it.
	//
	// Matching is case-insensitive and looks anywhere in the message body: under `keyword` the bare word is matched, under `mention` it must appear as `@keyword`. Replying directly to one of the agent's own messages always reaches it, so an agent with no keywords still answers replies but nothing else.
	AgentTriggerKeywords []string `json:"agent_trigger_keywords"`
	// The participant's read position in the conversation (read receipts): how far they have read.
	ReadCursor ReadCursor `json:"read_cursor"`
}

A participant (membership) in a conversation.

func (*ConversationParticipant) SchemaExample

func (*ConversationParticipant) SchemaExample() any

type Coordinate

type Coordinate struct {
	// The x-axis value.
	X float64 `json:"x" validate:"required"`
	// The y-axis value.
	Y float64 `json:"y" validate:"required"`
}

Coordinate represents a single data point on a chart.

type CostBreakdown

type CostBreakdown struct {
	// The total amount.
	Total *Quantity `json:"total" validate:"required"`
	// The labor amount.
	Labor *Quantity `json:"labor" validate:"required"`
	// The materials amount.
	Materials *Quantity `json:"materials" validate:"required"`
	// The overhead amount.
	Overhead *Quantity `json:"overhead" validate:"required"`
	// The time amount.
	Time *Quantity `json:"time" validate:"required"`
	// The quantity amount.
	Quantity *Quantity `json:"quantity" validate:"required"`
}

CostBreakdown represents a detailed cost breakdown with sub-quantities.

type CreateSessionResponse

type CreateSessionResponse struct {
	// ID of the registration session.
	//
	// If an active session already existed for the email, this is the existing session's ID rather than a new one.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=registration_session"`
}

Result of creating a registration session.

func (*CreateSessionResponse) SchemaExample

func (*CreateSessionResponse) SchemaExample() any

type CreateUserResponse

type CreateUserResponse struct {
	// ID of the user associated with the session.
	//
	// Repeating the call on a session that already has a user returns that same user rather than creating another.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=user"`
}

Result of creating a user for a registration session.

func (*CreateUserResponse) SchemaExample

func (*CreateUserResponse) SchemaExample() any

type CreatedAPIKey

type CreatedAPIKey struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=created_api_key"`
	// The secret used to authenticate requests, sent as a bearer token in the `Authorization` header.
	//
	// This is the only response that ever contains the secret; if it is lost, rotate the key to issue a new one. Learn more about [managing your API keys](https://docs.openmrp.ai/api/managing-api-keys).
	APIKeySecret string `json:"api_key_secret" validate:"required" sensitive:"true"`
	// The key's non-secret details, such as its ID, name, role, and expiration.
	APIKeyInfo APIKey `json:"api_key_info" validate:"required"`
}

A newly issued API key together with its secret value, returned when a key is created or rotated.

func (*CreatedAPIKey) SchemaExample

func (*CreatedAPIKey) SchemaExample() any

type CreatedBy

type CreatedBy struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=created_by"`
	// The creator's relationship to the account that owns the resource.
	//
	// - `internal`: created by a user of the owning account.
	// - `customer`: created by a customer of the owning account.
	// - `system`: created automatically with no human actor (e.g. an EDI import).
	Relation constants.CreatedByRelation `json:"relation" validate:"required"`
	// The actor who created the resource.
	//
	// Absent when `relation` is `system`, since no human or programmatic actor performed the action.
	Actor *Actor `json:"actor"`
}

CreatedBy describes who created a resource and their relationship to the account that owns it.

It is resolved from the resource's create audit event.

func NewCreatedBy

func NewCreatedBy(relation constants.CreatedByRelation, actor *Actor) *CreatedBy

NewCreatedBy builds a CreatedBy from a relation and optional actor.

func SystemCreatedBy

func SystemCreatedBy() *CreatedBy

SystemCreatedBy returns a CreatedBy for a resource created with no human actor.

func (*CreatedBy) SchemaExample

func (*CreatedBy) SchemaExample() any

type Customer

type Customer struct {
	// Customer ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer"`
	// The customer's business name, as shown throughout the app and on documents.
	Name string `json:"name" validate:"required"`
	// Human-readable customer number used to identify the account, distinct from the `id`.
	//
	// Unique within your account.
	Number string `json:"number" validate:"required"`
	// The customer's account standing.
	//
	// - `normal`: standard account with no restrictions.
	// - `preferred`: account flagged for prioritized handling.
	// - `hold_shipment`: the customer's shipments should be held, typically over a credit problem, while orders can still be placed.
	// - `hold_all`: all activity for the customer should be held.
	//
	// The hold statuses are advisory: OpenMRP flags the customer's orders as being on credit hold, but requests to create orders or shipments for the customer are not rejected.
	Status constants.AccountStatusCode `json:"status" validate:"required"`
	// Whether EDI (Electronic Data Interchange) is enabled for exchanging orders and documents with this customer.
	EDIStatus constants.EDIStatus `json:"edi_status" validate:"required"`
	// The customer's position in the account hierarchy.
	//
	// - `standalone`: no parent or child accounts.
	// - `parent`: has one or more child accounts (see `child_accounts`).
	// - `child`: belongs to a parent account (see `parent_account`).
	RelationshipType constants.CustomerRelationshipType `json:"relationship_type" validate:"required"`
	// How sales commission applies to this customer's orders.
	//
	// - `commission_exempt`: this customer's orders are exempt from sales commission.
	// - `commission_applied`: sales commission is calculated on this customer's orders.
	//
	// The customer counts as exempt if this field, its `type` group, or any of its `price_groups` is `commission_exempt`. Exempt customers never have a sales rep assigned automatically when an order is created without one.
	CommissionPolicy constants.CommissionPolicy `json:"commission_policy" validate:"required"`
	// Free-form note about the customer.
	Note *string `json:"note"`
	// Maximum credit extended to this customer.
	//
	// Used to flag orders once the customer's outstanding balance approaches or passes the limit; orders that exceed it are not rejected.
	CreditLimit *Quantity `json:"credit_limit" expandable:"true"`
	// General contact details for the customer's business.
	ContactInfo *CustomerContactInfo `json:"contact_info" expandable:"true"`
	// Freight and carrier preferences applied to this customer's shipments.
	FreightPreferences *CustomerFreightPreferences `json:"freight_preferences" expandable:"true"`
	// Default settings applied to new orders for this customer.
	Defaults *CustomerDefaults `json:"defaults" expandable:"true"`
	// Which document emails this customer is set up to receive.
	NotificationPreferences *CustomerNotificationPreferences `json:"notification_preferences" expandable:"true"`
	// Default billing address.
	BillToAddress *Address `json:"bill_to_address" expandable:"true"`
	// Default shipping address.
	ShipToAddress *Address `json:"ship_to_address" expandable:"true"`
	// The account group of type `type_group` that categorizes this customer (for example "Distributors").
	Type *AccountGroup `json:"type" expandable:"true"`
	// Account groups of type `pricing_group` that this customer belongs to, used to apply pricing rules.
	PriceGroups *List[AccountGroup] `json:"price_groups" expandable:"true"`
	// The customer this account belongs to, when it is a child account.
	ParentAccount *Customer `json:"parent_account" expandable:"true"`
	// The customers belonging to this account, when it is a parent account.
	ChildAccounts *List[Customer] `json:"child_accounts" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A business you sell to, with its contact details, default fulfillment settings, and order policies.

func (*Customer) SchemaExample

func (*Customer) SchemaExample() any

type CustomerAccountSummary

type CustomerAccountSummary struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// Display name.
	Name string `json:"name" validate:"required"`
}

A customer account under a vendor that the authenticated user is able to act on behalf of in that vendor's customer portal.

type CustomerContactInfo

type CustomerContactInfo struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_contact_info"`
	// Email address.
	Email *string `json:"email"`
	// Phone number.
	Phone *string `json:"phone"`
	// Website URL.
	URL *string `json:"url"`
}

Customer contact information.

type CustomerDefaults

type CustomerDefaults struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_defaults"`
	// Payment term used on this customer's orders when the order does not specify one.
	PaymentTerm *PaymentTerm `json:"payment_term" expandable:"true"`
	// Shipping term used on this customer's orders when the order does not specify one.
	ShippingTerm *ShippingTerm `json:"shipping_term" expandable:"true"`
	// Priority used to pre-fill new orders for this customer.
	Priority *Priority `json:"priority" expandable:"true"`
	// Account user credited as the sales rep on this customer's orders.
	//
	// Used when an order is created without a sales rep, unless the customer is commission-exempt. With no default set, the rep is resolved from the sales territory matching the order's ship-to postal code or state.
	SalesRep *AccountUser `json:"sales_rep" expandable:"true"`
	// Calendar days between an order being issued and it being due to ship.
	//
	// Sets each order's `ship_by_date` when it is issued. With none set here the customer inherits its parent account's lead time, then its account group's, then the account default.
	LeadTimeDays *int32 `json:"lead_time_days"`
	// The operating calendar naming the days this customer's dock accepts freight.
	//
	// A promised delivery date is worked back from a day the customer can actually receive on. With none set here the customer inherits its account group's calendar, then the account default, then Monday to Friday.
	ReceiveCalendarID *string `json:"receive_calendar_id"`
	// How this customer's orders are produced.
	//
	// - `make_to_stock`: their order history feeds the production-schedule forecast, so stock is built ahead of their demand.
	// - `make_to_order`: their history is left out of the forecast; their orders are produced only once placed, and fit into the schedule on their own ship-by dates.
	//
	// With none set here the customer inherits its account group's policy, then falls back to make-to-stock.
	FulfillmentPolicy *constants.FulfillmentPolicy `json:"fulfillment_policy"`
}

Values used to fill in a new sales order for this customer when the order does not supply its own.

type CustomerFreightPreferences

type CustomerFreightPreferences struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_freight_preferences"`
	// Freight policy applied to this customer's orders.
	//
	// - `free_freight`: the customer is not billed for freight.
	// - `billed_freight`: freight is billed to the customer.
	//
	// Freight is waived when this field, the customer's `type` group, any of its `price_groups`, or any product line the ordered products belong to is `free_freight`, so a shipment can come back freight-exempt even while this field is `billed_freight`.
	Status constants.FreightPolicy `json:"status" validate:"required"`
	// Carrier used on this customer's orders when the order does not specify one.
	Carrier *Carrier `json:"carrier" expandable:"true"`
	// Service level used when an order takes its carrier from this customer's default carrier.
	ServiceLevel *ServiceLevel `json:"service_level" expandable:"true"`
	// Who pays the carrier for shipments.
	//
	// - `sender`: the shipper (you) pays the carrier.
	// - `third_party`: a third party is billed, using `billing_account`.
	BillingType *constants.CarrierBillingType `json:"billing_type"`
	// Carrier billing account number charged when `billing_type` is `third_party`.
	BillingAccount *string `json:"billing_account"`
}

Customer freight and carrier settings.

type CustomerLeadTime

type CustomerLeadTime struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_lead_time"`
	// The customer the lead time was resolved for.
	Customer *Entity `json:"customer" validate:"required"`
	// Calendar days between an order being issued and it being due to ship.
	//
	// `0` means same-day: an order issued today would be due to ship today.
	Days int32 `json:"days"`
	// Which rule in the chain produced this lead time.
	//
	// - `customer`: a lead time set on the customer itself.
	// - `parent_customer`: inherited from the customer's parent account.
	// - `account_group`: inherited from the customer's account group.
	// - `account`: the account-wide fallback.
	//
	// The shared `manual` value cannot appear here: it means a promised date was set on one specific order, which is a fact about that order rather than about the customer.
	Source constants.LeadTimeSource `json:"source" validate:"required"`
	// The account group the lead time was inherited from.
	//
	// Present only when `source` is `account_group`. A customer that belongs to a group but sets its own lead time inherited nothing.
	AccountGroup *AccountGroup `json:"account_group" expandable:"true"`
	// The parent customer the lead time was inherited from.
	//
	// Present only when `source` is `parent_customer`. A customer that has a parent but sets its own lead time inherited nothing.
	ParentCustomer *Customer `json:"parent_customer" expandable:"true"`
}

The ship-by lead time a new order for this customer would be committed to.

func (*CustomerLeadTime) SchemaExample

func (*CustomerLeadTime) SchemaExample() any

type CustomerNotificationPreferences

type CustomerNotificationPreferences struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_notification_preferences"`
	// Whether anyone is set up to receive invoice emails for this customer.
	//
	// Derived from the customer's notification recipients: true when at least one of them is configured for invoice notifications.
	AcceptsInvoiceEmails bool `json:"accepts_invoice_emails"`
}

Customer notification settings.

type CustomerPricingFinding

type CustomerPricingFinding struct {
	// Identifier for this finding, stable for the same price and customer across runs.
	//
	// One contracted price produces one finding per customer it reaches, so the price's own ID is not unique across findings.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_pricing_finding"`
	// ID of the contracted price behind this finding, which is where it has to be changed.
	AccountPriceID string `json:"account_price_id" validate:"required"`
	// Why this price was flagged.
	Reason constants.PricingFindingReason `json:"reason" validate:"required"`
	// How the customer comes to receive this price.
	Origin constants.AccountPriceOrigin `json:"origin" validate:"required"`
	// The customer receiving the price.
	Customer *Customer `json:"customer" expandable:"true"`
	// The product line the price applies to.
	ProductLine *ProductLine `json:"product_line" expandable:"true"`
	// The attributes narrowing the price; empty when it covers the whole product line.
	Attributes *List[Attribute] `json:"attributes" expandable:"true"`
	// The contracted price.
	UnitPrice *ComputedRate `json:"unit_price" validate:"required"`
	// Median contracted price across every customer with a price for the same product line, attributes and per-unit basis. Null when no other customer has a comparable price.
	PeerMedianPrice *ComputedRate `json:"peer_median_price"`
	// How far below the peer median this price sits, as a fraction between 0 and 1. Null when there is no peer median.
	BelowPeerMedianFraction *string `json:"below_peer_median_fraction" format:"decimal"`
	// Gross margin at this price, as a fraction between 0 and 1. Null when no comparable cost could be established.
	GrossMargin *string `json:"gross_margin" format:"decimal"`
}

CustomerPricingFinding is one contracted price flagged by the pricing analysis.

type CustomerPricingSummary

type CustomerPricingSummary struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_pricing_summary"`
	// Contracted prices examined.
	PricesAnalyzed int `json:"prices_analyzed"`
	// Prices flagged for sitting below the peer median.
	BelowPeerMedianCount int `json:"below_peer_median_count"`
	// Prices flagged for failing the target gross margin.
	BelowTargetMarginCount int `json:"below_target_margin_count"`
	// Prices whose margin could not be checked because no comparable cost was available.
	MarginNotAssessedCount int `json:"margin_not_assessed_count"`
	// Anything the analysis had to leave out, so the result never overstates its own coverage.
	Notes []string `json:"notes"`
}

CustomerPricingSummary reports the shape of the analysis behind the findings.

type CustomerProductLineAccess

type CustomerProductLineAccess struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer_product_line_access"`
	// The customer whose product line access this record describes.
	//
	// There is at most one access record per customer, so this also identifies the record.
	Customer *Customer `json:"customer" validate:"required"`
	// Product lines this customer has been granted direct access to.
	//
	// Only product lines your account owns can be granted; the shared system product lines never appear here.
	ProductLines *List[ProductLine] `json:"product_lines" validate:"required"`
	// When the relationship with this customer was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When the relationship with this customer was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The product lines directly accessible to a customer.

Determines which product lines (and their products) the customer can browse and order. Direct access granted here combines with any access the customer inherits through its type group or pricing groups.

func (*CustomerProductLineAccess) SchemaExample

func (*CustomerProductLineAccess) SchemaExample() any

type DCLocation

type DCLocation struct {
	// DC location ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=dc_location"`
	// Free-form description identifying this distribution-center location, such as a warehouse name and bay (for example, `Warehouse A - Bay 3`).
	Location string `json:"location" validate:"required"`
	// The customer this DC location belongs to.
	Customer *DCLocationCustomer `json:"customer"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A distribution-center (DC) location belonging to a customer, used when processing orders received via EDI.

func (*DCLocation) SchemaExample

func (*DCLocation) SchemaExample() any

type DCLocationCustomer

type DCLocationCustomer struct {
	// Customer ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=customer"`
	// Display name of the customer.
	Name string `json:"name" validate:"required"`
}

Identifying details of the customer a DC location belongs to.

type DNSRecord

type DNSRecord struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=dns_record"`
	// The kind of DNS record to publish.
	//
	// - `CNAME`: points a subdomain at the portal's serving infrastructure.
	// - `A`: points an apex domain at the portal's serving infrastructure.
	// - `TXT`: carries an ownership-verification challenge.
	Type constants.DNSRecordType `json:"type" validate:"required"`
	// Record name (host) to publish.
	Name string `json:"name" validate:"required"`
	// Record value to publish.
	Value string `json:"value" validate:"required"`
	// Why the record must be published.
	//
	// - `routing`: the record points traffic at the portal's serving infrastructure.
	// - `ownership`: the record proves control of a domain that is already claimed elsewhere.
	Reason constants.DNSRecordReason `json:"reason" validate:"required"`
}

A DNS record that must be published at your DNS provider before a portal domain can be verified and serve traffic.

type DateTimeCoordinate

type DateTimeCoordinate struct {
	// The timestamp.
	X time.Time `json:"x" validate:"required"`
	// The value.
	Y float64 `json:"y" validate:"required"`
}

DateTimeCoordinate represents a time-value data point.

type Delivery

type Delivery struct {
	// Delivery ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=delivery"`
	// Human-readable delivery number.
	//
	// The first delivery against a purchase order takes that order's number; each later delivery appends a sequence suffix, such as `PO-001-2`.
	Number string `json:"number" validate:"required"`
	// The purchase order this delivery was received against.
	PurchaseOrder *PurchaseOrder `json:"purchase_order" expandable:"true"`
	// Whether any of the delivered goods were accepted into inventory.
	//
	// - `accepted`: at least part of the shipment was put into inventory. Quantities refused on inspection can still appear on the delivery's lines.
	// - `rejected`: nothing on the delivery entered inventory.
	Status constants.DeliveryStatus `json:"status" validate:"required"`
	// The goods recorded on this delivery.
	Lines *List[DeliveryLine] `json:"lines" expandable:"true"`
	// When goods on this delivery were accepted into inventory.
	//
	// A delivery that also had quantities refused has both this and `rejected_at` set.
	AcceptedAt *time.Time `json:"accepted_at"`
	// When goods on this delivery were refused on inspection.
	RejectedAt *time.Time `json:"rejected_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A delivery of goods received against a purchase order.

Deliveries are not created directly. One is recorded each time a receiving order is stocked, capturing what arrived in that shipment, where it was put away, and what was refused on inspection. A purchase order received in several shipments therefore has several deliveries.

func (*Delivery) SchemaExample

func (*Delivery) SchemaExample() any

type DeliveryBacklogBucket

type DeliveryBacklogBucket struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=delivery_backlog_bucket"`
	// Name of the band.
	Label string `json:"label"`
	// Lower bound of the band in days late.
	MinDaysLate int32 `json:"min_days_late"`
	// Upper bound in days late; `0` means unbounded.
	MaxDaysLate int32 `json:"max_days_late"`
	// Orders in the band.
	OrderCount int32 `json:"order_count"`
	// Quantity still owed across them, which is what remains unpacked rather than what was ordered.
	Units float64 `json:"units"`
}

One age band of orders past their promise and still unshipped.

type DeliveryBreakdown

type DeliveryBreakdown struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=delivery_breakdown"`
	// Identifier of the slice — a customer, customer group, product line, or commitment source. Empty when the dimension is unset on the orders in it.
	Key string `json:"key"`
	// Display name for the slice.
	Label string `json:"label"`
	// The delivery figures for it, on the same shape as the overall window.
	Performance *DeliveryPerformance `json:"performance" validate:"required"`
}

Delivery performance for one slice of the order book.

type DeliveryChartData

type DeliveryChartData struct {
	// On-time delivery chart data.
	OnTimeDelivery ChartData `json:"on_time_delivery" validate:"required"`
	// Average delivery time chart data.
	AverageDeliveryTime ChartData `json:"average_delivery_time" validate:"required"`
	// Average first shipment time chart data.
	AverageFirstShipmentTime ChartData `json:"average_first_shipment_time" validate:"required"`
}

DeliveryChartData contains chart data for delivery analytics.

type DeliveryLatenessBucket

type DeliveryLatenessBucket struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=delivery_lateness_bucket"`
	// Name of the band.
	Label string `json:"label"`
	// Lower bound of the band in days late.
	MinDaysLate int32 `json:"min_days_late"`
	// Upper bound in days late; `0` means unbounded.
	MaxDaysLate int32 `json:"max_days_late"`
	// Orders in the band, shipped and unshipped.
	OrderCount int32 `json:"order_count"`
	// How many of them have since shipped. The remainder are still owed, and are the same orders `backlog` counts.
	ShippedCount int32 `json:"shipped_count"`
	// Quantity still unpacked across the band's orders.
	Units float64 `json:"units"`
}

One band of how far the window's misses missed by.

type DeliveryLine

type DeliveryLine struct {
	// Delivery line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=delivery_line"`
	// The item received on this line.
	Item *Item `json:"item"`
	// Quantity recorded on this line.
	//
	// On a refused line this is the quantity rejected rather than the quantity taken into inventory.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// Cost per unit of the goods on this line.
	//
	// Copied from the originating purchase order line's unit price at the moment of stocking, so later price changes on the purchase order leave it untouched.
	UnitCost *Rate `json:"unit_cost" validate:"required"`
	// Storage location the goods on this line were put away at.
	//
	// Not set on refused lines, or when the quantity was stocked without naming a location.
	Location *Location `json:"location"`
	// Lot the goods on this line were assigned to.
	//
	// Set only when a lot number was supplied while stocking, and applied to every line produced from that receiving order line, including the refused one.
	Lot *Lot `json:"lot"`
	// When the goods on this line were accepted into inventory.
	AcceptedAt *time.Time `json:"accepted_at"`
	// When the goods on this line were refused on inspection.
	RejectedAt *time.Time `json:"rejected_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A quantity of one item recorded on a delivery.

Stocking a receiving order creates one line for each storage allocation of accepted goods, plus one further line for any quantity refused on inspection. Exactly one of `accepted_at` and `rejected_at` is set on each line, so a single receiving order line can produce several delivery lines.

func (*DeliveryLine) SchemaExample

func (*DeliveryLine) SchemaExample() any

type DeliveryPerformance

type DeliveryPerformance struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=delivery_performance"`
	// First day of the period; absent on the overall figure.
	PeriodStart *time.Time `json:"period_start"`
	// Orders whose promised ship date fell in this period.
	//
	// This is the denominator for both rates below — orders that were due, not orders that shipped. Measuring against shipments only would let unshipped late orders disappear from the score.
	CommittedOrderCount int32 `json:"committed_order_count"`
	// How many of them have shipped at all.
	ShippedOrderCount int32 `json:"shipped_order_count"`
	// How many shipped on or before the promised date.
	OnTimeOrderCount int32 `json:"on_time_order_count"`
	// How many shipped on time and complete.
	OnTimeInFullCount int32 `json:"on_time_in_full_count"`
	// How many shipped late, plus those already past their date and still unshipped.
	LateOrderCount int32 `json:"late_order_count"`
	// How many due in this period have not shipped at all.
	//
	// These count against on-time: a promise not yet met is not a promise kept.
	NotYetShippedCount int32 `json:"not_yet_shipped_count"`
	// Share of due orders that shipped on time, as a percentage.
	//
	// Null rather than zero when nothing was due, so a quiet week does not render as total failure.
	OnTimePct *float64 `json:"on_time_pct"`
	// Share of due orders that shipped on time and complete, as a percentage.
	OnTimeInFullPct *float64 `json:"on_time_in_full_pct"`
	// Average days late, over late orders only.
	//
	// Averaging over every order would dilute a real problem into a number that looks fine.
	AverageDaysLate *float64 `json:"average_days_late"`
	// Average days from issue to first shipment, over orders that have shipped.
	AverageLeadTimeDays *float64 `json:"average_lead_time_days"`
	// Average lead time these orders were promised.
	//
	// The gap between this and `average_lead_time_days` is what a lead time is renegotiated on.
	AverageCommittedLeadTimeDays *float64 `json:"average_committed_lead_time_days"`
}

Delivery reliability for one period, or for a whole window.

type DeliveryStatistics

type DeliveryStatistics struct {
	// Average time to first shipment in days.
	AverageTimeToFirstShipment *float64 `json:"average_time_to_first_shipment"`
	// Average time to completion in days.
	AverageTimeToCompletion *float64 `json:"average_time_to_completion"`
	// On-time delivery percentage.
	OnTimeDeliveryPercentage *float64 `json:"on_time_delivery_percentage"`
	// On-time first shipment percentage.
	OnTimeFirstShipmentPercentage *float64 `json:"on_time_first_shipment_percentage"`
	// Total number of orders.
	TotalOrders int64 `json:"total_orders" validate:"required"`
	// Number of orders with first shipment.
	OrdersWithFirstShipment int64 `json:"orders_with_first_shipment" validate:"required"`
	// Number of orders with completion.
	OrdersWithCompletion int64 `json:"orders_with_completion" validate:"required"`
	// Number of orders with a promise date.
	OrdersWithPromiseDate int64 `json:"orders_with_promise_date" validate:"required"`
	// Number of orders partially fulfilled within the promise date.
	OrdersPartiallyFulfilledInPromiseDate int64 `json:"orders_partially_fulfilled_in_promise_date" validate:"required"`
	// Number of orders completed within the promise date.
	OrdersCompletedWithinPromiseDate int64 `json:"orders_completed_within_promise_date" validate:"required"`
}

DeliveryStatistics represents delivery performance statistics.

type DemandForecastForecastPoint

type DemandForecastForecastPoint struct {
	// The date.
	Date time.Time `json:"at" validate:"required"`
	// The forecast value.
	Forecast float64 `json:"forecast" validate:"required"`
	// The lower confidence bound.
	LowerBound float64 `json:"lower_bound" validate:"required"`
	// The upper confidence bound.
	UpperBound float64 `json:"upper_bound" validate:"required"`
}

DemandForecastForecastPoint represents a forecasted data point with confidence bounds.

type DemandForecastPoint

type DemandForecastPoint struct {
	// The date.
	Date time.Time `json:"at" validate:"required"`
	// The demand value.
	Demand float64 `json:"demand" validate:"required"`
}

DemandForecastPoint represents a historical demand data point.

type DemandForecastRow

type DemandForecastRow struct {
	// The item.
	Item *Entity `json:"item" validate:"required"`
	// The product line.
	ProductLine *Entity `json:"product_line"`
	// The product SKU.
	ProductSku string `json:"product_sku" validate:"required"`
	// The product description.
	ProductDescription *string `json:"product_description"`
	// The unit of measure.
	Unit string `json:"unit" validate:"required"`
	// The currency.
	Currency string `json:"currency" validate:"required"`
	// The historical demand data points.
	History []DemandForecastPoint `json:"history" validate:"required"`
	// The forecasted demand data points.
	Forecast []DemandForecastForecastPoint `json:"forecast" validate:"required"`
	// The historical revenue data points.
	RevenueHistory []RevenueForecastPoint `json:"revenue_history" validate:"required"`
	// The forecasted revenue data points.
	RevenueForecast []DemandForecastForecastPoint `json:"revenue_forecast" validate:"required"`
	// The historical sales data points.
	SalesHistory []RevenueForecastPoint `json:"sales_history" validate:"required"`
	// The forecasted sales data points.
	SalesForecast []DemandForecastForecastPoint `json:"sales_forecast" validate:"required"`
	// The current month demand.
	CurrentMonthDemand float64 `json:"current_month_demand" validate:"required"`
	// The current month revenue.
	CurrentMonthRevenue float64 `json:"current_month_revenue" validate:"required"`
	// The current month sales.
	CurrentMonthSales float64 `json:"current_month_sales" validate:"required"`
}

DemandForecastRow represents a single item's demand forecast data.

type DemandOverride

type DemandOverride struct {
	// Demand override ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=demand_override"`
	// What the override targets.
	//
	// - `item`: a single item.
	// - `product_line`: every item sold under one product line.
	// - `account`: every item in the plan, which is how a blanket assumption such as "plan for double demand" is expressed.
	ScopeType constants.DemandOverrideScope `json:"scope_type" validate:"required"`
	// The item or product line the override targets.
	//
	// An account-wide override has no scope resource, because it targets every planned item rather than one thing.
	Scope *Entity `json:"scope" expandable:"true"`
	// First day of the demand period the override applies to.
	//
	// Overrides are applied month by month, so every calendar month the period touches is adjusted and any time of day is ignored.
	PeriodStartsAt time.Time `json:"period_starts_at" validate:"required"`
	// Last day of the demand period the override applies to.
	PeriodEndsAt time.Time `json:"period_ends_at" validate:"required"`
	// How the value adjusts the forecast.
	//
	// - `absolute`: replaces the forecast for each month in the period.
	// - `delta_units`: adds the value to each month in the period.
	// - `delta_percent`: scales each month in the period by the value as a percentage.
	//
	// When several overrides land on the same month they are applied in that order, so a percentage always acts on the already-adjusted number. An adjusted month is never taken below zero.
	Adjustment constants.DemandOverrideAdjustment `json:"adjustment" validate:"required"`
	// The amount of the adjustment, interpreted according to `adjustment`.
	//
	// A `delta_percent` value is a number of percent, so `-25` plans a quarter less than the forecast.
	Value float64 `json:"value" validate:"required"`
	// The unit the value is expressed in.
	//
	// Recorded for context only: the value is applied to the planned demand without unit conversion, so a unit adjustment should be stated in the unit the item is planned in.
	Unit *Unit `json:"unit" expandable:"true"`
	// Why the adjustment was made.
	//
	// The reason is carried into each schedule the override changes, so a plan can explain why a month departs from history.
	Reason *constants.DemandOverrideReason `json:"reason"`
	// Free-form notes about the adjustment.
	Note *string `json:"note"`
	// The actor that created the override.
	//
	// May be a user, an API key, or an agent.
	CreatedBy *Actor `json:"created_by" expandable:"true"`
	// When the override starts being applied to newly generated schedules.
	EffectiveAt time.Time `json:"effective_at" validate:"required"`
	// When the override stops being applied to newly generated schedules.
	//
	// An override with no expiry keeps applying until it is deactivated or deleted.
	ExpiresAt *time.Time `json:"expires_at"`
	// Whether the override is taken into account when a schedule is generated.
	//
	// An inactive override is skipped whatever its effective window says, which is how a prepared adjustment is parked without losing it.
	Status constants.ActivationStatus `json:"status" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An adjustment to the demand a production schedule is planned against.

Sales history cannot see a large customer that is about to order, a promotion, or a line that is being discontinued. An override is how management tells the planner about it. The period names the months the demand will occur in, and only months of the coming planning year are adjusted — a period entirely in the past changes nothing, because the plan covers the year ahead. `effective_at` and `expires_at` answer a different question: how long the override is consulted at all, so an adjustment can be retired on a date without deleting it.

func (*DemandOverride) SchemaExample

func (*DemandOverride) SchemaExample() any

type DemandOverrideType

type DemandOverrideType struct {
	// Override type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=demand_override_type"`
	// The value to send as an override's `adjustment`.
	Code constants.DemandOverrideAdjustment `json:"code" validate:"required"`
	// Display name of the type.
	Name string `json:"name" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A way of adjusting planned demand.

`absolute` replaces the forecast for each month an override covers, `delta_units` adds to it, and `delta_percent` scales it. When several overrides land on the same month they are applied in that order.

func (*DemandOverrideType) SchemaExample

func (*DemandOverrideType) SchemaExample() any

type Department

type Department struct {
	// Department ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=department"`
	// Display name of the department.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// Free-form notes about the department.
	Notes *string `json:"notes"`
	// The storage location where this department operates.
	Location *Location `json:"location" expandable:"true"`
	// Scanning stations in this department.
	ScanningStations *List[ScanningStation] `json:"scanning_stations" expandable:"true"`
	// Machines in this department.
	Machines *List[Machine] `json:"machines" expandable:"true"`
	// Hourly labor rate for work done in this department, such as a changeover technician.
	//
	// Production scheduling costs changeovers with the constraint department's rate when one is set, falling back to the account-wide changeover labor rate setting.
	LaborRate *Rate `json:"labor_rate"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A functional area of a production operation, such as fabrication or packaging, that groups scanning stations and machines.

func (*Department) SchemaExample

func (*Department) SchemaExample() any

type EDIRun

type EDIRun struct {
	// EDI run ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=edi_run"`
	// Timestamp when the EDI run finished processing.
	CompletedAt time.Time `json:"completed_at" validate:"required"`
	// Whether the run finished its EDI exchange without errors.
	HasSucceeded bool `json:"has_succeeded" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A record of a single EDI processing run.

EDI runs are created automatically by the platform's EDI processing and are read-only through the API.

func (*EDIRun) SchemaExample

func (*EDIRun) SchemaExample() any

type EmailContact

type EmailContact struct {
	// Email contact ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=email_contact"`
	// Account user whose email address receives order communications.
	AccountUser *AccountUser `json:"account_user" validate:"required"`
}

A contact that receives the purchase order email when an order is issued with the `send_email` option.

func (*EmailContact) SchemaExample

func (*EmailContact) SchemaExample() any

type EmailDomain

type EmailDomain struct {
	// Email domain ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=email_domain"`
	// The fully-qualified domain name (e.g. `support.acme.com`).
	Domain string `json:"domain" validate:"required"`
	// Verification status.
	//
	// - `pending`: registered and awaiting DKIM confirmation.
	// - `verified`: DKIM confirmed; the domain can send mail.
	// - `failed`: verification could not be completed.
	//
	// Inboxes can only be created on a `verified` domain.
	Status constants.EmailDomainStatus `json:"status" validate:"required"`
	// The DKIM tokens that must be published in your DNS before the domain can be verified.
	//
	// Publish each token as a CNAME record on the domain, then call the verify action to confirm them.
	DkimTokens []string `json:"dkim_tokens"`
	// When the domain's DKIM verification was confirmed.
	VerifiedAt *time.Time `json:"verified_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A domain registered with the email bridge for sending and receiving mail.

After registration the domain starts in `pending`; publish the returned DKIM records, then poll the verify action until it flips to `verified`.

func (*EmailDomain) SchemaExample

func (*EmailDomain) SchemaExample() any

type EmailInbox

type EmailInbox struct {
	// Email inbox ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=email_inbox"`
	// Whether the inbox is currently accepting mail.
	//
	// - `active`: inbound mail is threaded into a conversation.
	// - `disabled`: the inbox stays provisioned and keeps its history, but inbound mail is dropped without being threaded.
	Status constants.EmailInboxStatus `json:"status" validate:"required"`
	// The domain this inbox belongs to.
	EmailDomain *EmailDomain `json:"email_domain" validate:"required" expandable:"true"`
	// The full inbox address (e.g. `support@acme.com`).
	Address string `json:"address" validate:"required"`
	// A forwarding address on an OpenMRP-owned domain that also routes to this inbox.
	//
	// Use this when your domain's mail is hosted elsewhere (e.g. Google Workspace, Microsoft 365) and you cannot point its MX records at OpenMRP: forward mail from `address` to this address instead, and it will still be threaded into a conversation.
	ForwardingAddress *string `json:"forwarding_address"`
	// The display name used in the `From` header of outbound mail.
	FromName *string `json:"from_name"`
	// The agent that handles mail for this inbox.
	//
	// The agent is seated on every conversation this inbox opens, so it can read the thread and draft or send replies.
	AgentConfig *AgentDefinition `json:"agent_config" expandable:"true"`
	// When the bound agent runs on incoming mail.
	//
	// - `mention`: only when the agent is @mentioned, matched against its trigger keywords.
	// - `keyword`: when the mail contains any of the configured trigger keywords.
	// - `always`: on every incoming message.
	//
	// When no policy is set the agent runs on every incoming message, since email has no reliable @mention convention.
	AgentTriggerPolicy *constants.AgentTriggerPolicy `json:"agent_trigger_policy"`
	// The keywords that decide whether the agent runs on an incoming message.
	//
	// Under the `keyword` policy a keyword matches anywhere in the message; under `mention` it only counts where it is prefixed with `@`.
	AgentTriggerKeywords []string `json:"agent_trigger_keywords"`
	// The messaging group (roster) whose members are added to every conversation this inbox opens.
	//
	// Its members join each new email thread so the team can read, edit, and approve replies alongside the bound agent. Membership is captured when the thread opens, so later edits to the group only affect conversations opened after the change.
	GroupID *string `json:"group_id"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A routable email inbox on a verified domain.

Mail sent to this address is threaded into a conversation: the first message of a thread opens a new customer case, and later messages in the same thread join the conversation it already created. Replies to the customer go back out from this address, and the bound agent — if there is one — can draft or send them.

func (*EmailInbox) SchemaExample

func (*EmailInbox) SchemaExample() any

type EmailLog

type EmailLog struct {
	// Email log ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=email_log"`
	// Whether the email was handed off to the delivery provider.
	//
	// - `sent`: the provider accepted the email for delivery. It does not confirm that the recipient's mail server accepted it.
	// - `pending`: the email was never handed off — the send attempt failed, or it was suppressed because the account is in sandbox mode.
	SendStatus constants.EmailSendStatus `json:"send_status" validate:"required"`
	// Recipient email addresses.
	Recipients []string `json:"recipients" validate:"required"`
	// Email subject line.
	Subject *string `json:"subject"`
	// Filename of the document attached to the email.
	Filename *string `json:"filename"`
	// The user or API key that sent the email.
	//
	// Emails the platform sends automatically, such as system notifications, are not attributed to an actor.
	SentBy *Actor `json:"sent_by" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A record of an email the platform sent on the account's behalf, such as an order acknowledgement or a user invitation.

An email that never reached the delivery provider is recorded here too, rather than disappearing.

func (*EmailLog) SchemaExample

func (*EmailLog) SchemaExample() any

type EmptyResource

type EmptyResource struct {
}

An empty object, used by endpoints that take no request parameters or return no response data.

func (*EmptyResource) SchemaExample

func (*EmptyResource) SchemaExample() any

type EnsureBillingCustomerResponse

type EnsureBillingCustomerResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=ensure_billing_customer_response"`
	// Stripe customer ID.
	StripeCustomerID string `json:"stripe_customer_id" validate:"required"`
	// Whether a new Stripe customer was created by this call.
	//
	// `false` means the account already had a Stripe customer, which was returned instead.
	Created bool `json:"created"`
	// ID of the account's Stripe billing profile.
	//
	// The billing profile and its billing cadence are set up when the account is first prepared for paid billing, not by creating the Stripe customer.
	BillingProfileID *string `json:"billing_profile_id"`
}

Result of ensuring a billing customer exists.

func (*EnsureBillingCustomerResponse) SchemaExample

func (*EnsureBillingCustomerResponse) SchemaExample() any

type EnterpriseInquiry

type EnterpriseInquiry struct {
	// Enterprise inquiry ID.
	//
	// Inquiries are handed off to the sales team rather than stored as a queryable resource, so this identifier is only a reference to the submission you just made.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=enterprise_inquiry"`
	// When this inquiry was submitted.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A submitted request to upgrade to an enterprise plan, routed to the sales team for follow-up.

func (*EnterpriseInquiry) SchemaExample

func (*EnterpriseInquiry) SchemaExample() any

type Entity

type Entity struct {
	// Unique identifier for the entity.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=entity"`
	// The resource kind that this entity references, as an object-type value (e.g. `user`, `account`).
	//
	// Unlike `object` — which is always `entity` — this names the underlying resource the `id` points to.
	Type constants.ObjectType `json:"type" validate:"required"`
	// Human-readable display name for the entity (e.g. a user's full name, a sales order number).
	Name *string `json:"name"`
	// Secondary human-readable identifier (e.g. email address, username, redacted API key value).
	Handle *string `json:"handle"`
}

Entity is a polymorphic reference to any resource in the system.

func NewEntity

func NewEntity(id string, entityType constants.ObjectType, name, handle *string) *Entity

NewEntity constructs an Entity reference with the canonical "entity" object type and the supplied resource kind.

func (*Entity) SchemaExample

func (*Entity) SchemaExample() any

type EstimateRateResult

type EstimateRateResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=estimate_rate_result"`
	// Estimated shipping rate.
	//
	// `0` when freight is exempt (a freight-exempt product line, a customer exempted by its own policy or by one of its groups, or a free-freight shipping term), when the free-shipping minimum order value is met for a service level the shipping term allows, or when the account has no live-rating integration or the carrier is not linked to one. When the customer's shipping term has a flat rate, the flat rate is returned instead.
	Rate float64 `json:"rate" validate:"required"`
}

The shipping rate estimated for a single carrier and service level.

func (*EstimateRateResult) SchemaExample

func (*EstimateRateResult) SchemaExample() any

type ExportInventoryChangeLogsResponse

type ExportInventoryChangeLogsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// Exported inventory change logs.
	Items []*InventoryChangeLog `json:"items" validate:"required"`
	// Total count of exported items.
	Count int64 `json:"count" validate:"required"`
}

The JSON shape of an inventory change log export.

The export endpoint itself returns an Excel file; this structure documents the equivalent JSON payload.

type ExportItem

type ExportItem struct {
	// Item ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item"`
	// Stock keeping unit code, unique within the account.
	SKU string `json:"sku" validate:"required"`
	// Item description.
	Description *string `json:"description"`
	// Free-form notes about the item.
	Notes *string `json:"notes"`
	// What kind of item this is.
	//
	// - `product`: a finished product.
	// - `material`: a raw material or component consumed in production.
	// - `part`: a part used in production.
	ItemTypeCode constants.ItemTypeCode `json:"type" validate:"required"`
	// Name of the item's category.
	CategoryName string `json:"category_name"`
	// Physical quantity currently in stock, expressed in `on_hand_unit`.
	OnHandQuantity string `json:"on_hand_quantity" format:"decimal"`
	// Unit of measure for `on_hand_quantity`.
	OnHandUnit *Unit `json:"on_hand_unit"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single row of the items export: an item together with its on-hand inventory.

type ExportItemsResponse

type ExportItemsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// Exported items.
	Items []*ExportItem `json:"items" validate:"required"`
	// Total count of exported items.
	Count int64 `json:"count"`
}

The JSON shape of the items export.

The export endpoint itself responds with an Excel file; this documents the equivalent structured payload.

type Freight

type Freight struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=freight"`
	// How freight is arranged and billed for the record.
	//
	// - `free_freight`: no shipping cost to the buyer.
	// - `billed_freight`: freight is billed to the buyer.
	//
	// Sales orders, purchase orders, and shipments do not carry a policy of their own. Freight on those records is waived when the customer's freight preferences, the customer's type group, any of its pricing groups, the customer's shipping term, or any product line on the order is `free_freight`.
	Policy *constants.FreightPolicy `json:"policy"`
	// The shipping carrier selected to fulfill the shipment.
	Carrier *Carrier `json:"carrier"`
	// The carrier service level selected for the shipment (e.g. ground, overnight).
	ServiceLevel *ServiceLevel `json:"service_level"`
	// Which party the carrier bills for the shipment.
	//
	// - `sender`: the shipper (your account) is billed.
	// - `third_party`: a third party is billed via `billing_account_number`.
	BillingType *constants.CarrierBillingType `json:"billing_type"`
	// Carrier account number to bill, used when `billing_type` is `third_party`.
	BillingAccountNumber *string `json:"billing_account_number"`
}

Freight describes the carrier selection and freight billing for a record.

It is a generic, reusable sub-resource shared by anything that carries shipping configuration — a sales order, a purchase order, or a shipment.

func (*Freight) SchemaExample

func (*Freight) SchemaExample() any

type FrequentlyOrderedProduct

type FrequentlyOrderedProduct struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=frequently_ordered_product"`
	// The item the customer ordered.
	Item *Item `json:"item" validate:"required"`
	// The unit of measure this customer orders the item in most often.
	Unit *Unit `json:"unit"`
	// Number of sales order lines on which this customer ordered the item in the unit shown.
	OrderCount int32 `json:"order_count" validate:"required"`
}

An item a customer orders regularly, derived from their sales order history.

func (*FrequentlyOrderedProduct) SchemaExample

func (*FrequentlyOrderedProduct) SchemaExample() any

type FrozenAdherence

type FrozenAdherence struct {
	// The published version this measures.
	Schedule *Entity `json:"schedule" validate:"required"`
	// Version number of that schedule.
	Version int32 `json:"version"`
	// Campaigns frozen at publish.
	FrozenLineCount int64 `json:"frozen_line_count"`
	// Units frozen at publish.
	FrozenPlannedQuantity float64 `json:"frozen_planned_quantity"`
	// Frozen campaigns that were changed after publish.
	DeviatedLines int64 `json:"deviated_lines"`
	// Campaigns added into the frozen window after publish.
	AddedLines int64 `json:"added_lines"`
	// Total absolute unit change across frozen-week deviations.
	AbsDeltaUnits float64 `json:"abs_delta_units"`
	// Campaigns the floor ran inside the frozen window that the frozen plan never called for, counted per machine-week-SKU.
	//
	// Working around a commitment breaks it as surely as editing it does, so this scores alongside the hand edits rather than beside them.
	OffPlanLines int64 `json:"off_plan_lines"`
	// Units behind those off-plan campaigns.
	OffPlanQuantity float64 `json:"off_plan_quantity"`
	// Share of frozen campaigns that survived untouched. Null when nothing was frozen.
	LineAdherencePct *float64 `json:"line_adherence_pct"`
	// Share of frozen units that survived untouched. Null when nothing was frozen.
	UnitsAdherencePct *float64 `json:"units_adherence_pct"`
	// Last day of the frozen window.
	FrozenThroughDate *time.Time `json:"frozen_through_at"`
}

How well a published commitment survived the week it covered.

type FulfillmentRecommendation

type FulfillmentRecommendation struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=fulfillment_recommendation"`
	// The item the advice is about.
	Item *Entity `json:"item" validate:"required"`
	// SKU of that item.
	SKU string `json:"sku"`
	// The product line it sells under, when it sells under one.
	ProductLine *Entity `json:"product_line"`
	// How the item is planned today.
	CurrentPolicy constants.FulfillmentPolicy `json:"current_policy" validate:"required"`
	// How the engine thinks it should be planned.
	RecommendedPolicy constants.FulfillmentPolicy `json:"recommended_policy" validate:"required"`
	// Whether adopting the recommendation would change anything.
	Changes bool `json:"changes"`
	// The rule that decided.
	//
	// - `lead_time_infeasible`: customers are promised less time than production needs, so the stock has to exist before the order does. Checked first, because producing to order is not possible rather than not preferred.
	// - `no_recent_demand`: nothing has sold for long enough that a buffer is dead stock.
	// - `single_customer`: effectively one customer buys it, and that customer is served to order.
	// - `lumpy_demand`: demand arrives rarely and in wildly different sizes, which is the shape a safety stock sizes worst.
	// - `slow_moving_high_value`: expensive units, few sold — the buffer costs more than the service it buys.
	// - `steady_demand`: regular enough to forecast, which is what stocking is for.
	Reason constants.FulfillmentRecommendationReason `json:"reason" validate:"required"`
	// Months observed divided by months with demand: 1 means it sells every month, 3 means once a quarter on average.
	//
	// Measured on monthly buckets, which cannot distinguish two orders in one month from one.
	AverageDemandInterval float64 `json:"average_demand_interval"`
	// Squared coefficient of variation over the months that had demand, measuring how uneven the quantities are.
	CoefficientOfVariation float64 `json:"coefficient_of_variation"`
	// The largest customer's share of this item's demand, as a percentage.
	TopCustomerSharePct float64 `json:"top_customer_share_pct"`
	// Name of that customer.
	TopCustomerName *string `json:"top_customer_name"`
	// Calendar days customers are promised on average, weighted by how much each buys.
	DemandWeightedLeadTimeDays float64 `json:"demand_weighted_lead_time_days"`
	// Annual cost of goods for this item: demand times unit cost.
	AnnualCOGS float64 `json:"annual_cogs"`
	// Months since anything last sold, capped at the observation window.
	MonthsSinceLastSale int32 `json:"months_since_last_sale"`
	// Percentage of demand from customers whose own stated policy disagrees with the recommendation.
	//
	// A policy is resolved per SKU, so an item sold to both a stocking distributor and a contract customer gets one answer either way. A high share here is the signal that the single answer is uncomfortable.
	MixedStreamSharePct float64 `json:"mixed_stream_share_pct"`
}

The engine's advice on how one SKU should be produced, with the measurements behind it.

func (*FulfillmentRecommendation) SchemaExample

func (*FulfillmentRecommendation) SchemaExample() any

type Geolocation

type Geolocation struct {
	// Geolocation ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=geolocation"`
	// First line of the street address.
	StreetLine1 *string `json:"street_line_1"`
	// Second line of the street address.
	StreetLine2 *string `json:"street_line_2"`
	// City or locality.
	Locality *string `json:"locality"`
	// State or administrative area.
	State *string `json:"state"`
	// Postal or ZIP code.
	PostalCode *string `json:"postal_code"`
	// Two-letter country code.
	Country string `json:"country" validate:"required"`
}

The street-level location details of an address.

type Healthcheck

type Healthcheck struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=healthcheck"`
	// Current operational status of the API.
	//
	// Always `healthy` on a successful response: no other value is ever reported, so treat the HTTP status code, not this field, as the real signal.
	Status string `json:"status" validate:"required"`
}

A liveness report for the API.

func (*Healthcheck) SchemaExample

func (*Healthcheck) SchemaExample() any

type HubspotCompanyCandidate

type HubspotCompanyCandidate struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=hubspot_company_candidate"`
	// HubSpot company id.
	HubspotID string `json:"hubspot_id" validate:"required"`
	// HubSpot company name.
	Name string `json:"name"`
	// HubSpot company domain.
	Domain string `json:"domain"`
}

A possible HubSpot company match for a customer.

type HubspotCompanyReview

type HubspotCompanyReview struct {
	// Review ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=hubspot_company_review"`
	// The sync job this review belongs to.
	Job *HubspotSyncJob `json:"job" validate:"required"`
	// The OpenMRP customer account being matched.
	Customer *Customer `json:"customer" validate:"required"`
	// The customer's email address as it stood when the review was raised.
	//
	// Snapshotted on the review rather than read from the customer, because matching a company means comparing what OpenMRP held at match time against what HubSpot holds — a later edit to the customer must not silently change what a reviewer is deciding on.
	CustomerEmail *string `json:"customer_email"`
	// The customer's website as it stood when the review was raised — the field the domain match was derived from.
	CustomerURL *string `json:"customer_url"`
	// Candidate HubSpot companies the customer might match.
	//
	// These are the matches that made the customer ambiguous: either several HubSpot companies share its web domain, or it matched only by company name.
	Candidates *List[HubspotCompanyCandidate] `json:"candidates"`
	// Resolution status.
	//
	// - `pending`: awaiting a decision.
	// - `resolved`: linked or marked create-new.
	// - `skipped`: the customer and its orders are left out of the sync entirely.
	Status constants.HubspotCompanyReviewStatus `json:"status" validate:"required"`
	// How a resolved review was handled.
	//
	// - `link`: the customer was matched to an existing HubSpot company (see `resolved_hubspot_id`).
	// - `create_new`: a new HubSpot company will be created for the customer.
	Resolution *string `json:"resolution"`
	// The HubSpot company id this customer was linked to (when `resolution` is `link`).
	ResolvedHubspotID *string `json:"resolved_hubspot_id"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

One customer that needs a human company-match decision before the backfill can write to HubSpot.

func (*HubspotCompanyReview) SchemaExample

func (*HubspotCompanyReview) SchemaExample() any

type HubspotSyncJob

type HubspotSyncJob struct {
	// HubSpot sync job ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=hubspot_sync_job"`
	// Lifecycle status of the job.
	//
	// - `previewing`: matching customers to HubSpot companies; nothing is written to HubSpot yet.
	// - `review_pending`: awaiting resolution of ambiguous company matches and confirmation to execute.
	// - `executing`: writing companies, contacts, and deals to HubSpot.
	// - `completed`: the write phase finished successfully.
	// - `failed`: stopped on an error, or was cancelled (see `last_error`).
	//
	// A run that failed while writing to HubSpot can be executed again to resume where it stopped; a run that failed before its preview finished cannot, and a new sync has to be started instead. Only one sync per account can be `previewing`, `review_pending`, or `executing` at a time.
	Status constants.HubspotSyncJobStatus `json:"status" validate:"required"`
	// Orders placed on or after this cutoff are backfilled as Closed-Won deals.
	//
	// Only the UTC date is used, so the whole of that day is included regardless of the time of day given. When unset, no historical deals are created; companies and contacts still sync.
	GoLiveCutoffAt *time.Time `json:"go_live_cutoff_at"`
	// Dry-run report of what the execute phase will do.
	//
	// Populated once the read-only preview pass finishes.
	Report *HubspotSyncReport `json:"report"`
	// Explanation of why the run stopped.
	//
	// A cancelled sync records who cancelled it here.
	LastError *string `json:"last_error"`
	// When the execute phase started.
	StartedAt *time.Time `json:"started_at"`
	// When the job finished.
	CompletedAt *time.Time `json:"completed_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A one-time run that brings the account's existing customers, contacts, and orders into HubSpot.

A sync runs in two phases: a read-only preview that matches customers to HubSpot companies and produces a report, then an execute phase that does the writing once any ambiguous matches have been resolved.

func (*HubspotSyncJob) SchemaExample

func (*HubspotSyncJob) SchemaExample() any

type HubspotSyncRecord

type HubspotSyncRecord struct {
	// Sync record ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=hubspot_sync_record"`
	// The kind of OpenMRP record that was synced.
	//
	// - `customer`: a customer, mapped to a HubSpot company.
	// - `contact`: a customer's primary contact person, mapped to a HubSpot contact.
	// - `deal`: a sales order, mapped to a HubSpot deal.
	AugnoType constants.HubspotSyncRecordAugnoType `json:"augno_type" validate:"required"`
	// ID of the OpenMRP record that was synced.
	//
	// A `contact` record carries the customer's id, because a customer keeps a single primary contact in HubSpot.
	AugnoID string `json:"augno_id" validate:"required"`
	// Name of the OpenMRP record that was synced.
	//
	// Empty when the record has since been deleted.
	AugnoName string `json:"augno_name"`
	// The kind of HubSpot object it maps to.
	//
	// These are HubSpot's own object-type names, so they can be used directly against HubSpot's API.
	HubspotType constants.HubspotSyncRecordHubspotType `json:"hubspot_type" validate:"required"`
	// ID of the HubSpot object it maps to.
	HubspotID string `json:"hubspot_id" validate:"required"`
	// When the sync last updated this mapping.
	LastSyncedAt *time.Time `json:"last_synced_at"`
	// Why the last attempt to sync this record failed.
	LastError *string `json:"last_error"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

One OpenMRP record and the HubSpot object the sync has mapped it to.

func (*HubspotSyncRecord) SchemaExample

func (*HubspotSyncRecord) SchemaExample() any

type HubspotSyncReport

type HubspotSyncReport struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=hubspot_sync_report"`
	// Total customers considered.
	CustomersTotal int `json:"customers_total"`
	// Customers auto-linked to a HubSpot company by a unique domain match.
	CompaniesConfident int `json:"companies_confident"`
	// Customers queued for human company-match review.
	CompaniesAmbiguous int `json:"companies_ambiguous"`
	// Customers with no match — a new company will be created.
	CompaniesToCreate int `json:"companies_to_create"`
	// Customers with an email address, each of which becomes a HubSpot contact.
	//
	// A customer with no email address gets no contact, since HubSpot matches contacts by email.
	ContactsWithEmail int `json:"contacts_with_email"`
}

A tally of what the execute phase would do, produced by the read-only preview pass.

type InventoryChangeLog

type InventoryChangeLog struct {
	// Inventory change log ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=inventory_change_log"`
	// Action that produced this inventory change.
	//
	// - `scan`: change driven by a scan, typically a production step.
	// - `user_action`: change made manually by a user.
	// - `system_action`: change made automatically by the system.
	// - `user_correction`: manual adjustment a user made to correct an inventory discrepancy.
	ActionTypeCode constants.InventoryActionType `json:"action_type" validate:"required"`
	// Amount of inventory this change applied.
	//
	// The value is signed: positive values increased on-hand inventory, negative values decreased it.
	Quantity *Quantity `json:"quantity" expandable:"true"`
	// Item affected by this change.
	Item *Item `json:"item" expandable:"true"`
	// The user who made this change.
	ResponsibleUser *User `json:"responsible_user" expandable:"true"`
	// The scanning station this change came from.
	//
	// Present only for changes recorded on the production floor, which have an action type of `scan`.
	ResponsibleScanningStation *ScanningStation `json:"responsible_scanning_station" expandable:"true"`
	// Timestamp when this change was recorded.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when this record was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A record of a single change to an item's on-hand inventory.

Every inventory movement — production scans, manual user adjustments, and automatic system actions — produces one entry, forming an audit trail of how on-hand quantities changed over time.

func (*InventoryChangeLog) SchemaExample

func (*InventoryChangeLog) SchemaExample() any

type InventoryItem

type InventoryItem struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=inventory_item"`
	// The item this inventory entry reports on.
	Item Item `json:"item" validate:"required"`
	// Current on-hand quantity of the item.
	//
	// On-hand is the stock from available receipts less anything already allocated, measured in the base unit of the item's category. Items with no recorded inventory report zero.
	Quantity *Quantity `json:"quantity" validate:"required"`
}

An item together with its current on-hand inventory quantity.

func (*InventoryItem) SchemaExample

func (*InventoryItem) SchemaExample() any

type InventoryReceiptSummaryEntry

type InventoryReceiptSummaryEntry struct {
	// The item information.
	Item AnalyticsItem `json:"item" validate:"required"`
	// The location information.
	Location *Entity `json:"location"`
	// The lot information.
	Lot *AnalyticsLot `json:"lot"`
	// The owner account.
	OwnerAccount *Entity `json:"owner_account" validate:"required"`
	// The holder account.
	HolderAccount *Entity `json:"holder_account" validate:"required"`
	// The remaining quantity.
	RemainingQuantity *Quantity `json:"remaining_quantity" validate:"required"`
	// The weighted average unit cost.
	WeightedAverageUnitCost AnalyticsRate `json:"weighted_average_unit_cost" validate:"required"`
	// The inventory value.
	InventoryValue *Quantity `json:"inventory_value"`
	// The date of the oldest receipt.
	OldestReceiptAt *time.Time `json:"oldest_receipt_at"`
	// The date of the newest receipt.
	NewestReceiptAt *time.Time `json:"newest_receipt_at"`
}

InventoryReceiptSummaryEntry represents a summary of inventory receipts.

type Invoice

type Invoice struct {
	// Invoice ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice"`
	// Invoice number.
	Number string `json:"number" validate:"required"`
	// Note attached to the invoice.
	Note *string `json:"note"`
	// Customer associated with this invoice.
	Customer *Customer `json:"customer" expandable:"true"`
	// Sales order this invoice bills against.
	Order *SalesOrder `json:"order" expandable:"true"`
	// Shipment whose shipped goods this invoice bills for.
	Shipment *Shipment `json:"shipment" expandable:"true"`
	// Number of line items on the invoice.
	LineCount int32 `json:"line_count"`
	// Address the invoice is billed to.
	BillingAddress *Address `json:"billing_address" expandable:"true"`
	// Priority level carried onto the invoice from the order it bills.
	PriorityCode constants.PriorityCode `json:"priority" validate:"required"`
	// Payment term governing when the invoice is due.
	PaymentTerm *PaymentTerm `json:"payment_term" expandable:"true"`
	// Payment status of the invoice.
	//
	// Reported from the invoice's stored paid-in-full and overpaid flags, so marking an invoice paid through Update Invoice changes this value even when no payment has been allocated.
	//
	// - `unpaid`: the invoice is not marked paid in full, which includes invoices carrying partial payments.
	// - `paid`: the invoice is marked paid in full.
	// - `overpaid`: the payments applied to the invoice exceed the invoiced amount.
	// - `partially_paid`: not currently returned; an invoice carrying a partial payment reports `unpaid`.
	PaymentStatus constants.InvoicePaymentStatus `json:"payment_status" validate:"required"`
	// Whether the invoice has been transmitted to the customer via EDI.
	//
	// Nothing in the platform sets this flag; it is recorded through Update Invoice once the invoice has been transmitted elsewhere.
	IsEdiSent bool `json:"is_edi_sent"`
	// Whether the invoice has been sent to the customer.
	//
	// Set automatically when the invoice is emailed through Email Record, and can also be set directly through Update Invoice.
	HasBeenSent bool `json:"has_been_sent"`
	// Total amount billed by this invoice.
	//
	// The sum across the invoice's lines of the billed quantity multiplied by the unit price on the sales order line.
	TotalInvoiced string `json:"total_invoiced" validate:"required" format:"decimal"`
	// Whether the sales order behind this invoice has at least one contact set to receive invoice emails.
	//
	// These contacts are the recipients used by Email Record. When no contact is configured, emailing the invoice marks it sent without delivering anything.
	AcceptsInvoiceEmails bool `json:"accepts_invoice_emails"`
	// Whether the billed customer is configured to exchange documents via EDI.
	CustomerIsEdiEnabled bool `json:"customer_is_edi_enabled"`
	// Line items in this invoice.
	Lines *List[InvoiceLine] `json:"lines" expandable:"true"`
	// Transaction allocations applied against this invoice.
	//
	// These are the payments and credits recorded against the invoice; recording a settlement refreshes `payment_status` from them, while Update Invoice can set that status directly.
	Allocations *List[InvoiceAllocation] `json:"allocations" expandable:"true"`
	// Records this invoice bills against — its order and shipment.
	Related *InvoiceRelated `json:"related"`
	// Timestamp when the invoice was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when the invoice was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An invoice billing a customer for goods shipped against a sales order.

func (*Invoice) SchemaExample

func (*Invoice) SchemaExample() any

type InvoiceAllocation

type InvoiceAllocation struct {
	// Allocation ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice_allocation"`
	// Transaction whose amount is being applied to the invoice.
	Transaction *TransactionDetail `json:"transaction" expandable:"true"`
	// Portion of the transaction applied to the invoice by this allocation.
	Amount *Quantity `json:"amount" validate:"required"`
	// Note about this allocation.
	Note *string `json:"note"`
	// Timestamp when the allocation was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when the allocation was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A portion of a transaction applied against an invoice.

Allocations connect transactions (payments, rebates, adjustments, and credit memos) to the invoices they pay down. Recording a settlement refreshes the invoice's paid-in-full and overpaid state — and so its `payment_status` — from every allocation against it, but that state can also be set directly through Update Invoice.

func (*InvoiceAllocation) SchemaExample

func (*InvoiceAllocation) SchemaExample() any

type InvoiceAllocationEntry

type InvoiceAllocationEntry struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice_allocation_entry"`
	// Invoice number.
	InvoiceNumber string `json:"invoice_number" validate:"required"`
	// Allocated amount as a decimal string.
	Amount string `json:"amount" validate:"required"`
}

Allocation of a credit against an invoice.

type InvoiceForPayment

type InvoiceForPayment struct {
	// Invoice ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice_for_payment"`
	// Invoice number.
	Number string `json:"number" validate:"required"`
	// Purchase order number the customer supplied for the underlying order.
	CustomerPO *string `json:"customer_po"`
	// Customer associated with this invoice.
	Customer *Customer `json:"customer" expandable:"true"`
	// Whether the billed customer is a child of a parent account.
	//
	// When `true`, `parent_account` identifies that parent.
	IsParentAccount bool `json:"is_parent_account"`
	// The customer's parent account, when the billed customer is a child account.
	ParentAccount *Account `json:"parent_account" expandable:"true"`
	// Whether the billed customer's payment term is prepaid.
	IsPrepaid bool `json:"is_prepaid"`
	// Address the invoice is billed to.
	BillingAddress *Address `json:"billing_address" expandable:"true"`
	// Total amount billed by this invoice.
	InvoiceTotal string `json:"invoice_total" validate:"required" format:"decimal"`
	// Whether the invoice has been paid in full.
	//
	// Always `false` here, because only invoices that still owe a balance are listed.
	IsPaidInFull bool `json:"is_paid_in_full"`
	// Transaction allocations already applied against this invoice.
	Allocations *List[InvoiceAllocation] `json:"allocations" expandable:"true"`
	// Timestamp when the invoice was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when the invoice was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A payment-oriented view of an invoice, as returned by List Customer Invoices.

Carries the fields needed to apply a customer payment: the invoice total, the allocations already applied, and the billing relationship of the customer being charged. Only invoices that still owe a balance are represented.

func (*InvoiceForPayment) SchemaExample

func (*InvoiceForPayment) SchemaExample() any

type InvoiceLine

type InvoiceLine struct {
	// Invoice line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice_line"`
	// Quantity billed on this line.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// Price per unit billed on this line, carried over from the sales order line.
	UnitPrice *Rate `json:"unit_price" validate:"required"`
	// Sales order line this invoice line bills against.
	//
	// Expand with `lines.order_line` for the sold `product_sku` and the ordered quantities, and with `lines.order_line.product` for the product itself. To show only the SKU, read `item` below instead — it needs no expansion.
	OrderLine *SalesOrderLine `json:"order_line" expandable:"true"`
	// What this line bills, as recorded on the originating sales order line.
	Item *Item `json:"item" expandable:"true"`
	// Timestamp when the line was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when the line was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Line item in an invoice.

func (*InvoiceLine) SchemaExample

func (*InvoiceLine) SchemaExample() any

type InvoiceRelated

type InvoiceRelated struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=invoice_related"`
	// The sales order this invoice bills against.
	SalesOrder *Record `json:"sales_order" expandable:"true"`
	// The shipment whose shipping raised this invoice.
	Shipment *Record `json:"shipment" expandable:"true"`
}

Groups the records an invoice bills against: the order it belongs to and the shipment that raised it. Returned only when at least one member has been expanded.

type Item

type Item struct {
	// Item ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item"`
	// Stock keeping unit code, unique within the account.
	SKU string `json:"sku" validate:"required"`
	// Item description.
	Description *string `json:"description"`
	// Free-form notes about the item.
	Notes *string `json:"notes"`
	// What kind of item this is.
	//
	// - `product`: a finished product.
	// - `material`: a raw material or component consumed in production.
	// - `part`: a part used in production.
	ItemTypeCode constants.ItemTypeCode `json:"type" validate:"required"`
	// The category this item belongs to.
	//
	// The category's unit group determines the base unit the item's rates (`unit_value`, `unit_cost`, `burn_rate`) are expressed in.
	Category *ItemCategory `json:"category" expandable:"true"`
	// Selling value per unit, expressed as a rate (e.g. `$25.50 / kg`).
	UnitValue *Rate `json:"unit_value" expandable:"true"`
	// Cost per unit, expressed as a rate (e.g. `$10.00 / kg`).
	//
	// For items a production flow produces, retrieving the item's costs recomputes this from the flow and stores the result here, so it can change without the item having been edited.
	UnitCost *Rate `json:"unit_cost" expandable:"true"`
	// Rate at which this item is consumed in production, expressed as a quantity over time (e.g. `100 kg / hr`).
	BurnRate *Rate `json:"burn_rate" expandable:"true"`
	// Attributes assigned to this item.
	Attributes *List[Attribute] `json:"attributes" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An entry in your catalog: something you sell, consume, or build with.

func (*Item) SchemaExample

func (*Item) SchemaExample() any

type ItemCategory

type ItemCategory struct {
	// Item category ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item_category"`
	// Display name of the item category.
	Name string `json:"name" validate:"required"`
	// Free-form notes about the item category.
	Notes *string `json:"notes"`
	// What kind of items this category groups.
	//
	// - `material_category`: groups raw materials and components (items of type `material`).
	// - `product_category`: groups finished products and parts (items of type `product` or `part`).
	//
	// An item can only be assigned to a category whose type matches the item's `type`, and the category's type is fixed at creation.
	Type constants.ItemCategoryType `json:"type" validate:"required"`
	// Provenance of the item category.
	//
	// System-owned categories are platform-provided defaults shared across all accounts and cannot be updated or deleted; account-owned categories are custom to your account.
	Owner *Owner `json:"owner" expandable:"true"`
	// Properties associated with this item category, such as `Color` or `Size`.
	//
	// These describe the dimensions along which items in the category vary, and are also what the customer-facing catalog shows for the category. Attach and detach them with the Add Item Category Property and Remove Item Category Property endpoints.
	Properties *List[Property] `json:"properties" expandable:"true"`
	// Unit group associated with this item category.
	//
	// Items in this category are measured in units belonging to this group, and can only be ordered in those units unless the item's product line defines its own unit group, which takes precedence.
	UnitGroup *UnitGroup `json:"unit_group" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A grouping of related catalog items that defines the unit group and properties available to the items within it.

func (*ItemCategory) SchemaExample

func (*ItemCategory) SchemaExample() any

type ItemCosts

type ItemCosts struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item"`
	// Cost of materials consumed to produce one unit of the item, including the portion consumed as waste.
	//
	// Counts raw materials only. Parts and sub-products consumed along the way are not priced here; their labor, overhead, and material costs are already included through the steps that produce them.
	DirectMaterialCost string `json:"direct_material_cost" validate:"required" format:"decimal"`
	// Labor cost to produce one unit of the item.
	//
	// Based on each step's labor time after its leveling factor and allowances are applied, priced at that step's labor rate.
	DirectLaborCost string `json:"direct_labor_cost" validate:"required" format:"decimal"`
	// Overhead cost allocated to one unit of the item.
	//
	// Applied over the same corrected labor time as `direct_labor_cost`, priced at each step's overhead rate.
	OverheadCost string `json:"overhead_cost" validate:"required" format:"decimal"`
	// Total cost to produce one unit of the item (material + labor + overhead).
	TotalCost string `json:"total_cost" validate:"required" format:"decimal"`
	// The unit of the item the per-unit costs are expressed against.
	Unit *Unit `json:"unit"`
}

The per-unit production cost breakdown for an item, computed from the production flow that produces it.

func (*ItemCosts) SchemaExample

func (*ItemCosts) SchemaExample() any

type ItemInventory

type ItemInventory struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item_inventory"`
	// Physical quantity currently in stock.
	OnHand *ComputedQuantity `json:"on_hand" expandable:"true"`
	// Quantity committed to existing orders and therefore not free to allocate.
	Reserved *ComputedQuantity `json:"reserved" expandable:"true"`
	// Quantity free to commit to new orders, i.e. on-hand minus reserved minus short.
	AvailableToPromise *ComputedQuantity `json:"available_to_promise" expandable:"true"`
	// Quantity by which demand exceeds available supply (the unfulfillable shortfall).
	Short *ComputedQuantity `json:"short" expandable:"true"`
}

The stock position for an item: what is in stock, what is already committed, and what is still free to sell.

All four quantities are reported in the same unit — the base unit of the item's category. Derived figures, not stored rows: each is netted out of the ledger at read time, so none of them carries a quantity id.

func (*ItemInventory) SchemaExample

func (*ItemInventory) SchemaExample() any

type ItemLotDefault

type ItemLotDefault struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item_lot_default"`
	// The item the lot was resolved for.
	Item *Entity `json:"item" validate:"required"`
	// Units in one lot.
	//
	// `0` means the item has no lot convention, not that its lot is zero.
	Quantity float64 `json:"quantity"`
	// The unit the lot is counted in.
	//
	// A lot that came from a product line is counted in that line's unit; otherwise the item's own base unit is used. The unit is returned even when no rule supplies a lot size, so a form can show what is being counted with the quantity left blank.
	Unit *Unit `json:"unit" expandable:"true"`
	// Which rule in the chain produced this lot.
	//
	// - `item_override`: a lot size set on the item itself.
	// - `product_line`: the convention of the line the item sells under.
	// - `downstream_product_line`: inherited from the finished goods this item becomes, for intermediates that are not themselves sold.
	// - `account_default`: the account-wide fallback.
	//
	// Empty when no rule in the chain supplies a lot, which is the same case `quantity` reports as `0`.
	Source constants.ItemLotSource `json:"source" validate:"required"`
	// The product line the convention came from.
	//
	// Present only when `source` is `product_line` or `downstream_product_line`; an item override and the account default do not come from a line.
	ProductLine *Entity `json:"product_line"`
}

The lot an item is made in — how many, counted in what.

A lot is the quantity production is issued in: a doff, a pallet, a batch. The unit is what makes it meaningful, since 60 pairs and 60 eaches are different lots.

func (*ItemLotDefault) SchemaExample

func (*ItemLotDefault) SchemaExample() any

type ItemTrendPoint

type ItemTrendPoint struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item_trend_point"`
	// Timestamp of the data point.
	OccurredAt time.Time `json:"occurred_at" validate:"required"`
	// Recorded value of the trend metric at `occurred_at`.
	Value string `json:"value" validate:"required" format:"decimal"`
}

A single measurement in an item's trend series.

type ItemTrends

type ItemTrends struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=item"`
	// The trend type that was requested.
	TrendType constants.ItemTrendType `json:"trend_type" validate:"required"`
	// Trend data points, oldest first.
	//
	// At most one point is returned per calendar day: when several measurements were recorded on the same day, the earliest one is kept.
	Points *List[ItemTrendPoint] `json:"points" validate:"required"`
}

Historical trend data for an item, as a time-ordered series of measurements.

func (*ItemTrends) SchemaExample

func (*ItemTrends) SchemaExample() any

type Job

type Job struct {
	// Job ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=job"`
	// The kind of work the job carries out.
	Type constants.JobType `json:"type" validate:"required"`
	// The kind of resource the job operates on, as an object-type value (e.g. `product`).
	//
	// `type` names the verb — what the job does — and this names the subject, so a job that produced no results still says what it was for.
	ResourceType *constants.ObjectType `json:"resource_type"`
	// How far the job has got.
	//
	// `completed` means the work was processed, not that every row succeeded — read each entry's own `status` in `results`.
	Status constants.JobStatus `json:"status" validate:"required"`
	// The actor who requested the work.
	CreatedBy *Actor `json:"created_by" expandable:"true"`
	// One entry per submitted row, saying what became of it. A bulk create records these when it accepts the request, so they stay provisional until `status` is `completed`.
	//
	// `page_info.has_next_page` is true when the job produced more rows than it records.
	Results *List[JobResult] `json:"results"`
	// The failure that sank the job as a whole, in the same shape a synchronous error
	// response carries.
	//
	// A row rejected on its own merits reports its failure on its own entry in `results` instead, so this stays null even when some rows failed.
	Error *apierror.ResponseError `json:"error"`
	// Where a completed export job's file can be downloaded.
	//
	// Null on every other job, and returned only to a caller asking for JSON — otherwise retrieving the job redirects to it.
	Export *JobExport `json:"export"`
	// When the job began executing.
	StartedAt *time.Time `json:"started_at"`
	// When the job finished processing, whether or not every row succeeded.
	CompletedAt *time.Time `json:"completed_at"`
	// When the most recent attempt failed. A retry that succeeds leaves this alongside `completed_at`.
	FailedAt *time.Time `json:"failed_at"`
	// When the job was cancelled.
	CancelledAt *time.Time `json:"cancelled_at"`
	// When the job was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When the job was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Records a piece of work the API accepted and carries out asynchronously. Endpoints answering `202 Accepted` point at one with a `Location` header; poll it for the outcome.

func (*Job) SchemaExample

func (*Job) SchemaExample() any

type JobExport

type JobExport struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=job_export"`
	// Presigned link to the file, valid for five minutes.
	//
	// If the link has expired, read the job again for a fresh one.
	URL string `json:"url" validate:"required" sensitive:"true"`
}

Points a completed export job at the file it produced.

func NewJobExport

func NewJobExport(url string) *JobExport

NewJobExport builds the download reference a completed export job carries.

func (*JobExport) SchemaExample

func (*JobExport) SchemaExample() any

type JobResult

type JobResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=job_result"`
	// Zero-based row of the request this result names.
	Index int `json:"index"`
	// What became of the row.
	//
	// - `created`: the row produced a new resource.
	// - `updated`: the row updated an existing resource.
	// - `failed`: the row was rejected and wrote nothing.
	Status constants.JobResultStatus `json:"status" validate:"required"`
	// The resource the row produced. Null when the row failed.
	Resource *Entity `json:"resource"`
	// Resources produced as a side effect to the row's primary operation.
	//
	// For example, when creating a production run, several batch records may also be created.
	SubResources *List[Entity] `json:"sub_resources"`
	// Why the row was rejected, in the same shape a synchronous error response carries.
	//
	// Null unless `status` is `failed`.
	Error *apierror.ResponseError `json:"error"`
}

Accounts for one row of the request: the resource it produced, or the error it was rejected with. Every submitted row lands in exactly one of these once the job completes.

func (*JobResult) SchemaExample

func (*JobResult) SchemaExample() any

type List

type List[T any] struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=list"`
	// Pagination metadata.
	PageInfo PageInfo `json:"page_info"`
	// Resources in this page.
	Data []T `json:"data" validate:"required"`
}

A single page of resources, together with the metadata needed to page through the rest of the result set.

func NewList

func NewList[T any](data []T, pageInfo PageInfo) *List[T]

NewList creates a new List of resources.

type Location

type Location struct {
	// Location ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=location"`
	// Display name of the location.
	Name string `json:"name" validate:"required"`
	// This location's level in the storage hierarchy.
	//
	// The levels run from largest to smallest: `building`, `section`, `aisle`, `rack`, `shelf`, `bin`. They are descriptive labels rather than a rule — a location's parent is not required to be the next level up.
	TypeCode constants.LocationTypeCode `json:"type" validate:"required"`
	// The location directly above this one in the storage hierarchy.
	//
	// Absent for top-level locations.
	Parent *Location `json:"parent" expandable:"true"`
	// The locations directly below this one in the storage hierarchy.
	Children *List[Location] `json:"children" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at"`
	// Last-updated timestamp.
	UpdatedAt time.Time `json:"updated_at"`
}

A physical storage location, such as a warehouse, aisle, or bin, arranged in a parent-child hierarchy.

func (*Location) SchemaExample

func (*Location) SchemaExample() any

type LocationType

type LocationType struct {
	// Location type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=location_type"`
	// The level of the storage hierarchy this type represents.
	//
	// The levels run from largest to smallest: `building`, `section`, `aisle`, `rack`, `shelf`, `bin`.
	Code constants.LocationTypeCode `json:"code" validate:"required"`
	// Display name of the location type.
	Name string `json:"name" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at"`
	// Last-updated timestamp.
	UpdatedAt time.Time `json:"updated_at"`
}

A level in the storage location hierarchy, such as a building or a bin.

Location types are platform-defined and identical for every account: you choose one when creating a location, but you cannot add or modify the types themselves.

func (*LocationType) SchemaExample

func (*LocationType) SchemaExample() any

type Lot

type Lot struct {
	// Lot ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=lot"`
	// Lot number identifying the batch.
	//
	// Unique per item within the account: stocking goods under a lot number that already exists for that item records them into the existing lot rather than creating a new one.
	LotNumber string `json:"lot_number" validate:"required"`
}

An inventory lot — a batch of an item received together and tracked under a single lot number.

type Machine

type Machine struct {
	// Machine ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=machine"`
	// Display name of the machine.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// Serial number of the machine.
	SerialNumber string `json:"serial_number" validate:"required"`
	// Free-form notes about the machine.
	Notes *string `json:"notes"`
	// The department this machine belongs to.
	//
	// Set when the machine is created; a machine cannot be moved to another department afterwards.
	Department *Department `json:"department" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A piece of production equipment, such as a CNC router or press, assigned to a department.

func (*Machine) SchemaExample

func (*Machine) SchemaExample() any

type MachineCampaign

type MachineCampaign struct {
	// The schedule line this campaign came from.
	ScheduleLine *Entity `json:"schedule_line" validate:"required"`
	// The item being made.
	Item *Entity `json:"item" validate:"required"`
	// SKU of the item.
	SKU string `json:"sku" validate:"required"`
	// First day of the week the campaign belongs to.
	WeekStartDate time.Time `json:"week_starts_at" validate:"required"`
	// Zero-based week offset from the start of the horizon.
	WeekIndex int32 `json:"week_index"`
	// Quantity the plan asked for.
	PlannedQuantity float64 `json:"planned_quantity"`
	// Quantity the floor has scanned so far.
	ScannedQuantity float64 `json:"scanned_quantity"`
	// Quantity still to make.
	//
	// Never negative: an over-run shows up in `scanned_quantity` rather than as negative remaining work.
	RemainingQuantity float64 `json:"remaining_quantity"`
	// Unit the quantities are counted in.
	Unit *string `json:"unit"`
	// Batches issued to the floor for this campaign.
	ReleasedBatchCount int64 `json:"released_batch_count"`
	// Batches of this campaign the floor has scanned.
	ScannedBatchCount int64 `json:"scanned_batch_count"`
	// Machine hours the plan allocates to the campaign.
	PlannedRunHours float64 `json:"planned_run_hours"`
	// Where the campaign is in its lifecycle.
	//
	// - `planned`: scheduled, but not yet released to the floor.
	// - `released`: issued to the floor as a production run, so batches can be scanned against it.
	// - `in_progress`: being run.
	// - `complete`: finished.
	// - `cancelled`: will not be run.
	Status constants.ProductionScheduleLineStatus `json:"status" validate:"required"`
	// The run carrying this campaign's work, once its week has been released.
	ProductionRun *Entity `json:"production_run"`
}

One campaign on a machine, with how far through it the floor is.

A campaign is one item scheduled to run on one machine for one week. Progress is taken from the batches the floor has scanned against it rather than reported by hand, so it advances on its own as a shift runs.

type MachineDowntimeEvent

type MachineDowntimeEvent struct {
	// Downtime event ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=machine_downtime_event"`
	// The machine that stopped.
	Machine *Machine `json:"machine" expandable:"true"`
	// The department the machine belongs to, captured when the event was logged.
	Department *Department `json:"department" expandable:"true"`
	// Why the machine stopped.
	Reason *MachineDowntimeReasonSummary `json:"reason" validate:"required"`
	// When the machine stopped.
	StartedAt time.Time `json:"started_at" validate:"required"`
	// When the machine started running again.
	EndedAt *time.Time `json:"ended_at"`
	// How long the machine was down, in seconds.
	//
	// Calculated when the event is closed, and recalculated whenever its start or end time changes.
	DurationSeconds *int32 `json:"duration_seconds"`
	// The business day the stoppage is counted against.
	//
	// Taken from the calendar date of `started_at`, so correcting the start time can move the stoppage onto a different day's totals.
	ShiftDate time.Time `json:"shift_at" validate:"required"`
	// The shift the stoppage is counted against.
	ShiftCode *string `json:"shift_code"`
	// What the machine was running when it stopped.
	Item *Item `json:"item" expandable:"true"`
	// The production run in progress when the machine stopped.
	ProductionRun *Entity `json:"production_run"`
	// The batch in progress when the machine stopped.
	Batch *Entity `json:"batch"`
	// The scheduled campaign the stoppage interrupted.
	ScheduleLine *Entity `json:"schedule_line"`
	// Free-form notes about the stoppage.
	Note *string `json:"note"`
	// The actor that logged the event — a user, API key, or agent.
	//
	// Recorded from the credentials that created the event and not settable by the caller.
	ReportedBy *Actor `json:"reported_by" expandable:"true"`
	// How the event was recorded.
	//
	// - `manual`: a person logged the stoppage.
	// - `scanner`: a shop-floor station logged it.
	// - `inferred`: the system derived it from a gap in activity.
	// - `api`: an integration reported it.
	Source constants.MachineDowntimeSource `json:"source" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A period during which a machine was not running.

Downtime is what makes OEE Availability a measurement rather than an estimate. An event with no `ended_at` is still open, meaning the machine is down right now; a machine can only have one open event at a time.

func (*MachineDowntimeEvent) SchemaExample

func (*MachineDowntimeEvent) SchemaExample() any

type MachineDowntimeReason

type MachineDowntimeReason struct {
	// Downtime reason ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=machine_downtime_reason"`
	// Stable code used when logging downtime.
	//
	// This is the value to send as `reason` when creating or updating a downtime event.
	Code constants.MachineDowntimeReasonCode `json:"code" validate:"required"`
	// Display name of the reason.
	Name string `json:"name" validate:"required"`
	// Which OEE term this reason charges.
	OeeBucket constants.OeeBucket `json:"oee_bucket" validate:"required"`
	// Whether the stoppage was scheduled in advance, such as preventive maintenance.
	PlanningStatus constants.DowntimePlanningStatus `json:"planning_status" validate:"required"`
	// Display order, ascending.
	SortOrder int32 `json:"sort_order" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A reason a machine stopped running.

The `oee_bucket` decides which OEE term the stoppage charges: `availability` losses reduce run time, `performance` losses are minor stops and speed loss, `quality` losses cover rework and holds, and `not_scheduled` time is removed from the OEE calculation entirely rather than counted against it.

func (*MachineDowntimeReason) SchemaExample

func (*MachineDowntimeReason) SchemaExample() any

type MachineDowntimeReasonSummary

type MachineDowntimeReasonSummary struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=machine_downtime_reason"`
	// Stable code identifying the reason.
	Code constants.MachineDowntimeReasonCode `json:"code" validate:"required"`
	// Display name of the reason.
	Name *string `json:"name"`
	// Which OEE term this reason charges.
	OeeBucket *constants.OeeBucket `json:"oee_bucket"`
}

The reason for a stoppage, as carried on a downtime event.

A denormalized view of the reason taxonomy: the stable code plus the display name and OEE bucket resolved from it at read time.

type MachineDowntimeSummary

type MachineDowntimeSummary struct {
	// The downtime event.
	Event *Entity `json:"event" validate:"required"`
	// Why the machine stopped.
	Reason *MachineDowntimeReasonSummary `json:"reason" validate:"required"`
	// When the machine went down.
	StartedAt time.Time `json:"started_at" validate:"required"`
	// Free-text note left by whoever logged it.
	Note *string `json:"note"`
}

An open stoppage on a machine.

type MachineStatus

type MachineStatus struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=machine_status"`
	// The machine.
	Machine *Entity `json:"machine" validate:"required"`
	// The department the machine belongs to.
	Department *Entity `json:"department"`
	// What the machine is doing.
	//
	// - `running`: a released campaign with work still to scan.
	// - `idle`: nothing released to it.
	// - `down`: an open downtime event, which outranks running.
	Status constants.MachineWorkStatus `json:"status" validate:"required"`
	// The open stoppage, when the machine is down.
	Downtime *MachineDowntimeSummary `json:"downtime"`
	// The campaign the machine is working on now.
	//
	// The earliest released campaign that still has batches left to scan. Once its last batch is scanned it stops being current and the queue moves on, which is what makes a floor display advance by itself.
	Current *MachineCampaign `json:"current"`
	// What the machine takes on next, so an operator can set up for it.
	//
	// When the machine has no current campaign it is between jobs, and this is the earliest campaign still ahead of it.
	Next *MachineCampaign `json:"next"`
	// Quantity planned on this machine for the current week.
	//
	// Summed across every campaign scheduled on the machine that week, not just the current one.
	WeekPlannedQuantity float64 `json:"week_planned_quantity"`
	// Quantity scanned on this machine so far in the current week.
	WeekScannedQuantity float64 `json:"week_scanned_quantity"`
	// Machine hours the plan allocates on this machine for the current week.
	WeekPlannedRunHours float64 `json:"week_planned_run_hours"`
	// Unit the week's quantities are counted in.
	Unit *string `json:"unit"`
}

What one machine is doing right now.

Assembled from the published schedule, the batches the floor has scanned against it, and any open downtime. A machine with an open stoppage reads `down` even when it has a released campaign, because a broken machine is not producing whatever the plan says.

func (*MachineStatus) SchemaExample

func (*MachineStatus) SchemaExample() any

type ManufacturingMetrics

type ManufacturingMetrics struct {
	// The production metric value.
	Production float64 `json:"production" validate:"required"`
	// The costs per unit metric value.
	CostsPerUnit float64 `json:"costs_per_unit" validate:"required"`
	// The margin metric value.
	Margin float64 `json:"margin" validate:"required"`
	// The quality metric value.
	Quality float64 `json:"quality" validate:"required"`
	// The labor efficiency metric value.
	LaborEfficiency float64 `json:"labor_efficiency" validate:"required"`
}

ManufacturingMetrics represents manufacturing performance metrics for a period.

type Material

type Material struct {
	// Material ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=material"`
	// The underlying inventory item this material record extends with material-specific fields such as order point and lead time.
	Item *Item `json:"item" expandable:"true"`
	// Reorder threshold: when on-hand stock falls to this quantity, the material should be reordered.
	//
	// A threshold of zero is reported as no order point at all. Moving the underlying item to a different category re-expresses the order point in the new category's base unit, keeping the same numeric value rather than converting it.
	OrderPoint *Quantity `json:"order_point"`
	// Expected time between placing an order for this material and receiving it, expressed as a quantity in a time unit (e.g. days).
	//
	// A lead time of zero is reported as no lead time at all.
	LeadTime *Quantity `json:"lead_time"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A material in the account's catalog: a raw material or component consumed in production.

Material-level data such as the SKU, description, category, pricing, and attributes lives on the underlying `item`; the material record adds the reordering fields `order_point` and `lead_time`.

func (*Material) SchemaExample

func (*Material) SchemaExample() any

type MaterialAnalyticsEntry

type MaterialAnalyticsEntry struct {
	// Unique identifier for this entry.
	ID string `json:"id" validate:"required"`
	// The item ID.
	ItemID string `json:"item_id" validate:"required"`
	// The SKU.
	Sku string `json:"sku" validate:"required"`
	// The description.
	Description *string `json:"description"`
	// The quantity in inventory.
	QuantityInInventory *Quantity `json:"quantity_in_inventory" validate:"required"`
	// The order point quantity.
	OrderPoint *Quantity `json:"order_point"`
	// The lead time.
	LeadTime *Quantity `json:"lead_time"`
	// The quantity in demand.
	QuantityInDemand *Quantity `json:"quantity_in_demand" validate:"required"`
	// The unit group.
	UnitGroup AnalyticsUnitGroup `json:"unit_group" validate:"required"`
	// The supplier names.
	SupplierNames []string `json:"supplier_names" validate:"required"`
	// The supplier part numbers.
	SupplierPartNumbers []string `json:"supplier_part_numbers" validate:"required"`
}

MaterialAnalyticsEntry represents a single material analytics entry.

type Message

type Message struct {
	// Message ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=chat_message"`
	// What this message represents.
	//
	// - `chat`: written by a person.
	// - `system_event`: a record of something that happened in the conversation, such as someone joining or a record being linked.
	// - `agent`: written by an AI agent taking part in the conversation.
	// - `scheduled`: came from a send queued ahead of time.
	// - `alert`: an automated alert surfaced in the conversation.
	// - `email`: a message carried over the case's bridged email thread, either one that arrived from the customer or a reply sent back out to them.
	Kind constants.MessageKind `json:"kind" validate:"required"`
	// Where the message stands in its life.
	//
	// - `draft`: a proposed reply to the customer, still editable and waiting for approval before anyone outside sees it.
	// - `scheduled`: queued to go out at a future time.
	// - `sent`: delivered, and part of the conversation everyone reads.
	// - `canceled`: a scheduled message stopped before it went out.
	// - `rejected`: a draft discarded instead of being sent.
	// - `failed`: a scheduled message that could not be delivered.
	// - `superseded`: a draft replaced by a newer one for the same thread.
	//
	// Only a `sent` message occupies a place in the conversation; the others are records of messages that never reached it.
	Status constants.MessageStatus `json:"status" validate:"required"`
	// Who can see this message.
	//
	// - `internal`: a note only your team can see.
	// - `external`: sent to or received from an outside party, such as the customer on a support case, and part of the official record of that exchange.
	// - `system`: an event both your team and the customer see.
	//
	// A customer reading their own case is never served `internal` messages.
	Visibility constants.MessageVisibility `json:"visibility" validate:"required"`
	// The conversation this message belongs to.
	Conversation *Conversation `json:"conversation" expandable:"true"`
	// The message's position in the conversation timeline, counting up from the first message.
	//
	// A sequence is assigned only when a message is delivered, so a draft or a not-yet-sent scheduled message reports `0`. Listing a conversation's messages pages backwards through this ordering.
	Sequence int64 `json:"sequence"`
	// Message body.
	//
	// A message made up of nothing but attachments or a linked record carries no body, and a deleted message has its body cleared.
	Body *string `json:"body"`
	// The email subject line.
	//
	// On an email-bridged case, this is the subject of the inbound email, or the subject a customer reply is sent out with.
	Subject *string `json:"subject"`
	// The party the message is displayed as coming from.
	//
	// On a customer-facing case the customer sees every reply from your side as a single branded "Customer Service" party rather than the individual person or agent behind it, and an inbound email is shown as the outside address it arrived from. Everywhere else this is the user or agent that wrote the message. Pure system messages have no sender.
	Sender *Actor `json:"sender" expandable:"true"`
	// The user or agent that actually wrote the message.
	//
	// Absent on system messages, and on a vendor-side reply read by a customer — the real author behind the branded "Customer Service" party is never revealed to them.
	Author *Actor `json:"author" expandable:"true"`
	// Files, images, links, or resources attached to the message.
	Attachments *List[MessageAttachment] `json:"attachments" expandable:"true"`
	// The message this one replies to.
	ReplyTo *Message `json:"reply_to" expandable:"true"`
	// The record this message links to, such as the order it is about.
	Resource *Entity `json:"resource" expandable:"true"`
	// How the message reached its audience, or how a draft will be sent once it is approved.
	//
	// - `message`: appears in the conversation itself.
	// - `email`: goes out as email on the thread of the inbox the case is bridged to.
	Channel constants.MessageChannel `json:"channel" validate:"required"`
	// When a message queued for a future send is due to go out.
	ScheduledAt *time.Time `json:"scheduled_at"`
	// The agent run that produced this message, for deep-linking from an agent reply to its run.
	AgentRun *AgentRun `json:"agent_run" expandable:"true"`
	// The streaming state of an agent reply.
	//
	// `streaming` means the body is still being generated and keeps growing as realtime updates arrive; `complete` means it is final.
	StreamingState *constants.MessageStreamingState `json:"streaming_state"`
	// The dedupe key the client supplied when sending, echoed back so an optimistic local copy can be matched to the stored message.
	ClientMessageID *string `json:"client_message_id"`
	// When the message was last edited.
	EditedAt *time.Time `json:"edited_at"`
	// When the message was deleted.
	//
	// A deleted message keeps its place in the timeline with its body cleared, so surrounding ordering and replies stay intact.
	DeletedAt *time.Time `json:"deleted_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
	// Whether this message is an agent reply reporting that the agent's run failed.
	//
	// The body explains the failure to the reader rather than answering the request.
	AgentRunFailed bool `json:"agent_run_failed"`
	// Machine-readable reason an agent reply failed.
	//
	// A client can react to the specific code rather than just showing the body — `agent_spending_cap_reached`, for example, is a cue to offer raising the agent spending limit.
	AgentErrorCode *apierror.ErrorCode `json:"agent_error_code"`
}

A chat message within a conversation.

One resource covers every stage of a message's life: a delivered timeline message, a message queued for a future send, and a customer-reply draft awaiting approval. Read `status` to tell them apart.

func (*Message) SchemaExample

func (*Message) SchemaExample() any

type MessageAttachment

type MessageAttachment struct {
	// Attachment ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=message_attachment"`
	// The kind of attachment, which determines how it is stored and which of the fields below are populated.
	//
	// - `file`: an uploaded non-image file.
	// - `image`: an uploaded image.
	// - `link`: an external URL reference, with no stored file.
	// - `resource`: a reference to an in-app resource, such as an order.
	Kind constants.MessageAttachmentKind `json:"kind" validate:"required"`
	// The filename the attachment was uploaded under.
	//
	// Carried only by `file` and `image` attachments.
	Filename *string `json:"filename"`
	// The MIME type of the uploaded content.
	//
	// Carried only by `file` and `image` attachments.
	ContentType *string `json:"content_type"`
	// The size of the uploaded content in bytes.
	//
	// Carried only by `file` and `image` attachments, and only when the sender supplied it with the message.
	SizeBytes *int64 `json:"size_bytes"`
	// Where to fetch the attachment: a signed download URL for `file` and `image` attachments, or the target address for `link` attachments.
	//
	// Download URLs are signed for one hour and regenerated each time the message is read, so follow the URL promptly instead of persisting it. `resource` attachments have no URL — use `resource` to resolve them.
	URL *string `json:"url"`
	// The in-app record a `resource` attachment points to, such as a sales order.
	Resource *Entity `json:"resource" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A file, image, link, or resource attached to a message.

func (*MessageAttachment) SchemaExample

func (*MessageAttachment) SchemaExample() any

type MessageResource

type MessageResource struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=message"`
	// Plain-language summary of what the operation did.
	//
	// This text is meant for display only. Its wording can change at any time, so do not parse it or branch on its contents.
	Message string `json:"message" validate:"required"`
}

A human-readable confirmation returned by operations that do not produce a resource.

func (*MessageResource) SchemaExample

func (*MessageResource) SchemaExample() any

type MessagingBlock

type MessagingBlock struct {
	// Block ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=messaging_block"`
	// The account user who was blocked.
	BlockedUser *AccountUser `json:"blocked_user" expandable:"true"`
	// When the block was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A block one account user has placed on another.

While the block stands, neither of the two can start a direct message with the other or post in an existing one, whichever of them created it. Group conversations and customer cases are unaffected.

func (*MessagingBlock) SchemaExample

func (*MessagingBlock) SchemaExample() any

type MessagingGroup

type MessagingGroup struct {
	// Messaging group ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=messaging_group"`
	// The roster's display name.
	Name string `json:"name" validate:"required"`
	// The roster's members (users and agents).
	Members *List[MessagingGroupMember] `json:"members"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A reusable roster: a named set of members (users and/or agents) that seeds new conversations.

Starting a conversation from a group snapshots its current members into that conversation, so the same group can back many conversations (each with its own title); later edits to the group never change conversations already created from it.

func (*MessagingGroup) SchemaExample

func (*MessagingGroup) SchemaExample() any

type MessagingGroupMember

type MessagingGroupMember struct {
	// Membership ID.
	//
	// This identifies the member's place on the roster, not the user or agent themselves; it is the id to pass when removing them from the roster.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=messaging_group_member"`
	// The member: a `user` (account user) or an `agent`.
	Actor *Actor `json:"actor" validate:"required"`
}

A member of a reusable roster: either a user or an agent, represented by its actor.

func (*MessagingGroupMember) SchemaExample

func (*MessagingGroupMember) SchemaExample() any

type NewCustomersData

type NewCustomersData struct {
	// The label for the data series.
	Label string `json:"label" validate:"required"`
	// The data points.
	Data []DateTimeCoordinate `json:"data" validate:"required"`
}

NewCustomersData represents new customer time series data.

type Notification

type Notification struct {
	// Notification ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=notification"`
	// The kind of event this notification represents.
	//
	// The set is open-ended and may grow over time. Common first-party categories are:
	//
	// - `chat.message`: a new message in a conversation.
	// - `chat.mention`: a direct @mention, delivered even when the conversation is muted.
	// - `chat.added`: the user was added to a conversation.
	// - `order.updated`: an order the user is involved with changed.
	// - `agent.run_completed`: an agent run the user triggered finished.
	// - `agent.alert`: an agent raised an alert during a run.
	// - `system.broadcast`: a targeted system message.
	// - `customer.registered`: a buyer completed registration on your customer portal.
	Category constants.NotificationCategory `json:"category" validate:"required"`
	// Short headline shown in the feed.
	Title string `json:"title" validate:"required"`
	// Supporting detail shown beneath the title, such as a preview of the message that triggered the notification.
	Body *string `json:"body"`
	// Where the notification is in its lifecycle.
	//
	// - `unseen`: delivered but not yet surfaced to the user.
	// - `seen`: surfaced in the feed but not yet opened.
	// - `read`: explicitly opened by the user.
	// - `dismissed`: removed from the active feed.
	//
	// The status is derived from the seen, read, and dismissed timestamps, and only ever moves forward — a notification can never become unseen again.
	Status constants.NotificationStatus `json:"status" validate:"required"`
	// How prominently the notification should be surfaced, from `low` through `urgent`.
	Priority constants.NotificationPriority `json:"priority" validate:"required"`
	// The actor that generated this notification.
	//
	// Notifications raised by the platform itself, rather than by a person, agent, or API key, have no sender.
	Sender *Actor `json:"sender" expandable:"true"`
	// The resource this notification is about, which the client can link to.
	//
	// Chat notifications point at the conversation the message was posted in — or at the support case, for customer-facing threads — so opening the notification opens the thread.
	Resource *Entity `json:"resource" expandable:"true"`
	// When the notification was first surfaced to the user.
	SeenAt *time.Time `json:"seen_at"`
	// When the notification was explicitly opened.
	ReadAt *time.Time `json:"read_at"`
	// When the notification was dismissed.
	DismissedAt *time.Time `json:"dismissed_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An in-app notification addressed to a single user, shown in their notification (bell) feed.

A notification belongs to one user in one account, so the feed you read is always that of the authenticated caller in the account they are acting in. Announcements broadcast to a whole account are a separate resource.

func (*Notification) SchemaExample

func (*Notification) SchemaExample() any

type NotificationPreference

type NotificationPreference struct {
	// Preference ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=notification_preference"`
	// The notification category this preference applies to.
	//
	// A preference with no category is the user's global default, used for every category they have not set a specific preference for.
	Category *constants.NotificationCategory `json:"category"`
	// Whether notifications in this category appear in the user's in-app feed.
	//
	// A direct @mention is always delivered in-app, even when this is disabled.
	InAppEnabled bool `json:"in_app_enabled"`
	// Whether notifications in this category are also emailed to the user.
	//
	// Email is additionally suppressed for a conversation the user has muted, and only sent on the cadence set by `digest`.
	EmailEnabled bool `json:"email_enabled"`
	// Whether notifications in this category are also sent as push notifications.
	//
	// Push delivery is not available yet; the choice is stored for when it is.
	PushEnabled bool `json:"push_enabled"`
	// How often email for this category is sent.
	//
	// - `instant`: send an email as soon as an eligible notification occurs.
	// - `hourly`: collect eligible notifications into a single hourly email.
	// - `daily`: collect eligible notifications into a single daily email.
	// - `off`: never send email for this category, even when email is otherwise enabled.
	//
	// This governs email only; in-app delivery is unaffected. Batched sending is not running yet, so `hourly` and `daily` currently hold email back in the same way as `off`.
	Digest constants.NotificationDigest `json:"digest" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

One user's choice of which channels a category of notification is delivered on.

Preferences belong to the user's membership in a single account, so the same person can be notified differently in each account they belong to. A preference with no category is that user's global default, and a category-specific preference overrides it. Where neither exists, in-app notifications are delivered and email and push are not.

Chat notifications are the only ones these settings currently govern: notifications in every other category reach the in-app feed and are never emailed, whatever is stored here.

func (*NotificationPreference) SchemaExample

func (*NotificationPreference) SchemaExample() any

type NotificationSendResult

type NotificationSendResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=notification_send_result"`
	// Number of deliveries accepted for the notification.
	//
	// An account broadcast is stored once as a single announcement that serves everyone in the account, so it reports `1` rather than a per-user count. Acceptance is not delivery: recipients who cannot be resolved are skipped when the notification is fanned out.
	Enqueued int64 `json:"enqueued"`
}

The acknowledgement returned when a notification is accepted for delivery.

func (*NotificationSendResult) SchemaExample

func (*NotificationSendResult) SchemaExample() any

type NotificationTargetInput

type NotificationTargetInput struct {
	// The kind of recipient being addressed.
	//
	// - `account_user`: one member of the account, who receives a personal notification in their feed.
	// - `account`: every member of the account, who all receive a single shared announcement.
	Type constants.NotificationTargetType `json:"type" validate:"required"`
	// The id of the recipient, matching `type`: an account user id, or an account id.
	//
	// An account target must be the account you are currently acting in — you cannot broadcast into another account.
	ID string `json:"id" validate:"required"`
}

Who a notification is aimed at.

type NotificationUnreadCount

type NotificationUnreadCount struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=notification_unread_count"`
	// Number of the caller's notifications that have not been seen yet.
	//
	// Dismissed notifications are never counted, and marking all notifications seen drops this to zero.
	Notifications int64 `json:"notifications"`
	// Number of conversations with unread messages.
	//
	// Always `0` today — conversation unread counts are not yet folded into the bell.
	Conversations int64 `json:"conversations"`
	// Combined unread total for the bell badge.
	//
	// This is the unseen notification count plus any account announcements the caller has not seen, so it can exceed `notifications`. Announcements are cleared individually rather than by marking all notifications seen.
	Total int64 `json:"total"`
}

The caller's unread tallies in one account, used to drive the notification bell badge.

func (*NotificationUnreadCount) SchemaExample

func (*NotificationUnreadCount) SchemaExample() any

type NotificationUnreadSummary

type NotificationUnreadSummary struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=notification_unread_summary"`
	// Combined unread total across all of the caller's accounts.
	Total int64 `json:"total"`
	// Per-account unread tallies.
	//
	// Every account the caller belongs to is listed, including accounts with nothing unread.
	Accounts *List[NotificationUnreadSummaryAccount] `json:"accounts"`
}

The caller's unread totals across every account they belong to, used to show unread activity waiting in accounts they are not currently working in.

func (*NotificationUnreadSummary) SchemaExample

func (*NotificationUnreadSummary) SchemaExample() any

type NotificationUnreadSummaryAccount

type NotificationUnreadSummaryAccount struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=notification_unread_summary_account"`
	// The account this tally is for.
	Account *Entity `json:"account" validate:"required"`
	// Number of unseen notifications and account announcements the caller has in this account.
	Unread int64 `json:"unread"`
}

One account's unread tally within the caller's cross-account summary.

type OAuthResponse

type OAuthResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=oauth_response"`
	// URL to send the user to so they can authorize their carrier account.
	//
	// Once the user finishes authorizing, the carrier returns them to the `redirect_uri` supplied when the flow was initiated.
	OAuthURL string `json:"oauth_url" validate:"required"`
}

Response from initiating carrier OAuth.

func (*OAuthResponse) SchemaExample

func (*OAuthResponse) SchemaExample() any

type OAuthStatusResponse

type OAuthStatusResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=oauth_status_response"`
	// OAuth connection status.
	//
	// - `connected`: your own carrier account is authorized and ready for live rating and label purchase.
	// - `authorization_pending`: a carrier account exists but is still Shippo's shared default account, so authorization of your own carrier account has not been completed.
	// - `disconnected`: the carrier has no carrier account to authorize, or the carrier account could not be reached. Sandbox accounts always report this status.
	Status constants.CarrierConnectionStatus `json:"status" validate:"required"`
}

OAuth connection status for a carrier.

func (*OAuthStatusResponse) SchemaExample

func (*OAuthStatusResponse) SchemaExample() any

type OeeDepartment

type OeeDepartment struct {
	// The department.
	Department *Entity `json:"department" validate:"required"`
	// The number of good units produced.
	GoodUnits float64 `json:"good_units" validate:"required"`
	// The number of waste units.
	WasteUnits float64 `json:"waste_units" validate:"required"`
	// The number of seconds units.
	SecondsUnits float64 `json:"seconds_units" validate:"required"`
	// The time this output should have taken at each production step's own labor rate: ideal cycle time multiplied by the units produced. This is the numerator of Performance.
	StandardSecondsEarned float64 `json:"standard_seconds_earned" validate:"required"`
	// The estimated runtime in hours.
	EstimatedRuntimeHours float64 `json:"estimated_runtime_hours" validate:"required"`
	// Logged downtime charged against availability, in seconds.
	AvailabilityLossSeconds float64 `json:"availability_loss_seconds"`
	// Logged downtime charged against performance, in seconds.
	PerformanceLossSeconds float64 `json:"performance_loss_seconds"`
	// Logged downtime charged against quality, in seconds.
	QualityLossSeconds float64 `json:"quality_loss_seconds"`
	// Time nobody planned to run, removed from the OEE denominator rather than counted as a loss.
	NotScheduledSeconds float64 `json:"not_scheduled_seconds"`
	// Time spent changing over between products, in seconds.
	ChangeoverSeconds float64 `json:"changeover_seconds"`
	// Number of downtime events logged in the period.
	DowntimeEventCount int64 `json:"downtime_event_count"`
	// Downtime split by reason, largest first.
	DowntimeBreakdown *List[OeeDowntimeReason] `json:"downtime_breakdown"`
	// Planned time net of not-scheduled downtime, in seconds.
	ScheduledSeconds float64 `json:"scheduled_seconds"`
	// Scheduled time net of availability losses, in seconds.
	RunTimeSeconds float64 `json:"run_time_seconds"`
	// Run time divided by scheduled time.
	AvailabilityPct *float64 `json:"availability_pct"`
	// Standard seconds earned divided by run time: how fast the department ran against the designed speed of its production steps.
	PerformancePct *float64 `json:"performance_pct"`
	// Good units divided by total units produced.
	QualityPct *float64 `json:"quality_pct"`
	// Availability multiplied by performance multiplied by quality.
	OeePct *float64 `json:"oee_pct"`
	// Whether availability was measured from logged downtime or estimated from runtime. A department with no logged downtime computes as perfectly available, so an estimate is labelled rather than presented as a measurement.
	MeasurementStatus constants.OeeMeasurementStatus `json:"measurement_status" validate:"required"`
	// Data-quality warnings for this grouping. Empty when the numbers can be taken at face value.
	Anomalies []constants.OeeAnomaly `json:"anomalies"`
}

OeeDepartment represents OEE metrics for a single department.

type OeeDowntimeReason

type OeeDowntimeReason struct {
	// Why the machine stopped.
	Reason constants.MachineDowntimeReasonCode `json:"reason" validate:"required"`
	// Which OEE term this reason charges.
	OeeBucket constants.OeeBucket `json:"oee_bucket" validate:"required"`
	// Downtime attributed to this reason, in seconds.
	DowntimeSeconds float64 `json:"downtime_seconds" validate:"required"`
	// Number of events logged against this reason.
	EventCount int64 `json:"event_count" validate:"required"`
}

OeeDowntimeReason represents one reason's contribution to a department's downtime.

type OeeTrendPeriod

type OeeTrendPeriod struct {
	// The first instant this period covers. Weeks start on Monday; the first and last periods of a window are clipped to the window itself.
	StartsAt time.Time `json:"starts_at" validate:"required"`
	// The instant this period ends, exclusive.
	EndsAt time.Time `json:"ends_at" validate:"required"`
	// The number of good units produced.
	GoodUnits float64 `json:"good_units" validate:"required"`
	// The number of waste units.
	WasteUnits float64 `json:"waste_units" validate:"required"`
	// The number of seconds units.
	SecondsUnits float64 `json:"seconds_units" validate:"required"`
	// The time this output should have taken at each production step's own labor rate: ideal cycle time multiplied by the units produced.
	StandardSecondsEarned float64 `json:"standard_seconds_earned" validate:"required"`
	// Planned time net of not-scheduled downtime, in seconds.
	ScheduledSeconds float64 `json:"scheduled_seconds" validate:"required"`
	// Scheduled time net of availability losses, in seconds.
	RunTimeSeconds float64 `json:"run_time_seconds" validate:"required"`
	// Logged downtime charged against availability, in seconds.
	AvailabilityLossSeconds float64 `json:"availability_loss_seconds" validate:"required"`
	// Time nobody planned to run, removed from the denominator rather than counted as a loss.
	NotScheduledSeconds float64 `json:"not_scheduled_seconds" validate:"required"`
	// Run time divided by scheduled time.
	AvailabilityPct *float64 `json:"availability_pct"`
	// Standard seconds earned divided by run time.
	PerformancePct *float64 `json:"performance_pct"`
	// Good units divided by total units produced.
	QualityPct *float64 `json:"quality_pct"`
	// Availability multiplied by performance multiplied by quality.
	OeePct *float64 `json:"oee_pct"`
	// Whether availability was measured from logged downtime or estimated from runtime.
	MeasurementStatus constants.OeeMeasurementStatus `json:"measurement_status" validate:"required"`
	// Number of downtime events overlapping this period.
	DowntimeEventCount int64 `json:"downtime_event_count" validate:"required"`
}

OeeTrendPeriod represents one production week of OEE, rolled up across the departments that had scheduled time in it. Departments with no scheduled time have no OEE and take no part in the roll-up, so their output is not counted here either.

type OpenBatchSummary

type OpenBatchSummary struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=open_batch_summary"`
	// Name of the department the scanning station belongs to.
	DepartmentName string `json:"department_name" validate:"required"`
	// Item associated with this summary.
	Item *Item `json:"item" validate:"required"`
	// Scanning station associated with this summary.
	ScanningStation *ScanningStation `json:"scanning_station" validate:"required"`
	// Quantity still waiting at this scanning station, as a decimal measure expressed in `unit`.
	//
	// Each contributing batch counts for its own quantity less whatever has already been passed downstream into output batches, so the total reflects what is left to work on rather than everything ever produced at the station.
	Count string `json:"count" validate:"required" format:"decimal"`
	// Unit abbreviation that `count` is expressed in (for example `kg`).
	Unit string `json:"unit" validate:"required"`
}

Work in progress still sitting at one scanning station, aggregated for a single item.

func (*OpenBatchSummary) SchemaExample

func (*OpenBatchSummary) SchemaExample() any

type OpenCreditEntry

type OpenCreditEntry struct {
	// Transaction ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=open_credit_entry"`
	// Transaction number.
	Number string `json:"number" validate:"required"`
	// Original transaction amount as a decimal string.
	OriginalAmount string `json:"original_amount" validate:"required"`
	// Total amount already allocated against invoices as a decimal string.
	AllocatedAmount string `json:"allocated_amount" validate:"required"`
	// Credit still available to apply, as a decimal string (`original_amount` minus `allocated_amount`).
	LeftoverAmount string `json:"leftover_amount" validate:"required"`
	// The customer this credit belongs to.
	Customer *AllocationCustomer `json:"customer" validate:"required"`
	// Display name of the transaction's type, such as "Payment" or "Credit Memo".
	TransactionType string `json:"transaction_type" validate:"required"`
	// Display name of the payment method, such as "Check" or "Credit Card".
	//
	// Typically set only on payment transactions.
	TransactionMethod *string `json:"transaction_method"`
	// Display name of the adjustment category, such as "Discount" or "Write Off".
	//
	// Typically set only on adjustment transactions.
	AdjustmentType *string `json:"adjustment_type"`
	// Username of the account user recorded as responsible for the transaction.
	ResponsibleUserName *string `json:"responsible_user_name"`
	// Free-form note attached to the transaction.
	Note *string `json:"note"`
	// Identifier of the Stripe payment that produced this transaction.
	StripePaymentID *string `json:"stripe_payment_id"`
	// The invoices this transaction has already been applied to, and how much went to each.
	InvoiceAllocations *List[InvoiceAllocationEntry] `json:"invoice_allocations"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A transaction that still has credit available to apply to invoices.

Whether a transaction counts as an open credit is driven by its `is_fully_allocated` flag rather than by a recomputed balance, so a transaction keeps appearing here until that flag is set — even if its allocations already cover the full amount.

func (*OpenCreditEntry) SchemaExample

func (*OpenCreditEntry) SchemaExample() any

type OperatingCalendar

type OperatingCalendar struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=operating_calendar"`
	// Unique identifier.
	ID string `json:"id" validate:"required"`
	// Short stable identifier, unique per account.
	Code string `json:"code" validate:"required"`
	// Human-readable name.
	Name string `json:"name" validate:"required"`
	// Which side of a shipment this calendar describes.
	Kind constants.OperatingCalendarKind `json:"kind" validate:"required"`
	// Open weekdays as seven characters of '0' or '1', Monday first. "1111100" is Monday to Friday; "1111000" is a Monday-to-Thursday plant.
	DaysOfWeek string `json:"days_of_week" validate:"required"`
	// Local time freight has to be tendered by, as "15:00". Only a shipping calendar carries one.
	CutoffAt *string `json:"cutoff_at"`
	// IANA zone the cutoff is read in. Null on a receiving calendar means it is taken from the ship-to address.
	Timezone *string `json:"timezone"`
	// Whether this is the calendar used when nothing more specific is linked. Exactly one per kind.
	IsDefault bool `json:"is_default" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

OperatingCalendar is the set of days one party to a shipment operates.

A `ship` calendar is the plant tendering freight to a carrier; a `receive` calendar is a customer's dock accepting it. Ship-by dates are resolved against both, so an order is never committed to a day nobody can act on.

func (*OperatingCalendar) SchemaExample

func (*OperatingCalendar) SchemaExample() any

type OperatingCalendarClosure

type OperatingCalendarClosure struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=operating_calendar_closure"`
	// Unique identifier.
	ID string `json:"id" validate:"required"`
	// The calendar this closure belongs to.
	OperatingCalendarID string `json:"operating_calendar_id" validate:"required"`
	// The date nothing operates.
	ClosedOn time.Time `json:"closed_on" validate:"required"`
	// What the closure is, such as "Thanksgiving Day" or "Summer shutdown".
	Name string `json:"name" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

OperatingCalendarClosure is one date a calendar is shut — a holiday, or a day of a shutdown week.

func (*OperatingCalendarClosure) SchemaExample

func (*OperatingCalendarClosure) SchemaExample() any

type OrderContact

type OrderContact struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=order_contact"`
	// Email addresses that receive invoices for this order.
	Invoice []string `json:"invoice"`
	// Email addresses that receive order acknowledgements for this order.
	Acknowledgement []string `json:"acknowledgement"`
}

A sales order's email recipients, grouped by the notification they receive.

type OrderDiscount

type OrderDiscount struct {
	// Order discount ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=order_discount"`
	// Display name of the discount.
	Name string `json:"name" validate:"required"`
	// The code a buyer enters to apply this discount to an order.
	//
	// Codes are unique within your account and are matched without regard to letter case.
	Code string `json:"code" validate:"required"`
	// The fraction of the order total taken off, as a decimal string.
	//
	// This is a multiplier, not a whole percent: `0.1` takes 10% off. Only read when `discount_type` is `percentage`.
	Percentage string `json:"percentage" validate:"required" format:"decimal"`
	// The flat amount taken off the order total, as a decimal string.
	//
	// Only read when `discount_type` is `amount`.
	Amount string `json:"amount" validate:"required" format:"decimal"`
	// How the discount is calculated.
	//
	// - `percentage`: the order total is reduced by the fraction in `percentage`.
	// - `amount`: the order total is reduced by the flat amount in `amount`.
	DiscountType constants.OrderDiscountType `json:"discount_type" validate:"required"`
	// How many sales orders this discount has been applied to, across all buyers.
	OrderCount int32 `json:"order_count" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A discount code that can be applied to a sales order.

An order discount reduces the order total by either a percentage or a fixed amount, depending on `discount_type`. The reduction is capped at the order total and rounded to the nearest cent.

func (*OrderDiscount) SchemaExample

func (*OrderDiscount) SchemaExample() any

type OrderEntry

type OrderEntry struct {
	// Unique identifier for this entry.
	ID string `json:"id" validate:"required"`
	// The date the order was issued.
	IssuedAt *time.Time `json:"issued_at"`
	// The customer purchase order number.
	CustomerPO *string `json:"customer_po"`
	// The order number.
	OrderNumber string `json:"order_number" validate:"required"`
	// The order ID.
	OrderID string `json:"order_id" validate:"required"`
	// The sales representative ID.
	SalesRepID *string `json:"sales_rep_id"`
	// The sales representative username.
	SalesRepUsername *string `json:"sales_rep_username"`
	// The customer ID.
	CustomerID string `json:"customer_id" validate:"required"`
	// The customer name.
	CustomerName string `json:"customer_name" validate:"required"`
	// The customer number.
	CustomerNumber string `json:"customer_number" validate:"required"`
	// The customer type group ID.
	CustomerTypeGroupID *string `json:"customer_type_group_id"`
	// The customer group name.
	CustomerGroupName *string `json:"customer_group_name"`
	// The parent customer ID.
	ParentCustomerID *string `json:"parent_customer_id"`
	// The date the customer was created.
	CustomerCreatedAt time.Time `json:"customer_created_at" validate:"required"`
	// The product line ID.
	ProductLineID *string `json:"product_line_id"`
	// The product line name.
	ProductLine *string `json:"product_line"`
	// The product ID.
	ProductTypeID string `json:"product_type_id" validate:"required"`
	// The item ID.
	ItemID string `json:"item_id" validate:"required"`
	// The product SKU.
	ProductSku string `json:"product_sku" validate:"required"`
	// The product description.
	ProductDescription *string `json:"product_description"`
	// The category name.
	CategoryName string `json:"category_name" validate:"required"`
	// The quantity invoiced.
	QuantityInvoiced float64 `json:"quantity_invoiced" validate:"required"`
	// The unit of measure.
	Unit string `json:"unit" validate:"required"`
	// The unit cost.
	UnitCost float64 `json:"unit_cost" validate:"required"`
	// The unit price.
	UnitPrice float64 `json:"unit_price" validate:"required"`
	// The unit profit.
	UnitProfit float64 `json:"unit_profit" validate:"required"`
	// The total invoiced amount.
	TotalInvoiced float64 `json:"total_invoiced" validate:"required"`
	// The total cost.
	TotalCost float64 `json:"total_cost" validate:"required"`
	// The total profit.
	TotalProfit float64 `json:"total_profit" validate:"required"`
	// The ship-to city.
	ShipToCity *string `json:"ship_to_city"`
	// The ship-to zipcode.
	ShipToZipcode *string `json:"ship_to_zipcode"`
	// The ship-to state.
	ShipToState *string `json:"ship_to_state"`
	// The ship-to country.
	ShipToCountry *string `json:"ship_to_country"`
	// The order discount code.
	OrderDiscountCode *string `json:"discount_code"`
	// The date the order was completed.
	CompletedAt *time.Time `json:"completed_at"`
	// The date of the first shipment.
	FirstShipAt *time.Time `json:"first_ship_at"`
	// The promised delivery date.
	PromisedAt *time.Time `json:"promised_at"`
	// The quantity ordered.
	QuantityOrdered float64 `json:"quantity_ordered" validate:"required"`
	// The quantity back ordered.
	QuantityBackOrdered float64 `json:"quantity_back_ordered" validate:"required"`
	// The total ordered amount.
	TotalOrdered float64 `json:"total_ordered" validate:"required"`
	// The total back ordered amount.
	TotalBackOrdered float64 `json:"total_back_ordered" validate:"required"`
}

OrderEntry represents a single order entry for analytics.

type OrderNotificationRecipient

type OrderNotificationRecipient struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=order_notification_recipient"`
	// The account user who receives these notifications.
	//
	// The account user's `user` profile is not returned here; resolve the recipient's name and email from the account users on the customer's own account.
	AccountUser *AccountUser `json:"account_user" expandable:"true"`
	// Order notification types this recipient receives.
	//
	// - `order_acknowledgement`: the confirmation email sent when an order is placed for the customer.
	// - `invoice`: invoice emails for the customer's orders.
	// - `purchase_order_submission`: a copy of each purchase order you submit to this account as a supplier; those recipients are managed alongside the account's users and cannot be set through the customer notification-recipient endpoints.
	NotificationTypes []constants.AccountRelationNotificationType `json:"notification_types" validate:"required"`
}

A default order-notification recipient for a customer.

Each recipient pairs an account user on the customer's own account with the notification types they receive for that customer's orders.

func (*OrderNotificationRecipient) SchemaExample

func (*OrderNotificationRecipient) SchemaExample() any

type Owner

type Owner struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=owner"`
	// Where this resource came from.
	//
	// - `system`: a platform-provided default shared across all accounts; not editable.
	// - `account`: created and owned by a specific account; the `account` field identifies which.
	Type constants.OwnerType `json:"type" validate:"required"`
	// The account that owns this resource.
	//
	// Present only when `type` is `account`; system-owned resources have no owning account.
	Account *Account `json:"account" expandable:"true"`
}

Owner describes the provenance of a resource.

func NewOwner

func NewOwner(accountID *string) *Owner

NewOwner constructs an Owner from an optional account ID. A nil or empty account ID produces a system owner; otherwise an account owner.

func NewOwnerWithAccount

func NewOwnerWithAccount(accountID *string, account *Account) *Owner

NewOwnerWithAccount constructs an Owner from an optional account ID and a resolved Account. When account is non-nil it is used directly; otherwise the Owner falls back to a stub Account containing only ID and Object.

func SystemOwner

func SystemOwner() *Owner

SystemOwner returns an Owner representing a system-provided default.

func (*Owner) SchemaExample

func (*Owner) SchemaExample() any

type PackList

type PackList struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pack_list"`
	// Selling account's display name.
	AccountName string `json:"account_name" validate:"required"`
	// Presigned download URL for the selling account's logo.
	//
	// The URL expires one hour after it is generated, so render it promptly rather than caching it. Logo lookup is best effort: if the account has no logo or it cannot be resolved, the rest of the document is still returned.
	AccountLogoURL *string `json:"account_logo_url"`
	// Parent sales order number.
	SalesOrderNumber string `json:"sales_order_number" validate:"required"`
	// Customer's purchase order number.
	CustomerPO *string `json:"customer_po"`
	// Shipment number.
	ShipmentNumber string `json:"shipment_number" validate:"required"`
	// When the shipment was dispatched.
	ShippedAt *time.Time `json:"shipped_at"`
	// The party the order is billed to, as recorded on the parent sales order.
	BillTo *PackListParty `json:"bill_to"`
	// The party the goods are shipped to, as recorded on the parent sales order.
	ShipTo *PackListParty `json:"ship_to"`
	// Additional contact lines shown under the billing party: the sales order contacts set to receive invoice emails, followed by the billing contact phone.
	ContactInformation []string `json:"contact_information"`
	// Name of the carrier moving the shipment.
	Carrier *string `json:"carrier"`
	// Name of the carrier service level used for the shipment, such as `Ground`.
	CarrierOption *string `json:"carrier_option"`
	// Name of the parent order's priority.
	Priority *string `json:"priority"`
	// Name of the parent order's payment term.
	PaymentTerm *string `json:"payment_term"`
	// Name of the sales representative on the parent order.
	SalesRep *string `json:"sales_rep"`
	// Shipping cases on the shipment, ordered by case number.
	ShippingCases *List[PackListCase] `json:"shipping_cases" validate:"required"`
	// Line items packed into this shipment, ordered by the order line's line number.
	LineItems *List[PackListLineItem] `json:"line_items" validate:"required"`
	// Order lines that still have quantity outstanding once everything packed so far is accounted for.
	//
	// Only physical sale lines appear here; charge and adjustment lines such as freight, tax, and credits are excluded. The quantities span the whole order, not just this shipment.
	BackOrders *List[PackListBackOrder] `json:"back_orders" validate:"required"`
}

A pack-list document assembled for a shipment: the shipment's packed line items and shipping cases, the parent order's header, parties, and terms, and any order lines still back-ordered.

The document is generated on demand for printing and is a point-in-time snapshot of the shipment and its order; it is not persisted and cannot be retrieved again by ID.

func (*PackList) SchemaExample

func (*PackList) SchemaExample() any

type PackListBackOrder

type PackListBackOrder struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pack_list_back_order"`
	// The sales order line's line number.
	LineItemNumber *int32 `json:"line_item_number"`
	// Product SKU.
	SKU string `json:"sku"`
	// Product description.
	Description string `json:"description"`
	// Quantity ordered on the line.
	QuantityOrdered string `json:"quantity_ordered" format:"decimal"`
	// Quantity packed for the line across every shipment on the order, not just this one.
	QuantityShipped string `json:"quantity_shipped" format:"decimal"`
	// Quantity still outstanding: the quantity ordered less the quantity already packed.
	QuantityBackOrdered string `json:"quantity_back_ordered" format:"decimal"`
	// Name of the unit the quantities are measured in.
	Unit string `json:"unit"`
}

An order line that still has quantity outstanding once everything packed so far is accounted for.

type PackListCase

type PackListCase struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pack_list_case"`
	// Case number.
	Number string `json:"number"`
	// Case weight.
	Weight string `json:"weight" format:"decimal"`
	// Abbreviation of the weight unit.
	WeightUnit string `json:"weight_unit"`
	// Carrier tracking number for the case.
	TrackingNumber *string `json:"tracking_number"`
	// Carrier name for the case.
	Carrier *string `json:"carrier"`
}

A shipping case on a pack list.

type PackListLineItem

type PackListLineItem struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pack_list_line_item"`
	// Line number of the sales order line this shipment line was packed from.
	LineItemNumber *int32 `json:"line_item_number"`
	// Product SKU.
	SKU string `json:"sku"`
	// Product description.
	Description string `json:"description"`
	// Quantity packed into this shipment.
	Quantity string `json:"quantity" format:"decimal"`
	// Name of the unit the quantity is measured in.
	Unit string `json:"unit"`
}

A packed line item on a pack list.

type PackListParty

type PackListParty struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pack_list_party"`
	// Party name.
	Name string `json:"name"`
	// First line of the street address.
	StreetLine1 *string `json:"street_line_1"`
	// Second line of the street address.
	StreetLine2 *string `json:"street_line_2"`
	// City or locality.
	Locality *string `json:"locality"`
	// State or administrative area.
	State *string `json:"state"`
	// Postal or ZIP code.
	PostalCode *string `json:"postal_code"`
	// Two-letter country code.
	Country *string `json:"country"`
	// Phone number.
	Phone *string `json:"phone"`
	// Email address.
	Email *string `json:"email"`
}

A bill-to or ship-to party shown on a pack list.

type PageInfo

type PageInfo struct {
	// Relative URL that fetches the next page of results.
	NextPageURL *string `json:"next_page_url"`
	// Relative URL that fetches the previous page of results.
	PreviousPageURL *string `json:"previous_page_url"`
	// Whether more results exist after this page.
	HasNextPage bool `json:"has_next_page"`
	// Whether results exist before this page.
	HasPrevPage bool `json:"has_prev_page"`
}

PageInfo describes where the current page sits within a paginated result set and how to move to the adjacent pages.

Page a list by following the URLs below rather than assembling cursors yourself. For a top-level list endpoint the URL repeats the original request's query string with only the cursor swapped, so following it preserves the same filters, search term, and page size.

type PaginationRequest

type PaginationRequest struct {
	// Opaque cursor token identifying where the page of results starts.
	//
	// Use the `cursor` value embedded in a previous response's `next_page_url` or `previous_page_url` to fetch the adjacent page. Omit to start from the first page.
	Cursor *string `query:"cursor"`
	// Maximum number of results to return in a single page.
	Limit int32 `query:"limit" default:"100" validate:"min=1,max=1000"`
	// Free-text search term used to filter results.
	//
	// Which fields are matched against the term varies by endpoint.
	Query *string `query:"q" validate:"omitempty,max=500"`
}

PaginationRequest is the standard request type for paginated list endpoints.

Embed this in a custom request struct if the endpoint needs additional query parameters.

func (*PaginationRequest) SchemaExample

func (*PaginationRequest) SchemaExample() any

SchemaExample documents standard list query parameters for OpenAPI.

type Part

type Part struct {
	// Part ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=part"`
	// The underlying inventory item this part record represents.
	Item *Item `json:"item" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A part in the account's catalog: a component used in production.

Part-level data such as the SKU, description, category, pricing, and attributes lives on the underlying `item`.

func (*Part) SchemaExample

func (*Part) SchemaExample() any

type PaymentTerm

type PaymentTerm struct {
	// Payment term ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=payment_term"`
	// Display name (e.g. `Net 30`), unique among the payment terms visible to your account.
	Name string `json:"name" validate:"required"`
	// Whether this payment term is still in active use.
	//
	// Payment terms created through the API are always `active`, and no endpoint changes a term's status. List Payment Terms returns inactive terms alongside active ones, so filter them out yourself if you only want the ones still on offer.
	Status constants.PaymentTermStatus `json:"status" validate:"required"`
	// Provenance of this payment term.
	//
	// System-owned payment terms are platform-provided defaults shared across all accounts and cannot be updated or deleted; account-owned payment terms are custom to your account.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last-updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A payment term describing when payment is due (e.g. `Net 30`), assignable to customers, sales orders, purchase orders, and invoices.

func (*PaymentTerm) SchemaExample

func (*PaymentTerm) SchemaExample() any

type Permission

type Permission struct {
	// Permission ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=permission"`
	// Stable code identifying the area this permission controls, such as `customers` or `sales_orders`.
	//
	// Pair the code with an action (`create`, `read`, `update`, or `delete`) to form the permission strings used when creating or updating a role.
	Code string `json:"code" validate:"required"`
	// Human-readable name for the permission.
	Name string `json:"name" validate:"required"`
	// Human-readable description of what this permission controls.
	Description *string `json:"description"`
	// Code of the permission group this permission is listed under, such as `inventory`.
	PermissionGroupCode string `json:"group" validate:"required"`
	// When the permission was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When the permission was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

One area of the product that access can be granted for, such as customers, invoices, or production runs.

A role never grants a permission outright; it grants specific actions on it, written as `{code}:{action}` — for example `customers:read`.

func (*Permission) SchemaExample

func (*Permission) SchemaExample() any

type PermissionGroup

type PermissionGroup struct {
	// Permission group ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=permission_group"`
	// Unique code identifying the permission group, such as `customers`.
	Code string `json:"code" validate:"required"`
	// Human-readable name for the permission group.
	Name string `json:"name" validate:"required"`
	// Free-form description of the permission group.
	Description *string `json:"description"`
	// The individual permissions collected under this group.
	Permissions *List[Permission] `json:"permissions"`
	// Provenance of this permission group.
	//
	// Permission groups form the platform-defined permission catalog and are system-owned; they are the same across every account.
	Owner *Owner `json:"owner" expandable:"true"`
	// When the permission group was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When the permission group was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A category of the permission catalog that collects related permissions, such as inventory or invoices.

Groups exist to organize the catalog for display; access is always granted by the individual permissions inside a group, never by the group itself.

func (*PermissionGroup) SchemaExample

func (*PermissionGroup) SchemaExample() any

type Pick

type Pick struct {
	// Pick ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick"`
	// Human-readable number that identifies the pick, distinct from the `id`.
	Number string `json:"number" validate:"required"`
	// The customer associated with the sales order.
	Customer *Customer `json:"customer" expandable:"true"`
	// How urgently the pick should be worked.
	Priority constants.PriorityCode `json:"priority" validate:"required"`
	// Address the associated sales order ships to.
	ShipTo *Address `json:"ship_to"`
	// Number of lines on this pick.
	LineCount int32 `json:"line_count"`
	// Progress through picking and packing, aggregated over the pick's sale lines so a list row can render progress bars without expanding `lines`.
	Totals *PickTotals `json:"totals"`
	// Timestamp of the most recent shipment sent (null until shipped).
	LastShippedAt *time.Time `json:"last_shipped_at"`
	// The pick's lines, each tracking the quantity picked against one sales order line.
	Lines *List[PickLine] `json:"lines" expandable:"true"`
	// Records this pick sits between — the order it fulfills and the shipments packed from it.
	Related *PickRelated `json:"related"`
	// Timestamp when the pick was finished.
	FinishedAt *time.Time `json:"finished_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
	// When the associated sales order promised delivery.
	PromisedAt *time.Time `json:"promised_at"`
	// Date the order must ship by to meet its commitment.
	ShipByDate *time.Time `json:"ship_by_date"`
	// Days allowed to prepare the order before it ships.
	LeadTimeDays *int32 `json:"lead_time_days"`
	// Which rule in the customer/group/account chain produced `lead_time_days`.
	LeadTimeSource *constants.LeadTimeSource `json:"lead_time_source"`
	// Days the carrier is expected to take in transit.
	TransitDays *int32 `json:"transit_days"`
	// Whether `transit_days` came from a cached lane estimate or the service level's default.
	TransitSource *constants.TransitSource `json:"transit_source"`
}

A warehouse picking task for a sales order, tracking the quantities to pull from inventory and pack for shipment.

A pick is created automatically when a sales order is issued, with one line for each order line whose product is of type `sale` service, shipping, tax, credit and return lines are skipped — and nothing picked yet.

func (*Pick) SchemaExample

func (*Pick) SchemaExample() any

type PickLine

type PickLine struct {
	// Pick line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_line"`
	// The item this line picks, named by the originating sales order line and returned as it stands now rather than as it was when the order was placed.
	Item *Item `json:"item" expandable:"true"`
	// Quantity actually picked for this line. A value of `0` means nothing has been picked yet.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// Quantity requested by the originating sales order line for this pick line.
	OrderedQuantity *Quantity `json:"ordered_quantity" validate:"required"`
	// The sales order line this pick line fulfills.
	SalesOrderLine *SalesOrderLine `json:"sales_order_line" expandable:"true"`
	// Timestamp when the line was packed.
	PackedAt *time.Time `json:"packed_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single line on a pick, tracking the quantity picked against one sales order line.

func (*PickLine) SchemaExample

func (*PickLine) SchemaExample() any

type PickRelated

type PickRelated struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_related"`
	// The sales order this pick fulfills.
	SalesOrder *Record `json:"sales_order" expandable:"true"`
	// Lists the shipments packed from this pick.
	Shipments *List[Record] `json:"shipments" expandable:"true"`
}

Groups the records a pick sits between — the order it fulfills and the shipments packed from it — and is returned only once at least one member has been expanded.

type PickShipmentsResponse

type PickShipmentsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_shipments_response"`
	// Shipment numbers associated with the pick, oldest first.
	ShipmentNumbers []string `json:"shipment_numbers" validate:"required"`
	// Total number of matching shipments, ignoring `limit` and `offset`.
	Count int32 `json:"count" validate:"required"`
}

The shipment numbers for the sales order a pick belongs to.

func (*PickShipmentsResponse) SchemaExample

func (*PickShipmentsResponse) SchemaExample() any

type PickStageTotal

type PickStageTotal struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_stage_total"`
	// Progress as a fraction between 0 and 1.
	Completion float64 `json:"completion"`
}

How far one fulfillment stage of a pick has progressed.

type PickTotals

type PickTotals struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_totals"`
	// How far picking has progressed.
	Picked PickStageTotal `json:"picked"`
	// How far packing has progressed.
	Packed PickStageTotal `json:"packed"`
}

Progress through each fulfillment stage of a pick.

type PlanChangeLineItem

type PlanChangeLineItem struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=plan_change_line_item"`
	// Description of the line item.
	Description string `json:"description" validate:"required"`
	// Amount in cents this line contributes to the net total.
	//
	// Negative amounts are credits, such as unused time already paid for on the current plan.
	Amount int64 `json:"amount"`
}

Line item in a plan change cost preview.

type PlanChangeProration

type PlanChangeProration struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=plan_change_proration"`
	// Net amount due in cents for the plan change, after proration.
	//
	// A negative value indicates a credit to the account.
	NetAmount int64 `json:"net_amount"`
	// Formatted net amount for display (e.g., "$49.00").
	FormattedNetAmount string `json:"formatted_net_amount" validate:"required"`
	// Estimated recurring monthly bill in cents once the change takes effect.
	//
	// Calculated from the target plan's price and the number of users on the account, billed at no fewer seats than the plan's seat minimum.
	MonthlyBillAmount int64 `json:"monthly_bill_amount"`
	// Formatted monthly bill amount for display.
	FormattedMonthlyBillAmount string `json:"formatted_monthly_bill_amount" validate:"required"`
	// Detailed line items from the cost preview.
	LineItems *List[PlanChangeLineItem] `json:"line_items"`
	// Whether the amounts are locally estimated rather than quoted by Stripe.
	//
	// OpenMRP falls back to its own calculation when Stripe cannot quote the change, usually because another billing change is still in flight. The amounts are then approximations and the final charge may differ.
	IsEstimate bool `json:"is_estimate"`
}

Cost preview for switching to a different pricing plan.

Producing a preview neither changes the subscription nor charges anything.

func (*PlanChangeProration) SchemaExample

func (*PlanChangeProration) SchemaExample() any

type PlanLimit

type PlanLimit struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=plan_limit"`
	// Resource this limit applies to.
	//
	// - `seats_maximum`: users that can belong to the account.
	// - `sandboxes_maximum`: sandbox environments the account can have.
	// - `invoices_maximum`: invoices the account can issue per billing period.
	// - `batches_maximum`: production batches the account can create per billing period.
	Key constants.AccountPlanLimitKey `json:"key" validate:"required"`
	// Maximum allowed value.
	//
	// Null means the plan places no limit on this resource.
	Value *int `json:"value"`
}

Resource limit for a pricing plan.

func (*PlanLimit) SchemaExample

func (*PlanLimit) SchemaExample() any

type PortalDomain

type PortalDomain struct {
	// Portal domain ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=portal_domain"`
	// The fully-qualified domain name (e.g. `shop.acme.com`).
	Domain string `json:"domain" validate:"required"`
	// How far the domain has progressed towards serving the portal.
	//
	// - `pending`: the domain is waiting on DNS. Publish the listed records, then run the verify action.
	// - `securing`: DNS is correct and the TLS certificate is being issued. The portal is not yet reachable over HTTPS.
	// - `verified`: the certificate is live and the portal is served on the domain.
	// - `failed`: the domain was rejected and cannot be used.
	Status constants.PortalDomainStatus `json:"status" validate:"required"`
	// The DNS records that must be published for the domain to route to the portal and verify.
	//
	// The list is refreshed from the serving provider every time the domain is created or verified. It always contains the routing record; ownership records appear only while a verification challenge is outstanding.
	DNSRecords *List[DNSRecord] `json:"dns_records" validate:"required"`
	// When the domain became fully verified — its TLS certificate live and the portal serving on it.
	VerifiedAt *time.Time `json:"verified_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A custom domain that serves the account's customer portal (e.g. `shop.acme.com`).

After creation the domain starts in `pending`; publish the returned DNS records, then poll the verify action. Once DNS is correct the domain moves to `securing` while its TLS certificate is issued — it is not yet reachable over HTTPS during this window — and finally to `verified` once the certificate is live and the portal is served on the domain.

func (*PortalDomain) SchemaExample

func (*PortalDomain) SchemaExample() any

type PortalProfile

type PortalProfile struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=portal_profile"`
	// The seller's display name.
	Name string `json:"name" validate:"required"`
	// The URL slug that identifies the seller's customer portal.
	Slug string `json:"slug" validate:"required"`
	// Download URL for the seller's logo, valid for one hour after the response is generated.
	LogoURL *string `json:"logo_url"`
	// Download URL for the seller's customer-portal favicon, valid for one hour after the response is generated.
	FaviconURL *string `json:"favicon_url"`
	// The email address customers are directed to for support.
	SupportEmail *string `json:"support_email"`
	// The seller's letterhead address, shown on customer-facing documents.
	//
	// This is the seller account's own default billing address.
	Address *Address `json:"address"`
}

The seller's identity as presented inside a signed-in customer portal: display name, branding, and letterhead address.

This is the counterpart to the public branding profile used on pre-login pages, and it additionally carries the seller's letterhead address for rendering order documents.

func (*PortalProfile) SchemaExample

func (*PortalProfile) SchemaExample() any

type PortalRegistrationSession

type PortalRegistrationSession struct {
	// Portal registration session ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=portal_registration_session"`
	// The seller account whose portal the buyer is registering into.
	SellerAccountID string `json:"seller_account_id" validate:"required"`
	// The portal slug the registration was started from.
	SellerSlug string `json:"seller_slug" validate:"required"`
	// The buyer this session belongs to.
	//
	// Only this user can retrieve, update, complete, or abandon the session.
	UserID string `json:"user_id" validate:"required"`
	// Whether the buyer is joining a customer the seller already has, rather than creating a new one.
	//
	// When true, completing the registration links the buyer to the seller's existing customer identified by `customer_number`; otherwise it creates a new customer from the rest of the session data.
	IsExistingCustomer *bool `json:"is_existing_customer"`
	// The step the buyer has reached.
	//
	// Steps run `customer_details` → `billing_address` → `contact` → `completed`, and only ever move forward.
	Step constants.PortalRegistrationStep `json:"step" validate:"required"`
	// Where the registration stands, derived from its completion and abandonment timestamps and the seven-day resume window.
	//
	// - `in_progress`: still incomplete and inside the resume window.
	// - `completed`: the buyer finished registering.
	// - `abandoned`: the buyer explicitly gave the session up.
	// - `expired`: still incomplete, but past the resume window, so the buyer can no longer pick it back up.
	Status constants.PortalRegistrationStatus `json:"status" validate:"required"`
	// The customer the registration created or joined.
	CustomerID *string `json:"customer_id"`
	// The form data the buyer has entered so far.
	SessionData *PortalRegistrationSessionData `json:"session_data"`
	// When the buyer completed the registration.
	CompletedAt *time.Time `json:"completed_at"`
	// When the buyer abandoned the session.
	AbandonedAt *time.Time `json:"abandoned_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A buyer's registration into a seller's customer portal.

The buyer starts a session, advances it step by step, and completes it — so a half-finished registration can be resumed rather than leaving the buyer stuck. Sellers use the same record to see which registrations stalled before completing.

func (*PortalRegistrationSession) SchemaExample

func (*PortalRegistrationSession) SchemaExample() any

type PortalRegistrationSessionData

type PortalRegistrationSessionData struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=portal_registration_session_data"`
	// The name the buyer entered for the customer.
	//
	// Only used when the registration creates a new customer; joining an existing customer keeps that customer's own name.
	CustomerName string `json:"customer_name"`
	// The seller-assigned customer number the buyer is claiming.
	//
	// Only used when the buyer is joining an existing customer, where it must match a customer already on the seller's books. New customers are assigned a number automatically when the registration completes.
	CustomerNumber string `json:"customer_number"`
	// The chosen customer group ID.
	CustomerGroupID string `json:"customer_group_id"`
	// The chosen payment term ID.
	PaymentTermID string `json:"payment_term_id"`
	// The chosen shipping term ID.
	ShippingTermID string `json:"shipping_term_id"`
	// Contact phone number.
	Phone string `json:"phone"`
	// Billing address name.
	AddressName string `json:"address_name"`
	// Billing address street line 1.
	AddressStreet1 string `json:"address_street_1"`
	// Billing address street line 2.
	AddressStreet2 string `json:"address_street_2"`
	// Billing address city / locality.
	AddressLocality string `json:"address_locality"`
	// Billing address state.
	AddressState string `json:"address_state"`
	// Billing address postal code.
	AddressPostalCode string `json:"address_postal_code"`
	// Billing address two-letter country code.
	AddressCountry string `json:"address_country"`
}

The form data a buyer has entered so far in a customer-portal registration.

It is saved on the session as the buyer advances and echoed back on every read, so a resumed registration can restore the form exactly where the buyer left off. The values are used to create or link the customer when the registration is completed.

type PricingPlan

type PricingPlan struct {
	// Plan ID.
	//
	// Pass this value when previewing or performing a plan switch.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pricing_plan"`
	// Display name of the plan.
	Name string `json:"name" validate:"required"`
	// Tier of this pricing plan.
	PlanTypeCode constants.PublicPlanCode `json:"plan_type" validate:"required"`
	// Price per seat per month in dollars.
	PricePerSeat float64 `json:"price_per_seat"`
	// Per-seat price override in dollars used in place of `price_per_seat` when set.
	//
	// The monthly bill multiplies this by the number of seats (at least `seat_minimum`). `null` or `0` falls back to `price_per_seat`.
	PricePerMonth *float64 `json:"price_per_month"`
	// Minimum number of seats billed on this plan.
	//
	// When the account has fewer users than this minimum, the monthly bill is still calculated using this seat count. Null means no minimum.
	SeatMinimum *int `json:"seat_minimum"`
	// Resource limits for this plan.
	Limits *List[PlanLimit] `json:"limits" validate:"required"`
	// Features to display on the pricing page.
	DisplayFeatures []string `json:"display_features" validate:"required"`
	// Display order for sorting on the pricing page.
	DisplayOrder int `json:"display_order"`
	// Whether this plan should be visually highlighted.
	IsHighlighted bool `json:"is_highlighted"`
	// Call-to-action button text.
	ButtonText string `json:"button_text" validate:"required"`
	// Name of the lower plan tier whose features this plan also includes, for an "everything in X, plus..." callout on the pricing page.
	//
	// Null for the entry tier, which builds on no prior plan.
	IncludesPreviousPlan *string `json:"includes_previous_plan"`
}

A subscription plan an account can be billed on.

func (*PricingPlan) SchemaExample

func (*PricingPlan) SchemaExample() any

type Priority

type Priority struct {
	// Priority ID.
	ID string `json:"id"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=priority"`
	// Machine-readable code identifying the priority level.
	//
	// Other resources refer to a priority by this code rather than by its ID, such as a sales order's `priority`, and it can be used in place of the ID when retrieving a priority.
	Code constants.PriorityCode `json:"code" validate:"required"`
	// Display name of the priority level.
	Name string `json:"name" validate:"required"`
	// Owner of this resource.
	//
	// Priorities are platform-provided and shared across all accounts, so the owner is always the OpenMRP system owner.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at"`
}

Priority level used to order work on sales orders, purchase orders, and picks.

The levels are platform-provided and the same for every account, so they cannot be created, renamed, or removed. A customer can carry a default priority that pre-fills new orders for them.

func (*Priority) SchemaExample

func (*Priority) SchemaExample() any

type Product

type Product struct {
	// Product ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=product"`
	// Product type code, which determines how the product behaves on orders and invoices.
	//
	// - `sale`: a standard sellable product.
	// - `service`: a non-physical service line, such as labor or installation.
	// - `shipping`: a shipping charge applied to an order.
	// - `credit`: a credit applied against an order or invoice.
	// - `return`: a returned product (RMA).
	// - `tax`: a tax line.
	Type constants.ProductTypeCode `json:"type" validate:"required"`
	// Whether the product is shown to buyers in the customer portal.
	//
	// - `visible`: buyers can see and order the product in the portal.
	// - `hidden`: the product is concealed from the portal but remains usable internally.
	//
	// Visibility alone is not enough to expose a product: a buyer only sees it if their account has also been granted access to the product's product line.
	PortalVisibility constants.CustomerPortalVisibility `json:"portal_visibility" validate:"required"`
	// The product line this product is assigned to, if any.
	//
	// Customer accounts are granted access to whole product lines, so this assignment is what decides which buyers can see and order the product. A product with no product line is never visible in the customer portal. The line also supplies the default commission and freight policies for the product.
	ProductLine *ProductLine `json:"product_line" expandable:"true"`
	// The inventory item backing this product, which holds its SKU, description, pricing, and attributes.
	Item *Item `json:"item" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A catalog entry as it is sold: an inventory item together with its product type, product line, and customer portal visibility.

Every product is backed by exactly one item, which carries the SKU, description, pricing, attributes, and inventory position. Creating a product creates that item; deleting the product deletes it.

func (*Product) SchemaExample

func (*Product) SchemaExample() any

type ProductLine

type ProductLine struct {
	// Product line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=product_line"`
	// Display name of the product line.
	//
	// Unique among the product lines visible to your account, which includes the shared system lines.
	Name string `json:"name" validate:"required"`
	// Free-form description of the product line.
	Description *string `json:"description"`
	// Free-form notes about the product line.
	Notes *string `json:"notes"`
	// Default commission policy for products in this product line.
	//
	// - `commission_exempt`: no commission applies to these products.
	// - `commission_applied`: commission applies to these products, unless overridden elsewhere.
	CommissionPolicy constants.CommissionPolicy `json:"commission_policy" validate:"required"`
	// Default freight policy for products in this product line.
	//
	// - `free_freight`: these products do not incur a freight charge.
	// - `billed_freight`: freight is billed for these products, unless overridden elsewhere.
	FreightPolicy constants.FreightPolicy `json:"freight_policy" validate:"required"`
	// Owner of the product line.
	//
	// System-owned product lines are platform-provided and shared across all accounts; account-owned product lines are custom to your account. Only account-owned product lines can be updated, deleted, or granted to customers and account groups.
	Owner *Owner `json:"owner" expandable:"true"`
	// Unit group associated with this product line.
	//
	// The unit group determines the set of units available to products in this product line.
	UnitGroup *UnitGroup `json:"unit_group" expandable:"true"`
	// The lot products in this line are made in — a doff, a pallet.
	//
	// Sizes the campaigns a production schedule plans, and defaults the quantity when a batch is added to a production run. The unit is part of the value — 60 counted in pairs and 60 counted in eaches are different lots — and is drawn from this product line's unit group.
	//
	// An item's own lot override still takes precedence over the line's. When the line has no lot convention, planning falls back to the lot of the line the item feeds into, and then to the account-wide default lot size.
	DefaultLot *Quantity `json:"default_lot" expandable:"true"`
	// How products in this line are produced when they do not say for themselves.
	//
	// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
	// - `make_to_order`: built only against orders already on the book, holding no buffer.
	//
	// Null falls through to the account default.
	FulfillmentPolicy *constants.FulfillmentPolicy `json:"fulfillment_policy"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last-updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A named grouping of related products in your catalog.

A product line carries the default commission and freight policies for the products assigned to it, along with the unit group that determines how those products are measured. Product lines are also the unit that catalog access is granted over, for both customers and account groups.

func (*ProductLine) SchemaExample

func (*ProductLine) SchemaExample() any

type ProductType

type ProductType struct {
	// Product type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=product_type"`
	// Display name of the product type.
	//
	// Unique across all product types.
	Name string `json:"name" validate:"required"`
	// Stable machine-readable code identifying the kind of product type.
	//
	// - `sale`: a standard sellable product.
	// - `service`: a non-physical service line, such as labor or installation.
	// - `shipping`: a shipping charge applied to an order.
	// - `credit`: a credit applied against an order or invoice.
	// - `return`: a returned product (RMA).
	// - `tax`: a tax line.
	//
	// Products reference their product type by this code rather than by ID, and the code can be used in place of the ID when retrieving a product type.
	Code constants.ProductTypeCode `json:"code" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The classification that decides how a product behaves on orders and invoices — a sellable good, a service, a shipping charge, and so on.

Product types are shared across all accounts rather than owned by one.

func (*ProductType) SchemaExample

func (*ProductType) SchemaExample() any

type ProductionCostItem

type ProductionCostItem struct {
	// The department information.
	Department *Entity `json:"department"`
	// The category information.
	Category *Entity `json:"category" validate:"required"`
	// The total costs.
	TotalCosts CostBreakdown `json:"total_costs" validate:"required"`
	// The productive costs.
	ProductiveCosts CostBreakdown `json:"productive_costs" validate:"required"`
	// The waste costs.
	WasteCosts CostBreakdown `json:"waste_costs" validate:"required"`
	// The seconds costs.
	SecondsCosts CostBreakdown `json:"seconds_costs" validate:"required"`
}

ProductionCostItem represents an aggregated production cost entry.

type ProductionFlow

type ProductionFlow struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_flow"`
	// Steps in the production flow graph, with the item's producing step(s) listed first.
	Steps *List[ProductionFlowStep] `json:"steps" expandable:"true"`
}

The production flow graph for an item.

Contains the step(s) that produce the item, every upstream step that feeds them, and any connected downstream steps.

func (*ProductionFlow) SchemaExample

func (*ProductionFlow) SchemaExample() any

type ProductionFlowConsumption

type ProductionFlowConsumption struct {
	// Consumption record ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=consumption"`
	// Item consumed by the step.
	ConsumedItem *Item `json:"consumed_item" expandable:"true"`
	// Quantity of the item consumed by this step.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// Quantity of the consumed item expected to be lost as scrap or waste.
	WasteQuantity *Quantity `json:"waste_quantity" validate:"required"`
	// Instructions for how this material is consumed.
	Instructions *string `json:"instructions"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A material consumed by a step in the production flow, with its quantity and expected waste.

func (*ProductionFlowConsumption) SchemaExample

func (*ProductionFlowConsumption) SchemaExample() any

type ProductionFlowProduction

type ProductionFlowProduction struct {
	// Production record ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production"`
	// Item produced by the step.
	ProducedItem *Item `json:"produced_item" expandable:"true"`
	// Quantity of the item this step produces.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The item and quantity produced by a step in the production flow.

func (*ProductionFlowProduction) SchemaExample

func (*ProductionFlowProduction) SchemaExample() any

type ProductionFlowStep

type ProductionFlowStep struct {
	// Production step ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_step"`
	// Display name of the step.
	Name string `json:"name" validate:"required"`
	// Free-form notes about this step.
	Notes *string `json:"notes"`
	// The item and quantity this step produces.
	Production *ProductionFlowProduction `json:"production" expandable:"true"`
	// Materials this step consumes as inputs, with their quantities and expected waste.
	Consumptions *List[ProductionFlowConsumption] `json:"consumptions" expandable:"true"`
	// Steps that feed into this step.
	//
	// Restricted to steps that are themselves part of this flow.
	InSteps *List[ProductionStep] `json:"in_steps" expandable:"true"`
	// Steps that this step feeds into.
	//
	// Restricted to steps that are themselves part of this flow.
	OutSteps *List[ProductionStep] `json:"out_steps" expandable:"true"`
	// Machines assigned to this step.
	Machines *List[Machine] `json:"machines" expandable:"true"`
	// Department responsible for this step.
	Department *Department `json:"department" expandable:"true"`
	// Scanning station where this step's batches are scanned.
	ScanningStation *ScanningStation `json:"scanning_station" expandable:"true"`
	// Leveling correction factor applied to labor time in cost calculations, as a decimal string.
	//
	// Effective labor time per unit is `labor_time × (1 + leveling_factor) × (1 + allowances)`.
	LevelingFactor string `json:"leveling_factor" validate:"required" format:"decimal"`
	// Allowance correction factor applied to labor time in cost calculations, as a decimal string.
	//
	// Effective labor time per unit is `labor_time × (1 + leveling_factor) × (1 + allowances)`.
	Allowances string `json:"allowances" validate:"required" format:"decimal"`
	// Cost of labor for this step, expressed as a rate of currency per unit of time (e.g. `$` per `hr`).
	LaborRate *Rate `json:"labor_rate"`
	// Labor duration for this step, expressed as a rate (e.g. time per unit of output).
	LaborTime *Rate `json:"labor_time"`
	// Overhead cost for this step, expressed as a rate of currency per unit of time (e.g. `$` per `hr`).
	OverheadRate *Rate `json:"overhead_rate"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A stage of work within an item's production flow, with its output, material inputs, cost rates, and links to the steps around it.

func (*ProductionFlowStep) SchemaExample

func (*ProductionFlowStep) SchemaExample() any

type ProductionOutput

type ProductionOutput struct {
	// Production ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production"`
	// Item produced by the step.
	ProducedItem *Item `json:"produced_item" expandable:"true"`
	// Quantity produced.
	Quantity *Quantity `json:"quantity"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The output of a production step: the item it produces and the quantity produced.

func (*ProductionOutput) SchemaExample

func (*ProductionOutput) SchemaExample() any

type ProductionRun

type ProductionRun struct {
	// Production run ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_run"`
	// Production run number, unique per account.
	//
	// Assigned automatically at creation as the next sequential number for the account; can be changed via update.
	Number string `json:"number" validate:"required"`
	// Account user accountable for executing the run.
	ResponsibleUser *AccountUser `json:"responsible_user" expandable:"true"`
	// Number of batches currently recorded against this run.
	BatchCount int32 `json:"batch_count" validate:"required"`
	// Time the run started production.
	//
	// Set automatically the first time a batch in the run is scanned at a station.
	StartedAt *time.Time `json:"started_at"`
	// Time the run finished production.
	//
	// Set automatically once every batch in the run has been scanned or deleted. From that point the run can no longer be updated and no further batches can be added to it.
	CompletedAt *time.Time `json:"completed_at"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last-updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A production run: the group of shop-floor batches that are executed together, tracked from the first batch scan through to completion.

func (*ProductionRun) SchemaExample

func (*ProductionRun) SchemaExample() any

type ProductionRunReference

type ProductionRunReference struct {
	// Production run ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_run"`
	// Production run number.
	Number string `json:"number" validate:"required"`
}

Minimal reference to the production run a batch was created under.

func (*ProductionRunReference) SchemaExample

func (*ProductionRunReference) SchemaExample() any

type ProductionSchedule

type ProductionSchedule struct {
	// Schedule ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule"`
	// Sequential version number within the account.
	//
	// Regenerating a draft re-solves it in place and keeps its number; only generating a new plan takes the next one.
	Version int32 `json:"version" validate:"required"`
	// Where this version is in its lifecycle.
	//
	// - `draft`: still editable and commits to nothing.
	// - `generating`: a scheduled solve is still building this version.
	// - `published`: live, with its leading weeks frozen as a commitment to the floor.
	// - `superseded`: a later version was published over an overlapping horizon.
	// - `archived`: retired without being replaced.
	// - `failed`: the solver could not produce a plan; `error_message` says why.
	Status constants.ProductionScheduleStatus `json:"status" validate:"required"`
	// Label for the version, such as the planning cycle it was generated for.
	Name *string `json:"name"`
	// The instant the plan was calculated against.
	PlanningAsOf time.Time `json:"planning_as_of_at" validate:"required"`
	// First instant of the horizon.
	HorizonStartDate time.Time `json:"horizon_starts_at" validate:"required"`
	// First instant of the last day of the horizon.
	HorizonEndDate time.Time `json:"horizon_ends_at" validate:"required"`
	// Length of the horizon in weeks.
	HorizonWeeks int32 `json:"horizon_weeks" validate:"required"`
	// How many leading weeks freeze on publish.
	//
	// Publishing freezes every campaign that starts inside the window; changing one afterwards requires a reason and is recorded in the deviation log.
	FrozenWeeks int32 `json:"frozen_weeks"`
	// The last day the frozen window covers, set when the version is published.
	FrozenThroughDate *time.Time `json:"frozen_through_at"`
	// Which demand basis produced the plan.
	//
	// - `trailing_12`: demand is taken from the trailing twelve months of orders.
	// - `seasonal_ema`: demand is a seasonal exponential moving average, which follows a season arriving earlier or later than usual.
	DemandBasis constants.ScheduleDemandBasis `json:"demand_basis" validate:"required"`
	// What triggered the generation.
	//
	// - `manual`: someone asked for this version.
	// - `scheduled`: the account's generation cadence produced it on its own.
	GenerationSource constants.ScheduleGenerationSource `json:"generation_source" validate:"required"`
	// Version of the solver that produced the plan.
	SolverVersion string `json:"solver_version" validate:"required"`
	// The planning assumptions used, frozen at generation so the plan stays explainable after settings change.
	SettingsSnapshot map[string]any `json:"settings_snapshot"`
	// What the solver could not do, frozen at generation.
	Diagnostics ScheduleDiagnostics `json:"diagnostics"`
	// Why generation failed, when it did.
	ErrorMessage *string `json:"error_message"`
	// Number of lines that were frozen at publish.
	//
	// Captured once and never recomputed, because frozen-week adherence measures against what was committed to.
	FrozenLineCount int32 `json:"frozen_line_count"`
	// Total quantity frozen at publish.
	FrozenPlannedQuantity float64 `json:"frozen_planned_quantity"`
	// The actor that generated this version.
	GeneratedBy *Actor `json:"generated_by"`
	// The actor that published this version.
	PublishedBy *Actor `json:"published_by"`
	// When this version was published.
	PublishedAt *time.Time `json:"published_at"`
	// The version that replaced this one.
	//
	// Set automatically when a later version is published over an overlapping horizon.
	SupersededBy *Entity `json:"superseded_by"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A saved production schedule.

A published version is a record rather than a document that keeps being edited: generating again creates a new version, and publishing supersedes the previous one rather than changing it, because attainment is measured against whichever version was live at the time.

func (*ProductionSchedule) SchemaExample

func (*ProductionSchedule) SchemaExample() any

type ProductionScheduleDerivedLine

type ProductionScheduleDerivedLine struct {
	// Derived line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_derived_line"`
	// The schedule version this work was derived from.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// The constraint campaign this work follows from.
	SourceLine *Entity `json:"source_line" validate:"required"`
	// The production step that does the work.
	ProductionStep *Entity `json:"production_step" validate:"required"`
	// The department that owns the step.
	Department *Entity `json:"department"`
	// The item being worked on.
	Item *Entity `json:"item" validate:"required"`
	// Horizon week the work falls in, zero-based.
	WeekIndex int32 `json:"week_index"`
	// First instant of that week.
	WeekStartDate time.Time `json:"week_starts_at" validate:"required"`
	// Units implied for this step.
	Quantity float64 `json:"quantity"`
	// The unit the quantity is expressed in.
	PlannedUnit *Entity `json:"planned_unit"`
	// How many steps downstream of the constraint this work sits.
	ExplosionDepth int32 `json:"explosion_depth"`
	// Weeks after the constraint campaign this work starts.
	OffsetWeeks int32 `json:"offset_weeks"`
	// State of the derived work.
	//
	// Derived rows are discarded and rebuilt from the constraint plan every time the version is solved, and are only ever written as `planned`, so they report what the plan implies rather than what the floor has done.
	Status constants.ProductionScheduleLineStatus `json:"status" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Downstream department work implied by a constraint campaign.

The solver only schedules the constraint; every other department's work follows from it by walking the production-step graph. `explosion_depth` is how many steps downstream this sits — depth 1 waits only on the constraint, depth 3 waits on two intermediate steps — which is what a readiness indicator keys off.

The derived week can fall past the schedule's horizon when a long chain follows a late campaign. That work is still returned rather than dropped, because a department needs to see it coming.

func (*ProductionScheduleDerivedLine) SchemaExample

func (*ProductionScheduleDerivedLine) SchemaExample() any

type ProductionScheduleDeviation

type ProductionScheduleDeviation struct {
	// Deviation ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_deviation"`
	// The schedule version the change was made to.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// The line that was changed.
	//
	// A removal leaves no line to point at, so `before` is the only record of what was there.
	Line *Entity `json:"line"`
	// What kind of change this was.
	//
	// Derived from the change itself rather than supplied by the person making it. An edit that both moves a campaign to another machine and changes its quantity is recorded as the machine change, because that is what a planner has to react to first.
	DeviationType constants.ScheduleDeviationType `json:"deviation_type" validate:"required"`
	// Whether the change fell inside the frozen window when it was made.
	FreezeStatus constants.ScheduleFreezeStatus `json:"freeze_status" validate:"required"`
	// The horizon week the change affected, zero-based.
	WeekIndex *int32 `json:"week_index"`
	// The machine whose campaign changed.
	Machine *Entity `json:"machine"`
	// The item whose campaign changed.
	Item *Entity `json:"item"`
	// Snapshot of the line before the change, null when the change created it.
	Before json.RawMessage `json:"before"`
	// Snapshot of the line after the change, null when the change removed it.
	After json.RawMessage `json:"after"`
	// Signed change in planned units.
	DeltaQuantity float64 `json:"delta_quantity"`
	// Signed change in planned run hours.
	DeltaRunHours float64 `json:"delta_run_hours"`
	// Why the change was made.
	//
	// A change inside a frozen week has to supply one; outside it a reason is left to the planner.
	//
	// - `machine_down`: the machine the campaign was on stopped running.
	// - `material_shortage`: the material the campaign needs did not arrive.
	// - `rush_order`: demand that could not wait for the next plan.
	// - `quality_hold`: the work was stopped over a quality problem.
	// - `over_run`: the floor produced more than the plan asked for.
	// - `under_run`: the floor produced less than the plan asked for.
	// - `capacity_change`: the available machine time changed, such as a shutdown or an added shift.
	// - `other`: something outside the list, which should be spelled out in `reason_note`.
	Reason *constants.ScheduleChangeReason `json:"reason"`
	// Free-form explanation of the change.
	ReasonNote *string `json:"reason_note"`
	// The actor that made the change.
	Actor *Actor `json:"actor"`
	// When the change was made.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

One hand change to a production schedule.

The log is append-only: it is what frozen-week adherence is measured from, and a plan edited back into shape has to stay distinguishable from one that was right the first time. `before` and `after` are full snapshots of the line, so a deviation stays readable after the line it describes is deleted.

`freeze_status` is recorded when the change is made, from the freeze window as it stood at that moment. It is never re-derived, so a later publish cannot retroactively reclassify a past edit.

func (*ProductionScheduleDeviation) SchemaExample

func (*ProductionScheduleDeviation) SchemaExample() any

type ProductionScheduleFinishedPolicy

type ProductionScheduleFinishedPolicy struct {
	// Finished policy ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_finished_policy"`
	// The schedule version this was snapshotted onto.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// The finished good.
	Item *Entity `json:"item" validate:"required"`
	// SKU of the finished good.
	SKU string `json:"sku" validate:"required"`
	// The constraint item this is made from.
	GreigeItem *Entity `json:"greige_item" validate:"required"`
	// SKU of that constraint item.
	GreigeSKU string `json:"greige_sku" validate:"required"`
	// Product line the finished good belongs to.
	ProductLine *Entity `json:"product_line"`
	// This SKU's own annual demand.
	AnnualDemand float64 `json:"annual_demand"`
	// This SKU's own weekly demand.
	WeeklyDemand float64 `json:"weekly_demand"`
	// This SKU's own weekly demand variability.
	//
	// The constraint buffer pools these as the root of the sum of squares; these targets use them one at a time.
	SigmaWeekly float64 `json:"sigma_weekly"`
	// Buffer held as this finished good, covering the finishing lead time.
	SafetyStock float64 `json:"safety_stock"`
	// Stock position at which this finished good needs replenishing.
	ReorderPoint float64 `json:"reorder_point"`
	// This SKU's own stock, not the echelon it contributes to.
	OnHand float64 `json:"on_hand"`
	// Weeks of demand this SKU's own stock covers.
	WeeksOfCover float64 `json:"weeks_of_cover"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

One finished SKU's own inventory target, snapshotted onto a schedule version.

The item policy pools every finished good a constraint item feeds into one echelon figure, which is the right basis for deciding whether to build. These rows are what that pooling hides: this SKU's own demand, its own variability, and a buffer sized against the finishing lead time rather than the constraint's — because finishing, not the constraint, is what replenishes this stock.

The two stages do not overlap. The constraint stage holds its pooled buffer and the finished stage holds these, so together they describe the whole network's stock without counting any of it twice.

func (*ProductionScheduleFinishedPolicy) SchemaExample

func (*ProductionScheduleFinishedPolicy) SchemaExample() any

type ProductionScheduleFinishingLine

type ProductionScheduleFinishingLine struct {
	// Finishing line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_finishing_line"`
	// The schedule version this belongs to.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// Zero-based week offset from the start of the horizon.
	WeekIndex int32 `json:"week_index"`
	// First day of the week this is planned in.
	WeekStartDate time.Time `json:"week_starts_at" validate:"required"`
	// The finished good to make.
	Item *Entity `json:"item" validate:"required"`
	// SKU of the finished good, as it stood when the plan was generated.
	SKU string `json:"sku" validate:"required"`
	// The constraint item it is made from.
	GreigeItem *Entity `json:"greige_item" validate:"required"`
	// SKU of that constraint item.
	GreigeSKU string `json:"greige_sku" validate:"required"`
	// The department that does the work.
	//
	// Absent for a finished good nobody has ever scanned a finishing step for, which means the plan knows what to make but not yet where.
	Department *Entity `json:"department"`
	// The production step the work runs at.
	ProductionStep *Entity `json:"production_step"`
	// Units of the finished good to make.
	PlannedQuantity float64 `json:"planned_quantity"`
	// Abbreviation of the unit everything on this line is counted in.
	Unit *string `json:"unit"`
	// How many lots the quantity breaks into.
	PlannedLots int32 `json:"planned_lots"`
	// Units in one lot.
	PlannedLotUnits float64 `json:"planned_lot_units"`
	// Hours of the second stage's capacity this line consumes.
	PlannedRunHours float64 `json:"planned_run_hours"`
	// Units of the constraint item this takes out of the greige buffer.
	//
	// Equal to `planned_quantity` unless a finishing yield loss means a finished unit costs more than one knitted one.
	GreigeConsumed float64 `json:"greige_consumed"`
	// How much of the week's draw on this SKU is an order rather than a forecast.
	FirmUnits float64 `json:"firm_units"`
	// This SKU's own projected stock before the line lands.
	ProjectedOnHandBefore float64 `json:"projected_on_hand_before"`
	// And after it lands.
	ProjectedOnHandAfter float64 `json:"projected_on_hand_after"`
	// Where the line stands.
	Status constants.ProductionScheduleLineStatus `json:"status" validate:"required"`
	// Whether the solver produced this line or a person did.
	Source constants.ScheduleLineSource `json:"source" validate:"required"`
	// Whether the line sits inside the published frozen window.
	IsFrozen bool `json:"is_frozen"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

One finished good's build in one week: the second stage of the plan.

The constraint plan says how much greige to knit and deliberately does not say what to turn it into — a family's demand is pooled onto the greige precisely so the buffer can sit at the undifferentiated stage. These lines are where that pooling is undone: how many of which finished good to make from the knitted parts, decided against each SKU's own stock position, its own orders, and the hours the rest of the factory has that week.

Quantities are counted in the constraint item's unit, so `greige_consumed` and the knit plan's `planned_quantity` are directly comparable. That is what lets the two stages be reconciled rather than merely read side by side.

func (*ProductionScheduleFinishingLine) SchemaExample

func (*ProductionScheduleFinishingLine) SchemaExample() any

type ProductionScheduleItemPolicy

type ProductionScheduleItemPolicy struct {
	// Policy ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_item_policy"`
	// The schedule version this policy belongs to.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// The item the policy is for.
	Item *Entity `json:"item" validate:"required"`
	// How this item was planned.
	//
	// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
	// - `make_to_order`: built only against orders already on the book, holding no buffer, so its safety stocks and reorder point are all zero.
	FulfillmentPolicy constants.FulfillmentPolicy `json:"fulfillment_policy"`
	// Which rule decided that policy: the item itself, its product line, or the account default.
	PolicySource constants.FulfillmentPolicySource `json:"policy_source"`
	// Outstanding quantity the order book already owed for this item over the horizon.
	FirmDemandUnits float64 `json:"firm_demand_units"`
	// Quantity the forecast projected for the same window.
	ForecastDemandUnits float64 `json:"forecast_demand_units"`
	// SKU of the item.
	SKU string `json:"sku" validate:"required"`
	// Unit every quantity in this policy is counted in.
	Unit *Entity `json:"unit"`
	// Abbreviation of the unit every quantity in this policy is counted in, for display.
	//
	// A reorder point of 2,508 is uninterpretable without it, so the two are never meaningful apart.
	UnitAbbreviation *string `json:"unit_abbreviation"`
	// The production step the item runs at.
	ProductionStep *Entity `json:"production_step"`
	// The machine the item usually runs on.
	PrimaryMachine *Entity `json:"primary_machine"`
	// Demand used for planning, annualized.
	AnnualDemand float64 `json:"annual_demand"`
	// Demand used for planning, per week.
	WeeklyDemand float64 `json:"weekly_demand"`
	// How long one unit occupies the constraint.
	SecondsPerUnit float64 `json:"seconds_per_unit"`
	// Standard cost per unit.
	UnitCost float64 `json:"unit_cost"`
	// Cost of one changeover.
	SetupCost float64 `json:"setup_cost"`
	// Annual cost of holding one unit.
	HoldingCost float64 `json:"holding_cost"`
	// Economic order quantity: the campaign size that balances the cost of a changeover against the cost of holding what it produces.
	EOQUnits float64 `json:"eoq_units"`
	// Observed or default lead time at the constraint.
	ConstraintLeadTimeWeeks float64 `json:"constraint_lead_time_weeks"`
	// Lead time from the constraint to sellable stock.
	FinishLeadTimeWeeks float64 `json:"finish_lead_time_weeks"`
	// Pooled weekly demand variability at the constraint.
	SigmaWeeklyPooled float64 `json:"sigma_weekly_pooled"`
	// Summed weekly variability of the finished goods this item becomes.
	SigmaDownstreamSum float64 `json:"sigma_downstream_sum"`
	// Buffer held at the constraint.
	SafetyStockPrimary float64 `json:"safety_stock_primary"`
	// Buffer held as finished goods.
	SafetyStockDownstream float64 `json:"safety_stock_downstream"`
	// Stock position at which a campaign is triggered.
	ReorderPoint float64 `json:"reorder_point"`
	// Ceiling on how far ahead this item is built.
	OrderUpTo float64 `json:"order_up_to"`
	// Stock at the constraint plus everything downstream of it.
	//
	// This is what the build decision is made against — stock already finished still counts against building more.
	OnHandEchelon float64 `json:"on_hand_echelon"`
	// Stock sitting at the constraint stage on its own.
	//
	// Kept alongside the echelon total because that total cannot be decomposed back into its stages once summed.
	OnHandGreige float64 `json:"on_hand_greige"`
	// What the constraint stage holds on average: its buffer, plus half a campaign as one lands and drains.
	AverageGreigeInventory float64 `json:"average_greige_inventory"`
	// What the constraint stage holds at its peak: its buffer plus a whole campaign.
	MaxGreigeInventory float64 `json:"max_greige_inventory"`
	// Weeks of demand the current stock covers.
	WeeksOfCover float64 `json:"weeks_of_cover"`
	// The echelon position at the end of each horizon week, after that week's campaigns land and its demand is drawn down.
	//
	// A run of weeks with no campaign is stock draining toward `reorder_point`; this is what makes that visible rather than looking like the solver did nothing.
	ProjectedOnHand []float64 `json:"projected_on_hand"`
	// The physical greige store at the end of each horizon week — the constraint stage on its own, which `projected_on_hand` cannot be decomposed back into.
	//
	// A week where this dips to `safety_stock_primary` is the week knitting is meant to replenish, even where `projected_on_hand` still reads full because the stock is held downstream as finished goods. Empty for a schedule generated before the greige buffer existed.
	ProjectedGreigeOnHand []float64 `json:"projected_greige_on_hand"`
	// Constraint hours this item's annual demand consumes.
	AnnualRunHours float64 `json:"annual_run_hours"`
	// ABC class by share of constraint run hours.
	//
	// - `a`: consumes the largest share of constraint capacity.
	// - `b`: moderate constraint consumption.
	// - `c`: consumes little constraint capacity.
	ABCClass *constants.ABCClass `json:"abc_class"`
	// Limits the solver hit while sizing this item's campaigns, empty when the policy was applied as calculated.
	//
	// - `eoq_capped`: the economic lot size did not fit one machine-week and was cut back to what does, so campaigns run shorter and more often than the cost calculation alone would ask for.
	// - `capacity_starved`: the item was already below its trigger point and never won a slot in the horizon, so the plan does not replenish it.
	Constraints []constants.SchedulePolicyConstraint `json:"constraints"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The per-item policy behind a schedule version.

Snapshotted at generation rather than recomputed, so a historical plan can still explain itself after costs, demand or settings move.

func (*ProductionScheduleItemPolicy) SchemaExample

func (*ProductionScheduleItemPolicy) SchemaExample() any

type ProductionScheduleItemSetting

type ProductionScheduleItemSetting struct {
	// Item setting ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_item_setting"`
	// The item these overrides apply to.
	Item *Entity `json:"item" validate:"required"`
	// Whether this item takes part in planning.
	//
	// An excluded item is left out of the plan entirely: no campaigns, no policy, no capacity.
	ParticipationStatus constants.ParticipationStatus `json:"participation_status" validate:"required"`
	// Units in one production lot for this item, overriding the lot its product line would supply.
	LotMultipleUnits *float64 `json:"lot_multiple_units"`
	// How this item is produced.
	//
	// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
	// - `make_to_order`: built only against orders already on the book, holding no buffer.
	//
	// Null inherits from the item's product line, then from the account default.
	FulfillmentPolicy *constants.FulfillmentPolicy `json:"fulfillment_policy"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Planning overrides for one item, on top of the account-wide assumptions.

func (*ProductionScheduleItemSetting) SchemaExample

func (*ProductionScheduleItemSetting) SchemaExample() any

type ProductionScheduleLine

type ProductionScheduleLine struct {
	// Line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_line"`
	// The schedule version this line belongs to.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// Zero-based week offset from the start of the horizon.
	WeekIndex int32 `json:"week_index"`
	// First instant of the week this campaign runs in.
	WeekStartDate time.Time `json:"week_starts_at" validate:"required"`
	// The machine assigned to the campaign.
	Machine *Entity `json:"machine" validate:"required"`
	// The production step the campaign runs at.
	ProductionStep *Entity `json:"production_step"`
	// The department the machine belongs to.
	Department *Entity `json:"department"`
	// The item to produce.
	Item *Entity `json:"item" validate:"required"`
	// Quantity to produce.
	PlannedQuantity float64 `json:"planned_quantity"`
	// Unit the quantity is expressed in.
	PlannedUnit *Entity `json:"planned_unit"`
	// Abbreviation of the unit every quantity on this line is counted in, for display.
	//
	// A campaign of 360 means 360 pairs or 360 eaches depending on this, so the two are never meaningful apart.
	PlannedUnitAbbreviation *string `json:"planned_unit_abbreviation"`
	// Whole lots the quantity rounds to.
	PlannedLots int32 `json:"planned_lots"`
	// Units in one lot, which is the batch size the week is released to the floor in.
	PlannedLotUnits float64 `json:"planned_lot_units"`
	// Constraint hours the campaign consumes.
	PlannedRunHours float64 `json:"planned_run_hours"`
	// Modelled changeover time before the campaign.
	PlannedChangeoverMinutes float64 `json:"planned_changeover_minutes"`
	// Order the campaign runs within its week.
	SequenceIndex int32 `json:"sequence_index"`
	// Projected stock before the campaign lands.
	ProjectedOnHandBefore float64 `json:"projected_on_hand_before"`
	// Projected stock after the campaign lands and the week's demand is drawn down.
	ProjectedOnHandAfter float64 `json:"projected_on_hand_after"`
	// Where the line is in its lifecycle.
	//
	// A campaign becomes `released` when its week is issued to the floor as a production run, and goes back to `planned` if that run is deleted.
	Status constants.ProductionScheduleLineStatus `json:"status" validate:"required"`
	// Whether the solver or a person created the line.
	//
	// Editing a solver-placed campaign turns it `manual`, and a regenerate that preserves hand work keeps exactly the campaigns marked that way.
	Source constants.ScheduleLineSource `json:"source" validate:"required"`
	// Why the campaign was placed or last changed by hand.
	//
	// Only hand changes record a reason, and a change that touches a frozen week has to supply one.
	Reason *constants.ScheduleChangeReason `json:"reason"`
	// Whether the line is inside the frozen window, where changing it requires a reason for the deviation log.
	FreezeStatus constants.ScheduleFreezeStatus `json:"freeze_status" validate:"required"`
	// The production run this campaign's week was released as.
	//
	// One run carries the whole week, so every campaign released alongside this one points at the same run.
	ProductionRun *Entity `json:"production_run"`
	// Batches this campaign issued to the floor when its week was released.
	ReleasedBatchCount int64 `json:"released_batch_count"`
	// Batches of this campaign the floor has scanned.
	ScannedBatchCount int64 `json:"scanned_batch_count"`
	// Quantity scanned so far, in the planned unit.
	//
	// Measured from the run the week was released as, matched on this campaign's item, so a run holding several SKUs credits each campaign with only its own work.
	ScannedQuantity float64 `json:"scanned_quantity"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A saved campaign on a production schedule.

func (*ProductionScheduleLine) SchemaExample

func (*ProductionScheduleLine) SchemaExample() any

type ProductionSchedulePreview

type ProductionSchedulePreview struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_preview"`
	// Version of the solver that produced this plan.
	SolverVersion string `json:"solver_version" validate:"required"`
	// The instant the plan was calculated against.
	PlanningAsOf time.Time `json:"planning_as_of_at" validate:"required"`
	// The computed inventory policy per item, ordered by constraint run hours descending.
	Policies *List[SchedulePolicy] `json:"policies"`
	// The planned production blocks.
	Campaigns *List[ScheduleCampaign] `json:"campaigns"`
	// Projected stock position per item across the horizon.
	Projections *List[ScheduleProjection] `json:"projections"`
	// What the solver could not do.
	Diagnostics ScheduleDiagnostics `json:"diagnostics"`
}

A production plan produced by the scheduling solver.

func (*ProductionSchedulePreview) SchemaExample

func (*ProductionSchedulePreview) SchemaExample() any

type ProductionScheduleRegeneratePreview

type ProductionScheduleRegeneratePreview struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_regenerate_preview"`
	// The draft this would act on.
	ProductionSchedule *Entity `json:"production_schedule" validate:"required"`
	// Which solver produced the proposal.
	SolverVersion string `json:"solver_version" validate:"required"`
	// The instant the fresh solve planned from.
	//
	// Unless the caller names an instant, a regenerate plans from now rather than replaying the one the draft was first generated against, so demand overrides added since then are taken into account and the horizon re-anchors to today.
	PlanningAsOf time.Time `json:"planning_as_of_at" validate:"required"`
	// Every campaign either plan holds, including the ones both agree on.
	Lines *List[ScheduleDiffLine] `json:"lines"`
	// Campaigns the fresh solve wants that the current plan does not have.
	AddedCount int32 `json:"added_count"`
	// Campaigns the current plan has that the fresh solve does not want.
	RemovedCount int32 `json:"removed_count"`
	// Campaigns both hold, in different quantities.
	ChangedCount int32 `json:"changed_count"`
	// Hand-edited campaigns currently on the draft.
	ManualLineCount int32 `json:"manual_line_count"`
	// Hand-edited campaigns `replace_all` would destroy.
	DiscardedManualCount int32 `json:"discarded_manual_count"`
}

What a regenerate would change about a draft, without changing it.

A regenerate that silently discards hand-work is abandoned within two cycles, so the destructive mode states its cost as a number before it runs: `discarded_manual_count` is exactly how many hand-edited campaigns `replace_all` would destroy.

func (*ProductionScheduleRegeneratePreview) SchemaExample

func (*ProductionScheduleRegeneratePreview) SchemaExample() any

type ProductionScheduleResourceSetting

type ProductionScheduleResourceSetting struct {
	// Resource setting ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_resource_setting"`
	// What kind of resource this override applies to.
	ScopeType constants.ScheduleResourceScope `json:"scope_type" validate:"required"`
	// The machine, department or production step this overrides.
	Scope *Entity `json:"scope" validate:"required"`
	// Whether this resource takes part in planning.
	//
	// Machines are chosen by naming the constraint department, so an override is how one is taken out — a machine down for a rebuild — rather than how one is opted in. A machine with no override is planned.
	ParticipationStatus constants.ParticipationStatus `json:"participation_status" validate:"required"`
	// Weeks of lead time at this resource.
	LeadTimeWeeks *float64 `json:"lead_time_weeks"`
	// How many weeks after the step feeding it this resource's work starts.
	//
	// Read when downstream department work is derived from the constraint plan, so it is the production-step override that shifts a plan: without an offset every step lands in the same week as the step feeding it, and the offsets along a chain of steps add up. A schedule is planned in whole weeks, so a fractional offset is truncated.
	LeadTimeOffsetWeeks float64 `json:"lead_time_offset_weeks"`
}

A planning override for one machine, department or production step.

The account's settings apply to every resource; an override changes how one of them is treated — taking a machine out of the plan, or declaring how many weeks a downstream step's work starts after the step that feeds it. A resource has at most one override, and a resource without one is planned on the account settings alone.

func (*ProductionScheduleResourceSetting) SchemaExample

func (*ProductionScheduleResourceSetting) SchemaExample() any

type ProductionScheduleSettings

type ProductionScheduleSettings struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_settings"`
	// The department that sets the pace of the factory, and the one campaigns are planned onto.
	//
	// Every machine in the department is planned, and the work of downstream departments is derived from what those machines are scheduled to run. A machine that must sit out is taken out through its own resource setting rather than by leaving it unselected. Generation is refused until a constraint department is chosen.
	ConstraintDepartment *Entity `json:"constraint_department"`

	// How many weeks a generated plan covers.
	PlanningHorizonWeeks int32 `json:"planning_horizon_weeks"`
	// How many leading weeks of the horizon become a commitment when a version is published.
	//
	// Nothing is frozen while a version is still a draft. Once published, changing a campaign inside the frozen window requires a reason and is recorded against the plan. Cannot be longer than the planning horizon.
	FrozenWeeks int32 `json:"frozen_weeks"`
	// Day a planning week starts, where 0 is Sunday.
	WeekStartDay int32 `json:"week_start_day"`

	// Months of production history the solver measures run rates, changeover behavior and lead times from.
	DemandWindowMonths int32 `json:"demand_window_months"`
	// Months of order history the demand baseline is drawn from.
	ForecastHistoryMonths int32 `json:"forecast_history_months"`
	// Months the forecast projects forward.
	//
	// Only applies to the `seasonal_ema` basis. A projection of anything other than twelve months is scaled to an annual rate, so the plan always reasons about a year of demand.
	ForecastMonths int32 `json:"forecast_months"`
	// How the demand a plan is solved against is derived from history.
	//
	// - `trailing_12`: the last twelve complete months of orders, spread evenly across the coming year.
	// - `seasonal_ema`: a seasonally adjusted, exponentially smoothed projection that weights recent months more heavily. Falls back to the trailing baseline for an item with no history.
	//
	// Demand overrides are applied on top of whichever baseline is chosen.
	DemandBasis constants.ScheduleDemandBasis `json:"demand_basis" validate:"required"`
	// Z-score used for the confidence interval around the seasonal demand forecast.
	//
	// The plan is solved against the central forecast, so this widens or narrows that interval without changing what gets scheduled.
	ForecastZ float64 `json:"forecast_z"`

	// Typical changeover duration.
	//
	// Changeover time is modelled as rising with the number of new inputs a product introduces, between the minimum and maximum below. The slope is calibrated from production history so the model reproduces this average across the transitions actually observed, which is why the value belongs at the changeover time the floor typically reports rather than at a worst case.
	ChangeoverAvgMinutes float64 `json:"changeover_avg_minutes"`
	// Shortest plausible changeover, and the floor of the changeover model.
	ChangeoverMinMinutes float64 `json:"changeover_min_minutes"`
	// Longest plausible changeover, and the ceiling of the changeover model.
	ChangeoverMaxMinutes float64 `json:"changeover_max_minutes"`
	// Hourly labor rate charged to a changeover.
	//
	// This is a dedicated technician rate rather than an allocated production rate, because one person works a single machine through a changeover. Together with the typical changeover duration it prices the setup cost that decides economic campaign sizes. The constraint department's own labor rate takes precedence when it has one, leaving this as the fallback.
	ChangeoverLaborRate float64 `json:"changeover_labor_rate"`

	// Annual cost of holding stock, as a share of item value.
	//
	// Weighed against the cost of a changeover when campaigns are sized: a higher rate favors shorter, more frequent runs.
	HoldingRatePct float64 `json:"holding_rate_pct"`
	// Z-score behind the safety stock targets.
	//
	// A higher value buys more cover against demand variability at both the constraint and the finished goods stage, at the cost of carrying more stock.
	ServiceLevelZ float64 `json:"service_level_z"`
	// Weeks between coming off the constraint and being sellable.
	//
	// Added to the constraint's own lead time when reorder points are set, so a plan replenishes early enough for a decision made today to become sellable stock.
	FinishLeadTimeWeeks float64 `json:"finish_lead_time_weeks"`
	// Weeks of lead time to assume at the constraint for an item with no measured history.
	//
	// An item's own lead time, measured from production history, is used instead whenever one can be observed.
	DefaultConstraintLeadTimeWeeks float64 `json:"default_constraint_lead_time_weeks"`
	// Ceiling on how far ahead any item is built.
	//
	// An item is only rebuilt once its projected stock falls below the lower of its reorder point and this many weeks of demand, so a slow mover whose statistical reorder point covers months of demand is not topped up ahead of items that are actually short.
	MaxWeeksSupply float64 `json:"max_weeks_supply"`
	// How many steps down the production flow a constraint item is traced to the finished goods it becomes.
	//
	// Demand, stock and lot conventions are pooled onto the constraint item from every finished good the trace reaches, so anything further down the flow than this contributes nothing to the plan. The limit is also what stops a routing that loops back on itself from being traced forever.
	MaxFlowDepth int32 `json:"max_flow_depth"`

	// Shifts worked per day.
	ShiftsPerDay int32 `json:"shifts_per_day"`
	// Hours in a shift.
	HoursPerShift float64 `json:"hours_per_shift"`
	// Days worked per week.
	WorkDaysPerWeek int32 `json:"work_days_per_week"`
	// Weeks worked per year.
	WeeksPerYear int32 `json:"weeks_per_year"`
	// Share of machine time a plan may fill.
	//
	// Shifts, hours and work days give a machine's raw weekly hours; this trims them to what may actually be planned. The remainder absorbs changeovers, which are not scheduled as explicit blocks, so a value of 1 produces a plan that leaves no time to set anything up.
	CapacityHeadroomPct float64 `json:"capacity_headroom_pct"`
	// Units in a default production lot.
	//
	// The last resort in the lot-size chain: a lot set on the item, on its product line, or on the finished goods an intermediate item becomes all take precedence.
	DefaultLotUnits float64 `json:"default_lot_units"`

	// Calendar days between an order being issued and it being due to ship.
	//
	// The last resort in the ship-by chain: a lead time set on the customer, on its parent account, or on the customer's account group takes precedence. Zero means same-day shipping.
	DefaultCustomerLeadTimeDays int32 `json:"default_customer_lead_time_days"`
	// The account-wide operating calendars: the days the plant tenders freight, and the days a customer's dock accepts it.
	//
	// Behind the per-address and per-customer links and ahead of a plain Monday-to-Friday week. Null on both means every ship-by date is resolved against weekdays alone.
	ShipCalendarID    *string `json:"ship_calendar_id"`
	ReceiveCalendarID *string `json:"receive_calendar_id"`
	// How a SKU is produced when neither it nor its product line says.
	//
	// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
	// - `make_to_order`: built only against orders already on the book, holding no buffer.
	DefaultFulfillmentPolicy constants.FulfillmentPolicy `json:"default_fulfillment_policy" validate:"required"`

	// Whether schedules are generated automatically on a recurring cadence.
	//
	// While active, each due tick queues a new schedule version; a generation cron expression is required for the cadence to be saved.
	CadenceStatus constants.ActivationStatus `json:"cadence_status" validate:"required"`
	// Standard cron expression driving the generation cadence.
	GenerationCron *string `json:"generation_cron"`
	// Timezone the cadence is interpreted in.
	//
	// Decides when "every Wednesday at 6am" actually happens. A timezone the platform does not recognize falls back to UTC.
	GenerationTimezone string `json:"generation_timezone" validate:"required"`
	// Whether a version produced by the cadence is published automatically.
	//
	// While active, a cadence run publishes as soon as it solves, committing its frozen weeks without anyone reviewing the plan. Otherwise the run leaves a draft for a planner to publish by hand. Versions generated on request are never published automatically.
	AutoPublishStatus constants.ActivationStatus `json:"auto_publish_status" validate:"required"`
	// When the cadence last fired.
	//
	// Stamped when a run is queued rather than when the plan finishes solving, and the next due time is measured from it.
	LastGeneratedAt *time.Time `json:"last_generated_at"`

	// Whether the values returned were saved on the account or are the defaults applied when nothing has been saved.
	SettingsStatus constants.SettingsStatus `json:"settings_status" validate:"required"`

	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

The planning assumptions a production schedule is solved against.

The whole set is always returned. An account that has never saved settings reads back the values the solver would apply anyway, so a caller never has to know which assumptions are in play; `settings_status` says whether the values were saved on the account or are those defaults.

func (*ProductionScheduleSettings) SchemaExample

func (*ProductionScheduleSettings) SchemaExample() any

type ProductionStep

type ProductionStep struct {
	// Production step ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_step"`
	// Display name of the step.
	Name string `json:"name" validate:"required"`
	// Free-form notes about the step.
	Notes *string `json:"notes"`
	// Leveling correction factor applied to labor time in cost calculations, as a decimal string.
	//
	// Effective labor time per unit is `labor_time × (1 + leveling_factor) × (1 + allowances)`.
	LevelingFactor string `json:"leveling_factor" validate:"required" format:"decimal"`
	// Allowance correction factor applied to labor time in cost calculations, as a decimal string.
	//
	// Effective labor time per unit is `labor_time × (1 + leveling_factor) × (1 + allowances)`.
	Allowances string `json:"allowances" validate:"required" format:"decimal"`
	// Cost of labor for this step, expressed as a rate of currency per unit of time (e.g. `$` per `hr`).
	LaborRate *Rate `json:"labor_rate"`
	// Labor duration for this step, expressed as a rate (e.g. time per unit of output).
	LaborTime *Rate `json:"labor_time"`
	// Overhead cost for this step, expressed as a rate of currency per unit of time (e.g. `$` per `hr`).
	OverheadRate *Rate `json:"overhead_rate"`
	// The item and quantity this step produces.
	Production *ProductionOutput `json:"production" expandable:"true"`
	// Materials this step consumes as inputs, with their quantities and expected waste.
	Consumptions *List[Consumption] `json:"consumptions" expandable:"true"`
	// Machines assigned to this step.
	Machines *List[Machine] `json:"machines" expandable:"true"`
	// Scanning station where this step's batches are scanned.
	ScanningStation *ScanningStation `json:"scanning_station" expandable:"true"`
	// Steps that feed into this step.
	InSteps *List[ProductionStep] `json:"in_steps" expandable:"true"`
	// Steps that this step feeds into.
	OutSteps *List[ProductionStep] `json:"out_steps" expandable:"true"`
	// Department responsible for this step.
	Department *Department `json:"department" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single stage of work in an item's production flow, with its output, material inputs, cost rates, and graph connections.

func (*ProductionStep) SchemaExample

func (*ProductionStep) SchemaExample() any

type Property

type Property struct {
	// Property ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=property"`
	// Display name of the property, such as `Color` or `Size`.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// The selectable values defined under this property.
	//
	// Listed in the order the attributes are arranged within the property, first to last.
	Attributes *List[Attribute] `json:"attributes" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last update timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A named characteristic used to classify items, such as `Color` or `Size`.

Each property defines a set of attributes — the selectable values (e.g. `Red`, `Blue`) that can be assigned to items.

func (*Property) SchemaExample

func (*Property) SchemaExample() any

type PublicAccount

type PublicAccount struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=public_account"`
	// The account's display name.
	Name string `json:"name" validate:"required"`
	// The URL slug that identifies the account's customer portal.
	Slug string `json:"slug" validate:"required"`
	// The address billed by default on orders for this account.
	DefaultBillingAddress *Address `json:"default_billing_address" expandable:"true"`
	// The email address customers are directed to for support.
	SupportEmail *string `json:"support_email"`
	// Download URL for the account's logo, valid for one hour after the response is generated.
	LogoURL *string `json:"logo_url"`
	// The account's custom portal domain (e.g. shop.acme.com).
	//
	// A custom domain only appears here once it has passed verification; until then the portal is served from its slug URL.
	PortalDomain *string `json:"portal_domain"`
	// Download URL for the account's customer-portal favicon, valid for one hour after the response is generated.
	FaviconURL *string `json:"favicon_url"`
}

The publicly readable branding profile of an account, used to render customer portal pages before anyone signs in.

func (*PublicAccount) SchemaExample

func (*PublicAccount) SchemaExample() any

type PurchaseOrder

type PurchaseOrder struct {
	// Purchase order ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=purchase_order"`
	// Human-readable identifier for the order.
	//
	// Assigned automatically from a per-account sequence at creation; can be changed via update but must stay unique within the account.
	Number string `json:"number" validate:"required"`
	// Free-form note recorded on the order.
	Note *string `json:"note"`
	// Lifecycle status of the order.
	//
	// - `estimate`: a draft that has not yet been issued to the supplier.
	// - `issued`: the order has been issued to the supplier and is open for receiving.
	// - `fulfilled`: the order is complete and closed.
	Status constants.SalesOrderStatusCode `json:"status" validate:"required"`
	// Priority level for fulfilling the order, relative to other open orders.
	Priority constants.PriorityCode `json:"priority" validate:"required"`
	// Whether the order acknowledgment email has been sent to the supplier.
	//
	// Advances to `sent` when the order is issued with the `send_email` option; otherwise stays `not_sent`.
	AcknowledgmentStatus constants.AcknowledgmentStatus `json:"acknowledgment_status" validate:"required"`
	// Supplier the order is placed with.
	Supplier *Supplier `json:"supplier" expandable:"true"`
	// Address the supplier bills this order to.
	BillToAddress *Address `json:"bill_to_address" expandable:"true"`
	// Address the supplier ships the ordered goods to.
	ShipToAddress *Address `json:"ship_to_address" expandable:"true"`
	// Carrier selection and freight billing for this order.
	Freight *Freight `json:"freight" expandable:"true"`
	// Payment terms agreed with the supplier.
	PaymentTerm *PaymentTerm `json:"payment_term" expandable:"true"`
	// Shipping terms for the order.
	ShippingTerm *ShippingTerm `json:"shipping_term" expandable:"true"`
	// Receiving order used to receive inventory against this purchase order.
	//
	// Created automatically, with a line per order line, when the order is issued, and deleted again if the order is unissued.
	ReceivingOrder *ReceivingOrder `json:"receiving_order" expandable:"true"`
	// Line items on the order.
	Lines *List[PurchaseOrderLine] `json:"lines" expandable:"true"`
	// Total number of lines on the order.
	LineCount int32 `json:"line_count"`
	// Contacts that receive the purchase order email when the order is issued with the `send_email` option.
	Contacts *List[EmailContact] `json:"contacts" expandable:"true"`
	// When the order was issued to the supplier.
	//
	// Cleared again if the order is unissued back to `estimate`.
	IssuedAt *time.Time `json:"issued_at"`
	// When the order was closed as fulfilled.
	//
	// Cleared again if the order is re-opened.
	CompletedAt *time.Time `json:"completed_at"`
	// Date the supplier promised delivery for.
	//
	// Set through the `promised_at` field on create and update.
	ScheduledAt *time.Time `json:"scheduled_at"`
	// Created timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An order placed with a supplier to purchase materials or products.

The list endpoint returns this same resource as the retrieve endpoint, except that list rows never carry the note or the scheduled date and can only expand the supplier and the lines.

func (*PurchaseOrder) SchemaExample

func (*PurchaseOrder) SchemaExample() any

type PurchaseOrderLine

type PurchaseOrderLine struct {
	// Purchase order line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=purchase_order_line"`
	// Sequence number of this line within the order, starting at 1.
	//
	// Assigned automatically as one past the highest number currently on the order, so deleting a line can leave a gap in the numbering.
	LineItemNumber int32 `json:"line_item_number" validate:"required"`
	// SKU of the ordered product, copied onto the line at order time.
	ProductSKU string `json:"product_sku" validate:"required"`
	// Free-text description of the ordered product.
	ProductDescription *string `json:"product_description"`
	// Catalog item this line references, if it is linked to one.
	Item *Item `json:"item"`
	// Quantity ordered from the supplier.
	QuantityOrdered *Quantity `json:"quantity_ordered" validate:"required"`
	// Quantity booked against this line on the order's receiving order.
	//
	// Rolled up from the receiving order lines linked to this line, so it stays at zero until the order is issued and receiving lines are created for it.
	QuantityReceived *Quantity `json:"quantity_received"`
	// Agreed purchase price per unit for this line.
	UnitPrice *Rate `json:"unit_price" validate:"required"`
	// Recorded cost per unit, if captured separately from the purchase price.
	UnitCost *Rate `json:"unit_cost"`
	// Created timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single line item on a purchase order.

func (*PurchaseOrderLine) SchemaExample

func (*PurchaseOrderLine) SchemaExample() any

type Quantity

type Quantity struct {
	// Quantity ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=quantity"`
	// Raw decimal value of the quantity, as a string to preserve precision.
	//
	// This is the unformatted machine value; see `display_value` for the human-readable rendering with unit and thousands separators.
	Value string `json:"value" validate:"required" format:"decimal"`
	// Formatted value with unit abbreviation (e.g. "$1,234.56" or "100 kg").
	DisplayValue string `json:"display_value" validate:"required"`
	// Unit of measure for this value (e.g. a currency, mass, or count unit).
	Unit *Unit `json:"unit" expandable:"true"`
}

A measured amount: a numeric value together with the unit it is expressed in.

Quantities are shared building blocks rather than standalone records — other resources point at them to report stock levels, ordered and packed amounts, money, weights, and durations.

func (*Quantity) SchemaExample

func (*Quantity) SchemaExample() any

type QuarterlySalesData

type QuarterlySalesData struct {
	// First quarter total.
	Q1 float64 `json:"q1" validate:"required"`
	// Second quarter total.
	Q2 float64 `json:"q2" validate:"required"`
	// Third quarter total.
	Q3 float64 `json:"q3" validate:"required"`
	// Fourth quarter total.
	Q4 float64 `json:"q4" validate:"required"`
	// Annual total.
	Total float64 `json:"total" validate:"required"`
}

QuarterlySalesData represents sales data broken down by quarter.

type Rate

type Rate struct {
	// Rate ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=rate"`
	// Decimal value of the rate, as a string to preserve precision.
	//
	// Expressed as the amount of the numerator unit per one denominator unit.
	Value string `json:"value" validate:"required" format:"decimal"`
	// Unit of the rate's numerator (e.g. the currency of a price).
	NumeratorUnit *Unit `json:"numerator_unit" expandable:"true"`
	// Unit of the rate's denominator (the per-unit basis, e.g. kilograms for a price per kilogram).
	DenominatorUnit *Unit `json:"denominator_unit" expandable:"true"`
	// Human-readable formatted value (e.g. "$25.50 / kg" or "100 kg / hr").
	DisplayValue string `json:"display_value" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Value expressed as a ratio of two units, such as a price per kilogram or a throughput per hour.

func (*Rate) SchemaExample

func (*Rate) SchemaExample() any

type RateShopOption

type RateShopOption struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=rate_shop_option"`
	// The carrier that would handle the shipment.
	Carrier *Carrier `json:"carrier" expandable:"true"`
	// The carrier's service level, such as ground or overnight.
	ServiceLevel *ServiceLevel `json:"service_level" expandable:"true"`
	// Quoted shipping rate for this carrier and service level.
	//
	// `0` when the carrier is not linked to a live-rating account, or when the shipping term's free-shipping minimum order value has been met and this option qualifies for free shipping. When the customer's shipping term applies a flat rate, that amount replaces the rate on every option that is not already free.
	Rate float64 `json:"rate" validate:"required"`
	// Estimated number of days until delivery, when the carrier provides an estimate.
	EstimatedDays *int32 `json:"estimated_days"`
}

A single carrier and service level option returned by rate shopping.

type RateShopResult

type RateShopResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=rate_shop_result"`
	// Available rate options, sorted by rate ascending.
	//
	// Empty when freight is exempt for the order.
	Options *List[RateShopOption] `json:"options" validate:"required"`
	// Why a special freight outcome was applied to these options, if any.
	//
	// - `freight_exempt`: the order is exempt from freight; no options are returned.
	// - `minimum_order_met`: the customer's shipping term sets a free-shipping minimum order value and the order total exceeded it, so options are rated at zero. If the shipping term restricts free shipping to specific service levels, only those options are zeroed and the rest keep their carrier or flat rate.
	// - `flat_rate`: the customer's shipping term applies a flat shipping rate, which replaced every option's carrier rate.
	// - `none`: standard carrier rates apply with no exemption.
	ExemptionType *constants.FreightExemptionType `json:"exemption_type"`
	// Flat shipping amount applied to the options.
	//
	// Set when the customer's shipping term applies a flat rate, including when a met free-shipping minimum has already rated some options at zero.
	FlatRate *float64 `json:"flat_rate"`
}

The carrier and service level options returned by rate shopping, along with the freight rule that shaped their rates.

func (*RateShopResult) SchemaExample

func (*RateShopResult) SchemaExample() any

type ReadCursor

type ReadCursor struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=read_cursor"`
	// The sequence number of the last message the participant has read in the conversation.
	//
	// A message is "seen" by this participant when its `sequence` is `<=` this value. `0` means they have not read any message in the conversation yet.
	Sequence int64 `json:"sequence"`
	// The id of the last message the participant has read.
	MessageID *string `json:"message_id"`
	// When the participant last advanced their read cursor.
	ReadAt *time.Time `json:"read_at"`
}

A participant's read position in a conversation — the basis for read receipts ("who has seen this").

type RealizedMarginFinding

type RealizedMarginFinding struct {
	// Identifier for this finding, stable for the same customer and item across runs.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=realized_margin_finding"`
	// Why this trading relationship was flagged.
	Reason constants.PricingFindingReason `json:"reason" validate:"required"`
	// The customer that was charged.
	Customer *Customer `json:"customer" expandable:"true"`
	// The customer group the customer belongs to.
	CustomerGroup *AccountGroup `json:"customer_group" expandable:"true"`
	// The item that was sold.
	Item *Item `json:"item" expandable:"true"`
	// The product line the item belongs to.
	ProductLine *ProductLine `json:"product_line" expandable:"true"`
	// Quantity invoiced over the window.
	QuantityInvoiced *ComputedQuantity `json:"quantity_invoiced" validate:"required"`
	// Revenue invoiced over the window.
	Revenue *ComputedQuantity `json:"revenue" validate:"required"`
	// Cost of goods for the quantity invoiced.
	Cost *ComputedQuantity `json:"cost" validate:"required"`
	// Revenue divided by quantity: the price actually achieved across the window.
	AverageUnitPrice *ComputedRate `json:"average_unit_price" validate:"required"`
	// Median achieved price for this item across every customer that bought it. Null when no other customer bought it.
	PeerMedianPrice *ComputedRate `json:"peer_median_price"`
	// Number of invoiced lines behind these totals.
	LineCount int `json:"line_count"`
	// How far below the peer median this customer's achieved price sits, as a fraction between 0 and 1. Null when there is no peer median.
	BelowPeerMedianFraction *string `json:"below_peer_median_fraction" format:"decimal"`
	// Realized gross margin, as a fraction between 0 and 1. Null when no cost was captured on the lines.
	GrossMargin *string `json:"gross_margin" format:"decimal"`
}

RealizedMarginFinding is one customer/SKU trading relationship flagged by the realized margin analysis.

type RealizedMarginSummary

type RealizedMarginSummary struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=realized_margin_summary"`
	// Invoiced lines examined.
	LinesAnalyzed int `json:"lines_analyzed"`
	// Customer and SKU pairs examined.
	RelationshipsAnalyzed int `json:"relationships_analyzed"`
	// Relationships flagged for an achieved price below the peer median.
	BelowPeerMedianCount int `json:"below_peer_median_count"`
	// Relationships flagged for failing the target gross margin.
	BelowTargetMarginCount int `json:"below_target_margin_count"`
	// Relationships whose margin could not be checked because no cost was captured.
	MarginNotAssessedCount int `json:"margin_not_assessed_count"`
	// Anything the analysis had to leave out, so the result never overstates its own coverage.
	Notes []string `json:"notes"`
}

RealizedMarginSummary reports the shape of the analysis behind the findings.

type ReceivableEntry

type ReceivableEntry struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=receivable_entry"`
	// The invoice the balance is owed on.
	//
	// Only the invoice's identifying fields (`id`, `number`) are populated.
	Invoice *Invoice `json:"invoice"`
	// Customer who owes the balance.
	//
	// Only the customer's identifying fields (`id`, `name`, `number`) are populated.
	Customer *Customer `json:"customer"`
	// Purchase order number the customer supplied on the underlying sales order.
	PONumber *string `json:"po_number"`
	// Date the invoice was created.
	InvoicedAt time.Time `json:"invoiced_at" validate:"required"`
	// Remaining unpaid balance on the invoice.
	//
	// Calculated as the invoiced total minus all transaction allocations applied to the invoice. When a `cutoff_at` is supplied to the listing endpoint, only allocations made before that date are subtracted.
	RemainingBalance string `json:"remaining_balance" validate:"required"`
	// Whether the invoice has been paid in full.
	//
	// Always `false` here, because only invoices that still owe a balance produce a receivable entry.
	IsPaidInFull bool `json:"is_paid_in_full"`
}

An outstanding balance owed on an invoice.

Receivable entries are derived from invoices that have not been paid in full; one entry is returned per open invoice.

func (*ReceivableEntry) SchemaExample

func (*ReceivableEntry) SchemaExample() any

type ReceivingOrder

type ReceivingOrder struct {
	// Receiving order ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=receiving_order"`
	// Human-readable identifier for the receiving order, assigned when the originating purchase order is issued.
	//
	// It mirrors that purchase order's number (e.g. `PO-001`). Distinct from `id`; use it to reference the order in the UI and on documents.
	Number string `json:"number" validate:"required"`
	// Free-text note carried over from the originating purchase order.
	//
	// Not returned in list results.
	Note *string `json:"note"`
	// The purchase order whose issuance created this receiving order.
	PurchaseOrder *PurchaseOrder `json:"purchase_order" expandable:"true"`
	// The supplier (seller) account the originating purchase order was placed with.
	Supplier *Supplier `json:"supplier" expandable:"true"`
	// Line items in this receiving order.
	Lines *List[ReceivingOrderLine] `json:"lines" expandable:"true"`
	// Total number of lines on this receiving order.
	//
	// Always populated, even when `lines` is not expanded.
	LineCount int32 `json:"line_count"`
	// Percentage of lines that have been stocked, from `0` to `100`, rounded to two decimal places.
	//
	// A line counts toward completion once its `stocked_at` is set, and the order is marked complete when the figure reaches `100`. It is calculated for list results only; on responses that return a single receiving order it is `0`, and progress is best read from the lines' `stocked_at` values.
	CompletionPercentage float64 `json:"completion_percentage"`
	// Timestamp when the receiving order was completed.
	//
	// Set automatically once every line has been stocked, and also when the originating purchase order is closed. It is cleared again when the receiving order is voided or that purchase order is re-opened.
	CompletedAt *time.Time `json:"completed_at"`
	// Timestamp when the receiving order was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when the receiving order was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A receiving order tracks inbound inventory against an issued purchase order.

One receiving order is created automatically when a purchase order is issued, with one line per purchase order line. As goods arrive, line quantities are received and then stocked into inventory; the order is marked complete once every line is stocked. Unissuing the purchase order deletes the receiving order and its lines.

func (*ReceivingOrder) SchemaExample

func (*ReceivingOrder) SchemaExample() any

type ReceivingOrderLine

type ReceivingOrderLine struct {
	// Receiving order line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=receiving_order_line"`
	// The quantity being received on this line.
	//
	// Initialized to the originating order line's full ordered quantity. Adjust it with Update Receiving Order Line, or use the receive actions to set it to the quantity still outstanding on the order line. Voiding the line resets it to `0`.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// Quantity refused on inspection and never taken into inventory.
	//
	// Accumulated from the rejected quantities recorded against this line each time the order is stocked.
	RejectedQuantity *Quantity `json:"rejected_quantity"`
	// The purchase order line this receiving line was created from.
	OrderLine *SalesOrderLine `json:"order_line" expandable:"true"`
	// The item being received (the originating order line's item).
	Item *Item `json:"item"`
	// Timestamp when the received quantity was stocked into inventory.
	//
	// Once set, the line counts toward the order's `completion_percentage`. Voiding the line or the whole order clears it, but does not reverse the inventory that was already received.
	StockedAt *time.Time `json:"stocked_at"`
	// Timestamp when the line was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when the line was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Line item in a receiving order.

One line is created per purchase order line when the purchase order is issued, with its quantity initialized to the full ordered quantity. When a line is stocked short of the ordered quantity, a new line is created automatically for the remainder.

func (*ReceivingOrderLine) SchemaExample

func (*ReceivingOrderLine) SchemaExample() any

type ReconcileErrorResult

type ReconcileErrorResult struct {
	// Item SKU.
	SKU string `json:"sku" validate:"required"`
	// Error message.
	Error string `json:"error" validate:"required"`
}

A submitted row that could not be reconciled.

type ReconciledItemResult

type ReconciledItemResult struct {
	// Item ID.
	ItemID string `json:"item_id" validate:"required"`
	// Item SKU.
	SKU string `json:"sku" validate:"required"`
	// Quantity before the reconciliation, as a decimal string.
	PreviousQuantity string `json:"previous_quantity" validate:"required" format:"decimal"`
	// Quantity after the reconciliation, as a decimal string.
	NewQuantity string `json:"new_quantity" validate:"required" format:"decimal"`
}

An item whose on-hand quantity was successfully reconciled.

Both quantities are expressed in the item's own base unit, not in the unit submitted with the request.

type Record

type Record struct {
	// Unique identifier for the record.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=record"`
	// The kind of business record referenced.
	//
	// Determines how to resolve the record and which `status` and `metadata` keys may appear.
	//
	// - `sales_order`: a customer order.
	// - `purchase_order`: an order placed with a supplier.
	// - `receiving_order`: an inbound order being received into inventory.
	// - `pick`: a warehouse pick task.
	// - `shipment`: an outbound shipment.
	// - `delivery`: a delivery of one or more shipments to a destination.
	// - `production_run`: a manufacturing production run.
	// - `invoice`: a customer invoice.
	// - `transaction`: a payment or financial transaction.
	// - `settlement`: a settlement reconciling transactions against invoices.
	Type constants.RecordType `json:"type" validate:"required"`
	// Human-readable record number, when the record has one.
	Number *string `json:"number"`
	// Type-specific status code, when applicable.
	Status *string `json:"status"`
	// Type-specific metadata.
	//
	// The set of keys varies by record type.
	Metadata map[string]string `json:"metadata"`
}

Record is a lightweight reference to a business record — a sales order, purchase order, pick, shipment, production run, invoice, etc.

Like the `actor` and `entity` references, it carries just enough to identify and label the referenced record without embedding its full resource. The `status` and `metadata` fields hold type-specific detail that varies by the kind of record referenced.

func NewRecord

func NewRecord(id string, recordType constants.RecordType) *Record

NewRecord constructs a Record reference for the given record type.

func (*Record) SchemaExample

func (*Record) SchemaExample() any

type RegistrationFlow

type RegistrationFlow struct {
	// Registration flow ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=registration_flow"`
	// Display name of the registration flow.
	Name string `json:"name" validate:"required"`
	// Customer groups a registering customer can be placed into.
	CustomerGroupOptions *List[RegistrationFlowOption] `json:"customer_group_options" validate:"required"`
	// Payment terms a registering customer can choose from.
	PaymentTermOptions *List[RegistrationFlowOption] `json:"payment_term_options" validate:"required"`
	// Shipping terms a registering customer can choose from.
	ShippingTermOptions *List[RegistrationFlowOption] `json:"shipping_term_options" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Configuration for customer self-registration.

A registration flow defines which customer groups, payment terms, and shipping terms a customer can choose from when registering with your account.

func (*RegistrationFlow) SchemaExample

func (*RegistrationFlow) SchemaExample() any

type RegistrationFlowOption

type RegistrationFlowOption struct {
	// ID of the underlying customer group, payment term, or shipping term this option refers to.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=registration_flow_option"`
	// Display name of the underlying customer group, payment term, or shipping term.
	Name string `json:"name" validate:"required"`
}

Selectable option within a registration flow.

func (*RegistrationFlowOption) SchemaExample

func (*RegistrationFlowOption) SchemaExample() any

type RegistrationSession

type RegistrationSession struct {
	// Session ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=registration_session"`
	// Code of the pricing plan selected for this registration.
	PlanCode constants.PlanCode `json:"plan_code" validate:"required"`
	// Current step in the registration flow.
	//
	// Steps advance in this order:
	//
	// - `verification`: the user is verifying their email address.
	// - `user_details`: the user is providing their personal details (name, etc.).
	// - `account_details`: the user is providing their account/company details.
	// - `review`: the user is reviewing their registration details before payment.
	// - `payment`: the user is providing their payment details.
	// - `completed`: registration has finished and the account is active.
	Step constants.RegistrationStep `json:"step" validate:"required"`
	// ID of the Stripe customer created for this registration.
	//
	// Populated when Setup Registration Billing runs; absent for free plans, which never set up billing.
	StripeCustomerID *string `json:"stripe_customer_id"`
	// ID of the Stripe Setup Intent created to collect the payment method.
	//
	// Despite the field name, this holds the Setup Intent ID created by Setup Registration Billing, and Confirm Registration Payment only accepts a `setup_intent_id` matching it.
	StripeCheckoutSessionID *string `json:"stripe_checkout_session_id"`
	// Whether payment has been completed for this registration.
	//
	// Set to `true` once Confirm Registration Payment verifies the Setup Intent. Free plans never collect payment, so this stays `false` and the registration can still be completed.
	PaymentCompleted bool `json:"payment_completed"`
	// Account being registered.
	//
	// Populated once account details are entered during the `account_details` step.
	Account *RegistrationSessionAccount `json:"account"`
	// User being registered.
	User RegistrationSessionUser `json:"user" validate:"required"`
	// Timestamp when registration was completed.
	CompletedAt *time.Time `json:"completed_at"`
	// Timestamp when this session was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Timestamp when this session was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An in-progress self-serve registration.

A session tracks a new customer's progress through email verification, user and account setup, payment, and final account provisioning.

func (*RegistrationSession) SchemaExample

func (*RegistrationSession) SchemaExample() any

type RegistrationSessionAccount

type RegistrationSessionAccount struct {
	// ID of the account record.
	//
	// Populated only after the registration completes and the account is provisioned.
	ID *string `json:"id"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// Display name of the account being created.
	Name string `json:"name" validate:"required"`
	// Address the account will be billed at.
	//
	// Also becomes the new account's business address when the registration completes.
	BillingAddress RegistrationSessionAddress `json:"billing_address" validate:"required"`
}

Account data within a registration session.

func (*RegistrationSessionAccount) SchemaExample

func (*RegistrationSessionAccount) SchemaExample() any

type RegistrationSessionAddress

type RegistrationSessionAddress struct {
	// ID of the address record.
	ID *string `json:"id"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=address"`
	// Street address line 1.
	Line1 *string `json:"line1"`
	// Street address line 2 (apartment, suite, etc.).
	Line2 *string `json:"line2"`
	// City name.
	City *string `json:"city"`
	// State or province.
	State *string `json:"state"`
	// Postal or ZIP code.
	PostalCode *string `json:"postal_code"`
	// Two-letter country code.
	Country *string `json:"country"`
}

Address within a registration session.

func (*RegistrationSessionAddress) SchemaExample

func (*RegistrationSessionAddress) SchemaExample() any

type RegistrationSessionUser

type RegistrationSessionUser struct {
	// ID of the user record.
	//
	// Populated once the user is created during the `user_details` step.
	ID *string `json:"id"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=user"`
	// Email address.
	Email string `json:"email" validate:"required"`
	// The user's display name.
	//
	// Provided by the registrant during the `user_details` step.
	Name *string `json:"name"`
	// When the user's email address was verified.
	//
	// Set once the registrant follows the link in the verification email. It mirrors the session's `updated_at` timestamp rather than recording the moment of verification, so it moves forward as the rest of the registration is filled in.
	EmailVerifiedAt *time.Time `json:"email_verified_at"`
}

User data within a registration session.

func (*RegistrationSessionUser) SchemaExample

func (*RegistrationSessionUser) SchemaExample() any

type ReleaseScheduleBatch

type ReleaseScheduleBatch struct {
	// The item the batch produces.
	Item *Entity `json:"item" validate:"required"`
	// The item's SKU, as it stood when the plan was generated.
	SKU string `json:"sku" validate:"required"`
	// Units in this lot.
	//
	// The last lot of a campaign is short when the planned quantity is not a whole number of lots.
	Quantity float64 `json:"quantity"`
	// The batch this lot was created as.
	//
	// A preview names a batch only when the lot is one that already exists and is being moved.
	Batch *Entity `json:"batch"`
	// The number of the run this ticket came off, when the batch already existed.
	//
	// Present on a lot carried forward from an earlier week that the floor never worked. The ticket is already printed and on the floor, so the release moves it into the new run rather than issuing a replacement.
	CarriedForwardFrom *string `json:"carried_forward_from"`
}

One batch a release created, or would create: a single lot off one planned campaign.

type ReleaseScheduleWeekPreview

type ReleaseScheduleWeekPreview struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_week_release_preview"`
	// Zero-based week offset from the start of the horizon.
	WeekIndex int32 `json:"week_index"`
	// First instant of the week.
	WeekStartDate time.Time `json:"week_starts_at" validate:"required"`
	// How many campaigns would be released.
	LineCount int32 `json:"line_count"`
	// How many batches the run would hold, created and carried forward together.
	BatchCount int32 `json:"batch_count"`
	// How many of `batch_count` would be moved off an earlier run rather than created.
	CarriedForwardBatchCount int32 `json:"carried_forward_batch_count"`
	// Total units that would be released.
	TotalQuantity float64 `json:"total_quantity"`
	// The campaigns that would be released, each with its lots.
	Lines *List[ReleasedScheduleLine] `json:"lines"`
	// Whether the week can be released.
	IsReleasable bool `json:"is_releasable"`
	// Why the week cannot be released, phrased for display.
	//
	// A week is blocked when it has already been released to the floor, or when it holds nothing to release.
	BlockedReason *string `json:"blocked_reason"`
	// The run the week was already released as.
	ExistingProductionRun *Entity `json:"existing_production_run"`
}

What releasing a week would create, with nothing written.

A release makes a numbered production run and every batch under it, which is real work to undo by hand, so the confirmation is driven by this rather than by a count computed in the browser.

func (*ReleaseScheduleWeekPreview) SchemaExample

func (*ReleaseScheduleWeekPreview) SchemaExample() any

type ReleaseScheduleWeekResult

type ReleaseScheduleWeekResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=production_schedule_week_release"`
	// The run now carrying the week's work.
	ProductionRun *ProductionRun `json:"production_run"`
	// Zero-based week offset from the start of the horizon.
	WeekIndex int32 `json:"week_index"`
	// First instant of the released week.
	WeekStartDate time.Time `json:"week_starts_at" validate:"required"`
	// How many campaigns were released.
	ReleasedLineCount int32 `json:"released_line_count"`
	// How many batches the run holds across all campaigns, created and carried forward together.
	BatchCount int32 `json:"batch_count"`
	// How many of `batch_count` were moved off an earlier run rather than created.
	//
	// Tickets for these are already printed and on the floor.
	CarriedForwardBatchCount int32 `json:"carried_forward_batch_count"`
	// Total units released.
	TotalQuantity float64 `json:"total_quantity"`
	// The campaigns released, each with its lots.
	Lines *List[ReleasedScheduleLine] `json:"lines"`
}

The production run created from one week of a schedule.

Each planned campaign becomes one batch per lot, so a 360-unit week at a 60-unit lot arrives on the floor as six batches rather than one instruction to make 360.

func (*ReleaseScheduleWeekResult) SchemaExample

func (*ReleaseScheduleWeekResult) SchemaExample() any

type ReleasedScheduleLine

type ReleasedScheduleLine struct {
	// The schedule line released.
	Line *Entity `json:"line" validate:"required"`
	// The item to produce.
	Item *Entity `json:"item" validate:"required"`
	// The item's SKU, as it stood when the plan was generated.
	SKU string `json:"sku" validate:"required"`
	// The machine the campaign runs on.
	Machine *Entity `json:"machine" validate:"required"`
	// Total units planned for the campaign.
	PlannedQuantity float64 `json:"planned_quantity"`
	// Units in one lot.
	LotUnits float64 `json:"lot_units"`
	// Abbreviation of the unit the quantity and the lot are counted in.
	//
	// `6 × 60` is not an instruction until it says 6 × 60 of what.
	Unit *string `json:"unit"`
	// How many batches the campaign broke into.
	BatchCount int32 `json:"batch_count"`
	// How much of `planned_quantity` is covered by tickets an earlier week already issued.
	CarriedForwardQuantity float64 `json:"carried_forward_quantity"`
	// The individual lots, carried-forward tickets first and then the new ones, in run order.
	Batches *List[ReleaseScheduleBatch] `json:"batches"`
}

One planned campaign and the lots it broke into.

type RequestLog

type RequestLog struct {
	// Request log ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=request_log"`
	// HTTP method.
	Method constants.HTTPMethod `json:"method" validate:"required"`
	// Request host.
	//
	// Usually `api.openmrp.ai`.
	Host string `json:"host" validate:"required"`
	// The exact path the request was made to, including path parameter values.
	Path string `json:"path" validate:"required"`
	// The route template the request matched, with path parameters left as placeholders.
	//
	// For example `/v1/sales/customers/{id}` is the normalized route for the request path `/v1/sales/customers/ac_...`. Falls back to the raw path when the request did not match a registered route.
	NormalizedRoute string `json:"normalized_route" validate:"required"`
	// Query-string parameters the request was made with, as a JSON object.
	QueryJSON json.RawMessage `json:"query_params" expandable:"true"`
	// HTTP response status code (e.g. `200`, `404`).
	StatusCode int32 `json:"status_code" validate:"required"`
	// Request latency in microseconds.
	//
	// Measured at the API edge, from the moment the request was received until the response was written, so it excludes network time between your client and OpenMRP.
	LatencyUs int64 `json:"latency_us" validate:"required"`
	// The API version the request was served with.
	//
	// Taken from the `OpenMRP-Version` header the caller sent; requests rejected for omitting that header record no version.
	APIVersion *string `json:"api_version"`
	// Client IP address the request came from.
	//
	// Not recorded for requests an OpenMRP agent made on your behalf, since those originate inside OpenMRP's own network.
	ClientIP *string `json:"client_ip"`
	// User agent.
	UserAgent *string `json:"user_agent"`
	// Referrer header.
	Referrer *string `json:"referrer"`
	// Machine-readable API error code.
	//
	// Matches the `code` of the error response the caller received. Populated only for failed requests.
	ErrorCode *apierror.ErrorCode `json:"error_code"`
	// Human-readable error message.
	//
	// The same message the caller received. Populated only for failed requests.
	ErrorMessage *string `json:"error_message"`
	// When the request was received.
	//
	// Request logs are ordered and date-filtered by this timestamp rather than by `created_at`.
	OccurredAt time.Time `json:"occurred_at" validate:"required"`
	// When the log entry was written.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Account _targeted_ by the request: the account the request acted upon.
	//
	// Results are scoped to logs where your account is either the acting account or the target account. Use the `target_account_ids` query parameter to filter by which account was acted upon, and `actor_account_ids` to filter by who acted.
	Account *Account `json:"account" expandable:"true"`
	// Actor who made the request.
	Actor *Actor `json:"actor" expandable:"true"`
	// User-provided idempotency key.
	IdempotencyKey *string `json:"idempotency_key"`
	// The JSON body the request was sent with.
	//
	// Sensitive values such as passwords, tokens, and secrets are redacted before the body is stored. Bodies larger than 256 KB are not stored in full; a small marker object with `_truncated` set to `true` is stored in their place.
	RequestBodyJSON json.RawMessage `json:"request_body" expandable:"true"`
	// The JSON body OpenMRP responded with.
	//
	// Sensitive values such as generated API key secrets are redacted before the body is stored. Bodies larger than 256 KB are not stored in full; a small marker object with `_truncated` set to `true` is stored in their place.
	ResponseBodyJSON json.RawMessage `json:"response_body" expandable:"true"`
}

A log of a single API request, capturing its route, outcome, latency, and actor.

Logs are written after the response has been sent, so a new entry may take a moment to become readable.

func (*RequestLog) SchemaExample

func (*RequestLog) SchemaExample() any

func (*RequestLog) ScrubInternalInfra

func (r *RequestLog) ScrubInternalInfra(identityType *string)

ScrubInternalInfra blanks fields that expose internal infrastructure — the internal listener host and the in-cluster client (pod) IP — when the log represents an internal/agent request (identityType == "agent"). Every customer-facing presenter that renders a request_log MUST call this; the real values remain in platform-service storage for operators. No-op for external (user/api_key) requests, whose host/IP are legitimately customer-visible.

type RevenueForecastPoint

type RevenueForecastPoint struct {
	// The date.
	Date time.Time `json:"at" validate:"required"`
	// The revenue value.
	Revenue float64 `json:"revenue" validate:"required"`
}

RevenueForecastPoint represents a historical revenue data point.

type Role

type Role struct {
	// Role ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=role"`
	// Display name of the role.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// The kind of role.
	//
	// The type gates behavior that individual permissions do not cover, and some actions are reserved for a single role type.
	//
	// - `admin`: full administrative access. Sensitive areas such as API keys, billing, and third-party integrations are restricted to admins no matter what permissions another role holds.
	// - `user`: a custom role tailored to a specific need, with its permissions defined explicitly. Roles created through the API always have this type.
	// - `scanner`: the role used by shop-floor scanning stations, assigned automatically when a scanning-station user is created.
	// - `sales_rep`: a role for sales representatives. Order analytics are scoped to the rep's own orders.
	// - `agent`: a role assigned to an automated agent rather than a person.
	TypeCode constants.RoleType `json:"type" validate:"required"`
	// Provenance of this role.
	//
	// System-owned roles are platform-provided defaults shared across all accounts and cannot be updated or deleted; account-owned roles are custom to your account.
	Owner *Owner `json:"owner" expandable:"true"`
	// Permissions granted by this role, in `{permission}:{action}` format, such as `customers:read`.
	Permissions *[]string `json:"permissions" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at"`
}

A named set of permissions that can be assigned to users to control what they can access.

func (*Role) SchemaExample

func (*Role) SchemaExample() any

type RolePermission

type RolePermission struct {
	// Role permission ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=role_permission"`
	// Resource domain this entry grants access to, such as `customers` or `orders`.
	//
	// The `create`, `read`, `update`, and `delete` flags below apply to this domain.
	PermissionCode string `json:"domain" validate:"required"`
	// Grants create access.
	Create bool `json:"create"`
	// Grants read access.
	Read bool `json:"read"`
	// Grants update access.
	Update bool `json:"update"`
	// Grants delete access.
	Delete bool `json:"delete"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A role's access grant for a single resource domain, with separate create, read, update, and delete flags.

func (*RolePermission) SchemaExample

func (*RolePermission) SchemaExample() any

type SalesEntry

type SalesEntry struct {
	// Unique identifier for this entry.
	ID string `json:"id" validate:"required"`
	// The date the order was issued.
	IssuedAt *time.Time `json:"issued_at"`
	// The customer purchase order number.
	CustomerPO *string `json:"customer_po"`
	// The order number.
	OrderNumber string `json:"order_number" validate:"required"`
	// The order ID.
	OrderID string `json:"order_id" validate:"required"`
	// The sales representative ID.
	SalesRepID *string `json:"sales_rep_id"`
	// The sales representative username.
	SalesRepUsername *string `json:"sales_rep_username"`
	// The customer ID.
	CustomerID string `json:"customer_id" validate:"required"`
	// The customer name.
	CustomerName string `json:"customer_name" validate:"required"`
	// The customer number.
	CustomerNumber string `json:"customer_number" validate:"required"`
	// The customer type group ID.
	CustomerTypeGroupID *string `json:"customer_type_group_id"`
	// The customer group name.
	CustomerGroupName *string `json:"customer_group_name"`
	// The parent customer ID.
	ParentCustomerID *string `json:"parent_customer_id"`
	// The date the customer was created.
	CustomerCreatedAt time.Time `json:"customer_created_at" validate:"required"`
	// The product line ID.
	ProductLineID *string `json:"product_line_id"`
	// The product line name.
	ProductLine *string `json:"product_line"`
	// The product ID.
	ProductTypeID string `json:"product_type_id" validate:"required"`
	// The item ID.
	ItemID string `json:"item_id" validate:"required"`
	// The product SKU.
	ProductSku string `json:"product_sku" validate:"required"`
	// The product description.
	ProductDescription *string `json:"product_description"`
	// The category name.
	CategoryName string `json:"category_name" validate:"required"`
	// The quantity invoiced.
	QuantityInvoiced float64 `json:"quantity_invoiced" validate:"required"`
	// The unit of measure.
	Unit string `json:"unit" validate:"required"`
	// The unit cost.
	UnitCost float64 `json:"unit_cost" validate:"required"`
	// The unit price.
	UnitPrice float64 `json:"unit_price" validate:"required"`
	// The unit profit.
	UnitProfit float64 `json:"unit_profit" validate:"required"`
	// The total invoiced amount.
	TotalInvoiced float64 `json:"total_invoiced" validate:"required"`
	// The total cost.
	TotalCost float64 `json:"total_cost" validate:"required"`
	// The total profit.
	TotalProfit float64 `json:"total_profit" validate:"required"`
	// The ship-to city.
	ShipToCity *string `json:"ship_to_city"`
	// The ship-to zipcode.
	ShipToZipcode *string `json:"ship_to_zipcode"`
	// The ship-to state.
	ShipToState *string `json:"ship_to_state"`
	// The ship-to country.
	ShipToCountry *string `json:"ship_to_country"`
	// The order discount code.
	OrderDiscountCode *string `json:"discount_code"`
	// The date the order was completed.
	CompletedAt *time.Time `json:"completed_at"`
	// The date of the first shipment.
	FirstShipAt *time.Time `json:"first_ship_at"`
	// The promised delivery date.
	PromisedAt *time.Time `json:"promised_at"`
	// The invoice ID.
	InvoiceID string `json:"invoice_id" validate:"required"`
	// The invoice number.
	InvoiceNumber string `json:"invoice_number" validate:"required"`
	// The date the invoice was created.
	InvoicedAt time.Time `json:"invoiced_at" validate:"required"`
}

SalesEntry represents a single sales transaction entry for analytics.

type SalesOrder

type SalesOrder struct {
	// Sales order ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order"`
	// Human-readable order number, e.g. `SO-001`.
	//
	// Assigned automatically when the order is created; unique within your account.
	Number string `json:"number" validate:"required"`
	// The customer's own purchase order number, for cross-referencing.
	//
	// Unique among this customer's orders.
	CustomerPurchaseOrderNumber *string `json:"customer_purchase_order_number"`
	// Free-form note about the order.
	Note *string `json:"note"`
	// Order lifecycle status.
	//
	// - `estimate`: a draft quote that has not yet been committed; not counted as a real order.
	// - `issued`: the order has been issued and is being fulfilled.
	// - `fulfilled`: the order has been completed and closed.
	//
	// Status changes are made through the issue, unissue, close, and reopen action endpoints rather than by updating this field.
	Status constants.SalesOrderStatusCode `json:"status" validate:"required"`
	// Fulfillment priority, used to rank orders on the shop floor.
	Priority constants.PriorityCode `json:"priority" validate:"required"`
	// Payment state of the order, derived from settlement allocations, invoices, and Stripe payments.
	PaymentStatus constants.SalesOrderPaymentStatus `json:"payment_status" validate:"required"`
	// Stripe payment intent IDs recorded against this order.
	PaymentIntentIDs []string `json:"payment_intent_ids"`
	// Whether an order acknowledgment has been sent to the customer.
	//
	// Becomes `sent` when the order is issued with customer notification requested and the order has acknowledgement contacts to send to. It can also be set directly when an acknowledgement was sent outside OpenMRP.
	AcknowledgmentStatus constants.AcknowledgmentStatus `json:"acknowledgment_status" validate:"required"`
	// The customer this order is for.
	Customer *Customer `json:"customer" expandable:"true"`
	// The sales representative credited with the order.
	//
	// Chosen automatically at creation when none is supplied, from the customer's default rep or the sales territory covering the ship-to address.
	SalesRep *Actor `json:"sales_rep" expandable:"true"`
	// Who created this order, and their relation (internal/customer/system).
	CreatedBy *CreatedBy `json:"created_by" expandable:"true"`
	// Address the order is billed to.
	BillToAddress *Address `json:"bill_to_address" expandable:"true"`
	// Address the order ships to.
	ShipToAddress *Address `json:"ship_to_address" expandable:"true"`
	// Carrier selection and freight billing for this order.
	//
	// The freight charge itself is carried as a line on the order, not on this object.
	Freight *Freight `json:"freight" expandable:"true"`
	// Payment terms agreed for this order.
	PaymentTerm *PaymentTerm `json:"payment_term" expandable:"true"`
	// Shipping terms agreed for this order.
	ShippingTerm *ShippingTerm `json:"shipping_term" expandable:"true"`
	// Order-level discount applied to this order.
	//
	// The discount is charged through a negative-priced line on the order, so it is already reflected in the order totals.
	OrderDiscount *OrderDiscount `json:"order_discount" expandable:"true"`
	// The order's lines, including the automatically generated freight and discount lines.
	Lines *List[SalesOrderLine] `json:"lines" expandable:"true"`
	// Number of lines on this order.
	LineCount int32 `json:"line_count"`
	// Derived monetary totals and per-stage fulfillment progress.
	Totals *SalesOrderTotals `json:"totals" expandable:"true"`
	// Fulfillment records produced from this order.
	Related *SalesOrderRelated `json:"related"`
	// Email recipients grouped by notification purpose.
	Contacts *OrderContact `json:"contacts" expandable:"true"`
	// When the order was issued (moved out of `estimate`).
	IssuedAt *time.Time `json:"issued_at"`
	// When the order was fulfilled and closed.
	CompletedAt *time.Time `json:"completed_at"`
	// When the first shipment against this order went out.
	FirstShipAt *time.Time `json:"first_ship_at"`
	// When this estimate expires, if an expiration was set.
	ExpiredAt *time.Time `json:"expired_at"`
	// Date promised to the customer for delivery, if one was committed.
	PromisedAt *time.Time `json:"promised_at"`
	// Days between issue and the ship-by date, set on this order alone in place of the customer's standing lead time.
	LeadTimeOverrideDays *int32 `json:"lead_time_override_days"`
	// The ship date pinned on this order, bypassing transit and the customer's receiving days.
	ShipByOverrideDate *time.Time `json:"ship_by_override_date"`
	// Date this order is contractually due to ship.
	//
	// Stamped when the order is issued. With a promised delivery date, this is that date less the carrier's transit for the order's lane and less any day the customer cannot receive on — the day the order has to leave to arrive when promised. Otherwise it comes from a lead time, whether this order's own or the one on the customer, its parent account, its account group, or the account.
	//
	// Always a day the plant actually ships on, whichever rule produced it.
	//
	// It is not recomputed afterwards, so neither renegotiating a customer's lead time, nor a later carrier estimate, nor a holiday added to a calendar moves commitments already made. Cleared if the order is unissued.
	ShipByDate *time.Time `json:"ship_by_date"`
	// The ship-by date at the plant's pickup cutoff — the moment freight has to be tendered by, not just the day.
	//
	// Only set when the account's shipping calendar carries a cutoff time.
	ShipByCutoffAt *time.Time `json:"ship_by_cutoff_at"`
	// Days the customer's receiving calendar and the plant's shipping calendar pulled the ship-by date back, beyond what carrier transit accounted for.
	//
	// Zero means every date along the way already fell on an open day. This is what explains a ship-by date that is earlier than transit alone would suggest.
	CalendarAdjustmentDays *int32 `json:"calendar_adjustment_days"`
	// Calendar days between issue and the ship-by date.
	LeadTimeDays *int32 `json:"lead_time_days"`
	// Which rule produced the ship-by date.
	LeadTimeSource *constants.LeadTimeSource `json:"lead_time_source"`
	// Business days the carrier needs to cover this order's lane, subtracted from the promised delivery date to reach the ship-by date.
	//
	// Only set when a delivery date was promised and the lane could be priced. Without it the ship-by date falls back to the promised date itself.
	TransitDays *int32 `json:"transit_days"`
	// Where the transit estimate came from.
	TransitSource *constants.TransitSource `json:"transit_source"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An order placed by a customer, tracked from estimate through fulfillment.

func (*SalesOrder) SchemaExample

func (*SalesOrder) SchemaExample() any

type SalesOrderLine

type SalesOrderLine struct {
	// Sales order line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_line"`
	// Position of the line on the order.
	//
	// Assigned automatically in sequence, starting at `1`. Product lines are numbered first and the automatically generated freight and discount lines always sit at the bottom; removing a line renumbers the rest so the sequence stays contiguous.
	LineItemNumber int32 `json:"line_item_number" validate:"required"`
	// SKU recorded on this line.
	//
	// Taken from the product unless the line supplies its own, and editable afterwards, so it preserves what was sold even if the product's SKU later changes.
	ProductSKU string `json:"product_sku" validate:"required"`
	// Description recorded on this line, taken from the product unless the line supplies its own.
	ProductDescription *string `json:"product_description"`
	// The item this line sells, identified by the SKU recorded when the line was created.
	Item *Item `json:"item" expandable:"true"`
	// The product being sold on this line.
	//
	// The product's `type` tells you what kind of line this is: the freight and discount lines an order generates for itself reference the account's built-in shipping and credit products, so their type is `shipping` or `credit` rather than `sale`.
	Product *Product `json:"product" expandable:"true"`
	// Quantity ordered.
	QuantityOrdered *Quantity `json:"quantity_ordered" expandable:"true"`
	// Price charged per unit.
	UnitPrice *Rate `json:"unit_price" expandable:"true"`
	// Internal cost per unit.
	//
	// Reflects what the business pays for the item, not what the customer is charged, and is used to derive line profitability.
	UnitCost *Rate `json:"unit_cost" expandable:"true"`
	// Derived monetary totals for this line.
	Totals *SalesOrderTotals `json:"totals" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A single line item on a sales order.

func (*SalesOrderLine) SchemaExample

func (*SalesOrderLine) SchemaExample() any

type SalesOrderRelated

type SalesOrderRelated struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_related"`
	// The pick created when the order was issued.
	Pick *Record `json:"pick" expandable:"true"`
	// The production run created for this order, if one was started.
	ProductionRun *Record `json:"production_run" expandable:"true"`
	// Shipments made against this order.
	Shipments *List[Record] `json:"shipments" expandable:"true"`
	// Invoices raised against this order.
	Invoices *List[Record] `json:"invoices" expandable:"true"`
}

The fulfillment records produced from a sales order.

The group itself is returned only when at least one of its members has been expanded.

type SalesOrderStageTotal

type SalesOrderStageTotal struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_stage_total"`
	// Amount that has reached this stage, as a decimal string (unit price times the quantity at this stage).
	Amount string `json:"amount" validate:"required" format:"decimal"`
	// Progress through this stage, as a fraction between 0 and 1.
	//
	// Calculated as the quantity that has reached this stage divided by the quantity ordered, so `1` means the whole order has cleared the stage and `0` means nothing has reached it yet.
	Completion float64 `json:"completion"`
}

The monetary amount that has reached one fulfillment stage, together with how far that stage has progressed.

type SalesOrderStatus

type SalesOrderStatus struct {
	// Sales order status ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_status"`
	// Machine-readable status code.
	//
	// - `estimate`: a draft quote that has not yet been committed.
	// - `issued`: the order is committed for fulfillment, with a pick raised against it.
	// - `fulfilled`: the order has been completed and closed.
	Code constants.SalesOrderStatusCode `json:"code" validate:"required"`
	// Human-readable name of the status.
	Name string `json:"name" validate:"required"`
	// Owner of this status value.
	//
	// Sales order statuses are platform-provided and shared across all accounts, so the owner is always the OpenMRP system owner.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A lookup value describing where a sales order is in its lifecycle, from estimate through fulfillment.

These are the values that appear as a sales order's `status`. The set is platform-provided and the same for every account, and an order moves between the statuses through its issue, unissue, close, and reopen actions rather than by being assigned a status directly.

func (*SalesOrderStatus) SchemaExample

func (*SalesOrderStatus) SchemaExample() any

type SalesOrderStatusDetail

type SalesOrderStatusDetail struct {
	// Status code.
	Code string `json:"code" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_status"`
	// Display name.
	Name string `json:"name" validate:"required"`
}

Sales order status sub-resource.

NOTE: currently unreferenced (see the SalesOrderType note).

type SalesOrderTotals

type SalesOrderTotals struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_totals"`
	// Total ordered amount as a decimal string (unit price x quantity ordered).
	//
	// This is the baseline the stage completions are measured against.
	Ordered string `json:"ordered" validate:"required" format:"decimal"`
	// Picked amount and completion.
	Picked SalesOrderStageTotal `json:"picked"`
	// Packed amount and completion.
	Packed SalesOrderStageTotal `json:"packed"`
	// Invoiced amount and completion.
	Invoiced SalesOrderStageTotal `json:"invoiced"`
}

Derived monetary totals for a sales order or one of its lines.

Fulfillment runs ordered -> picked -> packed -> invoiced, and each downstream stage reports both the money that has reached it and its progress against the ordered baseline.

type SalesOrderType

type SalesOrderType struct {
	// Type code.
	Code string `json:"code" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_order_type"`
	// Display name.
	Name string `json:"name" validate:"required"`
}

Sales order type sub-resource.

NOTE: currently unreferenced — sales orders and purchase orders both expose status, type, and priority as plain codes.

type SalesTarget

type SalesTarget struct {
	// Sales target ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sales_target"`
	// Start of the period this target applies to (inclusive).
	StartAt time.Time `json:"start_at" validate:"required"`
	// End of the period this target applies to (e.g. the close of a quarter).
	EndAt time.Time `json:"end_at" validate:"required"`
	// The sales rep this target is assigned to, referencing the account-user record the `/v1/identity/account-users` endpoints return.
	//
	// A reference rather than the full record: it was tagged expandable but no include ever resolved it, so callers received an account user whose every field except the id was empty.
	SalesRep *Entity `json:"sales_rep" validate:"required"`
	// The revenue goal for the period, as a monetary quantity.
	Amount *Quantity `json:"amount" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A revenue goal assigned to a sales rep for a specific time period.

func (*SalesTarget) SchemaExample

func (*SalesTarget) SchemaExample() any

type Sandbox

type Sandbox struct {
	// Sandbox ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sandbox"`
	// Display name of the sandbox.
	Name string `json:"name" validate:"required"`
	// The production account that owns this sandbox.
	OwnerAccount *Account `json:"owner_account" expandable:"true"`
	// When this sandbox was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this sandbox was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

An isolated test account owned by a production account.

A sandbox is a full account with its own data, so anything created or changed inside it leaves your production data untouched.

func (*Sandbox) SchemaExample

func (*Sandbox) SchemaExample() any

type ScanningConsumption

type ScanningConsumption struct {
	// SKU of the material to consume.
	SKU string `json:"sku" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=scanning_consumption"`
	// Amount the operation requires, as a decimal measure expressed in `demand_unit`.
	DemandMeasure string `json:"demand_measure" validate:"required" format:"decimal"`
	// Unit abbreviation that `demand_measure` is expressed in.
	DemandUnit string `json:"demand_unit" validate:"required"`
	// Material's currently available-to-promise (ATP) inventory, as a decimal measure expressed in `inventory_unit`.
	InventoryMeasure string `json:"inventory_measure" validate:"required" format:"decimal"`
	// Unit abbreviation that the available-to-promise `inventory_measure` is expressed in.
	InventoryUnit string `json:"inventory_unit" validate:"required"`
	// Free-text instructions for consuming this material.
	Instructions *string `json:"instructions"`
}

Material consumption data for a scanning operation.

The `demand_*` pair is how much of the material this operation requires. The `inventory_*` pair is the material's currently available-to-promise (ATP) inventory — an independent value, not the demand amount converted.

func (*ScanningConsumption) SchemaExample

func (*ScanningConsumption) SchemaExample() any

type ScanningProductionStepInfo

type ScanningProductionStepInfo struct {
	// Production step ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=scanning_production_step_info"`
	// Production step name.
	Name string `json:"name" validate:"required"`
	// Whether the step combines multiple distinct part items.
	//
	// Multi-part steps consume several parts at once, so an operator must scan one batch per part before merging or splitting into the step.
	IsMultiPart bool `json:"is_multi_part"`
}

Production step information for the scanning next-steps response.

func (*ScanningProductionStepInfo) SchemaExample

func (*ScanningProductionStepInfo) SchemaExample() any

type ScanningStation

type ScanningStation struct {
	// Scanning station ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=scanning_station"`
	// Display name of the scanning station.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// Free-form notes about the scanning station.
	Notes *string `json:"notes"`
	// Scanning station type, determining which batch operation an operator performs when they scan here.
	//
	// - `init_batch`: starts a new batch at the beginning of a production flow.
	// - `merge_batch`: combines several scanned batches into one.
	// - `move_batch`: advances a batch through a production step connected to this station.
	// - `split_batch`: divides a batch into several batches.
	//
	// Fixed when the station is created.
	Type constants.ScanningStationType `json:"type" validate:"required"`
	// Size of the labels printed at this station, given as width-by-height (for example, `1x1`).
	LabelSizeCode *constants.LabelSizeCode `json:"label_size"`
	// Type of label printed at this station.
	//
	// - `tag`: a label attached to the physical product.
	// - `traveler`: a routing sheet that accompanies the batch through every production step.
	LabelTypeCode *constants.LabelTypeCode `json:"label_type"`
	// Whether operators must perform a material check at this station.
	//
	// - `none`: no additional operator check is required.
	// - `material_check`: a material check is expected before the operation.
	OperatorRequirement constants.OperatorRequirement `json:"operator_requirement"`
	// The department this scanning station belongs to.
	//
	// Assigned when the station is created and cannot be reassigned afterward.
	Department *Department `json:"department" expandable:"true"`
	// Production steps connected to this station.
	//
	// A production step can be connected to at most one scanning station, so connecting a step here disconnects it from any other station. Manage the connections with Connect Production Steps to Scanning Station.
	ProductionSteps *List[ProductionStep] `json:"production_steps" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A station on the production floor where operators scan batches to perform a batch operation, such as initializing or moving a batch.

func (*ScanningStation) SchemaExample

func (*ScanningStation) SchemaExample() any

type ScheduleAppliedOverride

type ScheduleAppliedOverride struct {
	// The override that was applied.
	Override *Entity `json:"override" validate:"required"`
	// The item whose demand changed.
	Item *Entity `json:"item" validate:"required"`
	// The first instant of the month the override applied to.
	MonthStart time.Time `json:"month_starts_at"`
	// Demand before the override.
	Before float64 `json:"before"`
	// Demand after the override.
	After float64 `json:"after"`
	// How the override was expressed.
	//
	// - `absolute`: the override replaced the forecast for the month outright.
	// - `delta_units`: the override was added to the forecast.
	// - `delta_percent`: the override scaled the forecast.
	Adjustment constants.DemandOverrideAdjustment `json:"adjustment"`
	// Why the override exists.
	Reason *constants.DemandOverrideReason `json:"reason"`
}

A demand override that changed a number, recorded so the plan can explain itself.

type ScheduleAtRiskOrder

type ScheduleAtRiskOrder struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=schedule_at_risk_order"`
	// The order at risk.
	SalesOrder *Entity `json:"sales_order" validate:"required"`
	// The item that has to be produced to meet it.
	Item *Entity `json:"item" validate:"required"`
	// SKU of that item.
	SKU string `json:"sku"`
	// Outstanding quantity still owed.
	Units float64 `json:"units"`
	// Horizon week the constraint stage has to finish in for the order to ship on time.
	DueWeek int32 `json:"due_week"`
	// Why the commitment is at risk.
	//
	// - `past_due`: production needed to start before this plan begins.
	// - `undated`: the order carries no ship-by commitment, so it is treated as owed now.
	// - `short`: the plan projects less stock than the order needs in the week it is needed.
	Reason constants.ScheduleAtRiskReason `json:"reason" validate:"required"`
}

An order commitment the plan does not meet.

type ScheduleCampaign

type ScheduleCampaign struct {
	// The item to produce.
	Item *Entity `json:"item" validate:"required"`
	// SKU of the item.
	SKU string `json:"sku" validate:"required"`
	// The machine assigned to the campaign.
	Machine *Entity `json:"machine" validate:"required"`
	// Zero-based week offset from the start of the horizon.
	WeekIndex int32 `json:"week_index"`
	// Quantity to produce.
	Units float64 `json:"units"`
	// Whole lots the quantity rounds to.
	Lots int32 `json:"lots"`
	// Constraint hours the campaign consumes.
	RunHours float64 `json:"run_hours"`
}

One planned production block: make this item, on this machine, in this week.

type ScheduleDeviationType

type ScheduleDeviationType struct {
	// Deviation type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=schedule_deviation_type"`
	// Stable code recorded on a deviation.
	Code constants.ScheduleDeviationType `json:"code" validate:"required"`
	// Display name of the type.
	Name string `json:"name" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A kind of hand change to a plan.

func (*ScheduleDeviationType) SchemaExample

func (*ScheduleDeviationType) SchemaExample() any

type ScheduleDiagnostics

type ScheduleDiagnostics struct {
	// Items whose economic lot size was reduced to fit one machine-week, meaning shorter and more frequent campaigns.
	EOQCappedSKUs []string `json:"eoq_capped_skus"`
	// Items that cannot fit even a single lot into a machine-week and are therefore never scheduled.
	UnschedulableSKUs []string `json:"unschedulable_skus"`
	// Items below their reorder point that never won a slot in the horizon.
	//
	// This is the signal that the plant is short of capacity.
	CapacityStarvedSKUs []string `json:"capacity_starved_skus"`
	// Items with no measured run rate, which cannot be scheduled because their machine time is unknown.
	ItemsWithoutRunRate []string `json:"items_without_run_rate"`
	// Number of items the merchant has excluded from planning.
	ExcludedItemCount int32 `json:"excluded_item_count"`
	// Machines the constraint department contributed to this solve.
	ConstraintMachineCount int32 `json:"constraint_machine_count"`
	// Batches found on those machines in the demand window.
	//
	// Zero means nothing has been scanned there, which is why a plan can be empty even with machines configured.
	MeasuredBatchCount int32 `json:"measured_batch_count"`
	// Machines in the constraint department with no production step.
	//
	// Their campaigns derive no downstream department work.
	MachinesWithoutStep int32 `json:"machines_without_step"`
	// Minutes of changeover the model adds for each new input a product transition introduces.
	//
	// Calibrated from measured production against `average_inputs_added`, so the modelled changeover lands on the time the floor actually reports rather than on a fixed allowance.
	ChangeoverSlopeMinutes float64 `json:"changeover_slope_minutes"`
	// Average inputs a product transition introduces, measured from history.
	AverageInputsAdded float64 `json:"average_inputs_added"`
	// Every demand override that moved a number.
	AppliedOverrides *List[ScheduleAppliedOverride] `json:"applied_overrides"`
	// Outstanding order quantity this plan owes, expressed in the constraint item's own unit.
	//
	// Zero means nothing is on order and the plan is driven purely by the forecast.
	FirmDemandUnits float64 `json:"firm_demand_units"`
	// Open orders carrying no ship-by commitment, dated at the front of the horizon because they are issued and unshipped.
	//
	// A non-zero count means orders placed before commitments were tracked still need a ship-by date.
	UndatedFirmOrderCount int32 `json:"undated_firm_order_count"`
	// Planned items built only against the order book rather than to a forecast.
	MakeToOrderItemCount int32 `json:"make_to_order_item_count"`
	// Commitments this plan does not meet.
	AtRiskOrders *List[ScheduleAtRiskOrder] `json:"at_risk_orders"`
	// How the second stage — the rest of the factory — fared against the plan the constraint produced.
	Finishing ScheduleFinishingDiagnostics `json:"finishing"`
	// Machines outside the constraint department that the second stage was sized from.
	//
	// Zero means its capacity was estimated from the shift pattern alone rather than counted.
	FinishingMachineCount int32 `json:"finishing_machine_count"`
	// Whether the second stage's capacity was estimated rather than counted from machines.
	FinishingCapacityIsEstimated bool `json:"finishing_capacity_is_estimated"`
}

What the solver could not do, and why the plan differs from raw history.

type ScheduleDiffLine

type ScheduleDiffLine struct {
	// What the regenerate would do to this campaign.
	//
	// - `added`: the fresh solve wants a campaign the current plan does not have.
	// - `removed`: the current plan holds a campaign the fresh solve does not want.
	// - `changed`: both hold the campaign, in different quantities.
	// - `unchanged`: both agree on it.
	Change constants.ScheduleDiffChange `json:"change" validate:"required"`
	// The item the campaign produces.
	Item *Entity `json:"item" validate:"required"`
	// SKU of that item.
	SKU string `json:"sku"`
	// The machine the campaign runs on.
	Machine *Entity `json:"machine"`
	// Zero-based horizon week.
	WeekIndex int32 `json:"week_index"`
	// Units the current plan asks for.
	//
	// Zero when the campaign is being added.
	CurrentQuantity float64 `json:"current_quantity"`
	// Units the fresh solve asks for.
	//
	// Zero when the campaign is being removed.
	ProposedQuantity float64 `json:"proposed_quantity"`
	// Whether the current campaign was created or edited by a person.
	CurrentIsManual bool `json:"current_is_manual"`
}

One campaign as the current plan and a fresh solve each see it.

type ScheduleFinishingDiagnostics

type ScheduleFinishingDiagnostics struct {
	// Hours the second stage can work in one week.
	WeeklyCapacityHours float64 `json:"weekly_capacity_hours"`
	// Hours the plan asks of it, week by week.
	PlannedHoursByWeek []float64 `json:"planned_hours_by_week"`
	// Those hours as a fraction of capacity, week by week.
	UtilisationByWeek []float64 `json:"utilisation_by_week"`
	// Finished goods that wanted building across the whole horizon and never had greige to build from.
	GreigeStarvedSKUs []string `json:"greige_starved_skus"`
	// Finished goods that had greige and never had hours.
	CapacityStarvedSKUs []string `json:"capacity_starved_skus"`
	// Finished goods with no measured finishing rate, which cannot be levelled because the hours they cost are unknown.
	ItemsWithoutRunRate []string `json:"items_without_run_rate"`
	// Constraint output the horizon never converts into anything.
	//
	// A large figure means the two stages are planned against different demand, which is worth looking at rather than leaving as an unexplained pile of greige.
	UnusedGreigeUnits float64 `json:"unused_greige_units"`
	// Total finished units the stage plans across the horizon.
	TotalPlannedUnits float64 `json:"total_planned_units"`
	// How many finishing lines the plan holds.
	LineCount int32 `json:"line_count"`
}

How the second stage fared: what it could not make, and which of the two things it ran out of.

The two starvation lists are the point of planning in two stages at all. A finished good held back for want of greige is a knitting problem — knit more of it, or knit it sooner — and one held back for want of hours is a finishing problem: another shift, or a different mix. A single "short" list would throw that distinction away, and it is the only thing this model knows that a one-stage plan does not.

type ScheduleOrderCoverage

type ScheduleOrderCoverage struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=schedule_order_coverage"`
	// The order at risk.
	SalesOrder *Entity `json:"sales_order" validate:"required"`
	// The item that has to be produced to meet it.
	Item *Entity `json:"item" validate:"required"`
	// SKU of that item.
	SKU string `json:"sku"`
	// Quantity the plan does not build in time.
	//
	// Less than the whole order when the plan builds part of it — a mostly-built order is mostly built, and reporting the full quantity would read as a total miss.
	UnitsAtRisk float64 `json:"units_at_risk"`
	// Horizon week the constraint stage has to finish in for the order to ship on time.
	DueWeek int32 `json:"due_week"`
	// Why the commitment is at risk.
	Reason constants.ScheduleAtRiskReason `json:"reason" validate:"required"`
	// The date this order is contractually due to ship.
	ShipByDate *time.Time `json:"ship_by_date"`
	// Campaigns earmarked for this order, covering the part of it the plan does build.
	CoveringLines *List[ScheduleOrderCoverageLine] `json:"covering_lines"`
}

An order this schedule does not build in time, with the campaigns covering the part it does.

func (*ScheduleOrderCoverage) SchemaExample

func (*ScheduleOrderCoverage) SchemaExample() any

type ScheduleOrderCoverageLine

type ScheduleOrderCoverageLine struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=schedule_order_coverage_line"`
	// The campaign.
	ProductionScheduleLine *Entity `json:"production_schedule_line" validate:"required"`
	// Horizon week it runs in.
	WeekIndex int32 `json:"week_index"`
	// The machine it runs on.
	Machine *Entity `json:"machine" validate:"required"`
	// Quantity of that campaign earmarked for this order.
	AllocatedQuantity float64 `json:"allocated_quantity"`
}

One campaign earmarked for an order.

type SchedulePolicy

type SchedulePolicy struct {
	// The item this policy is for.
	Item *Entity `json:"item" validate:"required"`
	// SKU of the item.
	SKU string `json:"sku" validate:"required"`
	// How this item was planned.
	//
	// - `make_to_stock`: built to the forecast, holding a safety stock against its variability.
	// - `make_to_order`: built only against orders already on the book, holding no buffer, so its safety stocks and reorder point are all zero.
	FulfillmentPolicy constants.FulfillmentPolicy `json:"fulfillment_policy"`
	// Which rule decided that policy: the item itself, its product line, or the account default.
	PolicySource constants.FulfillmentPolicySource `json:"policy_source"`
	// Outstanding quantity the order book already owed for this item over the horizon.
	FirmDemandUnits float64 `json:"firm_demand_units"`
	// Quantity the forecast projected for the same window.
	ForecastDemandUnits float64 `json:"forecast_demand_units"`
	// Demand used for planning, annualized.
	AnnualDemand float64 `json:"annual_demand"`
	// Demand used for planning, per week.
	WeeklyDemand float64 `json:"weekly_demand"`
	// How long one unit occupies the constraint.
	SecondsPerUnit float64 `json:"seconds_per_unit"`
	// Standard cost per unit.
	UnitCost float64 `json:"unit_cost"`
	// Cost of one changeover, used as the setup cost in the lot-size calculation.
	SetupCost float64 `json:"setup_cost"`
	// Annual cost of holding one unit.
	HoldingCost float64 `json:"holding_cost"`
	// Economic order quantity: the campaign size that balances the cost of a changeover against the cost of holding what it produces.
	EOQUnits float64 `json:"eoq_units"`
	// Observed or default lead time at the constraint.
	ConstraintLeadTimeWeeks float64 `json:"constraint_lead_time_weeks"`
	// Lead time from the constraint to sellable stock.
	FinishLeadTimeWeeks float64 `json:"finish_lead_time_weeks"`
	// Buffer held at the constraint, pooled across the finished goods it feeds.
	SafetyStockPrimary float64 `json:"safety_stock_primary"`
	// Buffer held as finished goods.
	SafetyStockDownstream float64 `json:"safety_stock_downstream"`
	// Stock position at which a campaign is triggered.
	ReorderPoint float64 `json:"reorder_point"`
	// Ceiling on how far ahead this item is built.
	OrderUpTo float64 `json:"order_up_to"`
	// Stock on hand at the constraint plus everything downstream of it.
	OnHandEchelon float64 `json:"on_hand_echelon"`
	// Stock sitting at the constraint stage on its own.
	OnHandGreige float64 `json:"on_hand_greige"`
	// What the constraint stage holds on average: its buffer plus half a campaign.
	AverageGreigeInventory float64 `json:"average_greige_inventory"`
	// What the constraint stage holds at its peak: its buffer plus a whole campaign.
	MaxGreigeInventory float64 `json:"max_greige_inventory"`
	// Weeks of demand the current stock covers.
	WeeksOfCover float64 `json:"weeks_of_cover"`
	// ABC class by share of constraint run hours.
	//
	// - `a`: consumes the largest share of constraint capacity.
	// - `b`: moderate constraint consumption.
	// - `c`: consumes little constraint capacity.
	ABCClass *constants.ABCClass `json:"abc_class"`
	// Constraint hours this item's annual demand consumes.
	AnnualRunHours float64 `json:"annual_run_hours"`
}

The inventory policy computed for one item.

type ScheduleProjection

type ScheduleProjection struct {
	// The item the projection is for.
	Item *Entity `json:"item" validate:"required"`
	// Projected stock at the end of each week of the horizon.
	OnHandByWeek []float64 `json:"on_hand_by_week"`
}

An item's projected stock position across the horizon.

type ServiceLevel

type ServiceLevel struct {
	// Service level ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=service_level"`
	// Human-readable name for the service level, shown to customers at checkout when the service level is visible.
	Name string `json:"name" validate:"required"`
	// Carrier-specific code identifying this service level (e.g. `fedex_ground`, `ups_next_day_air`).
	//
	// For service levels synced from a connected carrier this is the carrier's own token, which is what rate shopping and label purchase are keyed on; for service levels you create yourself it is the `code` you supplied.
	ServiceLevelToken constants.ServiceLevelCode `json:"service_level_token" validate:"required"`
	// Whether customers can see and select this service level at checkout in the customer portal.
	CustomerPortalVisibility constants.CustomerPortalVisibility `json:"customer_portal_visibility" validate:"required"`
	// Whether this is the carrier's default service level, pre-selected when the carrier is chosen.
	//
	// Each carrier has at most one default; setting a new default clears the previous one. A default service level cannot be deleted until another service level takes its place or the flag is cleared.
	IsDefault bool `json:"is_default"`
	// Business days this service typically takes in transit, used to work an order's ship-by date back from a promised delivery date.
	//
	// A fallback for lanes the carrier has not quoted. Null means transit is unknown for this service rather than instant, so a ship-by date falls back to the promised delivery date itself.
	DefaultTransitDays *int32 `json:"default_transit_days"`
	// Provenance of this service level.
	//
	// System-owned service levels are platform-provided defaults that cannot be updated or deleted; account-owned service levels are custom to your account.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A shipping speed or method offered by a carrier, such as ground or overnight.

Carriers connected through Shippo have their service levels synced from the carrier itself; any carrier can also have service levels you create by hand.

func (*ServiceLevel) SchemaExample

func (*ServiceLevel) SchemaExample() any

type Settlement

type Settlement struct {
	// Settlement ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=settlement"`
	// Number identifying the settlement within the account.
	//
	// Generated automatically from a per-account sequence at creation; it can be changed later but must remain unique within the account.
	Number string `json:"number" validate:"required"`
	// Free-form note attached to this settlement.
	Note *string `json:"note"`
	// The account user responsible for this settlement.
	ResponsibleUser *AccountUser `json:"responsible_user" expandable:"true"`
	// Transaction allocations recorded in this settlement, each applying part of a transaction to one invoice.
	Allocations *List[TransactionAllocation] `json:"allocations" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A batch of transaction allocations applying customer payments and credits to invoices.

Each allocation in a settlement applies part of a transaction (payment, rebate, adjustment, or credit memo) to a specific invoice.

func (*Settlement) SchemaExample

func (*Settlement) SchemaExample() any

type SettlementSummary

type SettlementSummary struct {
	// Settlement ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=settlement_summary"`
	// Settlement number.
	Number string `json:"number" validate:"required"`
	// Number of allocations in this settlement.
	AllocationCount int32 `json:"allocation_count"`
	// Total amount allocated from `payment` transactions, as a decimal string.
	TotalPayments *string `json:"total_payments"`
	// Total amount allocated from `rebate` transactions, as a decimal string.
	TotalRebates *string `json:"total_rebates"`
	// Total amount allocated from `adjustment` transactions, as a decimal string.
	TotalAdjustments *string `json:"total_adjustments"`
	// Total amount allocated from `credit_memo` transactions, as a decimal string.
	TotalCredits *string `json:"total_credits"`
	// Numbers of the invoices this settlement's allocations were applied to, without duplicates.
	InvoiceNumbers []string `json:"invoice_numbers"`
	// Names of the customers billed by those invoices, without duplicates.
	CustomerNames []string `json:"customer_names"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A condensed settlement shape returned by List Settlements.

Replaces the full allocation list with aggregate totals per transaction type, plus the invoice numbers and customer names the allocations touch.

When the list is filtered by transaction or invoice, every aggregate here — the allocation count, the totals, the invoice numbers, and the customer names — covers only the allocations that matched the filter, not every allocation in the settlement.

func (*SettlementSummary) SchemaExample

func (*SettlementSummary) SchemaExample() any

type SetupBillingResponse

type SetupBillingResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=setup_billing_response"`
	// Stripe customer ID.
	StripeCustomerID string `json:"stripe_customer_id" validate:"required"`
	// Stripe Setup Intent client secret for Stripe.js payment collection.
	ClientSecret string `json:"client_secret" validate:"required" sensitive:"true"` // #nosec G117 -- Stripe client_secret passed to frontend, not a hardcoded secret
	// Stripe publishable key for Stripe.js initialization.
	PublishableKey string `json:"publishable_key" validate:"required"`
}

Result of setting up billing for a registration.

func (*SetupBillingResponse) SchemaExample

func (*SetupBillingResponse) SchemaExample() any

type Shipment

type Shipment struct {
	// Shipment ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipment"`
	// Human-readable shipment number.
	Number string `json:"number" validate:"required"`
	// Note attached to this shipment.
	Note *string `json:"note"`
	// Bill of lading number.
	BillOfLading *string `json:"bill_of_lading"`
	// Carrier master tracking number covering the shipment as a whole.
	//
	// Individual shipping cases carry their own per-case tracking numbers.
	MasterTrackingNumber *string `json:"master_tracking_number"`
	// Current status of the shipment.
	//
	// - `packed`: the shipment has been packed but not yet dispatched.
	// - `shipped`: the shipment has left the facility (`shipped_at` is set).
	Status constants.ShipmentStatus `json:"status" validate:"required"`
	// Timestamp when the shipment was shipped.
	//
	// Cleared if the shipment is voided.
	ShippedAt *time.Time `json:"shipped_at"`
	// Fulfillment priority, inherited from the sales order.
	Priority constants.PriorityCode `json:"priority" validate:"required"`
	// Number of shipping cases packed into this shipment.
	CaseCount int32 `json:"case_count"`
	// TODO: change from bool to a status type constant; check if its sued
	IsReadyToShip bool `json:"is_ready_to_ship"`
	// The customer receiving this shipment.
	Customer *Customer `json:"customer" expandable:"true"`
	// Carrier selection and freight billing for this shipment.
	Freight *Freight `json:"freight" expandable:"true"`
	// Destination shipping address.
	ShippingAddress *Address `json:"shipping_address" expandable:"true"`
	// User who shipped this shipment.
	ShippedBy *CreatedBy `json:"shipped_by" expandable:"true"`
	// TODO: Lines are a sub-object of cases, so move them
	// Lines recording the quantity shipped for each sales order line.
	Lines *List[ShipmentLine] `json:"lines" expandable:"true"`
	// Physical cases (packages) in this shipment, each with its own tracking and label details.
	ShippingCases *List[ShippingCaseDetail] `json:"shipping_cases" expandable:"true"`
	// Records this shipment sits between — its order, pick and invoice.
	Related *ShipmentRelated `json:"related"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A shipment of packed goods fulfilling a sales order, from packing through dispatch.

func (*Shipment) SchemaExample

func (*Shipment) SchemaExample() any

type ShipmentLine

type ShipmentLine struct {
	// Shipment line ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipment_line"`
	// The sales order line this shipment line fulfills.
	SalesOrderLine *SalesOrderLine `json:"sales_order_line" expandable:"true"`
	// What this line ships, as recorded on the originating sales order line.
	Item *Item `json:"item" expandable:"true"`
	// Quantity shipped on this line.
	Quantity *Quantity `json:"quantity" validate:"required"`
	// TODO: get this setup
	Totals ShipmentLineTotals ``
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A shipment line recording the quantity of a sales order line included in a shipment.

func (*ShipmentLine) SchemaExample

func (*ShipmentLine) SchemaExample() any

type ShipmentLineStageTotal

type ShipmentLineStageTotal struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_stage_total"`
	// Progress through this stage, as a fraction between 0 and 1.
	//
	// Calculated as the quantity that has reached this stage divided by the quantity ordered, so `1` means the whole order has cleared the stage and `0` means nothing has reached it yet.
	Completion float64 `json:"completion"`
	// Amount that has reached this stage, as a decimal string (unit price times the quantity at this stage).
	Amount string `json:"amount" validate:"required" format:"decimal"`
}

The monetary amount that has reached one fulfillment stage, together with how far that stage has progressed.

type ShipmentLineTotals

type ShipmentLineTotals struct {
	Ordered     ShipmentLineStageTotal
	BackOrdered ShipmentLineStageTotal
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=pick_totals"`
}

type ShipmentRelated

type ShipmentRelated struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipment_related"`
	// The sales order this shipment fulfills.
	SalesOrder *Record `json:"sales_order" expandable:"true"`
	// The pick this shipment was packed from.
	Pick *Record `json:"pick" expandable:"true"`
	// The invoice raised when this shipment shipped.
	Invoice *Record `json:"invoice" expandable:"true"`
}

Groups the records a shipment sits between: the order it fulfills, the pick it was packed from, and the invoice it raised. Returned only when at least one member has been expanded.

type ShippingCase

type ShippingCase struct {
	// Shipping case ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipping_case"`
	// Human-readable case number.
	//
	// Built from the shipment's number and the case's position within that shipment when the case is created.
	Number string `json:"number" validate:"required"`
	// Serial Shipping Container Code (SSCC) identifying this case.
	//
	// An 18-digit code assigned automatically when the shipment ships, if the case does not already have one. It is kept when the shipment is voided, so a case that ships again keeps the same code.
	SSCC *string `json:"sscc"`
	// Carrier tracking number.
	//
	// Recorded when a label is purchased for the case, can be overwritten manually, and is cleared if the shipment is voided.
	TrackingNumber *string `json:"tracking_number"`
	// When the case shipped.
	//
	// Stamped on every case in the shipment when the shipment ships, and cleared if the shipment is voided.
	ShippedAt *time.Time `json:"shipped_at"`
	// Freight cost charged for this case.
	//
	// Starts at zero when the case is created, and is reset to zero if the shipment is voided.
	FreightAmount *Quantity `json:"freight_amount" expandable:"true"`
	// Shipping weight of this case.
	FreightWeight *Quantity `json:"freight_weight" expandable:"true"`
	// The shipment this case belongs to.
	Shipment *Shipment `json:"shipment" expandable:"true"`
	// The carrier transporting this case.
	//
	// Copied from the sales order's carrier when the case is created.
	Carrier *Carrier `json:"carrier" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A physical case packed within a shipment.

Cases are created when a pick is packed, one for each case counted on the pack, and each carries its own SSCC, carrier tracking number, shipping label, freight cost and shipping weight.

func (*ShippingCase) SchemaExample

func (*ShippingCase) SchemaExample() any

type ShippingCaseDetail

type ShippingCaseDetail struct {
	// Shipping case ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipping_case"`
	// Human-readable case number.
	Number string `json:"number" validate:"required"`
	// Serial Shipping Container Code (SSCC) identifying this case.
	//
	// Assigned automatically when the shipment is shipped if the case does not already have one, and kept if the shipment is later voided.
	SSCC *string `json:"sscc"`
	// Carrier tracking number for this case.
	//
	// Cleared when the shipment is voided.
	TrackingNumber *string `json:"tracking_number"`
	// ID of the Shippo transaction for this case's shipping label, when the label was purchased through the Shippo integration.
	ShippoTransactionID *string `json:"shippo_transaction_id"`
	// URL of the printable shipping label for this case.
	ShippingLabelURL *string `json:"shipping_label_url"`
	// Timestamp when this case was shipped.
	ShippedAt *time.Time `json:"shipped_at"`
	// Freight charge for this case.
	//
	// Reset to zero when the shipment is voided.
	FreightAmount *Quantity `json:"freight_amount"`
	// Shipping weight of this case.
	FreightWeight *Quantity `json:"freight_weight"`
	// The carrier handling this case.
	Carrier *Carrier `json:"carrier" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

TODO: collaps the detail with the shipping case object whichever is more accurate A physical case (package) within a shipment, with its own tracking number, label and freight charge.

type ShippingCaseLabelURL

type ShippingCaseLabelURL struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipping_case_label_url"`
	// Presigned link to the shipping case's label image.
	//
	// The link expires one hour after it is issued, and is absent until a label has been generated for the case.
	URL *string `json:"url"`
}

A temporary download link for a shipping case's label image.

func (*ShippingCaseLabelURL) SchemaExample

func (*ShippingCaseLabelURL) SchemaExample() any

type ShippingTerm

type ShippingTerm struct {
	// Shipping term ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=shipping_term"`
	// Human-readable name for the shipping term, used to identify it when assigning shipping terms to customers and orders.
	Name string `json:"name" validate:"required"`
	// Freight pricing model applied by this shipping term.
	//
	// - `free_freight`: the buyer is never charged for shipping.
	// - `flat_rate_freight`: the buyer is charged the fixed amount in `flat_rate`, regardless of what the carrier would have charged.
	// - `carrier_rate_freight`: the buyer is charged the rate the carrier quotes for the order's carrier and service level.
	Type constants.ShippingTermType `json:"type" validate:"required"`
	// Provenance of this shipping term.
	//
	// System-owned shipping terms are platform-provided defaults shared across all accounts and cannot be updated or deleted; account-owned shipping terms are custom to your account.
	Owner *Owner `json:"owner" expandable:"true"`
	// Fixed shipping charge applied to the order.
	//
	// Used only when `type` is `flat_rate_freight`; ignored for other freight pricing models. A `flat_rate_freight` term with no flat rate falls through to the carrier's quoted rate.
	FlatRate *Quantity `json:"flat_rate"`
	// Order total a buyer must exceed for this term's free-shipping rules to apply.
	//
	// Above this total, freight is free for the service levels in `free_shipping_service_levels`.
	MinimumOrderValue *Quantity `json:"minimum_order_value"`
	// Service levels that ship for free once an order exceeds `minimum_order_value`.
	//
	// When this list is empty, every service level ships free above the threshold. When it is not empty, an order that picks a service level outside the list is not shipped free even above the threshold.
	FreeShippingServiceLevels *List[ServiceLevel] `json:"free_shipping_service_levels" expandable:"true"`
	// When this shipping term was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this shipping term was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A named freight pricing rule that decides what a buyer pays for shipping.

A customer's default shipping term is evaluated whenever freight is quoted for one of their orders. Freight exemptions on the customer, its type group, or any of its price groups are checked first and zero the freight charge before the shipping term is considered.

func (*ShippingTerm) SchemaExample

func (*ShippingTerm) SchemaExample() any

type SkippedItemResult

type SkippedItemResult struct {
	// Item SKU.
	SKU string `json:"sku" validate:"required"`
	// Human-readable reason the item was skipped.
	Reason string `json:"reason" validate:"required"`
}

A submitted row that was skipped rather than reconciled.

type SpendingCapResponse

type SpendingCapResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=spending_cap_response"`
	// Ceiling in cents on estimated agent spending per billing month.
	//
	// Null means agent spending is uncapped.
	CapCents *int64 `json:"cap_cents"`
}

Monthly agent spending cap for an account.

func (*SpendingCapResponse) SchemaExample

func (*SpendingCapResponse) SchemaExample() any

type StripePublishableKey

type StripePublishableKey struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=stripe_publishable_key"`
	// The publishable key (`pk_...`) from the account's Stripe integration, safe to use in client-side code.
	PublishableKey string `json:"publishable_key" validate:"required"`
}

Stripe publishable key for an account.

func (*StripePublishableKey) SchemaExample

func (*StripePublishableKey) SchemaExample() any

type StripeStatus

type StripeStatus struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=stripe_status"`
	// Whether a Stripe integration is configured.
	//
	// `connected` if the account has a Stripe integration on file, regardless of whether the integration is currently active. The stored keys are not checked against Stripe, so `connected` does not guarantee that payments will succeed.
	Status constants.StripeConnectionStatus `json:"status" validate:"required"`
}

Stripe integration status for an account.

func (*StripeStatus) SchemaExample

func (*StripeStatus) SchemaExample() any

type StripeWebhookRequest

type StripeWebhookRequest struct {
	// Raw request body bytes for signature verification.
	RawBody []byte `rawbody:"true"`
	// Stripe-Signature header value for payload verification.
	Signature string `header:"Stripe-Signature"`
}

Request for Stripe webhook processing.

type SubscriptionInfo

type SubscriptionInfo struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=subscription_info"`
	// Whether the subscription is actively being serviced.
	//
	// Typically one of:
	// - `active`: the subscription is in good standing.
	// - `paused`: servicing is temporarily suspended.
	// - `canceled`: the subscription has been canceled.
	ServicingStatus string `json:"servicing_status" validate:"required"`
	// Payment collection status of the subscription.
	//
	// Typically one of:
	// - `current`: payments are being collected normally.
	// - `paused`: payment collection is temporarily suspended.
	// - `awaiting_customer_action`: a payment requires action from the customer (e.g., updating a payment method).
	CollectionStatus string `json:"collection_status" validate:"required"`
}

Subscription status information.

func (*SubscriptionInfo) SchemaExample

func (*SubscriptionInfo) SchemaExample() any

type Supplier

type Supplier struct {
	// Supplier ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=supplier"`
	// Name of the supplier account.
	Name string `json:"name" validate:"required"`
	// Human-facing supplier code, unique per account (e.g. `SUP-001`).
	Number string `json:"number" validate:"required"`
}

The supplier (selling account) an order is placed with.

func (*Supplier) SchemaExample

func (*Supplier) SchemaExample() any

type SupplierDetail

type SupplierDetail struct {
	// Supplier ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=supplier"`
	// The supplier's name, as shown in the dashboard and on documents.
	Name string `json:"name" validate:"required"`
	// Human-facing supplier code, unique per account (e.g. `SUP-001`).
	Number string `json:"number" validate:"required"`
	// Free-form notes about the supplier.
	Note *string `json:"note"`
	// The supplier's default billing address.
	//
	// A new address can be created inline when the supplier is created; afterwards this default is changed by passing `bill_to_address_id` to the update endpoint.
	BillToAddress *Address `json:"bill_to_address" expandable:"true"`
	// The supplier's default shipping address.
	//
	// When a supplier is created with only a bill-to address, that same address also becomes the default shipping address.
	ShipToAddress *Address `json:"ship_to_address" expandable:"true"`
	// Number of materials sourced from this supplier.
	//
	// Counts every material linked to the supplier, including links whose status is `inactive`.
	MaterialCount int64 `json:"material_count"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A business you purchase materials from, with its default billing and shipping addresses.

func (*SupplierDetail) SchemaExample

func (*SupplierDetail) SchemaExample() any

type SupplierMaterial

type SupplierMaterial struct {
	// ID of the linked material, which also identifies this supplier material.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=supplier_material"`
	// Material provided by this supplier.
	Material *Material `json:"material" expandable:"true"`
	// The part number the supplier uses for this material in their own catalog.
	SupplierPartNumber string `json:"supplier_part_number" validate:"required"`
	// The supplier's own description of this material.
	SupplierDescription *string `json:"supplier_description"`
	// Whether this supplier is currently one you would source the material from.
	//
	// Inactive links are kept for reference and are still returned when listing or retrieving supplier materials; the status is a record-keeping flag and does not by itself prevent purchasing the material from this supplier.
	Status constants.SupplierMaterialStatus `json:"status" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Links a material to a supplier that provides it, carrying the supplier's own part number and description for the material.

Each material can be linked to a given supplier at most once.

func (*SupplierMaterial) SchemaExample

func (*SupplierMaterial) SchemaExample() any

type SupplierSummary

type SupplierSummary struct {
	// Supplier ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=supplier_summary"`
	// The supplier's name, as shown in the dashboard and on documents.
	Name string `json:"name" validate:"required"`
	// Human-facing supplier code, unique per account (e.g. `SUP-001`).
	Number string `json:"number" validate:"required"`
	// Number of materials sourced from this supplier.
	//
	// Counts every material linked to the supplier, including links whose status is `inactive`.
	MaterialCount int64 `json:"material_count"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

A condensed supplier returned by the supplier list endpoint.

The supplier's note and its default bill-to and ship-to addresses are only available when a single supplier is retrieved.

func (*SupplierSummary) SchemaExample

func (*SupplierSummary) SchemaExample() any

type SupportAvailability

type SupportAvailability struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=support_availability"`
	// Whether support can be contacted.
	Available bool `json:"available"`
}

Whether the calling customer can contact support.

Support is available only when the vendor has configured a support route that resolves to at least one recipient. The customer portal gates its contact-support feature on this so customers never open a support thread no one is set up to receive.

func (*SupportAvailability) SchemaExample

func (*SupportAvailability) SchemaExample() any

type SupportRoute

type SupportRoute struct {
	// Support route ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=support_route"`
	// The customer account this route overrides for.
	//
	// When there is no relation account, this route is the account-level default applied to any customer without an override of their own.
	RelationAccount *Entity `json:"relation_account"`
	// The group conversation whose participants handle this relationship's support.
	//
	// Its active people are the ones seated on a customer's support thread when the thread is opened, so who handles support is changed by editing this group's membership or by pointing the route at a different group — either way, only for threads opened afterwards.
	GroupConversation *Entity `json:"group_conversation" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A support route designates the group conversation that handles a relationship's inbound support.

A route is scoped by `relation_account`: the route with no relation account is the account-level default used for any customer, and a route naming a specific customer account overrides that default for that customer.

When a customer opens a support thread, the route in effect for them is resolved and the group conversation's active people are seated on the new thread as its recipients. Routes are applied at that moment only, so re-pointing or clearing a route never changes who is already seated on threads that are open.

The group also serves as the account's customer-service team elsewhere: its people are the ones alerted when a customer registers for access to your portal.

func (*SupportRoute) SchemaExample

func (*SupportRoute) SchemaExample() any

type SwitchPlanResponse

type SwitchPlanResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=switch_plan_response"`
	// Whether the plan switch was applied successfully.
	Success bool `json:"success"`
	// ID of the Stripe billing intent that was committed to apply the change.
	//
	// Returned when switching to a paid plan; absent when switching to the free plan.
	IntentID *string `json:"intent_id"`
}

Result of a plan switch.

func (*SwitchPlanResponse) SchemaExample

func (*SwitchPlanResponse) SchemaExample() any

type SysProperty

type SysProperty struct {
	// System property ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sys_property"`
	// The kind of counter this property tracks.
	Type *SysPropertyType `json:"type" validate:"required"`
	// The counter's current position in its number series.
	//
	// The system advances the counter as it hands out numbers, so this normally matches the most recent number assigned in the series rather than the next one to be issued.
	Value int32 `json:"value" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A counter maintained by the system for a numbered series, such as transaction or sales order numbers.

Each account keeps at most one counter per counter type, created the first time that number series is used.

func (*SysProperty) SchemaExample

func (*SysProperty) SchemaExample() any

type SysPropertyType

type SysPropertyType struct {
	// System property type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sys_property_type"`
	// Human-readable name of the counter, such as `Transaction Number`.
	Name string `json:"name" validate:"required"`
	// Machine-readable code identifying which number series this counter feeds.
	//
	// - `transaction_number`: numbering for financial transactions such as payments, credit memos, adjustments, and rebates.
	// - `settlement_number`: numbering for settlements that apply transactions to invoices.
	// - `sales_order_number`: numbering for sales orders.
	// - `purchase_order_number`: numbering for purchase orders.
	// - `customer_number`: identifiers assigned to new customers.
	// - `supplier_number`: identifiers assigned to new suppliers.
	// - `production_run_number`: numbering for production runs.
	// - `sscc_count`: serial component of the GS1 SSCC-18 codes assigned to shipping cases.
	Code constants.SysPropertyTypeCode `json:"code" validate:"required"`
}

The kind of counter a system property tracks.

type SysPropertyValue

type SysPropertyValue struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=sys_property_value"`
	// The number the counter holds after this read.
	Value string `json:"value" validate:"required"`
}

The value read from a system property counter.

func (*SysPropertyValue) SchemaExample

func (*SysPropertyValue) SchemaExample() any

type Tenancy

type Tenancy struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=tenancy"`
	// Account the request is currently acting within.
	//
	// Absent when the user has no active account selected, such as partway through registration.
	CurrentAccount *TenancyCurrentAccount `json:"current_account"`
	// Sandbox accounts the user can switch into.
	//
	// Only administrators of a production account see its sandboxes; the list is empty for every other role, and while already acting inside a sandbox.
	Sandboxes *List[TenancySandboxAccount] `json:"sandboxes" validate:"required"`
	// The production account that the current account belongs to.
	//
	// This is the current account itself when acting in a production account, and its parent account when acting inside a sandbox.
	OwnerAccount *TenancyOwnerAccount `json:"owner_account"`
	// Accounts the user has been granted access to beyond their current and owner accounts, such as other vendors' accounts.
	//
	// Only accounts that have finished onboarding appear here, and the current account's own sandboxes are listed under `sandboxes` instead of being duplicated into this list.
	OtherAccounts *List[TenancyOtherAccount] `json:"other_accounts" validate:"required"`
	// In-progress registration session, populated only partway through signup before the account exists.
	PendingRegistration *TenancyPendingRegistration `json:"pending_registration"`
}

The authenticated user's tenancy context: which account they are currently acting in and every other account they can switch to.

func (*Tenancy) SchemaExample

func (*Tenancy) SchemaExample() any

type TenancyAccountPlan

type TenancyAccountPlan struct {
	// Identifier of the plan definition the account is subscribed to.
	TypeID string `json:"type_id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account_plan"`
	// Display name of the plan, as shown in billing.
	Name string `json:"name" validate:"required"`
	// Stable code for the plan tier.
	PlanTypeCode constants.PlanCode `json:"plan_type_code" validate:"required"`
	// Revision of the plan definition the account is on.
	//
	// Plans are versioned so existing subscribers keep the pricing, limits, and features they signed up under when a newer version of the same plan is published.
	Version int32 `json:"version"`
	// Price per seat per month in dollars.
	PricePerSeat float64 `json:"price_per_seat"`
	// Per-seat price override in dollars used in place of `price_per_seat` when set.
	//
	// The monthly bill multiplies this by the number of seats (at least `seat_minimum`). `null` or `0` falls back to `price_per_seat`.
	PricePerMonth *float64 `json:"price_per_month"`
	// Fewest seats the account is billed for, regardless of how many users it actually has.
	SeatMinimum *int32 `json:"seat_minimum"`
	// Ceilings this plan imposes, keyed by limit code (for example `seats_maximum`).
	//
	// A `null` value means that resource is unlimited on this plan.
	Limits map[string]*int32 `json:"limits"`
	// Which capabilities this plan unlocks, keyed by feature code (for example `customer_portal`).
	Features map[string]bool `json:"features"`
}

The resolved subscription plan for the current account, including its limits and features.

type TenancyCurrentAccount

type TenancyCurrentAccount struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// Display name.
	Name string `json:"name" validate:"required"`
	// Account type.
	//
	// - `company`: a standard production account.
	// - `sandbox`: an isolated testing account.
	Type constants.AccountTypeCode `json:"type" validate:"required"`
	// How far the account has progressed through onboarding.
	//
	// The account is fully set up and usable once this is `active`.
	OnboardingStatus constants.OnboardingStatus `json:"onboarding_status" validate:"required"`
	// Code of the account's subscription plan.
	//
	// The same code appears as `account_plan.plan_type_code`, alongside the plan's resolved limits and features.
	Plan constants.PlanCode `json:"plan" validate:"required"`
	// The slug this account's customer portal is addressed by.
	//
	// Absent until the account enables its customer portal.
	Slug *string `json:"slug"`
	// The authenticated user's role in this account.
	Role *Role `json:"role"`
	// The Stripe customer that OpenMRP bills this account's own subscription and usage against.
	//
	// This is not the account's own Stripe customer for charging their customers.
	InternalStripeCustomerID *string `json:"internal_stripe_customer_id"`
	// Full plan details for this account, including limits and features.
	AccountPlan *TenancyAccountPlan `json:"account_plan"`
	// ID of the authenticated user's membership record within this account.
	AccountUserID string `json:"account_user_id"`
}

Account the user is currently operating in.

type TenancyOtherAccount

type TenancyOtherAccount struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// Display name.
	Name string `json:"name" validate:"required"`
	// Account type.
	//
	// - `company`: a standard production account.
	// - `sandbox`: an isolated testing account.
	Type constants.AccountTypeCode `json:"type" validate:"required"`
}

Additional account the user has access to.

type TenancyOwnerAccount

type TenancyOwnerAccount struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// Display name.
	Name string `json:"name" validate:"required"`
}

The production account that the current account belongs to.

type TenancyPendingRegistration

type TenancyPendingRegistration struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=tenancy_pending_registration"`
	// Registration session ID.
	SessionID string `json:"session_id" validate:"required"`
	// Plan code selected during registration.
	PlanCode constants.PlanCode `json:"plan_code" validate:"required"`
	// How far the signup has progressed, so the flow can be resumed where the user left off.
	//
	// Steps run `verification`, `user_details`, `account_details`, `review`, `payment`, then `completed`.
	Step constants.RegistrationStep `json:"step" validate:"required"`
	// Session creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

An in-progress registration session, present only partway through signup before an account exists.

type TenancySandboxAccount

type TenancySandboxAccount struct {
	// Account ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=account"`
	// Display name.
	Name string `json:"name" validate:"required"`
}

Sandbox account available to the user.

type Territory

type Territory struct {
	// Territory ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=territory"`
	// State this territory covers (e.g. `NY`).
	//
	// The state is only used to match orders when the territory has no ZIP code range; territories with a ZIP code range are matched on the ZIP code alone. Matching is an exact comparison against the ship-to address's state, so use the same format your addresses use.
	State string `json:"state" validate:"required"`
	// Inclusive start of the ZIP code range this territory covers.
	//
	// Unset when the territory spans the entire state rather than a ZIP code range.
	StartZipcode *int32 `json:"start_zipcode"`
	// Inclusive end of the ZIP code range this territory covers.
	//
	// A territory with a start ZIP code but no end ZIP code matches that single ZIP code.
	EndZipcode *int32 `json:"end_zipcode"`
	// Account user credited as the sales rep on orders matching this territory.
	SalesRep *AccountUser `json:"sales_rep" expandable:"true"`
	// Product line this territory is associated with.
	//
	// Sales rep auto-assignment matches on ZIP code and state only, so this records what the territory covers rather than narrowing which orders it matches.
	ProductLine *ProductLine `json:"product_line" expandable:"true"`
	// When this territory was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this territory was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A geographic sales region that assigns a sales rep to a state or ZIP code range.

When a sales order is created without an explicit sales rep, one is auto-assigned: the customer's default sales rep takes precedence, then a territory matching the ship-to address's ZIP code, then a territory covering the entire ship-to state.

Territories are skipped entirely when the customer is commission-exempt or every line on the order belongs to a commission-exempt product line; those orders are left without a sales rep.

func (*Territory) SchemaExample

func (*Territory) SchemaExample() any

type ToolGroup

type ToolGroup struct {
	// Group ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=tool_group"`
	// Human-readable group name (e.g. `Product Tools`).
	Name string `json:"name" validate:"required"`
	// Description of what the tools in this group do.
	Description *string `json:"description"`
	// Machine-readable name for the group (e.g. `customer_tools`).
	Slug string `json:"slug" validate:"required"`
	// Icon identifier (e.g. a Material Icon name).
	Icon string `json:"icon"`
	// Display sort order, lowest first.
	SortOrder int32 `json:"sort_order"`
	// Tools belonging to this group.
	Tools *List[AvailableTool] `json:"tools" expandable:"true"`
}

A named grouping of the tools that can be granted to an agent, used to organize the tool catalog.

func (*ToolGroup) SchemaExample

func (*ToolGroup) SchemaExample() any

type TransactionAllocation

type TransactionAllocation struct {
	// Allocation ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=transaction_allocation"`
	// The part of the transaction's amount applied to the invoice, in US dollars.
	Amount *Quantity `json:"amount" validate:"required"`
	// Free-form note attached to this allocation, separate from any note on the underlying transaction.
	Note *string `json:"note"`
	// Transaction whose amount is being applied to the invoice.
	Transaction *TransactionDetail `json:"transaction" expandable:"true"`
	// The invoice the amount was applied to.
	Invoice *AllocationInvoice `json:"invoice"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A portion of a transaction's amount applied to a specific invoice.

func (*TransactionAllocation) SchemaExample

func (*TransactionAllocation) SchemaExample() any

type TransactionDetail

type TransactionDetail struct {
	// Transaction ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=transaction"`
	// Human-readable transaction number.
	//
	// Generated automatically as a per-account sequence when the transaction is created. It can be changed later, but must remain unique within the account.
	Number string `json:"number" validate:"required"`
	// The transaction amount, in US dollars.
	Amount *Quantity `json:"amount" validate:"required"`
	// The customer the transaction was recorded against.
	Customer *Customer `json:"customer" expandable:"true"`
	// The account user responsible for the transaction.
	//
	// When none is specified at creation, the account user making the request is recorded as responsible.
	ResponsibleUser *AccountUser `json:"responsible_user" expandable:"true"`
	// Free-form note attached to the transaction.
	Note *string `json:"note"`
	// The transaction's type (payment, credit memo, adjustment, or rebate).
	TransactionType *TransactionType `json:"transaction_type" validate:"required"`
	// How the money moved, such as a check or an ACH transfer.
	//
	// Typically set only on payment transactions.
	TransactionMethod *TransactionMethod `json:"transaction_method"`
	// The kind of correction this transaction represents, such as a discount or a write-off.
	//
	// Typically set only on `adjustment` transactions.
	AdjustmentType *AdjustmentType `json:"adjustment_type"`
	// Whether the full transaction amount has been applied to invoices.
	//
	// Recording a settlement that uses this transaction sets the flag to `true`, and deleting that settlement resets it to `false`. Editing or deleting an individual allocation does not recompute it, so it can also be set directly with Update Transaction.
	//
	// While it is `false`, the transaction is treated as an open credit and is returned by List Open Credits.
	IsFullyAllocated bool `json:"is_fully_allocated" validate:"required"`
	// Identifier of the Stripe payment that produced this transaction.
	StripePaymentID *string `json:"stripe_payment_id"`
	// Number of allocations against invoices for this transaction.
	AllocationCount int32 `json:"allocation_count" validate:"required"`
	// The portions of this transaction that have been applied to individual invoices.
	//
	// Allocations are created by recording a settlement; there is no endpoint that creates one directly.
	Allocations *List[TransactionAllocation] `json:"allocations" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A financial transaction recorded against a customer, such as a payment, credit memo, adjustment, or rebate.

func (*TransactionDetail) SchemaExample

func (*TransactionDetail) SchemaExample() any

type TransactionMethod

type TransactionMethod struct {
	// Transaction method ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=transaction_method"`
	// Display name.
	Name string `json:"name" validate:"required"`
	// Machine-readable code identifying how the transaction was made.
	Code constants.TransactionMethod `json:"code" validate:"required"`
}

The payment method used to make a transaction, such as cash or check.

func (*TransactionMethod) SchemaExample

func (*TransactionMethod) SchemaExample() any

type TransactionSummary

type TransactionSummary struct {
	// Transaction ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=transaction_summary"`
	// Human-readable transaction number, unique within the account.
	Number string `json:"number" validate:"required"`
	// The transaction amount, in US dollars.
	Amount *Quantity `json:"amount" validate:"required"`
	// The customer the transaction was recorded against.
	Customer *Customer `json:"customer" expandable:"true"`
	// The transaction's type (payment, credit memo, adjustment, or rebate).
	TransactionType *TransactionType `json:"transaction_type" validate:"required"`
	// How the money moved, such as a check or an ACH transfer.
	//
	// Typically set only on payment transactions.
	TransactionMethod *TransactionMethod `json:"transaction_method"`
	// The kind of correction this transaction represents, such as a discount or a write-off.
	//
	// Typically set only on `adjustment` transactions.
	AdjustmentType *AdjustmentType `json:"adjustment_type"`
	// Whether the full transaction amount has been applied to invoices.
	//
	// Recording a settlement that uses this transaction sets the flag to `true`, and deleting that settlement resets it to `false`. Editing or deleting an individual allocation does not recompute it, so it can also be set directly with Update Transaction.
	//
	// While it is `false`, the transaction is treated as an open credit and is returned by List Open Credits.
	IsFullyAllocated bool `json:"is_fully_allocated" validate:"required"`
	// Number of allocations against invoices for this transaction.
	AllocationCount int32 `json:"allocation_count" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Lightweight transaction for list views.

func (*TransactionSummary) SchemaExample

func (*TransactionSummary) SchemaExample() any

type TransactionType

type TransactionType struct {
	// Transaction type ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=transaction_type"`
	// Display name.
	Name string `json:"name" validate:"required"`
	// Machine-readable code identifying the kind of transaction.
	//
	// - `payment`: money received from the customer.
	// - `credit_memo`: a credit issued to the customer.
	// - `adjustment`: a manual correction (see the transaction's `adjustment_type`).
	// - `rebate`: a rebate granted to the customer.
	Code constants.TransactionType `json:"code" validate:"required"`
}

The category of a financial transaction, such as a payment or credit memo.

func (*TransactionType) SchemaExample

func (*TransactionType) SchemaExample() any

type TriggerConfig

type TriggerConfig struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=trigger_config"`
	// Cron expression for scheduled triggers (e.g. `0 9 * * *`).
	CronSchedule *string `json:"cron_schedule"`
	// IANA timezone for the cron schedule (e.g. `America/New_York`).
	Timezone *string `json:"timezone"`
	// Event types that trigger this agent (e.g. `["email.received", "order.created"]`).
	EventFilters []string `json:"event_filters"`
}

Trigger-type-specific configuration.

Which fields are populated depends on the agent's `trigger_type`:

- `scheduled`: `cron_schedule` (and optionally `timezone`) is set. - `event`: `event_filters` is set. - `manual`: all fields are empty.

func (*TriggerConfig) SchemaExample

func (*TriggerConfig) SchemaExample() any

type Unit

type Unit struct {
	// Unit ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=unit"`
	// Display name of the unit (e.g. "Gram", "Kilogram").
	Name string `json:"name" validate:"required"`
	// Short abbreviation for the unit (e.g. "g", "kg").
	Abbreviation string `json:"abbreviation" validate:"required"`
	// The dimension this unit measures, such as mass, volume, or currency.
	//
	// A unit can only be converted to another unit of the same dimension. The `quantity` dimension is for discrete countable items rather than a physical measure.
	Type constants.UnitType `json:"type" validate:"required"`
	// Numerator of the ratio that converts a quantity in this unit into the dimension's base unit.
	//
	// A quantity is converted with `value × (ratio_numerator / ratio_denominator) + (offset_numerator / offset_denominator)`, so a kilogram in a gram-based dimension has a numerator of `1000` and a denominator of `1`.
	RatioNumerator string `json:"ratio_numerator" validate:"required" format:"decimal"`
	// Denominator of the ratio that converts a quantity in this unit into the dimension's base unit.
	//
	// Cannot be zero.
	RatioDenominator string `json:"ratio_denominator" validate:"required" format:"decimal"`
	// Numerator of the conversion offset, applied after the ratio for scales that do not share a zero point, such as temperature.
	//
	// Zero for units that convert by ratio alone.
	OffsetNumerator string `json:"offset_numerator" validate:"required" format:"decimal"`
	// Denominator of the conversion offset applied after the ratio.
	//
	// Never zero; a unit with no offset carries a numerator of `0` over a denominator of `1`.
	OffsetDenominator string `json:"offset_denominator" validate:"required" format:"decimal"`
	// Whether this is the base unit for its dimension.
	//
	// Every other unit's conversion ratio is expressed relative to the base unit. Base units are platform-defined; units created through the API are never base units.
	IsBaseUnit bool `json:"is_base_unit"`
	// Owner of this resource.
	Owner *Owner `json:"owner" expandable:"true"`
	// When this unit was created.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// When this unit was last updated.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Unit of measurement used for conversions and product quantities.

func (*Unit) SchemaExample

func (*Unit) SchemaExample() any

type UnitGroup

type UnitGroup struct {
	// Unit group ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=unit_group"`
	// Display name of the unit group.
	//
	// Unique within the account.
	Name string `json:"name" validate:"required"`
	// Free-form notes about the unit group.
	Notes *string `json:"notes"`
	// The dimension shared by every unit in this group, such as mass, volume, or currency.
	//
	// Only units of this dimension can belong to the group, and the dimension is fixed once the group is created.
	Type constants.UnitType `json:"type" validate:"required"`
	// The reference unit designated for this group.
	BaseUnit *Unit `json:"base_unit" expandable:"true"`
	// Units associated with this group, each with its own discount and customer portal visibility settings.
	AssociatedUnits *List[UnitGroupUnit] `json:"associated_units" expandable:"true"`
	// Owner of this resource.
	Owner *Owner `json:"owner" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A named collection of units that share one dimension, defining which units a product can be ordered in.

Each associated unit carries its own discount and customer portal visibility, applied when an order line is priced in that unit. A product takes its unit group from its product line, falling back to its item category.

func (*UnitGroup) SchemaExample

func (*UnitGroup) SchemaExample() any

type UnitGroupUnit

type UnitGroupUnit struct {
	// Unit group unit ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=unit_group_unit"`
	// The unit this association refers to.
	Unit *Unit `json:"unit" expandable:"true"`
	// Share of the unit's price removed when an order is placed in this unit.
	//
	// Expressed as a decimal fraction rather than a whole number, so `0.1` is a 10% discount and `0` is no discount.
	DiscountPercentage float64 `json:"discount_percentage"`
	// Flat amount subtracted from the unit's price when an order is placed in this unit.
	//
	// Subtracted before `discount_percentage` is applied.
	DiscountFixed float64 `json:"discount_fixed"`
	// Whether this unit is shown to customers in the customer portal.
	CustomerPortalVisibility constants.CustomerPortalVisibility `json:"customer_portal_visibility" validate:"required"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

Membership of a unit in a unit group, carrying the discount and customer portal visibility settings applied when ordering in that unit.

func (*UnitGroupUnit) SchemaExample

func (*UnitGroupUnit) SchemaExample() any

type UsageItem

type UsageItem struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=usage_item"`
	// Current usage count.
	Current int `json:"current"`
	// Maximum allowed usage.
	//
	// Null means unlimited.
	Limit *int `json:"limit"`
}

A usage metric with its current value and any applicable limit.

func (*UsageItem) SchemaExample

func (*UsageItem) SchemaExample() any

type User

type User struct {
	// User ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=user"`
	// Email address the user signs in with and receives platform email at.
	Email *string `json:"email"`
	// User's full display name.
	Name *string `json:"name"`
	// Username the user can sign in with instead of their email address.
	//
	// Usernames are unique across the whole platform, not just within your account.
	Username *string `json:"username"`
	// When the user verified their email address.
	EmailVerifiedAt *time.Time `json:"email_verified_at"`
	// Location of the user's profile image.
	//
	// For photos uploaded through the API this holds an internal path rather than a fetchable image URL; call Get User Photo URL to obtain a temporary link to the image itself.
	ImageUrl *string `json:"image_url"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A user's global profile, shared across every account they belong to.

Account-specific settings (status, role, department) live on the account user resource that links the user to each account.

func (*User) SchemaExample

func (*User) SchemaExample() any

type UserPhotoURL

type UserPhotoURL struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=user_photo_url"`
	// Presigned URL for the profile photo.
	//
	// The URL is valid for one hour after it is issued.
	URL *string `json:"url"`
}

Presigned URL for a user's profile photo.

func (*UserPhotoURL) SchemaExample

func (*UserPhotoURL) SchemaExample() any

type UserPhotoUploadResult

type UserPhotoUploadResult struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=user_photo_upload_result"`
	// Whether the photo was uploaded successfully.
	Success bool `json:"success"`
}

Result of a user photo upload.

func (*UserPhotoUploadResult) SchemaExample

func (*UserPhotoUploadResult) SchemaExample() any

type ValidateProductsResponse

type ValidateProductsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=map"`
	// Matched products keyed by the same keys supplied in the request's `products_map`.
	//
	// Keys whose SKU did not match any product are omitted.
	Products map[string]*Product `json:"products" validate:"required"`
}

The outcome of a SKU lookup: the products that matched, addressed by the caller's own keys.

func (*ValidateProductsResponse) SchemaExample

func (*ValidateProductsResponse) SchemaExample() any

type ValidateUnitsResponse

type ValidateUnitsResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=map"`
	// Validated units keyed by the original map key.
	//
	// Abbreviations are matched case-insensitively; keys whose abbreviation did not match any unit are omitted.
	Units map[string]*Unit `json:"units" validate:"required"`
}

Result of unit abbreviation validation.

func (*ValidateUnitsResponse) SchemaExample

func (*ValidateUnitsResponse) SchemaExample() any

type ValidatedAddress

type ValidatedAddress struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=validated_address"`
	// Whether the address was confirmed as complete and specific enough to ship to.
	//
	// - `valid`: nothing required was missing and the address resolved to a specific building or block.
	// - `invalid`: required components were missing, or the address only resolved to a street or a wider area.
	//
	// When the status is `invalid`, read `validation_messages` and compare `components` against what you submitted to see what to correct.
	Status constants.AddressValidationStatus `json:"status" validate:"required"`
	// Formatted, single-line address as standardized by the validation service.
	//
	// The validation service may omit this regardless of `status`, so it can be absent even for a `valid` address.
	FormattedAddress *string `json:"formatted_address"`
	// Standardized, parsed address components returned by the validation service.
	//
	// The validation service may omit this regardless of `status`, so it can be absent even for a `valid` address.
	Components *AddressComponents `json:"components"`
	// Human-readable messages describing issues found during validation.
	//
	// May be non-empty even when `status` is `valid`, for example when components were inferred or replaced with standardized values. Empty when no issues were reported.
	ValidationMessages []string `json:"validation_messages"`
}

The outcome of checking a submitted address against an address validation service.

func (*ValidatedAddress) SchemaExample

func (*ValidatedAddress) SchemaExample() any

type VolumeDiscount

type VolumeDiscount struct {
	// Volume discount ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=volume_discount"`
	// Display name of the volume discount.
	//
	// Must be unique within the account.
	Name string `json:"name" validate:"required"`
	// Quantity tiers that define the discount.
	//
	// Every tier whose threshold the ordered quantity reaches is applied, and their reductions compound. A discount with no tiers never changes a price.
	Tiers *List[VolumeDiscountTier] `json:"tiers" validate:"required"`
	// Customer groups this discount is scoped to.
	//
	// When set, only customers belonging to at least one of these groups qualify; when empty, all customers qualify. A customer belongs to a group either by being assigned to it directly or through the price groups on their customer relationship.
	CustomerGroups *List[AccountGroup] `json:"customer_groups" expandable:"true"`
	// Product lines this discount is scoped to.
	//
	// When set, only items in one of these product lines qualify; when empty, all product lines qualify.
	ProductLines *List[ProductLine] `json:"product_lines" expandable:"true"`
	// Item categories this discount is scoped to.
	//
	// When set, only items in one of these categories qualify; when empty, all categories qualify.
	Categories *List[ItemCategory] `json:"categories" expandable:"true"`
	// Attributes this discount is scoped to.
	//
	// When set, an item qualifies only if it has every listed attribute; when empty, attributes are not considered.
	Attributes *List[Attribute] `json:"attributes" expandable:"true"`
	// Units that ordered quantities are measured in when evaluating tier thresholds.
	//
	// Quantities ordered in other units are converted to an acceptable unit before being compared against tier thresholds; a quantity that cannot be converted contributes nothing. A discount with no acceptable units always evaluates to a quantity of zero, so it never reaches a threshold above zero.
	AcceptableUnits *List[Unit] `json:"acceptable_units" expandable:"true"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A quantity-based discount with tiered percentage rates.

A volume discount reduces the price once the ordered quantity reaches a tier's threshold. The customer group associations scope which customers qualify, and the product line, category, and attribute associations scope which order lines qualify; an empty list on any of them means no restriction on that dimension. Acceptable units are not a scope: they are the units the ordered quantity is measured in, and a discount with none of them never reaches a threshold above zero.

At most one volume discount is applied to a given order line: among the discounts whose scope the line matches and whose thresholds are met, those scoped to a customer group the buyer belongs to take precedence. An account price for the same line overrides the discounted price entirely.

func (*VolumeDiscount) SchemaExample

func (*VolumeDiscount) SchemaExample() any

type VolumeDiscountTier

type VolumeDiscountTier struct {
	// Volume discount tier ID.
	ID string `json:"id" validate:"required"`
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=volume_discount_tier"`
	// Display name of the tier.
	Name string `json:"name" validate:"required"`
	// Fraction of the price taken off once the threshold is met, as a decimal string.
	//
	// This is a multiplier, not a whole percent: `0.05` takes 5% off. When an order meets several tiers of the same discount, their reductions compound: meeting a `0.1` tier and a `0.2` tier multiplies the price by `0.9 × 0.8`, a 28% reduction overall.
	DiscountPercentage string `json:"discount_percentage" validate:"required" format:"decimal"`
	// Minimum ordered quantity at which this tier's discount begins to apply, as a decimal string.
	//
	// The quantity compared against the threshold is the total across every line on the order that falls within the discount's scope, converted into one of the discount's acceptable units — not the quantity of a single line.
	Threshold string `json:"threshold" validate:"required" format:"decimal"`
	// Creation timestamp.
	CreatedAt time.Time `json:"created_at" validate:"required"`
	// Last updated timestamp.
	UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

A quantity threshold within a volume discount, and the reduction that applies at or above it.

func (*VolumeDiscountTier) SchemaExample

func (*VolumeDiscountTier) SchemaExample() any

type WebhookResponse

type WebhookResponse struct {
	// Resource type identifier.
	Object constants.ObjectType `json:"object" validate:"required,enum=webhook_response"`
	// Whether the event was accepted for processing.
	//
	// Acceptance means the signature was verified and the event was handled or queued. Event types OpenMRP takes no action on are acknowledged the same way, so this is not a signal that anything changed.
	Received bool `json:"received"`
}

Acknowledgement that a webhook event was accepted.

func (*WebhookResponse) SchemaExample

func (*WebhookResponse) SchemaExample() any

type WeeksOfSalesItem

type WeeksOfSalesItem struct {
	// The product line.
	ProductLine *Entity `json:"product_line" validate:"required"`
	// The on-hand quantity.
	QuantityOnHand *Quantity `json:"quantity_on_hand" validate:"required"`
	// The average weekly sales quantity.
	AverageSalesQuantity *Quantity `json:"average_sales_quantity" validate:"required"`
	// The number of weeks of inventory on hand.
	WeeksOfSales float64 `json:"weeks_of_sales" validate:"required"`
}

WeeksOfSalesItem represents a single product line's weeks-of-sales metrics.

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL