sanmar_sdk.common

Types shared across SanMar’s services and files.

The identifiers here are the ones SanMar’s services actually match on. SanMar has two color names for every product, and only one of them works in a request:

  • catalog_color is SanMar’s catalog or mainframe color: the abbreviated name in the SANMAR_MAINFRAME_COLOR column of SanMar_SDL_N.csv (CATALOG_COLOR in the SanMarPI files, colorName in PromoStandards). Every lookup and every order uses it.

  • color_name is the full display name (COLOR_NAME, standardColorName). It is for showing to people, and SanMar rejects it in requests: “Athletic Hthr” works where “Athletic Heather” does not.

The SDK never mixes the two: a field called catalog_color is always the catalog color.

Attributes

WarehouseNumber

A warehouse number as SanMar reports it.

Classes

Environment

Which of SanMar's two web service environments to call.

Warehouse

A SanMar warehouse, numbered as SanMar numbers them.

ShipMethod

How SanMar ships an order.

WillCall

Pick an order up from a warehouse instead of having it shipped.

ShipTo

Where an order ships.

SkuKey

SanMar's own key for one style, color and size.

StyleColorSize

One style, color and size, named the way SanMar's order services expect.

StyleQuery

A style to look up, optionally narrowed to one catalog color, one size, or both.

Module Contents

class sanmar_sdk.common.Environment[source]

Bases: enum.StrEnum

Which of SanMar’s two web service environments to call.

PRODUCTION = 'https://ws.sanmar.com:8080'[source]
EDEV = 'https://edev-ws.sanmar.com:8080'[source]

SanMar’s test environment. It needs its own credentials, requested from sanmarintegrations@sanmar.com, and its products, prices and inventory may not match production.

class sanmar_sdk.common.Warehouse[source]

Bases: enum.IntEnum

A SanMar warehouse, numbered as SanMar numbers them.

The number is also the warehouse’s PromoStandards FOB id.

SEATTLE = 1[source]
CINCINNATI = 2[source]
DALLAS = 3[source]
RENO = 4[source]
ROBBINSVILLE = 5[source]
JACKSONVILLE = 6[source]
MINNEAPOLIS = 7[source]
PHOENIX = 12[source]
RICHMOND = 31[source]
property code: str[source]

The warehouse’s will-call code, which goes in the ship method field.

property city: str[source]

The city the warehouse is in.

property state: str[source]

The two-letter state the warehouse is in.

sanmar_sdk.common.WarehouseNumber[source]

A warehouse number as SanMar reports it.

A known warehouse parses to Warehouse. A number SanMar has added since this SDK was released stays a plain int rather than failing the whole response.

class sanmar_sdk.common.ShipMethod[source]

Bases: enum.StrEnum

How SanMar ships an order.

The value is the ship method as SanMar’s own order services and order files spell it. PromoStandards orders split it into a carrier and a service; see promostandards_freight().

UPS_GROUND = 'UPS'[source]
UPS_2ND_DAY = 'UPS 2ND DAY'[source]
UPS_2ND_DAY_AM = 'UPS 2ND DAY AM'[source]
UPS_3RD_DAY = 'UPS 3RD DAY'[source]
UPS_NEXT_DAY = 'UPS NEXT DAY'[source]
UPS_NEXT_DAY_EARLY_AM = 'UPS NEXT DAY EA'[source]
UPS_NEXT_DAY_SAVER = 'UPS NEXT DAY SV'[source]
UPS_SATURDAY = 'UPS SATURDAY'[source]
USPS_GROUND_ADVANTAGE = 'USPS PP'[source]
USPS_PRIORITY_MAIL = 'USPS APP'[source]
PSST = 'PSST'[source]

SanMar’s Pack Separately, Ship Together program. The ship-to must exactly match the address SanMar has on file.

TRUCK = 'TRUCK'[source]

Truck freight, for orders over 500 pounds. Not available through PromoStandards.

promostandards_freight() → tuple[str, str][source]

Return the PromoStandards (carrier, service) pair for this ship method.

Raises:

ValueError – If SanMar does not offer the ship method through PromoStandards.

class sanmar_sdk.common.WillCall(/, **data: Any)[source]

Bases: sanmar_sdk.base.Model

Pick an order up from a warehouse instead of having it shipped.

Only SanMar’s own order services and order files support will call, and only for accounts SanMar has set up for warehouse selection.

warehouse: Warehouse[source]
property ship_method: str[source]

The value SanMar expects in the ship method field.

class sanmar_sdk.common.ShipTo(/, **data: Any)[source]

Bases: sanmar_sdk.base.Model

Where an order ships.

Field lengths are the tightest limits across SanMar’s order services and order files.

address1: Annotated[str, Field(min_length=1, max_length=35), sanmar_sdk.base.ORDER_TEXT][source]

The street address. SanMar asks for the abbreviations ST, AVE, RD, DR and BLVD.

city: Annotated[str, Field(min_length=1, max_length=28), sanmar_sdk.base.ORDER_TEXT][source]
state: str = None[source]

The two-letter state abbreviation.

zip_code: str = None[source]

A five-digit ZIP code, or ZIP+4 with or without the dash.

company: Annotated[str, Field(min_length=1, max_length=28), sanmar_sdk.base.ORDER_TEXT] | None = None[source]
attention: Annotated[str, Field(min_length=1, max_length=35), sanmar_sdk.base.ORDER_TEXT] | None = None[source]

The receiver’s name, or the PO number.

address2: Annotated[str, Field(min_length=1, max_length=35), sanmar_sdk.base.ORDER_TEXT] | None = None[source]

The suite or apartment number.

email: Annotated[str, Field(min_length=3, max_length=105), sanmar_sdk.base.ORDER_TEXT] | None = None[source]

Where SanMar sends the order confirmation and shipping notification.

When omitted, SanMar uses the default email on the account.

phone: Annotated[str, Field(min_length=1, max_length=32), sanmar_sdk.base.ORDER_TEXT] | None = None[source]

The receiver’s phone number. Only PromoStandards orders carry it.

residential: bool = False[source]
country: str = None[source]
class sanmar_sdk.common.SkuKey(/, **data: Any)[source]

Bases: sanmar_sdk.base.Model

SanMar’s own key for one style, color and size.

INVENTORY_KEY and SIZE_INDEX are in every SanMar product file. The inventory key is not the style number. SanMar recommends ordering by key rather than by style, color and size, because it cannot be misspelled.

inventory_key: int = None[source]
size_index: int = None[source]
class sanmar_sdk.common.StyleColorSize(/, **data: Any)[source]

Bases: sanmar_sdk.base.Model

One style, color and size, named the way SanMar’s order services expect.

style: str = None[source]

The style number, as printed in SanMar’s catalog (K500).

catalog_color: str = None[source]

The catalog (mainframe) color, not the display color name.

size: str = None[source]
class sanmar_sdk.common.StyleQuery(/, **data: Any)[source]

Bases: sanmar_sdk.base.Model

A style to look up, optionally narrowed to one catalog color, one size, or both.

style: str = None[source]

The style number, as printed in SanMar’s catalog (K500).

catalog_color: Annotated[str, Field(min_length=1, max_length=50)] | None = None[source]

The catalog (mainframe) color, not the display color name.

size: Annotated[str, Field(min_length=1, max_length=50)] | None = None[source]